Main Page | Data Structures | Directories | File List | Data Fields

src/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 /* $Header: /cvsroot/wifidog/wifidog/src/conf.h,v 1.23 2004/11/22 21:45:57 alexcv Exp $ */
00027 #ifndef _CONFIG_H_
00028 #define _CONFIG_H_
00029 
00032 #define DEFAULT_CONFIGFILE "/etc/wifidog.conf"
00033 #define DEFAULT_DAEMON 1
00034 #define DEFAULT_DEBUGLEVEL LOG_INFO
00035 #define DEFAULT_HTTPDMAXCONN 10
00036 #define DEFAULT_GATEWAYID "default"
00037 #define DEFAULT_GATEWAYPORT 2060
00038 #define DEFAULT_HTTPDNAME "WiFiDog"
00039 #define DEFAULT_CLIENTTIMEOUT 5
00040 #define DEFAULT_CHECKINTERVAL 5
00041 #define DEFAULT_LOG_SYSLOG 0
00042 #define DEFAULT_SYSLOG_FACILITY LOG_DAEMON
00043 #define DEFAULT_WDCTL_SOCK "/tmp/wdctl.sock"
00044 #define DEFAULT_AUTHSERVPORT 80
00045 #define DEFAULT_AUTHSERVSSLPORT 443
00046 
00047 #define DEFAULT_AUTHSERVSSLAVAILABLE 0
00048 
00049 #define DEFAULT_AUTHSERVPATH "wifidog/"
00050 #define DEFAULT_AUTHSERVMAXTRIES 1
00051 
00056 typedef struct _auth_serv_t {
00057     char *authserv_hostname;    
00058     char *authserv_path;        
00059     int authserv_http_port;     
00061     int authserv_ssl_port;      
00063     int authserv_use_ssl;       
00064     char *last_ip;      
00065     struct _auth_serv_t *next;
00066 } t_auth_serv;
00067 
00071 typedef struct _firewall_rule_t {
00072     int block_allow;            
00073     char *protocol;             
00074     char *port;                 
00075     char *mask;                 
00076     struct _firewall_rule_t *next;
00077 } t_firewall_rule;
00078 
00082 typedef struct _firewall_ruleset_t {
00083     char                        *name;
00084     t_firewall_rule             *rules;
00085     struct _firewall_ruleset_t  *next;
00086 } t_firewall_ruleset;
00087 
00091 typedef struct {
00092     char configfile[255];       
00093     char *wdctl_sock;           
00094     int daemon;                 
00095     int debuglevel;             
00096     char *external_interface;   
00098     char *gw_id;                
00100     char *gw_interface;         
00101     char *gw_address;           
00103     int gw_port;                
00105     int authserv_maxtries;      
00107     t_auth_serv *auth_servers;  
00108     char *httpdname;            
00110     int httpdmaxconn;           
00112     int clienttimeout;          
00114     int checkinterval;          
00116     int log_syslog;             
00117     int syslog_facility;        
00119     t_firewall_ruleset  *rulesets;      
00120 } s_config;
00121 
00123 s_config *config_get_config(void);
00124 
00126 void config_init(void);
00127 
00129 void config_init_override(void);
00130 
00132 void config_read(char *filename);
00133 
00135 void config_validate(void);
00136 
00138 t_auth_serv *get_auth_server(void);
00139 
00141 void mark_auth_server_bad(t_auth_serv *);
00142 
00144 t_firewall_rule *get_ruleset(char *);
00145 
00146 #define LOCK_CONFIG() do { \
00147         debug(LOG_DEBUG, "Locking config"); \
00148         pthread_mutex_lock(&config_mutex); \
00149         debug(LOG_DEBUG, "Config locked"); \
00150 } while (0)
00151 
00152 #define UNLOCK_CONFIG() do { \
00153         debug(LOG_DEBUG, "Unlocking config"); \
00154         pthread_mutex_unlock(&config_mutex); \
00155         debug(LOG_DEBUG, "Config unlocked"); \
00156 } while (0)
00157 
00158 #endif /* _CONFIG_H_ */

Generated on Sun Apr 3 20:04:45 2005 for WifiDog by  doxygen 1.4.1