Browse Source

* src/config.[ch] : add support of 'source' section type

master
Alex 'AdUser' Z 8 years ago
parent
commit
82335db1c7
  1. 8
      src/config.c
  2. 2
      src/config.h

8
src/config.c

@ -132,6 +132,13 @@ f2b_config_section_create(const char *src) {
return section; return section;
} }
name = "source:";
if (strncmp(line, name, strlen(name)) == 0) {
section->type = t_source;
strlcpy(section->name, line + strlen(name), sizeof(section->name));
return section;
}
name = "backend:"; name = "backend:";
if (strncmp(line, name, strlen(name)) == 0) { if (strncmp(line, name, strlen(name)) == 0) {
section->type = t_backend; section->type = t_backend;
@ -305,6 +312,7 @@ f2b_config_section_append(f2b_config_t *config, f2b_config_section_t *section) {
switch (section->type) { switch (section->type) {
case t_main: s = &config->main; break; case t_main: s = &config->main; break;
case t_defaults: s = &config->defaults; break; case t_defaults: s = &config->defaults; break;
case t_source: s = &config->sources; break;
case t_filter: s = &config->filters; break; case t_filter: s = &config->filters; break;
case t_backend: s = &config->backends; break; case t_backend: s = &config->backends; break;
case t_jail: s = &config->jails; break; case t_jail: s = &config->jails; break;

2
src/config.h

@ -16,6 +16,7 @@ typedef enum f2b_section_type {
t_unknown = 0, t_unknown = 0,
t_main, t_main,
t_defaults, t_defaults,
t_source,
t_filter, t_filter,
t_backend, t_backend,
t_jail, t_jail,
@ -38,6 +39,7 @@ typedef struct f2b_config_section_t {
typedef struct f2b_config_t { typedef struct f2b_config_t {
f2b_config_section_t *main; f2b_config_section_t *main;
f2b_config_section_t *defaults; f2b_config_section_t *defaults;
f2b_config_section_t *sources;
f2b_config_section_t *filters; f2b_config_section_t *filters;
f2b_config_section_t *backends; f2b_config_section_t *backends;
f2b_config_section_t *jails; f2b_config_section_t *jails;

Loading…
Cancel
Save