The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
conf.h
Go to the documentation of this file.
1 /* This file is part of Netsukuku
2  * (c) Copyright 2005 Andrea Lo Pumo aka AlpT <alpt@freaknet.org>
3  *
4  * This source code is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * This source code is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * Please refer to the GNU Public License for more details.
13  *
14  * You should have received a copy of the GNU Public License along with
15  * this source code; if not, write to:
16  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 
19 #ifndef CONF_H
20 #define CONF_H
21 
22 #define CONF_MAX_LINES 500 /* Max number of option lines */
23 
24 #define CONF_GET_VALUE(opt) (getenv(config_str[(opt)]))
25 #define CONF_GET_INT_VALUE(opt, n) \
26 ({ \
27  char *_val; \
28  _val=CONF_GET_VALUE((opt)); \
29  if(_val) \
30  (n)=atoi(_val); \
31 })
32 #define CONF_GET_STRN_VALUE(opt, str, maxbytes) \
33 ({ \
34  char *_val; \
35  _val=CONF_GET_VALUE((opt)); \
36  if(_val) \
37  *(str)=xstrndup(_val, (maxbytes)); \
38 })
39 
40 
41 /*
42  * The allowed options in the configuration file
43  */
45 {
49 
57 
62 
65 
78 };
79 
80 const static char config_str[][30]=
81 {
82  { "ntk_int_map_file" },
83  { "ntk_bnode_map_file" },
84  { "ntk_ext_map_file" },
85 
86  { "andna_hnames_file" },
87  { "snsd_nodes_file" },
88  { "andna_cache_file" },
89  { "andna_lclkey_file" },
90  { "andna_lcl_file" },
91  { "andna_rhc_file" },
92  { "andna_counter_c_file" },
93 
94  { "pid_file" },
95  { "ntk_max_connections" },
96  { "ntk_max_accepts_per_host" },
97  { "max_accepts_per_host_time" },
98 
99  { "disable_andna" },
100  { "disable_resolvconf" },
101  { "ntk_restricted_mode" },
102  { "ntk_restricted_class" },
103  { "internet_connection" },
104  { "internet_gateway" },
105  { "internet_upload_rate" },
106  { "internet_download_rate" },
107  { "internet_ping_hosts" },
108  { "share_internet" },
109  { "shape_internet" },
110  { "use_shared_internet" },
111  { "ip_masquerade_script" },
112  { "tc_shaper_script" },
113  { 0 },
114 };
115 
116 
117 void clear_config_env(void);
118 int load_config_file(char *file);
119 
120 #endif /*CONF_H*/
Definition: conf.h:51
static const char config_str[][30]
Definition: conf.h:80
Definition: conf.h:70
Definition: conf.h:73
Definition: conf.h:63
Definition: conf.h:74
Definition: conf.h:58
Definition: conf.h:66
Definition: conf.h:69
Definition: conf.h:67
Definition: conf.h:46
int load_config_file(char *file)
Definition: conf.c:86
Definition: conf.h:47
Definition: conf.h:75
Definition: conf.h:55
Definition: conf.h:56
Definition: conf.h:53
Definition: conf.h:54
config_options
Definition: conf.h:44
Definition: conf.h:71
Definition: conf.h:50
Definition: conf.h:68
Definition: conf.h:72
Definition: conf.h:64
Definition: conf.h:60
Definition: conf.h:52
Definition: conf.h:77
Definition: conf.h:76
void clear_config_env(void)
Definition: conf.c:35
Definition: conf.h:48
Definition: conf.h:59