Added infrastructure for different encode modules.

Made tcfs_errno thread-local and added TLS autoconf check.
This commit is contained in:
2010-11-15 19:54:46 +01:00
parent 794a7795d7
commit c2bbe2ef69
14 changed files with 243 additions and 52 deletions

View File

@@ -7,8 +7,25 @@
#ifndef TCFS_ENCODE_H
#define TCFS_ENCODE_H 1
struct encode_ctx;
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