conf.h

Go to the documentation of this file.
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 1305 2007-11-01 20:04:20Z benoitg $ */
00027 #ifndef _CONFIG_H_
00028 #define _CONFIG_H_
00029 
00034 #define NUM_EXT_INTERFACE_DETECT_RETRY 0
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 #define DEFAULT_AUTHSERVLOGINPATHFRAGMENT "login/?"
00064 #define DEFAULT_AUTHSERVPORTALPATHFRAGMENT "portal/?"
00065 #define DEFAULT_AUTHSERVMSGPATHFRAGMENT "gw_message.php?"
00066 #define DEFAULT_AUTHSERVPINGPATHFRAGMENT "ping/?"
00067 #define DEFAULT_AUTHSERVAUTHPATHFRAGMENT "auth/?"
00068 
00073 typedef struct _auth_serv_t {
00074     char *authserv_hostname;    
00075     char *authserv_path;        
00076     char *authserv_login_script_path_fragment;  
00077     char *authserv_portal_script_path_fragment; 
00078     char *authserv_msg_script_path_fragment;    
00079     char *authserv_ping_script_path_fragment;   
00080     char *authserv_auth_script_path_fragment;   
00081     int authserv_http_port;     
00083     int authserv_ssl_port;      
00085     int authserv_use_ssl;       
00086     char *last_ip;      
00087     struct _auth_serv_t *next;
00088 } t_auth_serv;
00089 
00093 typedef struct _firewall_rule_t {
00094     int block_allow;            
00095     char *protocol;             
00096     char *port;                 
00097     char *mask;                 
00098     struct _firewall_rule_t *next;
00099 } t_firewall_rule;
00100 
00104 typedef struct _firewall_ruleset_t {
00105     char                        *name;
00106     t_firewall_rule             *rules;
00107     struct _firewall_ruleset_t  *next;
00108 } t_firewall_ruleset;
00109 
00113 typedef struct _trusted_mac_t {
00114     char   *mac;
00115     struct _trusted_mac_t *next;
00116 } t_trusted_mac;
00117 
00121 typedef struct {
00122     char configfile[255];       
00123     char *wdctl_sock;           
00124     char *internal_sock;                
00125     int daemon;                 
00126     int debuglevel;             
00127     char *external_interface;   
00129     char *gw_id;                
00131     char *gw_interface;         
00132     char *gw_address;           
00134     int gw_port;                
00136     t_auth_serv *auth_servers;  
00137     char *httpdname;            
00139     int httpdmaxconn;           
00141     int clienttimeout;          
00143     int checkinterval;          
00145     int log_syslog;             
00146     int syslog_facility;        
00148     t_firewall_ruleset  *rulesets;      
00149     t_trusted_mac *trustedmaclist; 
00150 } s_config;
00151 
00153 s_config *config_get_config(void);
00154 
00156 void config_init(void);
00157 
00159 void config_init_override(void);
00160 
00162 void config_read(char *filename);
00163 
00165 void config_validate(void);
00166 
00168 t_auth_serv *get_auth_server(void);
00169 
00171 void mark_auth_server_bad(t_auth_serv *);
00172 
00174 t_firewall_rule *get_ruleset(char *);
00175 
00176 void parse_trusted_mac_list(char *);
00177 
00178 #define LOCK_CONFIG() do { \
00179         debug(LOG_DEBUG, "Locking config"); \
00180         pthread_mutex_lock(&config_mutex); \
00181         debug(LOG_DEBUG, "Config locked"); \
00182 } while (0)
00183 
00184 #define UNLOCK_CONFIG() do { \
00185         debug(LOG_DEBUG, "Unlocking config"); \
00186         pthread_mutex_unlock(&config_mutex); \
00187         debug(LOG_DEBUG, "Config unlocked"); \
00188 } while (0)
00189 
00190 #endif /* _CONFIG_H_ */

Generated on Sun Apr 13 21:55:00 2008 for WifiDog by  doxygen 1.5.3