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

wifidog-1.1.3_beta2/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 /* $Id: conf.h 935 2006-01-31 22:22:04 -0500 (Tue, 31 Jan 2006) benoitg $ */
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 NULL
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_INTERNAL_SOCK "/tmp/wifidog.sock"
00045 #define DEFAULT_AUTHSERVPORT 80
00046 #define DEFAULT_AUTHSERVSSLPORT 443
00047 
00048 #define DEFAULT_AUTHSERVSSLAVAILABLE 0
00049 
00050 #define DEFAULT_AUTHSERVPATH "/wifidog/"
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 _trusted_mac_t {
00092     char   *mac;
00093     struct _trusted_mac_t *next;
00094 } t_trusted_mac;
00095 
00099 typedef struct {
00100     char configfile[255];       
00101     char *wdctl_sock;           
00102     char *internal_sock;                
00103     int daemon;                 
00104     int debuglevel;             
00105     char *external_interface;   
00107     char *gw_id;                
00109     char *gw_interface;         
00110     char *gw_address;           
00112     int gw_port;                
00114     t_auth_serv *auth_servers;  
00115     char *httpdname;            
00117     int httpdmaxconn;           
00119     int clienttimeout;          
00121     int checkinterval;          
00123     int log_syslog;             
00124     int syslog_facility;        
00126     t_firewall_ruleset  *rulesets;      
00127     t_trusted_mac *trustedmaclist; 
00128 } s_config;
00129 
00131 s_config *config_get_config(void);
00132 
00134 void config_init(void);
00135 
00137 void config_init_override(void);
00138 
00140 void config_read(char *filename);
00141 
00143 void config_validate(void);
00144 
00146 t_auth_serv *get_auth_server(void);
00147 
00149 void mark_auth_server_bad(t_auth_serv *);
00150 
00152 t_firewall_rule *get_ruleset(char *);
00153 
00154 static void config_notnull(void *parm, char *parmname);
00155 static int parse_boolean_value(char *);
00156 static void parse_auth_server(FILE *, char *, int *);
00157 static int _parse_firewall_rule(char *ruleset, char *leftover);
00158 static void parse_firewall_ruleset(char *, FILE *, char *, int *);
00159 void parse_trusted_mac_list(char *);
00160 
00161 #define LOCK_CONFIG() do { \
00162         debug(LOG_DEBUG, "Locking config"); \
00163         pthread_mutex_lock(&config_mutex); \
00164         debug(LOG_DEBUG, "Config locked"); \
00165 } while (0)
00166 
00167 #define UNLOCK_CONFIG() do { \
00168         debug(LOG_DEBUG, "Unlocking config"); \
00169         pthread_mutex_unlock(&config_mutex); \
00170         debug(LOG_DEBUG, "Config unlocked"); \
00171 } while (0)
00172 
00173 #endif /* _CONFIG_H_ */

Generated on Tue Jan 31 23:13:16 2006 for WifiDog by  doxygen 1.4.4