Browse Source

* config.[ch]: add new section type: t_filter

master
Alex 'AdUser' Z 9 years ago
parent
commit
006e0d952f
  1. 9
      src/config.c
  2. 2
      src/config.h

9
src/config.c

@ -112,6 +112,13 @@ f2b_config_section_create(const char *src) {
return section;
}
name = "filter:";
if (strncmp(line, name, strlen(name)) == 0) {
section->type = t_filter;
strncpy(section->name, line + strlen(name), sizeof(section->name));
return section;
}
name = "jail:";
if (strncmp(line, name, strlen(name)) == 0) {
section->type = t_jail;
@ -248,6 +255,7 @@ f2b_config_free(f2b_config_t *config) {
FREE_SECTIONS(config->main);
FREE_SECTIONS(config->defaults);
FREE_SECTIONS(config->filters);
FREE_SECTIONS(config->backends);
FREE_SECTIONS(config->jails);
@ -265,6 +273,7 @@ f2b_config_append(f2b_config_t *config, f2b_config_section_t *section) {
switch (section->type) {
case t_main: s = &config->main; break;
case t_defaults: s = &config->defaults; break;
case t_filter: s = &config->filters; break;
case t_backend: s = &config->backends; break;
case t_jail: s = &config->jails; break;
default:

2
src/config.h

@ -10,6 +10,7 @@ typedef enum f2b_section_type {
t_unknown = 0,
t_main,
t_defaults,
t_filter,
t_backend,
t_jail,
} f2b_section_type;
@ -31,6 +32,7 @@ typedef struct f2b_config_section_t {
typedef struct f2b_config_t {
f2b_config_section_t *main;
f2b_config_section_t *defaults;
f2b_config_section_t *filters;
f2b_config_section_t *backends;
f2b_config_section_t *jails;
} f2b_config_t;

Loading…
Cancel
Save