root/trunk/wifidog/src/conf.h @ 178

Revision 178, 4.5 KB (checked in by alexcv, 9 years ago)

Added functions to handle the auth servers list.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/********************************************************************\
2 * This program is free software; you can redistribute it and/or    *
3 * modify it under the terms of the GNU General Public License as   *
4 * published by the Free Software Foundation; either version 2 of   *
5 * the License, or (at your option) any later version.              *
6 *                                                                  *
7 * This program is distributed in the hope that it will be useful,  *
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
10 * GNU General Public License for more details.                     *
11 *                                                                  *
12 * You should have received a copy of the GNU General Public License*
13 * along with this program; if not, contact:                        *
14 *                                                                  *
15 * Free Software Foundation           Voice:  +1-617-542-5942       *
16 * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
17 * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
18 *                                                                  *
19\********************************************************************/
20
21/* $Header$ */
22/** @file conf.h
23    @brief Config file parsing
24    @author Copyright (C) 2004 Philippe April <papril777@yahoo.com>
25*/
26
27#ifndef _CONFIG_H_
28#define _CONFIG_H_
29
30/*@{*/ 
31/** Defaults configuration values */
32#define DEFAULT_CONFIGFILE "/etc/wifidog.conf"
33#define DEFAULT_DAEMON 1
34#define DEFAULT_DEBUGLEVEL LOG_INFO
35#define DEFAULT_HTTPDMAXCONN 10
36#define DEFAULT_GATEWAYID "default"
37#define DEFAULT_GATEWAYPORT 2060
38#define DEFAULT_AUTHSERVPORT 80
39#define DEFAULT_HTTPDNAME "WiFiDog"
40#define DEFAULT_CLIENTTIMEOUT 5
41#define DEFAULT_CHECKINTERVAL 5
42#define DEFAULT_LOG_SYSLOG 0
43#define DEFAULT_SYSLOG_FACILITY LOG_DAEMON
44#define DEFAULT_WDCTL_SOCK "/tmp/wdctl.sock"
45#define DEFAULT_AUTHSERVPATH "/wifidog/auth"
46#define DEFAULT_AUTHSERVMAXTRIES 2
47/*@}*/ 
48
49typedef struct _auth_serv_t {
50    char *authserv_hostname;    /**< @brief Hostname of the central server */
51    int authserv_port;      /**< @brief Port the central server listens on */
52    struct _auth_serv_t *next;
53} t_auth_serv;
54
55/**
56 * Configuration structure
57 */
58typedef struct {
59    char configfile[255];       /**< @brief name of the config file */
60    char *wdctl_sock;           /**< @brief wdctl path to socket */
61    int daemon;                 /**< @brief if daemon > 0, use daemon mode */
62    int debuglevel;             /**< @brief Debug information verbosity */
63    char *external_interface;   /**< @brief External network interface name for
64                                     firewall rules */
65    char *gw_id;                /**< @brief ID of the Gateway, sent to central
66                                     server */
67    char *gw_interface;         /**< @brief Interface we will accept connections on */
68    char *gw_address;           /**< @brief Internal IP address for our web
69                                     server */
70    int gw_port;                /**< @brief Port the webserver will run on */
71   
72    int authserv_maxtries;      /**< @brief Maximum number of auth server connection attempts before abandoning */
73
74    t_auth_serv *auth_servers;  /**< @brief Auth servers list */
75   
76    char *authserv_path;        /**< @brief Path to the authentication script on
77                                     the central server */
78    char *authserv_loginurl;    /**< @brief Full URL to the login page */
79    char *httpdname;            /**< @brief Name the web server will return when
80                                     replying to a request */
81    int httpdmaxconn;           /**< @brief Used by libhttpd, not sure what it
82                                     does */
83    int clienttimeout;          /**< @brief How many CheckIntervals before a client
84                                     must be re-authenticated */
85    int checkinterval;          /**< @brief Frequency the the client timeout check
86                                     thread will run. */
87    int log_syslog;             /**< @brief boolean, wether to log to syslog */
88    int syslog_facility;        /**< @brief facility to use when using syslog for
89                                     logging */
90} s_config;
91
92/** @brief Get the current gateway configuration */
93s_config *
94config_get_config(void);
95
96/** @brief Initialise the conf system */
97void config_init(void);
98
99/** @brief Initialize the variables we override with the command line*/
100void config_init_override(void);
101
102/** @brief Reads the configuration file */
103void config_read(char *filename);
104
105/** @brief Check that the configuration is valid */
106void config_validate(void);
107
108/** @brief Get the active auth server */
109t_auth_serv *get_auth_server(void);
110
111/** @brief Bump server to bottom of the list */
112void mark_auth_server_bad(t_auth_serv *);
113
114#endif /* _CONFIG_H_ */
Note: See TracBrowser for help on using the browser.