page.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _KLONE_PAGE_H_
00012 #define _KLONE_PAGE_H_
00013
00014 #include "klone_conf.h"
00015 #ifdef HAVE_STDINT
00016 #include <stdint.h>
00017 #endif
00018 #include <u/libu.h>
00019 #include <klone/response.h>
00020 #include <klone/request.h>
00021
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00026 typedef void (*page_run_t)(request_t*, response_t*);
00027
00028 typedef enum page_type_e {
00029 PAGE_TYPE_UNKNOWN,
00030 PAGE_TYPE_STATIC,
00031 PAGE_TYPE_DYNAMIC
00032 } page_type_t;
00033
00034
00035 typedef struct page_static_s
00036 {
00037 size_t size;
00038 unsigned char *data;
00039 } page_static_t;
00040
00041
00042 typedef struct page_dynamic_s
00043 {
00044 page_run_t run;
00045 } page_dynamic_t;
00046
00047
00048 LIST_HEAD(pages_s, page_s);
00049
00050 struct page_s
00051 {
00052 const char *uri;
00053 const char *mime_type;
00054 page_type_t type;
00055 void *sd;
00056 LIST_ENTRY(page_s) np;
00057 };
00058
00059 #define PAGE_STATIC_INIT(uri, mime, type, ptr) \
00060 { uri, mime, type, ptr, LIST_ENTRY_NULL }
00061
00062 typedef struct page_s page_t;
00063 typedef struct pages_s pages_t;
00064
00065 #ifdef __cplusplus
00066 }
00067 #endif
00068
00069 #endif