emb.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _KLONE_EMB_H_
00012 #define _KLONE_EMB_H_
00013
00014 #include "klone_conf.h"
00015 #include <sys/stat.h>
00016 #ifdef HAVE_STDINT
00017 #include <stdint.h>
00018 #endif
00019 #include <u/libu.h>
00020 #include <klone/klone.h>
00021 #include <klone/dypage.h>
00022
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026
00027
00028 enum {
00029 ET_FILE,
00030 ET_PAGE
00031 };
00032
00033
00034 LIST_HEAD(emblist_s, embres_s);
00035
00036
00037 typedef struct embres_s
00038 {
00039 LIST_ENTRY(embres_s) np;
00040 const char *filename;
00041 int type;
00042 } embres_t;
00043
00044
00045 typedef struct embfile_s
00046 {
00047 embres_t res;
00048 size_t size;
00049 unsigned char *data;
00050 int comp;
00051 int encrypted;
00052 time_t mtime;
00053 const char *mime_type;
00054 size_t file_size;
00055 } embfile_t;
00056
00057
00058 typedef struct embpage_s
00059 {
00060 embres_t res;
00061 dypage_fun_t fun;
00062 } embpage_t;
00063
00064 int emb_init(void);
00065 int emb_term(void);
00066 int emb_register(embres_t *r);
00067 int emb_unregister(embres_t *r);
00068 int emb_lookup(const char *filename, embres_t **pr);
00069 int emb_count(void);
00070 int emb_getn(size_t n, embres_t **pr);
00071 int emb_open(const char *file, io_t **pio);
00072
00073 int emb_list (char ***plist);
00074 void emb_list_free (char **list);
00075 int emb_to_ubuf(const char *res_name, u_buf_t **pubuf);
00076
00077 #ifdef __cplusplus
00078 }
00079 #endif
00080
00081 #endif