00001 #ifndef _KLONE_DYPAGE_H_ 00002 #define _KLONE_DYPAGE_H_ 00003 #include <klone/request.h> 00004 #include <klone/response.h> 00005 #include <klone/session.h> 00006 00007 #ifdef __cplusplus 00008 extern "C" { 00009 #endif 00010 00011 struct dypage_args_s; 00012 typedef struct dypage_args_s dypage_args_t; 00013 00014 typedef void (*dypage_fun_t)(dypage_args_t *); 00015 00016 enum { DYPAGE_MAX_PARAMS = 16 }; 00017 00018 typedef struct dypage_param_s 00019 { 00020 const char *key, *val; 00021 } dypage_param_t; 00022 00023 const char *dypage_get_param(dypage_args_t *args, const char *key); 00024 00025 struct dypage_args_s 00026 { 00027 request_t *rq; 00028 response_t *rs; 00029 session_t *ss; 00030 dypage_fun_t fun; /* callback function */ 00031 void *opaque; /* additional opaque callback argument */ 00032 00033 size_t argc; /* # of argv */ 00034 const char **argv; /* regex submatches (#0 is the full url) */ 00035 size_t nparams; /* # of named params */ 00036 dypage_param_t *params; /* array of named parameters */ 00037 }; 00038 00039 int dypage_serve(dypage_args_t *args); 00040 00041 #ifdef __cplusplus 00042 } 00043 #endif 00044 00045 #endif