bgp_nexthop.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* BGP nexthop scan
  2. Copyright (C) 2000 Kunihiro Ishiguro
  3. This file is part of GNU Zebra.
  4. GNU Zebra is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by the
  6. Free Software Foundation; either version 2, or (at your option) any
  7. later version.
  8. GNU Zebra is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Zebra; see the file COPYING. If not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  15. 02111-1307, USA. */
  16. #ifndef _QUAGGA_BGP_NEXTHOP_H
  17. #define _QUAGGA_BGP_NEXTHOP_H
  18. #include "if.h"
  19. #include "queue.h"
  20. #include "prefix.h"
  21. #define BGP_SCAN_INTERVAL_DEFAULT 60
  22. #define BGP_IMPORT_INTERVAL_DEFAULT 15
  23. #define NEXTHOP_FAMILY(nexthop_len) ( \
  24. ((nexthop_len) == 4 || \
  25. (nexthop_len) == 12 ? AF_INET : \
  26. ((nexthop_len) == 16 || \
  27. (nexthop_len) == 24 || \
  28. (nexthop_len) == 48 ? AF_INET6 : \
  29. AF_UNSPEC)) \
  30. )
  31. /* BGP nexthop cache value structure. */
  32. struct bgp_nexthop_cache
  33. {
  34. /* This nexthop exists in IGP. */
  35. u_char valid;
  36. /* Nexthop is changed. */
  37. u_char changed;
  38. /* Nexthop is changed. */
  39. u_char metricchanged;
  40. /* IGP route's metric. */
  41. u_int32_t metric;
  42. /* Nexthop number and nexthop linked list.*/
  43. u_char nexthop_num;
  44. struct nexthop *nexthop;
  45. time_t last_update;
  46. u_int16_t flags;
  47. #define BGP_NEXTHOP_VALID (1 << 0)
  48. #define BGP_NEXTHOP_REGISTERED (1 << 1)
  49. u_int16_t change_flags;
  50. #define BGP_NEXTHOP_CHANGED (1 << 0)
  51. #define BGP_NEXTHOP_METRIC_CHANGED (1 << 1)
  52. struct bgp_node *node;
  53. LIST_HEAD(path_list, bgp_info) paths;
  54. unsigned int path_count;
  55. };
  56. extern void bgp_scan_init (void);
  57. extern void bgp_scan_finish (void);
  58. extern int bgp_nexthop_lookup (afi_t, struct peer *peer, struct bgp_info *,
  59. int *, int *);
  60. extern void bgp_connected_add (struct connected *c);
  61. extern void bgp_connected_delete (struct connected *c);
  62. extern int bgp_multiaccess_check_v4 (struct in_addr, char *);
  63. extern int bgp_config_write_scan_time (struct vty *);
  64. extern int bgp_nexthop_onlink (afi_t, struct attr *);
  65. extern int bgp_nexthop_self (struct attr *);
  66. extern void bgp_address_init (void);
  67. extern void bgp_address_destroy (void);
  68. extern void bgp_scan_destroy (void);
  69. extern struct bgp_nexthop_cache *bnc_new(void);
  70. extern void bnc_free(struct bgp_nexthop_cache *bnc);
  71. extern void bnc_nexthop_free(struct bgp_nexthop_cache *bnc);
  72. extern char *bnc_str(struct bgp_nexthop_cache *bnc, char *buf, int size);
  73. #endif /* _QUAGGA_BGP_NEXTHOP_H */