2008-08-02 20:56:07 +00:00
|
|
|
#ifndef _LIGHTTPD_CONFIGPARSER_H_
|
|
|
|
#define _LIGHTTPD_CONFIGPARSER_H_
|
|
|
|
|
|
|
|
|
2008-07-17 17:32:11 +00:00
|
|
|
#include "condition.h"
|
|
|
|
|
2008-07-23 20:22:33 +00:00
|
|
|
struct config_parser_context_t;
|
|
|
|
typedef struct config_parser_context_t config_parser_context_t;
|
|
|
|
|
|
|
|
|
2008-08-03 20:26:37 +00:00
|
|
|
/* returns a new config parser stack with the first context in it */
|
|
|
|
GList *config_parser_init(server *srv);
|
2008-08-05 16:10:22 +00:00
|
|
|
void config_parser_finish(server *srv, GList *ctx_stack);
|
2008-08-03 20:26:37 +00:00
|
|
|
|
2008-07-08 16:51:03 +00:00
|
|
|
/* loads a file into memory and parses it */
|
2008-08-02 20:56:07 +00:00
|
|
|
gboolean config_parser_file(server *srv, GList *ctx_stack, const gchar *path);
|
2008-07-08 16:51:03 +00:00
|
|
|
/* launched a command through the shell and parses the stdout it returns */
|
2008-08-02 20:56:07 +00:00
|
|
|
gboolean config_parser_shell(server *srv,GList *ctx_stack, const gchar *command);
|
2008-07-08 16:51:03 +00:00
|
|
|
/* parses a buffer pointed to by the previously allocated config_parser_data struct */
|
2008-08-02 20:56:07 +00:00
|
|
|
gboolean config_parser_buffer(server *srv, GList *ctx_stack);
|
2008-07-08 16:51:03 +00:00
|
|
|
|
2008-08-03 20:26:37 +00:00
|
|
|
config_parser_context_t *config_parser_context_new(server *srv, GList *ctx_stack);
|
|
|
|
void config_parser_context_free(server *srv, config_parser_context_t *ctx, gboolean free_queues);
|
2008-07-17 21:12:52 +00:00
|
|
|
|
2008-07-23 20:22:33 +00:00
|
|
|
struct config_parser_context_t {
|
2008-07-08 16:51:03 +00:00
|
|
|
/* ragel vars */
|
|
|
|
int cs;
|
|
|
|
int *stack;
|
|
|
|
int top;
|
2008-08-02 20:56:07 +00:00
|
|
|
int stacksize; /* not really used by ragel but need to remember it */
|
2008-07-08 16:51:03 +00:00
|
|
|
char *p, *pe, *eof;
|
|
|
|
|
|
|
|
gchar *mark;
|
2008-08-02 20:56:07 +00:00
|
|
|
gboolean in_setup_block;
|
2008-07-23 20:22:33 +00:00
|
|
|
|
2008-08-02 20:56:07 +00:00
|
|
|
comp_operator_t op;
|
2008-08-04 21:16:49 +00:00
|
|
|
gchar value_op;
|
2008-07-08 16:51:03 +00:00
|
|
|
|
2008-08-05 19:21:31 +00:00
|
|
|
GHashTable *action_blocks; /* foo { } */
|
|
|
|
GHashTable *uservars; /* var.foo */
|
2008-08-05 16:10:22 +00:00
|
|
|
|
2008-08-02 20:56:07 +00:00
|
|
|
GQueue *action_list_stack; /* first entry is current action list */
|
2008-08-03 20:26:37 +00:00
|
|
|
GQueue *option_stack; /* stack of option* */
|
2008-07-17 17:32:11 +00:00
|
|
|
|
2008-08-02 20:56:07 +00:00
|
|
|
/* information about currenty parsed file */
|
|
|
|
gchar *filename;
|
|
|
|
gchar *ptr; /* pointer to the data */
|
|
|
|
gsize len;
|
|
|
|
gsize line; /* holds current line */
|
2008-07-08 16:51:03 +00:00
|
|
|
};
|
2008-08-02 20:56:07 +00:00
|
|
|
|
|
|
|
#endif
|