The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
netsukuku.h
Go to the documentation of this file.
1 /* This file is part of Netsukuku
2  * (c) Copyright 2004 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 NETSUKUKU_H
20 #define NETSUKUKU_H
21 
22 #include "config.h"
23 #include "igs.h"
24 
25 #define VERSION_STR "NetsukukuD "PACKAGE_VERSION
26 
27 #ifdef DEBUG
28 #undef VERSION_STR
29 #define VERSION_STR "NetsukukuD "PACKAGE_VERSION" (debug)"
30 #endif
31 
32 /*
33  * current_globals
34  *
35  * Here there are the main globals variables used among the code.
36  */
38 {
39  /*
40  * Internal map
41  */
42  map_node *int_map; /*Internal Map*/
43 
44  /*
45  * External map
46  */
47  map_gnode **ext_map; /*External Map. */
49 
50  /*
51  * Border nodes maps.(bmap.h)
52  */
54  u_int *bmap_nodes; /* bnode counter for each map*/
55  u_int *bmap_nodes_closed; /* number of closed bnodes */
56  u_int *bmap_nodes_opened; /* " " opened " */
57 
58  /*
59  * Myself
60  */
63 
64  /*
65  * external rnode cache list. (see gmap.h)
66  */
69 
70  /*
71  * Current Qspn id and qspn time
72  */
73  int *cur_qspn_id; /*The current qspn_id we are processing.
74  It is cur_qspn_id[levels] big*/
75  struct timeval *cur_qspn_time; /*When the last qspn round was received/sent
76  (gettimeofday format)*/
77  /*
78  * Internet gateways
79  */
82  inet_gw **my_igws; /* my_igws[level] points to our inet gateway
83  present at igws[level]. It's the same of using
84  igw_find_node(igws, me.cur_quadg.gnode[_EL(level)]); */
85  u_char my_bandwidth; /* The bandwidth of the Internet connection
86  we are sharing*/
87  u_char inet_connected; /* If it is 1, we are connected to the Internet */
88 
89  /*
90  * Network interfaces
91  */
92  interface cur_ifs[MAX_INTERFACES];
93  int cur_ifs_n; /* number of interfaces present
94  in `cur_ifs' */
95 
96  time_t uptime; /*The time when we finished the hooking,
97  to get the the actual uptime just do:
98  time(0)-me.uptime*/
99 }me;
100 
101 #define NTK_TCP_PORT 269
102 #define NTK_UDP_RADAR_PORT 269
103 
104 #define ANDNA_UDP_PORT 277
105 #define ANDNA_TCP_PORT 277
106 
107 const static u_short ntk_udp_radar_port = NTK_UDP_RADAR_PORT,
109 const static u_short andna_udp_port = ANDNA_UDP_PORT,
111 
112 #define NTK_CONFIG_FILE CONF_DIR "/netsukuku.conf"
113 #define NTK_PID_FILE PID_DIR "/ntkd.pid"
114 
115 
116 #define INT_MAP_FILE DATA_DIR "/ntk_internal_map"
117 #define EXT_MAP_FILE DATA_DIR "/ntk_external_map"
118 #define BNODE_MAP_FILE DATA_DIR "/ntk_bnode_map"
119 
120 #define ANDNA_HNAMES_FILE CONF_DIR "/andna_hostnames"
121 #define SNSD_NODES_FILE CONF_DIR "/snsd_nodes"
122 #define ANDNA_CACHE_FILE DATA_DIR "/andna_cache"
123 #define LCLKEY_FILE DATA_DIR "/andna_lcl_keyring"
124 #define LCL_FILE DATA_DIR "/andna_lcl_cache"
125 #define RHC_FILE DATA_DIR "/andna_rh_cache"
126 #define COUNTER_C_FILE DATA_DIR "/andna_counter_cache"
127 
128 #define IPMASQ_SCRIPT_FILE CONF_DIR "/ip_masquerade.sh"
129 #define TCSHAPER_SCRIPT_FILE CONF_DIR "/tc_shaper.sh"
130 
131 /*
132  * ServOpt
133  *
134  * Options
135  */
136 typedef struct
137 {
138  char *config_file;
139  char *pid_file;
140 
141  int family;
142 
143  char *ifs[MAX_INTERFACES];
144  int ifs_n; /* number of interfaces present in `ifs' */
145 
149 
153  char *lclkey_file;
154  char *lcl_file;
155  char *rhc_file;
157 
158  char daemon;
159 
162  char inet_connection;/* If it's 1, we are connected
163  to the Internet */
168  char *inet_gw_dev;
169  char **inet_hosts; /* Hosts to be pinged in order to check
170  if the internet connection is up */
174 
175  /* The bandwidths of the Internet connection we are sharing.
176  * If we are just leeching they are all 0. */
179 
182 
186 
187  char dbg_lvl;
188 }ServOpt;
190 
192 
193 #endif /*NETSUKUKU_H*/
map_bnode ** bnode_map
Definition: netsukuku.h:53
u_int * bmap_nodes_closed
Definition: netsukuku.h:55
int max_accepts_per_host
Definition: netsukuku.h:184
quadro_group cur_quadg
Definition: netsukuku.h:48
Definition: netsukuku.h:136
char * rhc_file
Definition: netsukuku.h:155
char * ext_map_file
Definition: netsukuku.h:147
char * lcl_file
Definition: netsukuku.h:154
char * pid_file
Definition: netsukuku.h:139
map_node * cur_node
Definition: netsukuku.h:62
int max_accepts_per_host_time
Definition: netsukuku.h:185
char * inet_gw_dev
Definition: netsukuku.h:168
static const u_short andna_udp_port
Definition: netsukuku.h:109
ServOpt server_opt
Definition: netsukuku.h:189
char * ip_masq_script
Definition: netsukuku.h:172
int restricted_class
Definition: netsukuku.h:161
int * cur_qspn_id
Definition: netsukuku.h:73
int max_connections
Definition: netsukuku.h:183
int inet_hosts_counter
Definition: netsukuku.h:171
time_t sigalrm_timestamp
Definition: netsukuku.h:191
Definition: map.h:125
int family
Definition: netsukuku.h:141
char use_shared_inet
Definition: netsukuku.h:166
char daemon
Definition: netsukuku.h:158
char restricted
Definition: netsukuku.h:160
Definition: inet.h:73
Definition: gmap.h:127
char * bnode_map_file
Definition: netsukuku.h:148
u_int my_dnload_bw
Definition: netsukuku.h:178
char * andna_cache_file
Definition: netsukuku.h:152
struct current_globals me
time_t uptime
Definition: netsukuku.h:96
inet_prefix cur_ip
Definition: netsukuku.h:61
char * config_file
Definition: netsukuku.h:138
#define MAX_INTERFACES
Definition: if.h:25
char disable_andna
Definition: netsukuku.h:180
time_t sighup_timestamp
Definition: netsukuku.h:191
static const u_short ntk_udp_radar_port
Definition: netsukuku.h:107
#define ANDNA_TCP_PORT
Definition: netsukuku.h:105
u_int * bmap_nodes
Definition: netsukuku.h:54
map_gnode ** ext_map
Definition: netsukuku.h:47
ext_rnode_cache * cur_erc
Definition: netsukuku.h:67
Definition: gmap.h:197
#define NTK_TCP_PORT
Definition: netsukuku.h:101
u_int cur_erc_counter
Definition: netsukuku.h:68
u_int * bmap_nodes_opened
Definition: netsukuku.h:56
int * igws_counter
Definition: netsukuku.h:81
inet_prefix inet_gw
Definition: netsukuku.h:167
char share_internet
Definition: netsukuku.h:164
struct timeval * cur_qspn_time
Definition: netsukuku.h:75
static const u_short ntk_tcp_port
Definition: netsukuku.h:108
inet_gw ** igws
Definition: netsukuku.h:80
map_node * int_map
Definition: netsukuku.h:42
char * andna_hnames_file
Definition: netsukuku.h:150
char * lclkey_file
Definition: netsukuku.h:153
u_int my_upload_bw
Definition: netsukuku.h:177
time_t sigterm_timestamp
Definition: netsukuku.h:191
char inet_connection
Definition: netsukuku.h:162
int cur_ifs_n
Definition: netsukuku.h:93
#define ANDNA_UDP_PORT
Definition: netsukuku.h:104
inet_gw ** my_igws
Definition: netsukuku.h:82
int ifs_n
Definition: netsukuku.h:144
static const u_short andna_tcp_port
Definition: netsukuku.h:110
Definition: netsukuku.h:37
char shape_internet
Definition: netsukuku.h:165
char * counter_c_file
Definition: netsukuku.h:156
char * int_map_file
Definition: netsukuku.h:146
u_char inet_connected
Definition: netsukuku.h:87
char ** inet_hosts
Definition: netsukuku.h:169
#define NTK_UDP_RADAR_PORT
Definition: netsukuku.h:102
u_char my_bandwidth
Definition: netsukuku.h:85
char disable_resolvconf
Definition: netsukuku.h:181
char dbg_lvl
Definition: netsukuku.h:187
Definition: gmap.h:37
char * tc_shaper_script
Definition: netsukuku.h:173
char * snsd_nodes_file
Definition: netsukuku.h:151
Definition: igs.h:87