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

Revision 213, 4.9 KB (checked in by benoitg, 9 years ago)

2004-08-30 Benoit Gr�goire <bock@…>

  • README.openwrt: Documentation update
  • Makefile.am: Make a ipkg target to ease WRT54G installation
  • ipkg/rules: Add wdctl and the init.d script.
  • Add BUILDROOT variable to the build system so we can use it when needed
  • src/ping_thread.c: Have the server ping immediately on boot. Note that this will only help if the second server responds. The logic of the ping itself should be changed so it iterates in the list until it finds one that responds or exausts the list
  • wifidog.conf: Add more doc, and (most) of ISF's default config in comments.
  • Bump version in anticipation for release
  • 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_HTTPDNAME "WiFiDog"
39#define DEFAULT_CLIENTTIMEOUT 5
40#define DEFAULT_CHECKINTERVAL 5
41#define DEFAULT_LOG_SYSLOG 0
42#define DEFAULT_SYSLOG_FACILITY LOG_DAEMON
43#define DEFAULT_WDCTL_SOCK "/tmp/wdctl.sock"
44#define DEFAULT_AUTHSERVPORT 80
45#define DEFAULT_AUTHSERVSSLPORT 443
46/** Note that DEFAULT_AUTHSERVSSLAVAILABLE must be 0 or 1, even if the config file syntax is yes or no */
47#define DEFAULT_AUTHSERVSSLAVAILABLE 0
48/** Note:  The path must NOT be prefixed by /, and must be suffixed /.  Leave empty for the server root.*/
49#define DEFAULT_AUTHSERVPATH "wifidog/"
50#define DEFAULT_AUTHSERVMAXTRIES 1
51
52/*@}*/ 
53
54/**
55 * Information about the authentication server
56 */
57typedef struct _auth_serv_t {
58    char *authserv_hostname;    /**< @brief Hostname of the central server */
59    char *authserv_path;        /**< @brief Path where wifidog resides */
60    int authserv_http_port;     /**< @brief Http port the central server
61                                     listens on */
62    int authserv_ssl_port;      /**< @brief Https port the central server
63                                     listens on */
64    int authserv_use_ssl;       /**< @brief Use SSL or not */
65    struct _auth_serv_t *next;
66} t_auth_serv;
67
68/**
69 * Configuration structure
70 */
71typedef struct {
72    char configfile[255];       /**< @brief name of the config file */
73    char *wdctl_sock;           /**< @brief wdctl path to socket */
74    int daemon;                 /**< @brief if daemon > 0, use daemon mode */
75    int debuglevel;             /**< @brief Debug information verbosity */
76    char *external_interface;   /**< @brief External network interface name for
77                                     firewall rules */
78    char *gw_id;                /**< @brief ID of the Gateway, sent to central
79                                     server */
80    char *gw_interface;         /**< @brief Interface we will accept connections on */
81    char *gw_address;           /**< @brief Internal IP address for our web
82                                     server */
83    int gw_port;                /**< @brief Port the webserver will run on */
84   
85    int authserv_maxtries;      /**< @brief Maximum number of auth server
86                                     connection attempts before abandoning */
87    t_auth_serv *auth_servers;  /**< @brief Auth servers list */
88    char *httpdname;            /**< @brief Name the web server will return when
89                                     replying to a request */
90    int httpdmaxconn;           /**< @brief Used by libhttpd, not sure what it
91                                     does */
92    int clienttimeout;          /**< @brief How many CheckIntervals before a client
93                                     must be re-authenticated */
94    int checkinterval;          /**< @brief Frequency the the client timeout check
95                                     thread will run. */
96    int log_syslog;             /**< @brief boolean, wether to log to syslog */
97    int syslog_facility;        /**< @brief facility to use when using syslog for
98                                     logging */
99} s_config;
100
101/** @brief Get the current gateway configuration */
102s_config *config_get_config(void);
103
104/** @brief Initialise the conf system */
105void config_init(void);
106
107/** @brief Initialize the variables we override with the command line*/
108void config_init_override(void);
109
110/** @brief Reads the configuration file */
111void config_read(char *filename);
112
113/** @brief Check that the configuration is valid */
114void config_validate(void);
115
116/** @brief Get the active auth server */
117t_auth_serv *get_auth_server(void);
118
119/** @brief Bump server to bottom of the list */
120void mark_auth_server_bad(t_auth_serv *);
121
122#endif /* _CONFIG_H_ */
Note: See TracBrowser for help on using the browser.