2
0
Fork 0

Modify header usage; include all core headers from base.h and forbid direct including of core headers. Move typedefs into separate header.

personal/stbuehler/wip
Stefan Bühler 2008-10-28 22:11:50 +01:00
parent bdce397e70
commit 649f7baf78
55 changed files with 305 additions and 291 deletions

View File

@ -1,7 +1,5 @@
#include "log.h"
#include "actions.h"
#include "condition.h"
#include "base.h"
struct action_stack_element;
typedef struct action_stack_element action_stack_element;

View File

@ -1,16 +1,11 @@
#ifndef _LIGHTTPD_ACTIONS_H_
#define _LIGHTTPD_ACTIONS_H_
#include "settings.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
// typedef enum {
// ACTION_GO_ON,
// ACTION_FINISHED,
// ACTION_ERROR,
// ACTION_WAIT_FOR_EVENT
// } action_result;
// action type
/* action type */
typedef enum {
ACTION_TSETTING,
ACTION_TFUNCTION,
@ -18,19 +13,12 @@ typedef enum {
ACTION_TLIST
} action_type;
struct action;
typedef struct action action;
struct action_stack;
typedef struct action_stack action_stack;
struct action_stack {
GArray* stack;
};
struct server; struct connection; struct vrequest;
typedef handler_t (*ActionFunc)(struct vrequest *vr, gpointer param);
typedef void (*ActionFree)(struct server *srv, gpointer param);
typedef handler_t (*ActionFunc)(vrequest *vr, gpointer param);
typedef void (*ActionFree)(server *srv, gpointer param);
struct action_func {
ActionFunc func;
@ -39,10 +27,6 @@ struct action_func {
};
typedef struct action_func action_func;
#include "condition.h"
#include "plugin.h"
#include "options.h"
struct action {
gint refcount;
action_type type;

View File

@ -1,7 +1,7 @@
#ifndef _LIGHTTPD_ACTIONS_LUA_H_
#define _LIGHTTPD_ACTIONS_LUA_H_
#include "actions.h"
#include "base.h"
#include <lua.h>
action* lua_get_action(lua_State *L, int ndx);

View File

@ -20,28 +20,21 @@
(ev)->repeat = (repeat_); \
} while (0)
#define CONST_STR_LEN(x) (x), (x) ? sizeof(x) - 1 : 0
#define GSTR_LEN(x) (x) ? (x)->str : "", (x) ? (x)->len : 0
#define GSTR_SAFE_STR(x) ((x && x->str) ? x->str : "(null)")
typedef enum {
HTTP_TRANSFER_ENCODING_IDENTITY,
HTTP_TRANSFER_ENCODING_CHUNKED
} transfer_encoding_t;
struct server;
typedef struct server server;
struct connection;
typedef struct connection connection;
#include "typedefs.h"
#include "module.h"
#include "chunk.h"
#include "chunk_parser.h"
#include "server.h"
#include "worker.h"
#include "actions.h"
#include "condition.h"
#include "options.h"
#include "value.h"
#include "actions.h"
#include "plugin.h"
#include "http_headers.h"
#include "http_request_parser.h"
#include "request.h"
#include "response.h"
#include "virtualrequest.h"
@ -49,6 +42,8 @@ typedef struct connection connection;
#include "connection.h"
#include "network.h"
#include "collect.h"
#include "utils.h"
#define SERVER_VERSION ((guint) 0x01FF0000)

View File

@ -1,7 +1,5 @@
#include "base.h"
#include "chunk.h"
#include "log.h"
#include <sys/stat.h>
#include <fcntl.h>

View File

@ -1,24 +1,9 @@
#ifndef _LIGHTTPD_CHUNK_H_
#define _LIGHTTPD_CHUNK_H_
#include <glib.h>
struct chunkfile;
typedef struct chunkfile chunkfile;
struct chunk;
typedef struct chunk chunk;
struct chunkqueue;
typedef struct chunkqueue chunkqueue;
struct chunkiter;
typedef struct chunkiter chunkiter;
struct server;
struct vrequest;
#include "settings.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
/* Open a file only once, so it shouldn't get lost;
* as a file may get split into many chunks, we

View File

@ -1,6 +1,5 @@
#include "base.h"
#include "chunk_parser.h"
void chunk_parser_init(chunk_parser_ctx *ctx, chunkqueue *cq) {
ctx->cq = cq;

View File

@ -1,13 +1,9 @@
#ifndef _LIGHTTPD_CHUNK_PARSER_H_
#define _LIGHTTPD_CHUNK_PARSER_H_
struct chunk_parser_ctx;
typedef struct chunk_parser_ctx chunk_parser_ctx;
struct chunk_parser_mark;
typedef struct chunk_parser_mark chunk_parser_mark;
#include "chunk.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
struct chunk_parser_ctx {
chunkqueue *cq;

View File

@ -1,6 +1,5 @@
#include "base.h"
#include "collect.h"
struct collect_job;
typedef struct collect_job collect_job;

View File

@ -1,6 +1,10 @@
#ifndef _LIGHTTPD_COLLECT_H_
#define _LIGHTTPD_COLLECT_H_
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
/* executes a function in each worker context */
/** CollectFunc: the type of functions to execute in each workers context

View File

@ -1,5 +1,4 @@
#include "condition.h"
#include "log.h"
#include "base.h"
static gboolean condition_parse_ip(condition_rvalue *val, const char *txt) {
if (parse_ipv4(txt, &val->ipv4.addr, NULL)) {

View File

@ -1,16 +1,9 @@
#ifndef _LIGHTTPD_CONDITION_H_
#define _LIGHTTPD_CONDITION_H_
#include "settings.h"
struct condition_rvalue;
typedef struct condition_rvalue condition_rvalue;
struct condition_lvalue;
typedef struct condition_lvalue condition_lvalue;
struct condition;
typedef struct condition condition;
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
/**
* possible compare ops in the configfile parser

View File

@ -1,7 +1,7 @@
#ifndef _LIGHTTPD_CONDITION_LUA_H_
#define _LIGHTTPD_CONDITION_LUA_H_
#include "condition.h"
#include "base.h"
#include <lua.h>
condition* lua_get_condition(lua_State *L, int ndx);

View File

@ -1,7 +1,5 @@
#include "settings.h"
#include <stdlib.h>
#include "base.h"
%%{
machine ipv4_parser;

View File

@ -1,8 +1,7 @@
#ifndef _LIGHTTPD_CONFIGPARSER_H_
#define _LIGHTTPD_CONFIGPARSER_H_
#include "condition.h"
#include "base.h"
struct config_parser_context_t;
typedef struct config_parser_context_t config_parser_context_t;

View File

@ -1,7 +1,5 @@
#include "base.h"
#include "network.h"
#include "utils.h"
#include "plugin_core.h"
/* only call it from the worker context the con belongs to */

View File

@ -1,7 +1,9 @@
#ifndef _LIGHTTPD_CONNECTION_H_
#define _LIGHTTPD_CONNECTION_H_
#include "base.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
typedef enum {
/** unused */

View File

@ -1,6 +1,5 @@
#include "base.h"
#include "http_headers.h"
static void _http_header_free(gpointer p) {
http_header *h = (http_header*) p;

View File

@ -1,13 +1,9 @@
#ifndef _LIGHTTPD_HTTP_HEADERS_H_
#define _LIGHTTPD_HTTP_HEADERS_H_
struct http_header;
typedef struct http_header http_header;
struct http_headers;
typedef struct http_headers http_headers;
#include "settings.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
#define HEADER_VALUE(h) \
(&(h)->data->str[h->keylen + 2])

View File

@ -1,13 +1,13 @@
#ifndef _LIGHTTPD_HTTP_REQUEST_PARSER_H_
#define _LIGHTTPD_HTTP_REQUEST_PARSER_H_
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
struct http_request_ctx;
typedef struct http_request_ctx http_request_ctx;
#include "chunk_parser.h"
struct request;
struct http_request_ctx {
chunk_parser_ctx chunk_ctx;
struct request *request;
@ -16,13 +16,11 @@ struct http_request_ctx {
GString *h_key, *h_value;
};
#include "request.h"
LI_API void http_request_parser_init(http_request_ctx* ctx, request *req, chunkqueue *cq);
LI_API void http_request_parser_reset(http_request_ctx* ctx);
LI_API void http_request_parser_clear(http_request_ctx *ctx);
LI_API handler_t http_request_parse(struct vrequest *vr, http_request_ctx *ctx);
LI_API handler_t http_request_parse(vrequest *vr, http_request_ctx *ctx);
#endif

View File

@ -17,7 +17,8 @@ int main(int argc, char *argv[]) {
gboolean free_config_path = TRUE;
gchar *config_path = NULL;
gchar *module_dir = NULL;
const gchar *def_module_dir = "/usr/local/lib"; /* TODO: configure module-dir with make-system */
const gchar *module_dir = def_module_dir;
gboolean luaconfig = FALSE;
gboolean test_config = FALSE;
gboolean show_version = FALSE;
@ -28,7 +29,7 @@ int main(int argc, char *argv[]) {
{ "config", 'c', 0, G_OPTION_ARG_FILENAME, &config_path, "filename/path of the config", "PATH" },
{ "lua", 'l', 0, G_OPTION_ARG_NONE, &luaconfig, "use the lua config frontend", NULL },
{ "test", 't', 0, G_OPTION_ARG_NONE, &test_config, "test config and exit", NULL },
{ "module-dir", 'm', 0, G_OPTION_ARG_STRING, &module_dir, "module directory", NULL },
{ "module-dir", 'm', 0, G_OPTION_ARG_STRING, &module_dir, "module directory", "PATH" },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, "show version and exit", NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
@ -67,9 +68,8 @@ int main(int argc, char *argv[]) {
/* initialize threading */
g_thread_init(NULL);
srv = server_new();
srv = server_new(module_dir);
srv->module_dir = module_dir;
srv->core_plugin = plugin_register(srv, "core", plugin_core_init);
/* if no path is specified for the config, read lighttpd.conf from current directory */

View File

@ -1,8 +1,11 @@
#ifndef _LIGHTTPD_LOG_H_
#define _LIGHTTPD_LOG_H_
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
/* #include "valgrind/valgrind.h" */
#include "base.h"
#define REMOVE_PATH_FROM_FILE 1
#if REMOVE_PATH_FROM_FILE

View File

@ -1,13 +1,13 @@
#include "base.h"
#include "module.h"
modules *modules_init(gpointer main) {
modules *modules_init(gpointer main, const gchar *module_dir) {
modules *m = g_slice_new(modules);
m->version = MODULE_VERSION;
m->main = main;
m->mods = g_array_new(FALSE, TRUE, sizeof(module*));
m->module_dir = g_strdup(module_dir);
return m;
}
@ -26,23 +26,21 @@ static module *module_lookup(modules *mods, const gchar *name) {
return NULL;
}
void modules_cleanup(server *srv) {
void modules_cleanup(modules* mods) {
/* unload all modules */
GArray *a = srv->modules->mods;
GArray *a = mods->mods;
module *mod;
for (guint i = 0; i < a->len; i++) {
mod = g_array_index(a, module*, i);
if (!mod)
continue;
module_release(srv->modules, mod);
module_release(mods, mod);
}
g_array_free(srv->modules->mods, TRUE);
g_slice_free(modules, srv->modules);
if (srv->module_dir)
g_free(srv->module_dir);
g_array_free(mods->mods, TRUE);
g_free(mods->module_dir);
g_slice_free(modules, mods);
}
@ -63,8 +61,7 @@ module* module_load(modules *mods, const gchar* name) {
mod = g_slice_new0(module);
mod->name = g_string_new(name);
mod->refcount = 1;
mod->path = g_module_build_path(((server *)mods->main)->module_dir, name);
TRACE(mods->main, "loading module '%s' from path: %s", name, mod->path);
mod->path = g_module_build_path(mods->module_dir, name);
mod->module = g_module_open(mod->path, G_MODULE_BIND_LAZY);

View File

@ -40,12 +40,13 @@ struct module {
struct modules {
guint version; /**< api version */
GArray *mods; /**< array of (module*) */
gpointer main; /**< pointer to a application specific main structure, e.g. server */
GArray *mods; /**< array of (module*) */
gchar *module_dir;
};
LI_API modules* modules_init(gpointer main);
LI_API void modules_cleanup(server *srv);
LI_API modules* modules_init(gpointer main, const gchar *module_dir);
LI_API void modules_cleanup(modules *mods);
/** Loads a module if not loaded yet and returns the module struct for it (after increasing refcount)
* returns NULL if it couldn't load the module.

View File

@ -1,5 +1,5 @@
#include "network.h"
#include "base.h"
/** repeats write after EINTR */
ssize_t net_write(int fd, void *buf, ssize_t nbyte) {

View File

@ -1,7 +1,9 @@
#ifndef _LIGHTTPD_NETWORK_H_
#define _LIGHTTPD_NETWORK_H_
#include "base.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
typedef enum {
NETWORK_STATUS_SUCCESS, /**< some IO was actually done (read/write) or cq was empty for write */

View File

@ -1,5 +1,5 @@
#include "network.h"
#include "base.h"
/* first chunk must be a FILE_CHUNK ! */
network_status_t network_backend_sendfile(vrequest *vr, int fd, chunkqueue *cq, goffset *write_max) {

View File

@ -1,5 +1,5 @@
#include "network.h"
#include "base.h"
network_status_t network_backend_write(vrequest *vr, int fd, chunkqueue *cq, goffset *write_max) {
const ssize_t blocksize = 16*1024; /* 16k */

View File

@ -1,5 +1,5 @@
#include "network.h"
#include "base.h"
#include <sys/uio.h>

View File

@ -1,6 +1,5 @@
#include "base.h"
#include "options.h"
/* Extract ovalue from ovalue, ovalue set to none */
option_value value_extract(value *val) {

View File

@ -1,14 +1,9 @@
#ifndef _LIGHTTPD_OPTIONS_H_
#define _LIGHTTPD_OPTIONS_H_
struct option_set;
typedef struct option_set option_set;
union option_value;
typedef union option_value option_value;
#include "settings.h"
#include "value.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
union option_value {
gpointer ptr;
@ -23,11 +18,10 @@ union option_value {
condition *cond;
};
struct server_option;
struct option_set {
size_t ndx;
option_value value;
struct server_option *sopt;
server_option *sopt;
};
/* Extract content from value, value set to none */

View File

@ -1,6 +1,5 @@
#include "plugin.h"
#include "log.h"
#include "base.h"
static gboolean plugin_load_default_option(server *srv, server_option *sopt);
static void plugin_free_default_options(server *srv, plugin *p);

View File

@ -1,26 +1,9 @@
#ifndef _LIGHTTPD_PLUGIN_H_
#define _LIGHTTPD_PLUGIN_H_
struct plugin;
typedef struct plugin plugin;
struct plugin_option;
typedef struct plugin_option plugin_option;
struct server_option;
typedef struct server_option server_option;
struct plugin_action;
typedef struct plugin_action plugin_action;
struct server_action;
typedef struct server_action server_action;
struct plugin_setup;
typedef struct plugin_setup plugin_setup;
struct server_setup;
typedef struct server_setup server_setup;
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
#define INIT_FUNC(x) \
LI_EXPORT void * x(server *srv, plugin *)
@ -29,11 +12,6 @@ typedef struct server_setup server_setup;
size_t id; \
ssize_t option_base_ndx
#include "base.h"
#include "options.h"
#include "actions.h"
#include "module.h"
typedef void (*PluginInit) (server *srv, plugin *p);
typedef void (*PluginFree) (server *srv, plugin *p);
typedef gboolean (*PluginParseOption) (server *srv, plugin *p, size_t ndx, value *val, option_value *oval);

View File

@ -1,15 +1,11 @@
#include "base.h"
#include "plugin_core.h"
#include "utils.h"
#include "profiler.h"
#include <sys/stat.h>
#include <fcntl.h>
static action* core_list(server *srv, plugin* p, value *val) {
action *a;
guint i;

View File

@ -1,6 +1,8 @@
#ifndef _LIGHTTPD_PLUGIN_CORE_H_
#define _LIGHTTPD_PLUGIN_CORE_H_
#include "base.h"
enum core_options_t {
CORE_OPTION_DEBUG_REQUEST_HANDLING = 0,

View File

@ -20,4 +20,5 @@ void profiler_enable(); /* enables the profiler */
void profiler_finish();
void profiler_dump(); /* dumps memory statistics to stdout */
void profiler_dump_table();
#endif

View File

@ -1,7 +1,6 @@
#include "base.h"
#include "url_parser.h"
#include "utils.h"
void request_init(request *req) {
req->http_method = HTTP_METHOD_UNSET;

View File

@ -1,50 +1,9 @@
#ifndef _LIGHTTPD_REQUEST_H_
#define _LIGHTTPD_REQUEST_H_
typedef enum {
HTTP_METHOD_UNSET = -1,
HTTP_METHOD_GET,
HTTP_METHOD_POST,
HTTP_METHOD_HEAD,
HTTP_METHOD_OPTIONS,
HTTP_METHOD_PROPFIND, /* WebDAV */
HTTP_METHOD_MKCOL,
HTTP_METHOD_PUT,
HTTP_METHOD_DELETE,
HTTP_METHOD_COPY,
HTTP_METHOD_MOVE,
HTTP_METHOD_PROPPATCH,
HTTP_METHOD_REPORT, /* DeltaV */
HTTP_METHOD_CHECKOUT,
HTTP_METHOD_CHECKIN,
HTTP_METHOD_VERSION_CONTROL,
HTTP_METHOD_UNCHECKOUT,
HTTP_METHOD_MKACTIVITY,
HTTP_METHOD_MERGE,
HTTP_METHOD_LOCK,
HTTP_METHOD_UNLOCK,
HTTP_METHOD_LABEL,
HTTP_METHOD_CONNECT
} http_method_t;
typedef enum {
HTTP_VERSION_UNSET = -1,
HTTP_VERSION_1_0,
HTTP_VERSION_1_1
} http_version_t;
struct request;
typedef struct request request;
struct request_uri;
typedef struct request_uri request_uri;
struct physical;
typedef struct physical physical;
#include "http_headers.h"
#include "http_request_parser.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
struct request_uri {
GString *raw;
@ -81,9 +40,6 @@ struct request {
goffset content_length;
};
#include "base.h"
LI_API void request_init(request *req);
LI_API void request_reset(request *req);
LI_API void request_clear(request *req);

View File

@ -1,6 +1,5 @@
#include "base.h"
#include "utils.h"
#include "plugin_core.h"
void response_init(response *resp) {

View File

@ -1,10 +1,9 @@
#ifndef _LIGHTTPD_RESPONSE_H_
#define _LIGHTTPD_RESPONSE_H_
struct response;
typedef struct response response;
#include "http_headers.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
struct response {
http_headers *headers;

View File

@ -1,6 +1,5 @@
#include "base.h"
#include "utils.h"
#include "plugin_core.h"
static void server_value_free(gpointer _so) {
@ -50,7 +49,7 @@ static void sigpipe_cb(struct ev_loop *loop, struct ev_signal *w, int revents) {
UNUSED(loop); UNUSED(w); UNUSED(revents);
}
server* server_new() {
server* server_new(const gchar *module_dir) {
server* srv = g_slice_new0(server);
srv->magic = LIGHTTPD_SERVER_MAGIC;
@ -60,7 +59,7 @@ server* server_new() {
srv->sockets = g_array_new(FALSE, TRUE, sizeof(server_socket*));
srv->modules = modules_init(srv);
srv->modules = modules_init(srv, module_dir);
srv->plugins = g_hash_table_new(g_str_hash, g_str_equal);
srv->options = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, server_value_free);
@ -99,7 +98,7 @@ void server_free(server* srv) {
action_release(srv, srv->mainaction);
/* release modules */
modules_cleanup(srv);
modules_cleanup(srv->modules);
plugin_free(srv, srv->core_plugin);

View File

@ -19,10 +19,6 @@ struct server_socket {
ev_io watcher;
};
struct worker;
union option_value;
struct server {
guint32 magic; /** server magic version, check against LIGHTTPD_SERVER_MAGIC in plugins */
server_state state; /** atomic access */
@ -41,7 +37,6 @@ struct server {
GArray *sockets; /** array of (server_socket*) */
gchar *module_dir;
struct modules *modules;
GHashTable *plugins; /**< const gchar* => (plugin*) */
@ -79,7 +74,7 @@ struct server {
};
LI_API server* server_new();
LI_API server* server_new(const gchar *module_dir);
LI_API void server_free(server* srv);
LI_API gboolean server_loop_init(server *srv);

View File

@ -17,6 +17,10 @@
#define L_GOFFSET_FORMAT G_GINT64_FORMAT
#define L_GOFFSET_MODIFIER G_GINT64_MODIFIER
#define CONST_STR_LEN(x) (x), (x) ? sizeof(x) - 1 : 0
#define GSTR_LEN(x) (x) ? (x)->str : "", (x) ? (x)->len : 0
#define GSTR_SAFE_STR(x) ((x && x->str) ? x->str : "(null)")
#include <assert.h>
@ -137,16 +141,6 @@
# define USE_WRITE
#endif
typedef enum {
HANDLER_GO_ON,
HANDLER_FINISHED,
HANDLER_COMEBACK,
HANDLER_WAIT_FOR_EVENT,
HANDLER_ERROR,
HANDLER_WAIT_FOR_FD
} handler_t;
/* Shared library support */
#ifdef _WIN32
#define LI_IMPORT __declspec(dllimport)

View File

@ -2,9 +2,7 @@
#include "base.h"
#include "log.h"
#include "http_request_parser.h"
#include "config_parser.h"
int request_test() {

189
src/typedefs.h Normal file
View File

@ -0,0 +1,189 @@
#ifndef _LIGHTTPD_TYPEDEFS_H_
#define _LIGHTTPD_TYPEDEFS_H_
typedef enum {
HTTP_TRANSFER_ENCODING_IDENTITY,
HTTP_TRANSFER_ENCODING_CHUNKED
} transfer_encoding_t;
typedef enum {
HANDLER_GO_ON,
HANDLER_FINISHED,
HANDLER_COMEBACK,
HANDLER_WAIT_FOR_EVENT,
HANDLER_ERROR,
HANDLER_WAIT_FOR_FD
} handler_t;
/* structs from headers, in alphabetic order */
/* actions.h */
struct action;
typedef struct action action;
struct action_stack;
typedef struct action_stack action_stack;
/* chunk.h */
struct chunkfile;
typedef struct chunkfile chunkfile;
struct chunk;
typedef struct chunk chunk;
struct chunkqueue;
typedef struct chunkqueue chunkqueue;
struct chunkiter;
typedef struct chunkiter chunkiter;
/* chunk_parser.h */
struct chunk_parser_ctx;
typedef struct chunk_parser_ctx chunk_parser_ctx;
struct chunk_parser_mark;
typedef struct chunk_parser_mark chunk_parser_mark;
/* condition.h */
struct condition_rvalue;
typedef struct condition_rvalue condition_rvalue;
struct condition_lvalue;
typedef struct condition_lvalue condition_lvalue;
struct condition;
typedef struct condition condition;
/* connection.h */
struct connection;
typedef struct connection connection;
/* hhtp_headers.h */
struct http_header;
typedef struct http_header http_header;
struct http_headers;
typedef struct http_headers http_headers;
/* options.h */
struct option_set;
typedef struct option_set option_set;
union option_value;
typedef union option_value option_value;
/* plugin.h */
struct plugin;
typedef struct plugin plugin;
struct plugin_option;
typedef struct plugin_option plugin_option;
struct server_option;
typedef struct server_option server_option;
struct plugin_action;
typedef struct plugin_action plugin_action;
struct server_action;
typedef struct server_action server_action;
struct plugin_setup;
typedef struct plugin_setup plugin_setup;
struct server_setup;
typedef struct server_setup server_setup;
/* request.h */
typedef enum {
HTTP_METHOD_UNSET = -1,
HTTP_METHOD_GET,
HTTP_METHOD_POST,
HTTP_METHOD_HEAD,
HTTP_METHOD_OPTIONS,
HTTP_METHOD_PROPFIND, /* WebDAV */
HTTP_METHOD_MKCOL,
HTTP_METHOD_PUT,
HTTP_METHOD_DELETE,
HTTP_METHOD_COPY,
HTTP_METHOD_MOVE,
HTTP_METHOD_PROPPATCH,
HTTP_METHOD_REPORT, /* DeltaV */
HTTP_METHOD_CHECKOUT,
HTTP_METHOD_CHECKIN,
HTTP_METHOD_VERSION_CONTROL,
HTTP_METHOD_UNCHECKOUT,
HTTP_METHOD_MKACTIVITY,
HTTP_METHOD_MERGE,
HTTP_METHOD_LOCK,
HTTP_METHOD_UNLOCK,
HTTP_METHOD_LABEL,
HTTP_METHOD_CONNECT
} http_method_t;
typedef enum {
HTTP_VERSION_UNSET = -1,
HTTP_VERSION_1_0,
HTTP_VERSION_1_1
} http_version_t;
struct request;
typedef struct request request;
struct request_uri;
typedef struct request_uri request_uri;
struct physical;
typedef struct physical physical;
/* respone.h */
struct response;
typedef struct response response;
/* server.h */
struct server;
typedef struct server server;
/* value.h */
struct value;
typedef struct value value;
typedef enum {
VALUE_NONE,
VALUE_BOOLEAN,
VALUE_NUMBER,
VALUE_STRING,
VALUE_LIST,
VALUE_HASH,
VALUE_ACTION, /**< shouldn't be used for options, but may be needed for constructing actions */
VALUE_CONDITION /**< shouldn't be used for options, but may be needed for constructing actions */
} value_type;
/* virtualrequest.h */
struct vrequest;
typedef struct vrequest vrequest;
struct filter;
typedef struct filter filter;
struct filters;
typedef struct filters filters;
/* worker.h */
struct worker;
typedef struct worker worker;
#endif

View File

@ -1,8 +1,7 @@
#ifndef _LIGHTTPD_URL_PARSER_H_
#define _LIGHTTPD_URL_PARSER_H_
#include "settings.h"
#include "request.h"
#include "base.h"
LI_API gboolean parse_raw_url(request_uri *uri);
LI_API gboolean parse_hostname(request_uri *uri);

View File

@ -1,5 +1,5 @@
#include "url_parser.h"
#include "base.h"
#include <stdlib.h>

View File

@ -1,7 +1,9 @@
#ifndef _LIGHTTPD_UTILS_H_
#define _LIGHTTPD_UTILS_H_
#include "settings.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
LI_API void fatal(const gchar* msg);

View File

@ -1,5 +1,4 @@
#include "base.h"
#include "value.h"
value* value_new_bool(gboolean val) {
value *v = g_slice_new0(value);

View File

@ -1,21 +1,9 @@
#ifndef _LIGHTTPD_VALUE_H_
#define _LIGHTTPD_VALUE_H_
typedef enum {
VALUE_NONE,
VALUE_BOOLEAN,
VALUE_NUMBER,
VALUE_STRING,
VALUE_LIST,
VALUE_HASH,
VALUE_ACTION, /**< shouldn't be used for options, but may be needed for constructing actions */
VALUE_CONDITION /**< shouldn't be used for options, but may be needed for constructing actions */
} value_type;
struct value;
typedef struct value value;
#include "settings.h"
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
struct value {
value_type type;

View File

@ -2,7 +2,6 @@
#include "value_lua.h"
#include "condition_lua.h"
#include "actions_lua.h"
#include "log.h"
/* replace a negative stack index with a positive one,
* so that you don't need to care about push/pop

View File

@ -2,8 +2,6 @@
#define _LIGHTTPD_OPTIONS_LUA_H_
#include "base.h"
#include "options.h"
#include <lua.h>
/* converts the top of the stack into an value

View File

@ -1,6 +1,10 @@
#ifndef _LIGHTTPD_VIRTUALREQUEST_H_
#define _LIGHTTPD_VIRTUALREQUEST_H_
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
typedef enum {
/* waiting for request headers */
VRS_CLEAN,
@ -29,20 +33,9 @@ typedef enum {
} vrequest_state;
struct vrequest;
typedef struct vrequest vrequest;
struct filter;
typedef struct filter filter;
struct filters;
typedef struct filters filters;
typedef handler_t (*filter_handler)(vrequest *vr, filter *f, plugin *p);
typedef handler_t (*vrequest_handler)(vrequest *vr);
#include "base.h"
struct filter {
chunkqueue *in, *out;
plugin *p;

View File

@ -2,7 +2,6 @@
#include <sched.h>
#include "base.h"
#include "collect.h"
static connection* worker_con_get(worker *wrk);
void worker_con_put(connection *con);

View File

@ -1,10 +1,9 @@
#ifndef _LIGHTTPD_WORKER_H_
#define _LIGHTTPD_WORKER_H_
struct worker;
typedef struct worker worker;
struct server;
#ifndef _LIGHTTPD_BASE_H_
#error Please include "base.h" instead of this file
#endif
struct statistics_t;
typedef struct statistics_t statistics_t;
@ -23,8 +22,6 @@ struct statistics_t {
ev_tstamp last_update;
};
#include "settings.h"
#define CUR_TS(wrk) ((time_t)ev_now((wrk)->loop))
/* only locks if there is more than one worker */