diff options
author | Edward Rudd <urkle@outoforder.cc> | 2008-10-22 12:40:58 (GMT) |
---|---|---|
committer | Edward Rudd <urkle@outoforder.cc> | 2008-10-22 12:40:58 (GMT) |
commit | 0ddd719a72469f732a881c93d4c804e9aca787fe (patch) | |
tree | e05821ff5a6ad0f00d63f23090ce4f2ec19bef75 /utility/config.h | |
parent | cc75ebf7e8560a69a6847f0260cce4772fff440a (diff) |
added more config options
included PCRE wrapper from httpd
more complete log parser code.
fixed NASTY bug with setting values in the hash tables (Need to DUP the strings before setting the keys)
Diffstat (limited to 'utility/config.h')
-rw-r--r-- | utility/config.h | 59 |
1 files changed, 49 insertions, 10 deletions
diff --git a/utility/config.h b/utility/config.h index e1827fe..67f8ea5 100644 --- a/utility/config.h +++ b/utility/config.h | |||
@@ -5,6 +5,8 @@ | |||
5 | #include "apr_hash.h" | 5 | #include "apr_hash.h" |
6 | #include "apr_file_io.h" | 6 | #include "apr_file_io.h" |
7 | 7 | ||
8 | #include "ap_pcre.h" | ||
9 | |||
8 | typedef enum { | 10 | typedef enum { |
9 | LOGLEVEL_QUIET = 0, | 11 | LOGLEVEL_QUIET = 0, |
10 | LOGLEVEL_ERROR = 1, | 12 | LOGLEVEL_ERROR = 1, |
@@ -12,7 +14,8 @@ typedef enum { | |||
12 | LOGLEVEL_DEBUG = 3, | 14 | LOGLEVEL_DEBUG = 3, |
13 | } loglevel_e; | 15 | } loglevel_e; |
14 | 16 | ||
15 | typedef struct { | 17 | typedef struct config_t config_t; |
18 | struct config_t { | ||
16 | /** the structures pool (to ease function arguments) */ | 19 | /** the structures pool (to ease function arguments) */ |
17 | apr_pool_t *pool; | 20 | apr_pool_t *pool; |
18 | 21 | ||
@@ -46,29 +49,33 @@ typedef struct { | |||
46 | apr_array_header_t *output_fields; | 49 | apr_array_header_t *output_fields; |
47 | 50 | ||
48 | /** filter configuration */ | 51 | /** filter configuration */ |
49 | apr_array_header_t *filters; | 52 | apr_array_header_t *linefilters; |
53 | apr_array_header_t *prefilters; | ||
54 | apr_array_header_t *postfilters; | ||
50 | 55 | ||
51 | /** Dry Run */ | 56 | /** Dry Run */ |
52 | int dryrun; | 57 | int dryrun; |
53 | 58 | ||
54 | /* Show the summary */ | 59 | /* Show the summary */ |
55 | int summary; | 60 | int summary; |
56 | } config_t; | 61 | }; |
62 | |||
57 | 63 | ||
58 | typedef struct { | 64 | typedef struct config_logformat_t config_logformat_t; |
65 | struct config_logformat_t { | ||
59 | const char *name; | 66 | const char *name; |
60 | apr_array_header_t *fields; | 67 | apr_array_header_t *fields; |
61 | } config_logformat_t; | 68 | }; |
62 | 69 | ||
63 | typedef struct { | 70 | typedef struct config_logformat_field_t config_logformat_field_t; |
71 | struct config_logformat_field_t { | ||
64 | const char *name; | 72 | const char *name; |
65 | const char *datatype; | 73 | const char *datatype; |
66 | } config_logformat_field_t; | 74 | }; |
67 | 75 | ||
68 | typedef struct config_opt_t config_opt_t; | 76 | typedef struct config_opt_t config_opt_t; |
69 | typedef apr_status_t (*config_func_t)(config_t *cfg, config_opt_t *opt, | 77 | typedef apr_status_t (*config_func_t)(config_t *cfg, config_opt_t *opt, |
70 | int argc, const char **argv); | 78 | int argc, const char **argv); |
71 | |||
72 | struct config_opt_t { | 79 | struct config_opt_t { |
73 | const char *name; | 80 | const char *name; |
74 | const char *help; | 81 | const char *help; |
@@ -76,6 +83,40 @@ struct config_opt_t { | |||
76 | void *data; | 83 | void *data; |
77 | }; | 84 | }; |
78 | 85 | ||
86 | typedef struct config_filter_t config_filter_t; | ||
87 | struct config_filter_t { | ||
88 | const char *field; | ||
89 | const char *filter; | ||
90 | int negative; | ||
91 | ap_regex_t *regex; | ||
92 | }; | ||
93 | |||
94 | typedef enum { | ||
95 | LOGSQL_DATATYPE_INT = 0, | ||
96 | LOGSQL_DATATYPE_SMALLINT, | ||
97 | LOGSQL_DATATYPE_VARCHAR, | ||
98 | LOGSQL_DATATYPE_CHAR, | ||
99 | LOGSQL_DATATYPE_BIGINT | ||
100 | } logsql_field_datatype; | ||
101 | #define logsql_field_datatyeName(x) \ | ||
102 | (x == LOGSQL_DATATYPE_INT ? "INT" \ | ||
103 | : (x == LOGSQL_DATATYPE_SMALLINT ? "SMALLINT" \ | ||
104 | : (x == LOGSQL_DATATYPE_VARCHAR ? "VARCHAR" \ | ||
105 | : (x == LOGSQL_DATATYPE_CHAR ? "CHAR" \ | ||
106 | : (x == LOGSQL_DATATYPE_BIGINT ? "BIGINT" : "ERR"))))) | ||
107 | |||
108 | typedef struct config_output_field_t config_output_field_t; | ||
109 | |||
110 | struct config_output_field_t { | ||
111 | const char *field; | ||
112 | logsql_field_datatype datatype; | ||
113 | apr_size_t size; | ||
114 | const char *source; | ||
115 | const char *fname; | ||
116 | void *func; | ||
117 | const char **args; | ||
118 | }; | ||
119 | |||
79 | #define CHECK_YESNO(c) ((!strcasecmp(c,"on") || !strcasecmp(c,"yes")) ? 1 : 0) | 120 | #define CHECK_YESNO(c) ((!strcasecmp(c,"on") || !strcasecmp(c,"yes")) ? 1 : 0) |
80 | 121 | ||
81 | /** | 122 | /** |
@@ -99,6 +140,4 @@ config_t *config_create(apr_pool_t *p); | |||
99 | apr_status_t config_read(config_t *cfg, const char *filename, | 140 | apr_status_t config_read(config_t *cfg, const char *filename, |
100 | apr_table_t *merge); | 141 | apr_table_t *merge); |
101 | 142 | ||
102 | void config_generate(const char *filename); | ||
103 | |||
104 | #endif /*CONFIG_H_*/ | 143 | #endif /*CONFIG_H_*/ |