Files
tcfs/src/encode.h
Matthias Blankertz c2bbe2ef69 Added infrastructure for different encode modules.
Made tcfs_errno thread-local and added TLS autoconf check.
2010-11-15 19:54:46 +01:00

32 lines
738 B
C

/*
Copyright (c) 2010 Matthias Blankertz <matthias@blankertz.org>
This work is licensed under the Open Software License ("OSL") v. 3.0.
*/
#ifndef TCFS_ENCODE_H
#define TCFS_ENCODE_H 1
struct encode_ctx {
struct encode_ops *ops;
};
struct encode_ops {
struct encode_ctx *(*open)(const char *);
int (*encode)(void *, size_t, const void *, size_t, struct encode_ctx *);
int (*close)(struct encode_ctx *);
};
struct encoders_entry {
struct encode_ops *ops;
char name[];
};
extern struct encoders_entry encoders[];
struct encode_ctx *encode_open(const char *tfmt);
int encode_encode(void *dst, size_t dst_size, const void *src, size_t src_size, struct encode_ctx *ctx);
int encode_close(struct encode_ctx *ctx);
#endif