2008-08-02 20:56:07 +00:00
|
|
|
#ifndef _LIGHTTPD_CONFIGPARSER_H_
|
|
|
|
#define _LIGHTTPD_CONFIGPARSER_H_
|
|
|
|
|
2008-11-16 20:33:53 +00:00
|
|
|
#include <lighttpd/base.h>
|
2008-07-17 17:32:11 +00:00
|
|
|
|
2009-07-08 19:06:07 +00:00
|
|
|
typedef struct liConfigParserContext liConfigParserContext;
|
2008-07-23 20:22:33 +00:00
|
|
|
|
2008-09-24 22:00:23 +00:00
|
|
|
typedef enum {
|
2009-07-08 19:06:07 +00:00
|
|
|
LI_CFG_PARSER_CAST_NONE,
|
|
|
|
LI_CFG_PARSER_CAST_INT,
|
|
|
|
LI_CFG_PARSER_CAST_STR
|
|
|
|
} liCastType;
|
2008-09-24 22:00:23 +00:00
|
|
|
|
2009-07-08 19:06:07 +00:00
|
|
|
struct liConfigParserContext {
|
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;
|
2009-01-06 00:33:20 +00:00
|
|
|
|
|
|
|
|
2008-08-12 15:09:05 +00:00
|
|
|
gboolean condition_with_key;
|
2009-01-06 00:33:20 +00:00
|
|
|
gboolean condition_nonbool;
|
|
|
|
gboolean condition_negated;
|
2008-07-23 20:22:33 +00:00
|
|
|
|
2009-07-08 19:06:07 +00:00
|
|
|
liCompOperator op;
|
2008-08-04 21:16:49 +00:00
|
|
|
gchar value_op;
|
2008-07-08 16:51:03 +00:00
|
|
|
|
2009-07-08 19:06:07 +00:00
|
|
|
liCastType cast;
|
2008-08-12 15:09:05 +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 */
|
2009-07-08 19:06:07 +00:00
|
|
|
GQueue *option_stack; /* stack of liValue* */
|
2008-08-12 15:09:05 +00:00
|
|
|
GQueue *condition_stack; /* stack of condition* */
|
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
|
|
|
|
2009-10-09 13:38:12 +00:00
|
|
|
/* returns a new config parser stack with the first context in it */
|
|
|
|
LI_API GList* li_config_parser_init(liServer *srv);
|
|
|
|
LI_API void li_config_parser_finish(liServer *srv, GList *ctx_stack, gboolean free_all);
|
|
|
|
|
|
|
|
/* loads a file into memory and parses it */
|
|
|
|
LI_API gboolean li_config_parser_file(liServer *srv, GList *ctx_stack, const gchar *path);
|
|
|
|
|
2008-08-02 20:56:07 +00:00
|
|
|
#endif
|