merged from lp
commit
4ae1c04b55
|
@ -44,12 +44,7 @@ void action_acquire(action *a) {
|
|||
a->refcount++;
|
||||
}
|
||||
|
||||
action *action_new_setting(server *srv, const gchar *name, option *value) {
|
||||
option_set setting;
|
||||
if (!parse_option(srv, name, value, &setting)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
action *action_new_setting(option_set setting) {
|
||||
action *a = g_slice_new(action);
|
||||
|
||||
a->refcount = 1;
|
||||
|
|
|
@ -74,7 +74,7 @@ LI_API action_result action_execute(server *srv, connection *con);
|
|||
LI_API void action_release(server *srv, action *a);
|
||||
LI_API void action_acquire(action *a);
|
||||
/* create new action */
|
||||
LI_API action *action_new_setting(server *srv, const gchar *name, option *value);
|
||||
LI_API action *action_new_setting(option_set setting);
|
||||
LI_API action *action_new_function(ActionFunc func, ActionFree free, gpointer param);
|
||||
LI_API action *action_new_list();
|
||||
LI_API action *action_new_condition(condition *cond, action *target);
|
||||
|
|
|
@ -138,7 +138,7 @@ static action* action_from_lua(server *srv, lua_State *L) {
|
|||
lua_pushstring(L, "missing config value");
|
||||
lua_error(L);
|
||||
}
|
||||
a = action_new_setting(srv, optname, value);
|
||||
a = option_action(srv, optname, value);
|
||||
if (!a) {
|
||||
option_free(value);
|
||||
lua_pushstring(L, "couldn't create action from setting");
|
||||
|
|
10
src/plugin.c
10
src/plugin.c
|
@ -217,6 +217,16 @@ void release_option(server *srv, option_set *mark) { /** Does not free the optio
|
|||
mark->value = NULL;
|
||||
}
|
||||
|
||||
action* option_action(server *srv, const gchar *name, option *value) {
|
||||
option_set setting;
|
||||
|
||||
if (!parse_option(srv, name, value, &setting)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return action_new_setting(setting);
|
||||
}
|
||||
|
||||
action* create_action(server *srv, const gchar *name, option *value) {
|
||||
action *a;
|
||||
server_action *sa;
|
||||
|
|
10
src/plugin.h
10
src/plugin.h
|
@ -99,14 +99,20 @@ struct server_setup {
|
|||
PluginSetup setup;
|
||||
};
|
||||
|
||||
LI_API void plugin_free(server *srv, plugin *p);
|
||||
/* Needed my modules to register their plugin(s) */
|
||||
LI_API gboolean plugin_register(server *srv, const gchar *name, PluginInit init);
|
||||
|
||||
LI_API void plugin_free(server *srv, plugin *p);
|
||||
|
||||
LI_API gboolean parse_option(server *srv, const char *name, option *opt, option_set *mark);
|
||||
LI_API void release_option(server *srv, option_set *mark); /**< Does not free the option_set memory */
|
||||
|
||||
/* Needed for config frontends */
|
||||
/** For parsing 'somemod.option = "somevalue"' */
|
||||
LI_API action* option_action(server *srv, const gchar *name, option *value);
|
||||
/** For parsing 'somemod.action value', e.g. 'rewrite "/url" => "/destination"' */
|
||||
LI_API action* create_action(server *srv, const gchar *name, option *value);
|
||||
|
||||
/** For setup function, e.g. 'listen "127.0.0.1:8080"' */
|
||||
LI_API gboolean call_setup(server *srv, const char *name, option *opt);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue