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
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00026
00027 enum {
00028 ET_FILE,
00029 ET_PAGE
00030 };
00031
00032
00033 LIST_HEAD(emblist_s, embres_s);
00034
00035
00036 typedef struct embres_s
00037 {
00038 LIST_ENTRY(embres_s) np;
00039 const char *filename;
00040 int type;
00041 } embres_t;
00042
00043
00044 typedef struct embfile_s
00045 {
00046 embres_t res;
00047 size_t size;
00048 unsigned char *data;
00049 int comp;
00050 int encrypted;
00051 time_t mtime;
00052 const char *mime_type;
00053 size_t file_size;
00054 } embfile_t;
00055
00056
00057 typedef struct embpage_s
00058 {
00059 embres_t res;
00060 void (*run)(request_t*, response_t*, session_t*);
00061 } embpage_t;
00062
00063 int emb_init(void);
00064 int emb_term(void);
00065 int emb_register(embres_t *r);
00066 int emb_unregister(embres_t *r);
00067 int emb_lookup(const char *filename, embres_t **pr);
00068 int emb_count(void);
00069 int emb_getn(size_t n, embres_t **pr);
00070 int emb_open(const char *file, io_t **pio);
00071
00072 #ifdef __cplusplus
00073 }
00074 #endif
00075
00076 #endif