The Netsukuku Project
0.0.9
An Alternative routing method
Main Page
Data Structures
Files
File List
Globals
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
*/
44
enum
config_options
45
{
46
CONF_NTK_INT_MAP_FILE
,
47
CONF_NTK_BNODE_MAP_FILE
,
48
CONF_NTK_EXT_MAP_FILE
,
49
50
CONF_ANDNA_HNAMES_FILE
,
51
CONF_SNSD_NODES_FILE
,
52
CONF_ANDNA_CACHE_FILE
,
53
CONF_ANDNA_LCLKEY_FILE
,
54
CONF_ANDNA_LCL_FILE
,
55
CONF_ANDNA_RHC_FILE
,
56
CONF_ANDNA_COUNTER_C_FILE
,
57
58
CONF_NTK_PID_FILE
,
59
CONF_NTK_MAX_CONNECTIONS
,
60
CONF_NTK_MAX_ACCEPTS_PER_HOST
,
61
CONF_NTK_MAX_ACCEPTS_PER_HOST_TIME
,
62
63
CONF_DISABLE_ANDNA
,
64
CONF_DISABLE_RESOLVCONF
,
65
66
CONF_NTK_RESTRICTED_MODE
,
67
CONF_NTK_RESTRICTED_CLASS
,
68
CONF_NTK_INTERNET_CONNECTION
,
69
CONF_NTK_INTERNET_GW
,
70
CONF_NTK_INTERNET_UPLOAD
,
71
CONF_NTK_INTERNET_DOWNLOAD
,
72
CONF_NTK_INTERNET_PING_HOSTS
,
73
CONF_SHARE_INTERNET
,
74
CONF_SHAPE_INTERNET
,
75
CONF_USE_SHARED_INET
,
76
CONF_NTK_IP_MASQ_SCRIPT
,
77
CONF_NTK_TC_SHAPER_SCRIPT
,
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*/
CONF_SNSD_NODES_FILE
Definition:
conf.h:51
config_str
static const char config_str[][30]
Definition:
conf.h:80
CONF_NTK_INTERNET_UPLOAD
Definition:
conf.h:70
CONF_SHARE_INTERNET
Definition:
conf.h:73
CONF_DISABLE_ANDNA
Definition:
conf.h:63
CONF_SHAPE_INTERNET
Definition:
conf.h:74
CONF_NTK_PID_FILE
Definition:
conf.h:58
CONF_NTK_RESTRICTED_MODE
Definition:
conf.h:66
CONF_NTK_INTERNET_GW
Definition:
conf.h:69
CONF_NTK_RESTRICTED_CLASS
Definition:
conf.h:67
CONF_NTK_INT_MAP_FILE
Definition:
conf.h:46
load_config_file
int load_config_file(char *file)
Definition:
conf.c:86
CONF_NTK_BNODE_MAP_FILE
Definition:
conf.h:47
CONF_USE_SHARED_INET
Definition:
conf.h:75
CONF_ANDNA_RHC_FILE
Definition:
conf.h:55
CONF_ANDNA_COUNTER_C_FILE
Definition:
conf.h:56
CONF_NTK_MAX_ACCEPTS_PER_HOST_TIME
Definition:
conf.h:61
CONF_ANDNA_LCLKEY_FILE
Definition:
conf.h:53
CONF_ANDNA_LCL_FILE
Definition:
conf.h:54
config_options
config_options
Definition:
conf.h:44
CONF_NTK_INTERNET_DOWNLOAD
Definition:
conf.h:71
CONF_ANDNA_HNAMES_FILE
Definition:
conf.h:50
CONF_NTK_INTERNET_CONNECTION
Definition:
conf.h:68
CONF_NTK_INTERNET_PING_HOSTS
Definition:
conf.h:72
CONF_DISABLE_RESOLVCONF
Definition:
conf.h:64
CONF_NTK_MAX_ACCEPTS_PER_HOST
Definition:
conf.h:60
CONF_ANDNA_CACHE_FILE
Definition:
conf.h:52
CONF_NTK_TC_SHAPER_SCRIPT
Definition:
conf.h:77
CONF_NTK_IP_MASQ_SCRIPT
Definition:
conf.h:76
clear_config_env
void clear_config_env(void)
Definition:
conf.c:35
CONF_NTK_EXT_MAP_FILE
Definition:
conf.h:48
CONF_NTK_MAX_CONNECTIONS
Definition:
conf.h:59
src
conf.h
Generated on Wed Feb 19 2014 14:19:07 for The Netsukuku Project by
1.8.6