The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
iptunnel.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 IPTUNNEL_H
20 #define IPTUNNEL_H
21 
22 #include "if.h"
23 
24 #define DEFAULT_TUNL_PREFIX "tunl"
25 #define DEFAULT_TUNL_NUMBER 0 /* The permanent tunl0 device */
26 #define DEFAULT_TUNL_IF "tunl0"
27 #define NTK_TUNL_PREFIX "ntk_tunl"
28 
29 /* Usage: printf(TUNL_STRING, TUNL_NUMBER("tunl", x)); */
30 #define TUNL_STRING "%s%d"
31 #define TUNL_N(prefix, x) prefix, x
32 
33 #define MAX_TUNNEL_IFS 24 /* it must be >= MAX_MULTIPATH_ROUTES,
34  since in igs.c we are using a tunnel
35  for each nexthop inet-gw */
36 
37 /*
38  * * Globals * *
39  */
40 
41 interface tunnel_ifs[MAX_TUNNEL_IFS];
42 
43 
44 /*
45  * Functions declaration
46  */
47 
48 
49 int tunnel_add(inet_prefix *remote, inet_prefix *local, char *dev,
50  char *tunl_prefix, int tunl_number);
51 int tunnel_change(inet_prefix *remote, inet_prefix *local, char *dev,
52  char *tunl_prefix, int tunl_number);
53 int tunnel_del(inet_prefix *remote, inet_prefix *local, char *dev,
54  char *tunl_prefix, int tunl_number);
55 
56 int tun_add_tunl(interface *ifs, char *tunl_prefix, u_char tunl_number);
57 int tun_del_tunl(interface *ifs, char *tunl_prefix, u_char tunl_number);
58 void init_tunnels_ifs(void);
59 int set_tunnel_ip(char *tunl_prefix, int tunl_number, inet_prefix *tunl_ip);
60 int first_free_tunnel_if(void);
61 int do_get(char *dev);
62 int add_tunnel_if(inet_prefix *remote, inet_prefix *local, char *dev,
63  char *tunl_prefix, int tunl_number, inet_prefix *tunl_ip);
64 int del_tunnel_if(inet_prefix *remote, inet_prefix *local, char *dev,
65  char *tunl_prefix, int tunl_number);
66 void del_all_tunnel_ifs(inet_prefix *remote, inet_prefix *local, char *dev,
67  char *tunl_prefix);
68 #endif /* IPTUNNEL_H */
int add_tunnel_if(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number, inet_prefix *tunl_ip)
Definition: iptunnel.c:368
#define MAX_TUNNEL_IFS
Definition: iptunnel.h:33
int tunnel_add(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number)
Definition: iptunnel.c:49
int tun_del_tunl(interface *ifs, char *tunl_prefix, u_char tunl_number)
Definition: iptunnel.c:307
Definition: inet.h:73
Definition: if.h:29
int set_tunnel_ip(char *tunl_prefix, int tunl_number, inet_prefix *tunl_ip)
Definition: iptunnel.c:349
int tunnel_del(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number)
Definition: iptunnel.c:63
void del_all_tunnel_ifs(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix)
Definition: iptunnel.c:437
int first_free_tunnel_if(void)
Definition: iptunnel.c:335
int do_get(char *dev)
Definition: iptunnel.c:235
int del_tunnel_if(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number)
Definition: iptunnel.c:418
int tun_add_tunl(interface *ifs, char *tunl_prefix, u_char tunl_number)
Definition: iptunnel.c:289
void init_tunnels_ifs(void)
Definition: iptunnel.c:325
int tunnel_change(inet_prefix *remote, inet_prefix *local, char *dev, char *tunl_prefix, int tunl_number)
Definition: iptunnel.c:56