conf.h

00001 /********************************************************************\
00002  * This program is free software; you can redistribute it and/or    *
00003  * modify it under the terms of the GNU General Public License as   *
00004  * published by the Free Software Foundation; either version 2 of   *
00005  * the License, or (at your option) any later version.              *
00006  *                                                                  *
00007  * This program is distributed in the hope that it will be useful,  *
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00010  * GNU General Public License for more details.                     *
00011  *                                                                  *
00012  * You should have received a copy of the GNU General Public License*
00013  * along with this program; if not, contact:                        *
00014  *                                                                  *
00015  * Free Software Foundation           Voice:  +1-617-542-5942       *
00016  * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
00017  * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
00018  *                                                                  *
00019 \********************************************************************/
00020 
00021 /* $Id: conf.h 1241 2007-06-24 04:13:13Z benoitg $ */
00027 #ifndef _CONFIG_H_
00028 #define _CONFIG_H_
00029 
00034 #define NUM_EXT_INTERFACE_DETECT_RETRY 120
00035 
00037 #define EXT_INTERFACE_DETECT_RETRY_INTERVAL 1
00038 
00040 #ifndef SYSCONFDIR
00041         #define DEFAULT_CONFIGFILE "/etc/wifidog.conf"
00042 #else
00043         #define DEFAULT_CONFIGFILE SYSCONFDIR"/wifidog.conf"
00044 #endif  
00045 #define DEFAULT_DAEMON 1
00046 #define DEFAULT_DEBUGLEVEL LOG_INFO
00047 #define DEFAULT_HTTPDMAXCONN 10
00048 #define DEFAULT_GATEWAYID NULL
00049 #define DEFAULT_GATEWAYPORT 2060
00050 #define DEFAULT_HTTPDNAME "WiFiDog"
00051 #define DEFAULT_CLIENTTIMEOUT 5
00052 #define DEFAULT_CHECKINTERVAL 60
00053 #define DEFAULT_LOG_SYSLOG 0
00054 #define DEFAULT_SYSLOG_FACILITY LOG_DAEMON
00055 #define DEFAULT_WDCTL_SOCK "/tmp/wdctl.sock"
00056 #define DEFAULT_INTERNAL_SOCK "/tmp/wifidog.sock"
00057 #define DEFAULT_AUTHSERVPORT 80
00058 #define DEFAULT_AUTHSERVSSLPORT 443
00059 
00060 #define DEFAULT_AUTHSERVSSLAVAILABLE 0
00061 
00062 #define DEFAULT_AUTHSERVPATH "/wifidog/"
00063 
00068 typedef struct _auth_serv_t {
00069     char *authserv_hostname;    
00070     char *authserv_path;        
00071     int authserv_http_port;     
00073     int authserv_ssl_port;      
00075     int authserv_use_ssl;       
00076     char *last_ip;      
00077     struct _auth_serv_t *next;
00078 } t_auth_serv;
00079 
00083 typedef struct _firewall_rule_t {
00084     int block_allow;            
00085     char *protocol;             
00086     char *port;                 
00087     char *mask;                 
00088     struct _firewall_rule_t *next;
00089 } t_firewall_rule;
00090 
00094 typedef struct _firewall_ruleset_t {
00095     char                        *name;
00096     t_firewall_rule             *rules;
00097     struct _firewall_ruleset_t  *next;
00098 } t_firewall_ruleset;
00099 
00103 typedef struct _trusted_mac_t {
00104     char   *mac;
00105     struct _trusted_mac_t *next;
00106 } t_trusted_mac;
00107 
00111 typedef struct {
00112     char configfile[255];       
00113     char *wdctl_sock;           
00114     char *internal_sock;                
00115     int daemon;                 
00116     int debuglevel;             
00117     char *external_interface;   
00119     char *gw_id;                
00121     char *gw_interface;         
00122     char *gw_address;           
00124     int gw_port;                
00126     t_auth_serv *auth_servers;  
00127     char *httpdname;            
00129     int httpdmaxconn;           
00131     int clienttimeout;          
00133     int checkinterval;          
00135     int log_syslog;             
00136     int syslog_facility;        
00138     t_firewall_ruleset  *rulesets;      
00139     t_trusted_mac *trustedmaclist; 
00140 } s_config;
00141 
00143 s_config *config_get_config(void);
00144 
00146 void config_init(void);
00147 
00149 void config_init_override(void);
00150 
00152 void config_read(char *filename);
00153 
00155 void config_validate(void);
00156 
00158 t_auth_serv *get_auth_server(void);
00159 
00161 void mark_auth_server_bad(t_auth_serv *);
00162 
00164 t_firewall_rule *get_ruleset(char *);
00165 
00166 static void config_notnull(void *parm, char *parmname);
00167 static int parse_boolean_value(char *);
00168 static void parse_auth_server(FILE *, char *, int *);
00169 static int _parse_firewall_rule(char *ruleset, char *leftover);
00170 static void parse_firewall_ruleset(char *, FILE *, char *, int *);
00171 void parse_trusted_mac_list(char *);
00172 
00173 #define LOCK_CONFIG() do { \
00174         debug(LOG_DEBUG, "Locking config"); \
00175         pthread_mutex_lock(&config_mutex); \
00176         debug(LOG_DEBUG, "Config locked"); \
00177 } while (0)
00178 
00179 #define UNLOCK_CONFIG() do { \
00180         debug(LOG_DEBUG, "Unlocking config"); \
00181         pthread_mutex_unlock(&config_mutex); \
00182         debug(LOG_DEBUG, "Config unlocked"); \
00183 } while (0)
00184 
00185 #endif /* _CONFIG_H_ */

Generated on Sun Jun 24 00:29:52 2007 for WifiDog by  doxygen 1.5.1