2
0
Fork 0

merged from lp

personal/stbuehler/wip
Thomas Porzelt 2008-07-24 14:50:45 +02:00
commit 5d2f95cce3
4 changed files with 61 additions and 2 deletions

View File

@ -3,6 +3,7 @@
#include "log.h"
#include "config_parser.h"
void plugin_core_init(server *srv, plugin *p);
int main(int argc, char *argv[]) {
GError *error;
@ -46,6 +47,8 @@ int main(int argc, char *argv[]) {
log_init(srv);
plugin_register(srv, "core", plugin_core_init);
/* if no path is specified for the config, read lighttpd.conf from current directory */
if (config_path == NULL)
config_path = "lighttpd.conf";

56
src/plugin_core.c Normal file
View File

@ -0,0 +1,56 @@
#include "base.h"
static action_result core_handle_static(server *srv, connection *con, gpointer param) {
UNUSED(param);
/* TODO */
CON_ERROR(srv, con, "%s", "Not implemented yet");
return HANDLER_ERROR;
}
static gboolean core_static(server *srv, gpointer p_d, option *opt, action_func *func) {
UNUSED(p_d);
if (opt) {
ERROR(srv, "%s", "static action doesn't have parameters");
return FALSE;
}
func->func = core_handle_static;
func->free = NULL;
func->param = NULL;
return TRUE;
}
static gboolean core_listen(server *srv, gpointer p_d, option *opt) {
UNUSED(p_d);
if (opt->type != OPTION_STRING) {
ERROR(srv, "%s", "listen expects a string as parameter");
return FALSE;
}
TRACE(srv, "will listen to '%s'", opt->value.opt_string->str);
return TRUE;
}
static const plugin_option options[] = {
{ "static-file.exclude", OPTION_LIST, NULL, NULL },
{ NULL, 0, NULL, NULL }
};
static const plugin_action actions[] = {
{ "static", core_static },
{ NULL, NULL }
};
static const plugin_setup setups[] = {
{ "listen", core_listen },
{ NULL, NULL }
};
void plugin_core_init(server *srv, plugin *p) {
UNUSED(srv);
p->options = options;
p->actions = actions;
p->setups = setups;
}

View File

@ -7,8 +7,6 @@ struct server {
GHashTable *plugins;
struct action_list *actions;
size_t option_count;
GHashTable *options;

View File

@ -22,6 +22,8 @@ common_source='''
server.c
sys-files.c
sys-socket.c
plugin_core.c
'''
common_source_lua='''