Added infrastructure for different encode modules.
Made tcfs_errno thread-local and added TLS autoconf check.
This commit is contained in:
19
src/encode.h
19
src/encode.h
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user