You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

route.h 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifndef ROUTE_H
  19. #define ROUTE_H
  20. #include "gmap.h"
  21. #include "bmap.h"
  22. #include "if.h"
  23. #define MAX_MULTIPATH_ROUTES 24 /* The maximum number of
  24. nexthops used to create a
  25. single multipath route. */
  26. /*
  27. * get_gw_gnode_recurse() uses this array to decide the number of forks per
  28. * level. The number of forks for the level `x' is located at
  29. * sub_gw_links[GET_LEVELS(my_family) - x - 1].
  30. * `x' must be < GET_LEVELS(my_family).
  31. * For example, at level 3, in ipv4, it will fork in 4 gateway gnodes, then,
  32. * descending in each gw gnodes (in the lower level) it will fork in other 3
  33. * gw gnodes. Continuing it will reach the level 1, and there it will choose 2
  34. * gw gnodes for each forked gw gnode of the higher level. The total number of
  35. * gateways choosen will be MAX_MULTIPATH_ROUTES, which is 4*3*2.
  36. * For the ipv6 it's the same thing, but from the level 11 there will be no
  37. * more forks.
  38. */
  39. const static int sub_gw_links[MAX_LEVELS] = { 4, 3, 2, 1, 1, 1, 1, 1,
  40. 1, 1, 1, 1, 1, 1, 1, 1
  41. };
  42. /* * * Functions declaration * * */
  43. void **get_gw_gnode(map_node *, map_gnode **, map_bnode **,
  44. u_int *, map_gnode *, u_char, u_char, int);
  45. int get_gw_ips(map_node *, map_gnode **, map_bnode **, u_int *,
  46. quadro_group *, map_gnode *, u_char, u_char,
  47. inet_prefix *, map_node **, int);
  48. struct nexthop *rt_build_nexthop_gw(map_node * node, map_gnode * gnode,
  49. int level, int maxhops);
  50. void rt_update_node(inet_prefix * dst_ip, void *dst_node,
  51. quadro_group * dst_quadg, void *void_gw, interface **,
  52. u_char level);
  53. void rt_rnodes_update(int check_update_flag);
  54. void rt_full_update(int check_update_flag);
  55. int rt_get_default_gw(inet_prefix * gw, char *dev_name);
  56. int rt_add_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table);
  57. int rt_del_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table);
  58. int rt_change_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table);
  59. int rt_replace_gw(char *dev, inet_prefix to, inet_prefix gw, u_char table);
  60. int rt_replace_def_gw(char *dev, inet_prefix gw, u_char table);
  61. int rt_delete_def_gw(u_char);
  62. int rt_del_loopback_net(void);
  63. int rt_append_subnet_src(inet_prefix * src, char *dev);
  64. #endif /*ROUTE_H */