ioprv.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _KLONE_IO_PRV_H_
00012 #define _KLONE_IO_PRV_H_
00013
00014 #include "klone_conf.h"
00015 #ifdef HAVE_STDINT
00016 #include <stdint.h>
00017 #endif
00018 #include <klone/codec.h>
00019 #include <klone/utils.h>
00020
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024
00025
00026
00028 #define io_create(type, pio) io_prv_create(sizeof(type), pio)
00029 int io_prv_create(size_t dev_sz, io_t **pio);
00030
00031 typedef ssize_t (*io_read_op) (io_t*, char*, size_t);
00032 typedef ssize_t (*io_write_op) (io_t*, const char*, size_t);
00033 typedef ssize_t (*io_seek_op) (io_t*, size_t);
00034 typedef ssize_t (*io_tell_op) (io_t*);
00035 typedef int (*io_close_op) (io_t*);
00036 typedef int (*io_free_op) (io_t*);
00037
00038 struct io_s
00039 {
00040 char *name;
00041 codec_chain_t codec_chain;
00042 int eof;
00043 int type;
00044 size_t size;
00045
00046
00047 unsigned int refcnt;
00048
00049
00050 int is_secure;
00051
00052
00053 io_read_op read;
00054 io_write_op write;
00055 io_seek_op seek;
00056 io_tell_op tell;
00057 io_close_op close;
00058 io_free_op free;
00059
00060
00061
00062 char *rbuf;
00063 size_t rbsz;
00064 size_t rcount;
00065 size_t roff;
00066
00067 size_t rtot;
00068
00069
00070 char *ubuf;
00071 size_t ucount;
00072 size_t uoff;
00073
00074
00075
00076
00077 char *wbuf;
00078 size_t wbsz;
00079 size_t wcount;
00080 size_t woff;
00081
00082 };
00083
00084 #ifdef __cplusplus
00085 }
00086 #endif
00087
00088 #endif