The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
route.h
Go to the documentation of this file.
1 /* This file is part of Netsukuku system
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 ROUTE_H
20 #define ROUTE_H
21 
22 #include "gmap.h"
23 #include "bmap.h"
24 #include "if.h"
25 
26 #define MAX_MULTIPATH_ROUTES 24 /* The maximum number of
27  nexthops used to create a
28  single multipath route. */
29 
30 /*
31  * get_gw_gnode_recurse() uses this array to decide the number of forks per
32  * level. The number of forks for the level `x' is located at
33  * sub_gw_links[GET_LEVELS(my_family) - x - 1].
34  * `x' must be < GET_LEVELS(my_family).
35  * For example, at level 3, in ipv4, it will fork in 4 gateway gnodes, then,
36  * descending in each gw gnodes (in the lower level) it will fork in other 3
37  * gw gnodes. Continuing it will reach the level 1, and there it will choose 2
38  * gw gnodes for each forked gw gnode of the higher level. The total number of
39  * gateways choosen will be MAX_MULTIPATH_ROUTES, which is 4*3*2.
40  * For the ipv6 it's the same thing, but from the level 11 there will be no
41  * more forks.
42  */
43 const static int sub_gw_links[MAX_LEVELS] = { 4, 3, 2, 1, 1, 1, 1, 1,
44  1, 1, 1, 1, 1, 1, 1, 1 };
45 
46 /* * * Functions declaration * * */
47 void **get_gw_gnode(map_node *, map_gnode **, map_bnode **,
48  u_int *, map_gnode *, u_char, u_char, int);
49 int get_gw_ips(map_node *, map_gnode **, map_bnode **, u_int *,
50  quadro_group *, map_gnode *, u_char, u_char,
51  inet_prefix *, map_node **, int);
52 struct nexthop *rt_build_nexthop_gw(map_node *node, map_gnode *gnode, int level,
53  int maxhops);
54 void rt_update_node(inet_prefix *dst_ip, void *dst_node, quadro_group *dst_quadg,
55  void *void_gw, interface **, u_char level);
56 void rt_rnodes_update(int check_update_flag);
57 void rt_full_update(int check_update_flag);
58 
59 int rt_get_default_gw(inet_prefix *gw, char *dev_name);
60 int rt_add_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table);
61 int rt_del_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table);
62 int rt_change_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table);
63 int rt_replace_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table);
64 int rt_replace_def_gw(char *dev, inet_prefix gw, u_char table);
65 int rt_delete_def_gw(u_char);
66 
67 int rt_del_loopback_net(void);
68 int rt_append_subnet_src(inet_prefix *src, char *dev);
69 
70 #endif /*ROUTE_H*/
struct nexthop * rt_build_nexthop_gw(map_node *node, map_gnode *gnode, int level, int maxhops)
Definition: route.c:373
int rt_change_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table)
Definition: route.c:764
void ** get_gw_gnode(map_node *, map_gnode **, map_bnode **, u_int *, map_gnode *, u_char, u_char, int)
Definition: route.c:214
static const int sub_gw_links[(14+(1+1))]
Definition: route.h:43
int rt_add_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table)
Definition: route.c:754
int rt_replace_def_gw(char *dev, inet_prefix gw, u_char table)
Definition: route.c:774
Definition: map.h:125
#define MAX_LEVELS
Definition: gmap.h:107
Definition: inet.h:73
Definition: gmap.h:127
inet_prefix gw
Definition: krnl_route.h:28
int rt_del_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table)
Definition: route.c:759
void rt_rnodes_update(int check_update_flag)
Definition: route.c:626
Definition: if.h:29
void rt_update_node(inet_prefix *dst_ip, void *dst_node, quadro_group *dst_quadg, void *void_gw, interface **, u_char level)
Definition: route.c:506
int rt_replace_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table)
Definition: route.c:769
char * dev
Definition: krnl_route.h:29
int rt_del_loopback_net(void)
Definition: route.c:809
void rt_full_update(int check_update_flag)
Definition: route.c:680
int rt_delete_def_gw(u_char)
Definition: route.c:788
int rt_append_subnet_src(inet_prefix *src, char *dev)
Definition: route.c:853
int get_gw_ips(map_node *, map_gnode **, map_bnode **, u_int *, quadro_group *, map_gnode *, u_char, u_char, inet_prefix *, map_node **, int)
Definition: route.c:306
Definition: krnl_route.h:26
int rt_get_default_gw(inet_prefix *gw, char *dev_name)
Definition: route.c:724
Definition: gmap.h:37