Go to the source code of this file.
Defines | |
#define | _GNU_SOURCE |
#define | TO_NEXT_WORD(s, e) |
Enumerations | |
enum | OpCodes { oBadOption, oDaemon, oDebugLevel, oExternalInterface, oGatewayID, oGatewayInterface, oGatewayAddress, oGatewayPort, oAuthServer, oAuthServHostname, oAuthServSSLAvailable, oAuthServSSLPort, oAuthServHTTPPort, oAuthServPath, oAuthServLoginScriptPathFragment, oAuthServPortalScriptPathFragment, oAuthServMsgScriptPathFragment, oAuthServPingScriptPathFragment, oAuthServAuthScriptPathFragment, oHTTPDMaxConn, oHTTPDName, oClientTimeout, oCheckInterval, oWdctlSocket, oSyslogFacility, oFirewallRule, oFirewallRuleSet, oTrustedMACList } |
Functions | |
static void | config_notnull (void *parm, char *parmname) |
static int | parse_boolean_value (char *) |
static void | parse_auth_server (FILE *, char *, int *) |
static int | _parse_firewall_rule (char *ruleset, char *leftover) |
static void | parse_firewall_ruleset (char *, FILE *, char *, int *) |
static OpCodes | config_parse_token (const char *cp, const char *filename, int linenum) |
s_config * | config_get_config (void) |
Get the current gateway configuration. | |
void | config_init (void) |
Initialise the conf system. | |
void | config_init_override (void) |
Initialize the variables we override with the command line. | |
t_firewall_rule * | get_ruleset (char *ruleset) |
Fetch a firewall rule set. | |
void | config_read (char *filename) |
Reads the configuration file. | |
void | parse_trusted_mac_list (char *ptr) |
void | config_validate (void) |
Check that the configuration is valid. | |
t_auth_serv * | get_auth_server (void) |
Get the active auth server. | |
void | mark_auth_server_bad (t_auth_serv *bad_server) |
Bump server to bottom of the list. | |
Variables | |
static s_config | config |
pthread_mutex_t | config_mutex = PTHREAD_MUTEX_INITIALIZER |
static int | missing_parms |
struct { | |
const char * name | |
OpCodes opcode | |
int required | |
} | keywords [] |
Definition in file conf.c.
#define TO_NEXT_WORD | ( | s, | |||
e | ) |
Value:
do { \ while (*s != '\0' && !isblank(*s)) { \ s++; \ } \ if (*s != '\0') { \ *s = '\0'; \ s++; \ while (isblank(*s)) \ s++; \ } else { \ e = 1; \ } \ } while (0)
s | string to parse, this is the next_word pointer, the value of s when the macro is called is the current word, after the macro completes, s contains the beginning of the NEXT word, so you need to save s to something else before doing TO_NEXT_WORD | |
e | should be 0 when calling TO_NEXT_WORD(), it'll be changed to 1 if the end of the string is reached. |
Definition at line 373 of file conf.c.
Referenced by _parse_firewall_rule().
enum OpCodes |
static int _parse_firewall_rule | ( | char * | ruleset, | |
char * | leftover | |||
) | [static] |
< 0 == block, 1 == allow
< If 0, port contained non-numerics
< reached end of line
< First word
< port to open/block
< protocol to block, tcp/udp/icmp
< Netmask
< other key word
Definition at line 468 of file conf.c.
References debug, t_firewall_ruleset::name, t_firewall_rule::next, t_firewall_ruleset::next, t_firewall_ruleset::rules, s_config::rulesets, safe_malloc(), safe_strdup(), and TO_NEXT_WORD.
Referenced by parse_firewall_ruleset().
s_config* config_get_config | ( | void | ) |
Get the current gateway configuration.
Accessor for the current gateway configuration
Definition at line 145 of file conf.c.
Referenced by _connect_auth_server(), _debug(), authenticate_client(), fw_sync_with_authserver(), get_status_text(), http_callback_404(), http_callback_auth(), http_wifidog_header(), iptables_fw_init(), iptables_fw_set_authservers(), is_auth_online(), is_online(), parse_commandline(), ping(), thread_client_timeout_check(), thread_ping(), and wdctl_restart().
void config_init | ( | void | ) |
void config_init_override | ( | void | ) |
void config_read | ( | char * | filename | ) |
void config_validate | ( | void | ) |
t_auth_serv* get_auth_server | ( | void | ) |
Get the active auth server.
This function returns the current (first auth_server)
Definition at line 826 of file conf.c.
Referenced by auth_server_request(), authenticate_client(), http_callback_404(), http_callback_auth(), http_send_redirect_to_auth(), and ping().
t_firewall_rule* get_ruleset | ( | char * | ruleset | ) |
void mark_auth_server_bad | ( | t_auth_serv * | bad_server | ) |
Bump server to bottom of the list.
This function marks the current auth_server, if it matches the argument, as bad. Basically, the "bad" server becomes the last one on the list.
Definition at line 838 of file conf.c.
Referenced by _connect_auth_server().
pthread_mutex_t config_mutex = PTHREAD_MUTEX_INITIALIZER |