diff --git a/include/lighttpd/plugin.h b/include/lighttpd/plugin.h index f6fc611..6263de2 100644 --- a/include/lighttpd/plugin.h +++ b/include/lighttpd/plugin.h @@ -12,12 +12,12 @@ size_t id; \ ssize_t option_base_ndx -typedef void (*liPluginInitCB) (liServer *srv, liPlugin *p); +typedef void (*liPluginInitCB) (liServer *srv, liPlugin *p, gpointer userdata); typedef void (*liPluginFreeCB) (liServer *srv, liPlugin *p); typedef gboolean (*liPluginParseOptionCB) (liServer *srv, liPlugin *p, size_t ndx, liValue *val, liOptionValue *oval); typedef void (*liPluginFreeOptionCB) (liServer *srv, liPlugin *p, size_t ndx, liOptionValue oval); -typedef liAction*(*liPluginCreateActionCB) (liServer *srv, liPlugin *p, liValue *val); -typedef gboolean (*liPluginSetupCB) (liServer *srv, liPlugin *p, liValue *val); +typedef liAction*(*liPluginCreateActionCB) (liServer *srv, liPlugin *p, liValue *val, gpointer userdata); +typedef gboolean (*liPluginSetupCB) (liServer *srv, liPlugin *p, liValue *val, gpointer userdata); typedef void (*liPluginAngelCB) (liServer *srv, liPlugin *p, gint32 id, GString *data); typedef void (*liPluginHandleCloseCB) (liConnection *con, liPlugin *p); @@ -65,11 +65,13 @@ struct liPluginOption { struct liPluginAction { const gchar *name; liPluginCreateActionCB li_create_action; + gpointer userdata; }; struct liPluginSetup { const gchar *name; liPluginSetupCB setup; + gpointer userdata; }; struct liPluginAngel { @@ -111,15 +113,17 @@ struct liServerOption { struct liServerAction { liPlugin *p; liPluginCreateActionCB li_create_action; + gpointer userdata; }; struct liServerSetup { liPlugin *p; liPluginSetupCB setup; + gpointer userdata; }; /* Needed by modules to register their plugin(s) */ -LI_API liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB init); +LI_API liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB init, gpointer userdata); /* Internal needed functions */ LI_API void li_plugin_free(liServer *srv, liPlugin *p); diff --git a/include/lighttpd/plugin_core.h b/include/lighttpd/plugin_core.h index 0e149e1..d63f32f 100644 --- a/include/lighttpd/plugin_core.h +++ b/include/lighttpd/plugin_core.h @@ -28,6 +28,6 @@ enum liCoreOptions { #define CORE_OPTION(idx) _CORE_OPTION(vr, idx) #define _CORE_OPTION(vr, idx) _OPTION_ABS(vr, idx) -LI_API void li_plugin_core_init(liServer *srv, liPlugin *p); +LI_API void li_plugin_core_init(liServer *srv, liPlugin *p, gpointer userdata); #endif diff --git a/src/main/config_lua.c b/src/main/config_lua.c index 78b4860..9166263 100644 --- a/src/main/config_lua.c +++ b/src/main/config_lua.c @@ -147,7 +147,7 @@ static int handle_server_action(liServer *srv, lua_State *L, gpointer _sa) { li_lua_unlock(srv); /* TRACE(srv, "%s", "Creating action"); */ - a = sa->li_create_action(srv, sa->p, val); + a = sa->li_create_action(srv, sa->p, val, sa->userdata); li_value_free(val); li_lua_lock(srv); @@ -170,7 +170,7 @@ static int handle_server_setup(liServer *srv, lua_State *L, gpointer _ss) { li_lua_unlock(srv); /* TRACE(srv, "%s", "Calling setup"); */ - res = ss->setup(srv, ss->p, val); + res = ss->setup(srv, ss->p, val, ss->userdata); li_lua_lock(srv); if (!res) { diff --git a/src/main/lighttpd.c b/src/main/lighttpd.c index d878ec4..4da44c0 100644 --- a/src/main/lighttpd.c +++ b/src/main/lighttpd.c @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) { li_server_loop_init(srv); /* load core plugin */ - srv->core_plugin = li_plugin_register(srv, "core", li_plugin_core_init); + srv->core_plugin = li_plugin_register(srv, "core", li_plugin_core_init, NULL); if (use_angel) { li_angel_setup(srv); } diff --git a/src/main/plugin.c b/src/main/plugin.c index 5d52244..338cd0a 100644 --- a/src/main/plugin.c +++ b/src/main/plugin.c @@ -100,12 +100,12 @@ void li_server_plugins_free(liServer *srv) { g_hash_table_destroy(srv->setups); } -liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB init) { +liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB init, gpointer userdata) { liPlugin *p; liServerState s; if (!init) { - ERROR(srv, "Module '%s' needs an init function", name); + ERROR(srv, "Plugin '%s' needs an init function", name); return NULL; } @@ -116,7 +116,7 @@ liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB in } if (g_hash_table_lookup(srv->plugins, name)) { - ERROR(srv, "Module '%s' already registered", name); + ERROR(srv, "Plugin '%s' already registered", name); return NULL; } @@ -124,7 +124,7 @@ liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB in p->id = g_hash_table_size(srv->plugins); g_hash_table_insert(srv->plugins, (gchar*) p->name, p); - init(srv, p); + init(srv, p, userdata); p->opt_base_index = g_hash_table_size(srv->options); if (p->options) { @@ -171,6 +171,7 @@ liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB in sa = g_slice_new0(liServerAction); sa->li_create_action = pa->li_create_action; sa->p = p; + sa->userdata = pa->userdata; g_hash_table_insert(srv->actions, (gchar*) pa->name, sa); } } @@ -192,6 +193,7 @@ liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB in ss = g_slice_new0(liServerSetup); ss->setup = ps->setup; ss->p = p; + ss->userdata = ps->userdata; g_hash_table_insert(srv->setups, (gchar*) ps->name, ss); } } @@ -298,7 +300,7 @@ liAction* li_create_action(liServer *srv, const gchar *name, liValue *val) { return NULL; } - if (NULL == (a = sa->li_create_action(srv, sa->p, val))) { + if (NULL == (a = sa->li_create_action(srv, sa->p, val, sa->userdata))) { ERROR(srv, "Action '%s' creation failed", name); return NULL; } @@ -314,7 +316,7 @@ gboolean li_call_setup(liServer *srv, const char *name, liValue *val) { return FALSE; } - if (!ss->setup(srv, ss->p, val)) { + if (!ss->setup(srv, ss->p, val, ss->userdata)) { ERROR(srv, "Setup '%s' failed", name); return FALSE; } diff --git a/src/main/plugin_core.c b/src/main/plugin_core.c index b8c29ef..b37bf8d 100644 --- a/src/main/plugin_core.c +++ b/src/main/plugin_core.c @@ -10,10 +10,10 @@ #include #include -static liAction* core_list(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_list(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { liAction *a; guint i; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!val) { ERROR(srv, "%s", "need parameter"); @@ -46,10 +46,10 @@ static liAction* core_list(liServer *srv, liPlugin* p, liValue *val) { return a; } -static liAction* core_when(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_when(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { liValue *val_cond, *val_act, *val_act_else; liAction *a, *act = NULL, *act_else = NULL; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!val) { ERROR(srv, "%s", "need parameter"); @@ -100,10 +100,10 @@ static liAction* core_when(liServer *srv, liPlugin* p, liValue *val) { return a; } -static liAction* core_set(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_set(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { liValue *val_val, *val_name; liAction *a; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!val) { ERROR(srv, "%s", "need parameter"); @@ -127,9 +127,9 @@ static liAction* core_set(liServer *srv, liPlugin* p, liValue *val) { return a; } -static gboolean core_setup_set(liServer *srv, liPlugin* p, liValue *val) { +static gboolean core_setup_set(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { liValue *val_val, *val_name; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!val) { ERROR(srv, "%s", "need parameter"); @@ -181,8 +181,8 @@ static void core_docroot_free(liServer *srv, gpointer param) { g_string_free(param, TRUE); } -static liAction* core_docroot(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(p); +static liAction* core_docroot(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(p); UNUSED(userdata); if (!val || val->type != LI_VALUE_STRING) { ERROR(srv, "%s", "docroot action expects a string parameter"); return NULL; @@ -251,11 +251,11 @@ static void core_alias_free(liServer *srv, gpointer _param) { g_array_free(param, TRUE); } -static liAction* core_alias(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_alias(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GArray *a = NULL; GArray *vl, *vl1; core_alias_config ac; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!val || val->type != LI_VALUE_LIST) { ERROR(srv, "%s", "unexpected or no parameter for alias action"); @@ -391,11 +391,11 @@ static void core_index_free(liServer *srv, gpointer param) { g_array_free(files, TRUE); } -static liAction* core_index(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_index(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GArray *files; guint i; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!val || val->type != LI_VALUE_LIST) { ERROR(srv, "%s", "index action expects a list of strings as parameter"); @@ -604,8 +604,8 @@ static liHandlerResult core_handle_static(liVRequest *vr, gpointer param, gpoint return LI_HANDLER_GO_ON; } -static liAction* core_static(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(p); +static liAction* core_static(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(p); UNUSED(userdata); if (val) { ERROR(srv, "%s", "static action doesn't have parameters"); return NULL; @@ -658,8 +658,8 @@ next_round: return LI_HANDLER_GO_ON; } -static liAction* core_pathinfo(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(p); +static liAction* core_pathinfo(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(p); UNUSED(userdata); if (val) { ERROR(srv, "%s", "pathinfo action doesn't have parameters"); return NULL; @@ -677,10 +677,10 @@ static liHandlerResult core_handle_status(liVRequest *vr, gpointer param, gpoint return LI_HANDLER_GO_ON; } -static liAction* core_status(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_status(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { gpointer ptr; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!val || val->type != LI_VALUE_NUMBER) { ERROR(srv, "%s", "set_status action expects a number as parameter"); @@ -708,8 +708,8 @@ static liHandlerResult core_handle_log_write(liVRequest *vr, gpointer param, gpo return LI_HANDLER_GO_ON; } -static liAction* core_log_write(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(p); +static liAction* core_log_write(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(p); UNUSED(userdata); if (!val || val->type != LI_VALUE_STRING) { ERROR(srv, "%s", "log.write expects a string parameter"); return NULL; @@ -730,8 +730,8 @@ static liHandlerResult core_handle_blank(liVRequest *vr, gpointer param, gpointe return LI_HANDLER_GO_ON; } -static liAction* core_blank(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(p); +static liAction* core_blank(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(p); UNUSED(userdata); if (val) { ERROR(srv, "%s", "'blank' action doesn't have parameters"); @@ -752,8 +752,8 @@ static liHandlerResult core_handle_profile_mem(liVRequest *vr, gpointer param, g return LI_HANDLER_GO_ON; } -static liAction* core_profile_mem(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(p); +static liAction* core_profile_mem(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(p); UNUSED(userdata); if (val) { ERROR(srv, "%s", "'profile_mem' action doesn't have parameters"); @@ -763,9 +763,9 @@ static liAction* core_profile_mem(liServer *srv, liPlugin* p, liValue *val) { return li_action_new_function(core_handle_profile_mem, NULL, NULL, NULL); } -static gboolean core_listen(liServer *srv, liPlugin* p, liValue *val) { +static gboolean core_listen(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GString *ipstr; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_STRING) { ERROR(srv, "%s", "listen expects a string as parameter"); @@ -779,9 +779,9 @@ static gboolean core_listen(liServer *srv, liPlugin* p, liValue *val) { } -static gboolean core_workers(liServer *srv, liPlugin* p, liValue *val) { +static gboolean core_workers(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { gint workers; - UNUSED(p); + UNUSED(p); UNUSED(userdata); workers = val->data.number; if (val->type != LI_VALUE_NUMBER || workers < 1) { @@ -796,10 +796,10 @@ static gboolean core_workers(liServer *srv, liPlugin* p, liValue *val) { return TRUE; } -static gboolean core_module_load(liServer *srv, liPlugin* p, liValue *val) { +static gboolean core_module_load(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { liValue *mods = li_value_new_list(); - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!g_module_supported()) { ERROR(srv, "%s", "module loading not supported on this platform"); @@ -850,8 +850,8 @@ static gboolean core_module_load(liServer *srv, liPlugin* p, liValue *val) { return TRUE; } -static gboolean core_io_timeout(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(p); +static gboolean core_io_timeout(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(p); UNUSED(userdata); if (!val || val->type != LI_VALUE_NUMBER || val->data.number < 1) { ERROR(srv, "%s", "io.timeout expects a positive number as parameter"); @@ -863,8 +863,8 @@ static gboolean core_io_timeout(liServer *srv, liPlugin* p, liValue *val) { return TRUE; } -static gboolean core_stat_cache_ttl(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(p); +static gboolean core_stat_cache_ttl(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(p); UNUSED(userdata); if (!val || val->type != LI_VALUE_NUMBER || val->data.number < 1) { ERROR(srv, "%s", "stat_cache.ttl expects a positive number as parameter"); @@ -1104,9 +1104,9 @@ static void core_header_free(liServer *srv, gpointer param) { li_value_list_free(param); } -static liAction* core_header_add(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_header_add(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GArray *l; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_LIST) { ERROR(srv, "'header.add' action expects a string tuple as parameter, %s given", li_value_type_string(val->type)); @@ -1141,9 +1141,9 @@ static liHandlerResult core_handle_header_append(liVRequest *vr, gpointer param, return LI_HANDLER_GO_ON; } -static liAction* core_header_append(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_header_append(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GArray *l; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_LIST) { ERROR(srv, "'header.append' action expects a string tuple as parameter, %s given", li_value_type_string(val->type)); @@ -1178,9 +1178,9 @@ static liHandlerResult core_handle_header_overwrite(liVRequest *vr, gpointer par return LI_HANDLER_GO_ON; } -static liAction* core_header_overwrite(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_header_overwrite(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GArray *l; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_LIST) { ERROR(srv, "'header.overwrite' action expects a string tuple as parameter, %s given", li_value_type_string(val->type)); @@ -1217,8 +1217,8 @@ static liHandlerResult core_handle_header_remove(liVRequest *vr, gpointer param, return LI_HANDLER_GO_ON; } -static liAction* core_header_remove(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(p); +static liAction* core_header_remove(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_STRING) { ERROR(srv, "'header.remove' action expects a string as parameter, %s given", li_value_type_string(val->type)); @@ -1238,9 +1238,9 @@ static liHandlerResult core_handle_buffer_out(liVRequest *vr, gpointer param, gp return LI_HANDLER_GO_ON; } -static liAction* core_buffer_out(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_buffer_out(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { gint64 limit; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_NUMBER) { ERROR(srv, "'io.buffer_out' action expects an integer as parameter, %s given", li_value_type_string(val->type)); @@ -1271,9 +1271,9 @@ static liHandlerResult core_handle_buffer_in(liVRequest *vr, gpointer param, gpo return LI_HANDLER_GO_ON; } -static liAction* core_buffer_in(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_buffer_in(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { gint64 limit; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_NUMBER) { ERROR(srv, "'io.buffer_in' action expects an integer as parameter, %s given", li_value_type_string(val->type)); @@ -1326,13 +1326,13 @@ static liHandlerResult core_handle_throttle_pool(liVRequest *vr, gpointer param, return LI_HANDLER_GO_ON; } -static liAction* core_throttle_pool(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_throttle_pool(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GString *name; guint i; liThrottlePool *pool = NULL; gint64 rate; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_STRING && val->type != LI_VALUE_LIST) { ERROR(srv, "'io.throttle_pool' action expects a string or a string-number tuple as parameter, %s given", li_value_type_string(val->type)); @@ -1420,9 +1420,9 @@ static liHandlerResult core_handle_throttle_connection(liVRequest *vr, gpointer return LI_HANDLER_GO_ON; } -static liAction* core_throttle_connection(liServer *srv, liPlugin* p, liValue *val) { +static liAction* core_throttle_connection(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { liThrottleParam *param; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type == LI_VALUE_LIST && val->data.list->len == 2) { liValue *v1 = g_array_index(val->data.list, liValue*, 0); @@ -1510,46 +1510,46 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "list", core_list }, - { "when", core_when }, - { "set", core_set }, + { "list", core_list, NULL }, + { "when", core_when, NULL }, + { "set", core_set, NULL }, - { "docroot", core_docroot }, - { "alias", core_alias }, - { "index", core_index }, - { "static", core_static }, - { "pathinfo", core_pathinfo }, + { "docroot", core_docroot, NULL }, + { "alias", core_alias, NULL }, + { "index", core_index, NULL }, + { "static", core_static, NULL }, + { "pathinfo", core_pathinfo, NULL }, - { "set_status", core_status }, + { "set_status", core_status, NULL }, - { "log.write", core_log_write }, + { "log.write", core_log_write, NULL }, - { "blank", core_blank }, - { "profile_mem", core_profile_mem }, + { "blank", core_blank, NULL }, + { "profile_mem", core_profile_mem, NULL }, - { "header.add", core_header_add }, - { "header.append", core_header_append }, - { "header.overwrite", core_header_overwrite }, - { "header.remove", core_header_remove }, + { "header.add", core_header_add, NULL }, + { "header.append", core_header_append, NULL }, + { "header.overwrite", core_header_overwrite, NULL }, + { "header.remove", core_header_remove, NULL }, - { "io.buffer_out", core_buffer_out }, - { "io.buffer_in", core_buffer_in }, - { "io.throttle", core_throttle_connection }, - { "io.throttle_pool", core_throttle_pool }, - /*{ "io.throttle_ip", core_throttle_ip },*/ + { "io.buffer_out", core_buffer_out, NULL }, + { "io.buffer_in", core_buffer_in, NULL }, + { "io.throttle", core_throttle_connection, NULL }, + { "io.throttle_pool", core_throttle_pool, NULL }, + /*{ "io.throttle_ip", core_throttle_ip, NULL },*/ - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { "set_default", core_setup_set }, - { "listen", core_listen }, - { "workers", core_workers }, - { "module_load", core_module_load }, - { "io.timeout", core_io_timeout }, - { "stat_cache.ttl", core_stat_cache_ttl }, - - { NULL, NULL } + { "set_default", core_setup_set, NULL }, + { "listen", core_listen, NULL }, + { "workers", core_workers, NULL }, + { "module_load", core_module_load, NULL }, + { "io.timeout", core_io_timeout, NULL }, + { "stat_cache.ttl", core_stat_cache_ttl, NULL }, + + { NULL, NULL, NULL } }; static const liPluginAngel angelcbs[] = { @@ -1560,8 +1560,8 @@ static const liPluginAngel angelcbs[] = { { NULL, NULL } }; -void li_plugin_core_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +void li_plugin_core_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; diff --git a/src/modules/mod_access.c b/src/modules/mod_access.c index 80258df..1bec1bf 100644 --- a/src/modules/mod_access.c +++ b/src/modules/mod_access.c @@ -107,7 +107,7 @@ static void access_check_free(liServer *srv, gpointer param) { g_slice_free(access_check_data, acd); } -static liAction* access_check_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* access_check_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GArray *arr; liValue *v, *ip; guint i, j; @@ -116,6 +116,7 @@ static liAction* access_check_create(liServer *srv, liPlugin* p, liValue *val) { access_check_data *acd = NULL; UNUSED(srv); + UNUSED(userdata); if (!val || val->type != LI_VALUE_LIST || (val->data.list->len != 1 && val->data.list->len != 2)) { ERROR(srv, "%s", "access_check expects a list of one or two string,list tuples as parameter"); @@ -219,9 +220,8 @@ static liHandlerResult access_deny(liVRequest *vr, gpointer param, gpointer *con return LI_HANDLER_GO_ON; } -static liAction* access_deny_create(liServer *srv, liPlugin* p, liValue *val) { - - UNUSED(srv); +static liAction* access_deny_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); if (val) { ERROR(srv, "%s", "access.deny doesn't expect any parameters"); @@ -240,19 +240,19 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "access.check", access_check_create }, - { "access.deny", access_deny_create }, + { "access.check", access_check_create, NULL }, + { "access.deny", access_deny_create, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_access_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_access_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -265,7 +265,7 @@ gboolean mod_access_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_access", plugin_access_init); + mod->config = li_plugin_register(mods->main, "mod_access", plugin_access_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_accesslog.c b/src/modules/mod_accesslog.c index 85c2f6f..9ba96bb 100644 --- a/src/modules/mod_accesslog.c +++ b/src/modules/mod_accesslog.c @@ -489,11 +489,11 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; @@ -503,10 +503,10 @@ static void plugin_accesslog_free(liServer *srv, liPlugin *p) { g_slice_free(al_data, p->data); } -static void plugin_accesslog_init(liServer *srv, liPlugin *p) { +static void plugin_accesslog_init(liServer *srv, liPlugin *p, gpointer userdata) { al_data *ald; - UNUSED(srv); + UNUSED(srv); UNUSED(userdata); p->free = plugin_accesslog_free; p->options = options; @@ -525,7 +525,7 @@ LI_API gboolean mod_accesslog_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_accesslog", plugin_accesslog_init); + mod->config = li_plugin_register(mods->main, "mod_accesslog", plugin_accesslog_init, NULL); /* set default accesslog format */ str = g_string_new_len(CONST_STR_LEN("%h %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"")); diff --git a/src/modules/mod_auth.c b/src/modules/mod_auth.c index 06b8e72..183514c 100644 --- a/src/modules/mod_auth.c +++ b/src/modules/mod_auth.c @@ -447,15 +447,18 @@ static liAction* auth_generic_create(liServer *srv, liPlugin* p, liValue *val, c } -static liAction* auth_plain_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* auth_plain_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(userdata); return auth_generic_create(srv, p, val, "auth.plain", auth_backend_plain, FALSE); } -static liAction* auth_htpasswd_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* auth_htpasswd_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(userdata); return auth_generic_create(srv, p, val, "auth.htpasswd", auth_backend_htpasswd, FALSE); } -static liAction* auth_htdigest_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* auth_htdigest_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(userdata); return auth_generic_create(srv, p, val, "auth.htdigest", auth_backend_htdigest, TRUE); } @@ -483,9 +486,10 @@ static liHandlerResult auth_handle_deny(liVRequest *vr, gpointer param, gpointer return LI_HANDLER_GO_ON; } -static liAction* auth_deny(liServer *srv, liPlugin* p, liValue *val) { +static liAction* auth_deny(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { UNUSED(srv); UNUSED(p); + UNUSED(userdata); if (val) { ERROR(srv, "%s", "'auth.deny' action doesn't have parameters"); @@ -502,21 +506,22 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "auth.plain", auth_plain_create }, - { "auth.htpasswd", auth_htpasswd_create }, - { "auth.htdigest", auth_htdigest_create }, + { "auth.plain", auth_plain_create, NULL }, + { "auth.htpasswd", auth_htpasswd_create, NULL }, + { "auth.htdigest", auth_htdigest_create, NULL }, - { "auth.deny", auth_deny }, + { "auth.deny", auth_deny, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_auth_init(liServer *srv, liPlugin *p) { +static void plugin_auth_init(liServer *srv, liPlugin *p, gpointer userdata) { UNUSED(srv); + UNUSED(userdata); p->options = options; p->actions = actions; @@ -529,7 +534,7 @@ gboolean mod_auth_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_auth", plugin_auth_init); + mod->config = li_plugin_register(mods->main, "mod_auth", plugin_auth_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_balancer.c b/src/modules/mod_balancer.c index dae5f04..e309c2d 100644 --- a/src/modules/mod_balancer.c +++ b/src/modules/mod_balancer.c @@ -158,10 +158,10 @@ static void balancer_act_free(liServer *srv, gpointer param) { balancer_free(srv, (balancer*) param); } -static liAction* balancer_rr(liServer *srv, liPlugin* p, liValue *val) { +static liAction* balancer_rr(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { balancer *b; liAction *a; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!val) { ERROR(srv, "%s", "need parameter"); @@ -184,17 +184,17 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "balancer.rr", balancer_rr }, - { NULL, NULL } + { "balancer.rr", balancer_rr, NULL }, + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -205,7 +205,7 @@ static void plugin_init(liServer *srv, liPlugin *p) { gboolean mod_balancer_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_balancer", plugin_init); + mod->config = li_plugin_register(mods->main, "mod_balancer", plugin_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_cache_disk_etag.c b/src/modules/mod_cache_disk_etag.c index 11d2e2d..61f4c03 100644 --- a/src/modules/mod_cache_disk_etag.c +++ b/src/modules/mod_cache_disk_etag.c @@ -305,9 +305,9 @@ static void cache_etag_free(liServer *srv, gpointer param) { g_slice_free(cache_etag_context, ctx); } -static liAction* cache_etag_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* cache_etag_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { cache_etag_context *ctx; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_STRING) { ERROR(srv, "%s", "cache.disk.etag expects a string as parameter"); @@ -325,16 +325,16 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "cache.disk.etag", cache_etag_create }, - { NULL, NULL } + { "cache.disk.etag", cache_etag_create, NULL }, + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -344,7 +344,7 @@ static void plugin_init(liServer *srv, liPlugin *p) { gboolean mod_cache_disk_etag_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_cache_disk_etag", plugin_init); + mod->config = li_plugin_register(mods->main, "mod_cache_disk_etag", plugin_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_debug.c b/src/modules/mod_debug.c index 899765f..e1c0d2e 100644 --- a/src/modules/mod_debug.c +++ b/src/modules/mod_debug.c @@ -295,8 +295,8 @@ static liHandlerResult debug_show_connections(liVRequest *vr, gpointer param, gp return (*context) ? LI_HANDLER_WAIT_FOR_EVENT : LI_HANDLER_GO_ON; } -static liAction* debug_show_connections_create(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(srv); UNUSED(p); +static liAction* debug_show_connections_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(srv); UNUSED(p); UNUSED(userdata); if (val) { ERROR(srv, "%s", "debug.show_connections doesn't expect any parameters"); @@ -312,18 +312,18 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "debug.show_connections", debug_show_connections_create }, + { "debug.show_connections", debug_show_connections_create, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_debug_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_debug_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -336,7 +336,7 @@ gboolean mod_debug_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_debug", plugin_debug_init); + mod->config = li_plugin_register(mods->main, "mod_debug", plugin_debug_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_deflate.c b/src/modules/mod_deflate.c index 6b2088f..fc96221 100644 --- a/src/modules/mod_deflate.c +++ b/src/modules/mod_deflate.c @@ -658,11 +658,9 @@ static const GString don_outputbuffer = { CONST_STR_LEN("output-buffer"), 0 } ; -static liAction* deflate_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* deflate_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { deflate_config *conf; - UNUSED(srv); - UNUSED(p); - UNUSED(val); + UNUSED(userdata); if (val && val->type != LI_VALUE_HASH) { ERROR(srv, "%s", "deflate expects an optional hash of options"); @@ -724,17 +722,17 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "deflate", deflate_create }, - { NULL, NULL } + { "deflate", deflate_create, NULL }, + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -744,7 +742,7 @@ static void plugin_init(liServer *srv, liPlugin *p) { gboolean mod_deflate_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_deflate", plugin_init); + mod->config = li_plugin_register(mods->main, "mod_deflate", plugin_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_dirlist.c b/src/modules/mod_dirlist.c index 78a96b9..45d3a8d 100644 --- a/src/modules/mod_dirlist.c +++ b/src/modules/mod_dirlist.c @@ -609,12 +609,13 @@ static void dirlist_free(liServer *srv, gpointer param) { g_slice_free(dirlist_data, data); } -static liAction* dirlist_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* dirlist_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { dirlist_data *data; guint i; guint j; liValue *v, *tmpval; GString *k; + UNUSED(userdata); if (val && val->type != LI_VALUE_LIST) { ERROR(srv, "%s", "dirlist expects an optional list of string-value pairs"); @@ -786,13 +787,13 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "dirlist", dirlist_create }, + { "dirlist", dirlist_create, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; @@ -806,10 +807,10 @@ static void plugin_dirlist_free(liServer *srv, liPlugin *p) { } -static void plugin_dirlist_init(liServer *srv, liPlugin *p) { +static void plugin_dirlist_init(liServer *srv, liPlugin *p, gpointer userdata) { dirlist_plugin_data *pd; - UNUSED(srv); + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -826,7 +827,7 @@ gboolean mod_dirlist_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_dirlist", plugin_dirlist_init); + mod->config = li_plugin_register(mods->main, "mod_dirlist", plugin_dirlist_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_expire.c b/src/modules/mod_expire.c index 7e6ea4f..e2cf5e9 100644 --- a/src/modules/mod_expire.c +++ b/src/modules/mod_expire.c @@ -131,12 +131,11 @@ static void expire_free(liServer *srv, gpointer param) { g_slice_free(expire_rule, param); } -static liAction* expire_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* expire_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { expire_rule *rule; gchar *str; - UNUSED(srv); - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (!val || val->type != LI_VALUE_STRING) { ERROR(srv, "%s", "expire expects a string as parameter"); @@ -241,18 +240,18 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "expire", expire_create }, + { "expire", expire_create, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_expire_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_expire_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -265,7 +264,7 @@ gboolean mod_expire_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_expire", plugin_expire_init); + mod->config = li_plugin_register(mods->main, "mod_expire", plugin_expire_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_fastcgi.c b/src/modules/mod_fastcgi.c index 97f9861..2715454 100644 --- a/src/modules/mod_fastcgi.c +++ b/src/modules/mod_fastcgi.c @@ -768,9 +768,11 @@ static void fastcgi_free(liServer *srv, gpointer param) { fastcgi_context_release(ctx); } -static liAction* fastcgi_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* fastcgi_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { fastcgi_context *ctx; + UNUSED(userdata); + if (val->type != LI_VALUE_STRING) { ERROR(srv, "%s", "fastcgi expects a string as parameter"); return FALSE; @@ -789,17 +791,17 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "fastcgi", fastcgi_create }, - { NULL, NULL } + { "fastcgi", fastcgi_create, NULL }, + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -813,7 +815,7 @@ static void plugin_init(liServer *srv, liPlugin *p) { gboolean mod_fastcgi_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_fastcgi", plugin_init); + mod->config = li_plugin_register(mods->main, "mod_fastcgi", plugin_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_fortune.c b/src/modules/mod_fortune.c index 28061d5..06768da 100644 --- a/src/modules/mod_fortune.c +++ b/src/modules/mod_fortune.c @@ -55,8 +55,8 @@ static liHandlerResult fortune_header_handle(liVRequest *vr, gpointer param, gpo return LI_HANDLER_GO_ON; } -static liAction* fortune_header(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(srv); UNUSED(val); +static liAction* fortune_header(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(srv); UNUSED(val); UNUSED(userdata); return li_action_new_function(fortune_header_handle, NULL, NULL, p->data); } @@ -87,18 +87,19 @@ static liHandlerResult fortune_page_handle(liVRequest *vr, gpointer param, gpoin return LI_HANDLER_GO_ON; } -static liAction* fortune_page(liServer *srv, liPlugin* p, liValue *val) { - UNUSED(srv); UNUSED(val); +static liAction* fortune_page(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { + UNUSED(srv); UNUSED(val); UNUSED(userdata); return li_action_new_function(fortune_page_handle, NULL, NULL, p->data); } -static gboolean fortune_load(liServer *srv, liPlugin* p, liValue *val) { +static gboolean fortune_load(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { gchar *file; GError *err = NULL; gchar *data; gsize len; guint count = 0; fortune_data *fd = p->data; + UNUSED(userdata); if (!val || val->type != LI_VALUE_STRING) { ERROR(srv, "fortune.load takes a string as parameter, %s given", val ? li_value_type_string(val->type) : "none"); @@ -148,15 +149,16 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "fortune.header", fortune_header }, - { "fortune.page", fortune_page }, + { "fortune.header", fortune_header, NULL }, + { "fortune.page", fortune_page, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { "fortune.load", fortune_load }, - { NULL, NULL } + { "fortune.load", fortune_load, NULL }, + + { NULL, NULL, NULL } }; @@ -175,9 +177,9 @@ static void plugin_fortune_free(liServer *srv, liPlugin *p) { g_slice_free(fortune_data, fd); } -static void plugin_fortune_init(liServer *srv, liPlugin *p) { +static void plugin_fortune_init(liServer *srv, liPlugin *p, gpointer userdata) { fortune_data *fd; - UNUSED(srv); + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -196,7 +198,7 @@ gboolean mod_fortune_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(srv, "mod_fortune", plugin_fortune_init); + mod->config = li_plugin_register(srv, "mod_fortune", plugin_fortune_init, NULL); if (!mod->config) return FALSE; diff --git a/src/modules/mod_lua.c b/src/modules/mod_lua.c index 1506e23..921e4b1 100644 --- a/src/modules/mod_lua.c +++ b/src/modules/mod_lua.c @@ -10,8 +10,8 @@ * none * Actions: * lua.handler filename, [ "ttl": 300 ] - * - Basically the same as include_lua, but loads the script in a worker - * specific lua_State, so it doesn't use the server wide lua lock. + * - Basically the same as include_lua (no setup.* calls allowed), but loads the script + * in a worker specific lua_State, so it doesn't use the server wide lua lock. * - You can give a ttl, after which the file is checked for modifications * and reloaded. The default value 0 disables reloading. * @@ -139,11 +139,11 @@ static const GString /* lua option names */ lon_ttl = { CONST_STR_LEN("ttl"), 0 } ; -static liAction* lua_handler_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* lua_handler_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { liValue *v_filename = NULL, *v_options = NULL; lua_config *conf; guint ttl = 0; - UNUSED(srv); UNUSED(p); + UNUSED(srv); UNUSED(p); UNUSED(userdata); if (val) { if (val->type == LI_VALUE_STRING) { @@ -199,24 +199,23 @@ option_failed: return NULL; } - static const liPluginOption options[] = { { NULL, 0, NULL, NULL, NULL } }; static const liPluginAction actions[] = { - { "lua.handler", lua_handler_create }, + { "lua.handler", lua_handler_create, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_lua_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_lua_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -229,7 +228,7 @@ gboolean mod_lua_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_lua", plugin_lua_init); + mod->config = li_plugin_register(mods->main, "mod_lua", plugin_lua_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_openssl.c b/src/modules/mod_openssl.c index d6c5e71..a0989fb 100644 --- a/src/modules/mod_openssl.c +++ b/src/modules/mod_openssl.c @@ -341,7 +341,7 @@ static void openssl_setup_listen_cb(liServer *srv, int fd, gpointer data) { srv_sock->release_cb = openssl_sock_release; } -static gboolean openssl_setup(liServer *srv, liPlugin* p, liValue *val) { +static gboolean openssl_setup(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { openssl_context *ctx; GHashTableIter hti; gpointer hkey, hvalue; @@ -353,7 +353,7 @@ static gboolean openssl_setup(liServer *srv, liPlugin* p, liValue *val) { GString *ipstr = NULL; gboolean allow_ssl2 = FALSE; - UNUSED(p); + UNUSED(p); UNUSED(userdata); if (val->type != LI_VALUE_HASH) { ERROR(srv, "%s", "openssl expects a hash as parameter"); @@ -476,18 +476,18 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { "openssl", openssl_setup }, + { "openssl", openssl_setup, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -547,7 +547,7 @@ gboolean mod_openssl_init(liModules *mods, liModule *mod) { return FALSE; } - mod->config = li_plugin_register(mods->main, "mod_openssl", plugin_init); + mod->config = li_plugin_register(mods->main, "mod_openssl", plugin_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_proxy.c b/src/modules/mod_proxy.c index 5827055..65077f2 100644 --- a/src/modules/mod_proxy.c +++ b/src/modules/mod_proxy.c @@ -424,8 +424,9 @@ static void proxy_free(liServer *srv, gpointer param) { proxy_context_release(ctx); } -static liAction* proxy_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* proxy_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { proxy_context *ctx; + UNUSED(userdata); if (val->type != LI_VALUE_STRING) { ERROR(srv, "%s", "proxy expects a string as parameter"); @@ -443,17 +444,18 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "proxy", proxy_create }, - { NULL, NULL } + { "proxy", proxy_create, NULL }, + + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -467,7 +469,7 @@ static void plugin_init(liServer *srv, liPlugin *p) { gboolean mod_proxy_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_proxy", plugin_init); + mod->config = li_plugin_register(mods->main, "mod_proxy", plugin_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_redirect.c b/src/modules/mod_redirect.c index d19e82f..aecd7fa 100644 --- a/src/modules/mod_redirect.c +++ b/src/modules/mod_redirect.c @@ -385,7 +385,7 @@ static void redirect_free(liServer *srv, gpointer param) { g_slice_free(redirect_data, rd); } -static liAction* redirect_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* redirect_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GArray *arr; liValue *v; guint i; @@ -393,8 +393,7 @@ static liAction* redirect_create(liServer *srv, liPlugin* p, liValue *val) { redirect_rule rule; GError *err = NULL; - UNUSED(srv); - UNUSED(p); + UNUSED(userdata); if (!val || !(val->type == LI_VALUE_STRING || val->type == LI_VALUE_LIST)) { ERROR(srv, "%s", "redirect expects a either a string, a tuple of strings or a list of string tuples"); @@ -521,17 +520,17 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "redirect", redirect_create }, + { "redirect", redirect_create, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_redirect_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_redirect_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -544,7 +543,7 @@ gboolean mod_redirect_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_redirect", plugin_redirect_init); + mod->config = li_plugin_register(mods->main, "mod_redirect", plugin_redirect_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_rewrite.c b/src/modules/mod_rewrite.c index 53e2233..a8c391a 100644 --- a/src/modules/mod_rewrite.c +++ b/src/modules/mod_rewrite.c @@ -377,7 +377,7 @@ static void rewrite_free(liServer *srv, gpointer param) { g_slice_free(rewrite_data, rd); } -static liAction* rewrite_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* rewrite_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GArray *arr; liValue *v; guint i; @@ -386,8 +386,7 @@ static liAction* rewrite_create(liServer *srv, liPlugin* p, liValue *val) { rewrite_plugin_data *rpd = p->data; GError *err = NULL; - UNUSED(srv); - UNUSED(p); + UNUSED(userdata); if (!val || !(val->type == LI_VALUE_STRING || val->type == LI_VALUE_LIST)) { ERROR(srv, "%s", "rewrite expects a either a string, a tuple of strings or a list of string tuples"); @@ -490,13 +489,13 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "rewrite", rewrite_create }, + { "rewrite", rewrite_create, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; @@ -513,8 +512,8 @@ static void plugin_rewrite_free(liServer *srv, liPlugin *p) { g_slice_free(rewrite_plugin_data, data); } -static void plugin_rewrite_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_rewrite_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -532,7 +531,7 @@ gboolean mod_rewrite_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_rewrite", plugin_rewrite_init); + mod->config = li_plugin_register(mods->main, "mod_rewrite", plugin_rewrite_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_scgi.c b/src/modules/mod_scgi.c index 8c7d05e..76c0595 100644 --- a/src/modules/mod_scgi.c +++ b/src/modules/mod_scgi.c @@ -519,8 +519,9 @@ static void scgi_free(liServer *srv, gpointer param) { scgi_context_release(ctx); } -static liAction* scgi_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* scgi_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { scgi_context *ctx; + UNUSED(userdata); if (val->type != LI_VALUE_STRING) { ERROR(srv, "%s", "scgi expects a string as parameter"); @@ -538,17 +539,18 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "scgi", scgi_create }, - { NULL, NULL } + { "scgi", scgi_create, NULL }, + + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -562,7 +564,7 @@ static void plugin_init(liServer *srv, liPlugin *p) { gboolean mod_scgi_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_scgi", plugin_init); + mod->config = li_plugin_register(mods->main, "mod_scgi", plugin_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_status.c b/src/modules/mod_status.c index 38ae353..341523b 100644 --- a/src/modules/mod_status.c +++ b/src/modules/mod_status.c @@ -878,10 +878,9 @@ static void status_info_free(liServer *srv, gpointer param) { g_slice_free(mod_status_param, param); } -static liAction* status_info_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* status_info_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { mod_status_param *param = g_slice_new0(mod_status_param); - UNUSED(srv); - UNUSED(val); + UNUSED(userdata); param->p = p; param->short_info = FALSE; @@ -1151,18 +1150,18 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "status.info", status_info_create }, + { "status.info", status_info_create, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_status_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_status_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -1175,7 +1174,7 @@ gboolean mod_status_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_status", plugin_status_init); + mod->config = li_plugin_register(mods->main, "mod_status", plugin_status_init, NULL); return mod->config != NULL; } diff --git a/src/modules/mod_vhost.c b/src/modules/mod_vhost.c index e85bfd1..c0aad87 100644 --- a/src/modules/mod_vhost.c +++ b/src/modules/mod_vhost.c @@ -183,14 +183,14 @@ static void vhost_simple_free(liServer *srv, gpointer param) { g_slice_free(vhost_simple_data, sd); } -static liAction* vhost_simple_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* vhost_simple_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { guint i; GArray *arr; liValue *k, *v; vhost_simple_data *sd; GString **setting; - UNUSED(srv); UNUSED(p); + UNUSED(userdata); if (!val || val->type != LI_VALUE_LIST) { ERROR(srv, "%s", "vhost.simple expects a list if string tuples as parameter"); @@ -289,11 +289,12 @@ static void vhost_map_free(liServer *srv, gpointer param) { g_slice_free(vhost_map_data, md); } -static liAction* vhost_map_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* vhost_map_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GHashTableIter iter; gpointer k, v; vhost_map_data *md; GString *str; + UNUSED(userdata); if (!val || val->type != LI_VALUE_HASH) { ERROR(srv, "%s", "vhost.map expects a hashtable as parameter"); @@ -420,7 +421,7 @@ static void vhost_map_regex_free(liServer *srv, gpointer param) { g_slice_free(vhost_map_regex_data, mrd); } -static liAction* vhost_map_regex_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* vhost_map_regex_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { GHashTable *hash; GHashTableIter iter; gpointer k, v; @@ -429,6 +430,7 @@ static liAction* vhost_map_regex_create(liServer *srv, liPlugin* p, liValue *val GArray *list; guint i; GError *err = NULL; + UNUSED(userdata); if (!val || val->type != LI_VALUE_HASH) { ERROR(srv, "%s", "vhost.map_regex expects a hashtable as parameter"); @@ -584,11 +586,12 @@ static void vhost_pattern_free(liServer *srv, gpointer param) { g_slice_free(vhost_pattern_data, pd); } -static liAction* vhost_pattern_create(liServer *srv, liPlugin* p, liValue *val) { +static liAction* vhost_pattern_create(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) { vhost_pattern_data *pd; GString *str; gchar *c, *c_last; vhost_pattern_part part; + UNUSED(userdata); if (!val || val->type != LI_VALUE_STRING) { ERROR(srv, "%s", "vhost.map expects a hashtable as parameter"); @@ -689,21 +692,21 @@ static const liPluginOption options[] = { }; static const liPluginAction actions[] = { - { "vhost.simple", vhost_simple_create }, - { "vhost.map", vhost_map_create }, - { "vhost.map_regex", vhost_map_regex_create }, - { "vhost.pattern", vhost_pattern_create }, + { "vhost.simple", vhost_simple_create, NULL }, + { "vhost.map", vhost_map_create, NULL }, + { "vhost.map_regex", vhost_map_regex_create, NULL }, + { "vhost.pattern", vhost_pattern_create, NULL }, - { NULL, NULL } + { NULL, NULL, NULL } }; static const liPluginSetup setups[] = { - { NULL, NULL } + { NULL, NULL, NULL } }; -static void plugin_vhost_init(liServer *srv, liPlugin *p) { - UNUSED(srv); +static void plugin_vhost_init(liServer *srv, liPlugin *p, gpointer userdata) { + UNUSED(srv); UNUSED(userdata); p->options = options; p->actions = actions; @@ -716,7 +719,7 @@ gboolean mod_vhost_init(liModules *mods, liModule *mod) { MODULE_VERSION_CHECK(mods); - mod->config = li_plugin_register(mods->main, "mod_vhost", plugin_vhost_init); + mod->config = li_plugin_register(mods->main, "mod_vhost", plugin_vhost_init, NULL); return mod->config != NULL; }