mirror of
https://github.com/lxsang/ant-http
synced 2025-07-13 13:04:23 +02:00
Allow specific configuration for plugins
This commit is contained in:
@ -115,15 +115,15 @@ void htdocs(antd_request_t *rq, char *dest)
|
||||
strcpy(dest, www);
|
||||
}
|
||||
}
|
||||
void dbdir(char *dest)
|
||||
void dbdir(char **dest)
|
||||
{
|
||||
UNUSED(dest);
|
||||
}
|
||||
void tmpdir(char *dest)
|
||||
void tmpdir(char **dest)
|
||||
{
|
||||
UNUSED(dest);
|
||||
}
|
||||
void plugindir(char *dest)
|
||||
void plugindir(char **dest)
|
||||
{
|
||||
UNUSED(dest);
|
||||
}
|
||||
|
14
lib/handle.h
14
lib/handle.h
@ -98,23 +98,25 @@ typedef struct
|
||||
list_t gzip_types;
|
||||
dictionary_t mimes;
|
||||
dictionary_t ports;
|
||||
dictionary_t plugins;
|
||||
// #endif
|
||||
} config_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[128];
|
||||
char dbpath[512];
|
||||
char tmpdir[512];
|
||||
char pdir[512];
|
||||
char* dbpath;
|
||||
char* tmpdir;
|
||||
char* pdir;
|
||||
dictionary_t config;
|
||||
int raw_body;
|
||||
} plugin_header_t;
|
||||
|
||||
int __attribute__((weak)) require_plugin(const char *);
|
||||
void __attribute__((weak)) htdocs(antd_request_t *rq, char *dest);
|
||||
void __attribute__((weak)) dbdir(char *dest);
|
||||
void __attribute__((weak)) tmpdir(char *dest);
|
||||
void __attribute__((weak)) plugindir(char *dest);
|
||||
void __attribute__((weak)) dbdir(char **dest);
|
||||
void __attribute__((weak)) tmpdir(char **dest);
|
||||
void __attribute__((weak)) plugindir(char **dest);
|
||||
|
||||
int __attribute__((weak)) compressable(char *ctype);
|
||||
|
||||
|
@ -35,11 +35,12 @@ STATIC PART, should be included in any plugin
|
||||
#ifdef PLUGIN_IMPLEMENT
|
||||
static plugin_header_t __plugin__;
|
||||
// private function
|
||||
void __init_plugin__(const char* pl){
|
||||
void __init_plugin__(const char* pl, dictionary_t* conf){
|
||||
strcpy(__plugin__.name,pl);
|
||||
dbdir(__plugin__.dbpath);
|
||||
plugindir(__plugin__.pdir);
|
||||
tmpdir(__plugin__.tmpdir);
|
||||
dbdir(&__plugin__.dbpath);
|
||||
plugindir(&__plugin__.pdir);
|
||||
tmpdir(&__plugin__.tmpdir);
|
||||
__plugin__.config = conf;
|
||||
__plugin__.raw_body = 0;
|
||||
init();
|
||||
};
|
||||
|
Reference in New Issue
Block a user