bgp_nexthop.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 NEXTHOP_FAMILY(nexthop_len) ( \
  22. ((nexthop_len) == 4 || \
  23. (nexthop_len) == 12 ? AF_INET : \
  24. ((nexthop_len) == 16 || \
  25. (nexthop_len) == 24 || \
  26. (nexthop_len) == 48 ? AF_INET6 : \
  27. AF_UNSPEC)) \
  28. )
  29. /* BGP nexthop cache value structure. */
  30. struct bgp_nexthop_cache
  31. {
  32. /* IGP route's metric. */
  33. u_int32_t metric;
  34. /* Nexthop number and nexthop linked list.*/
  35. u_char nexthop_num;
  36. struct nexthop *nexthop;
  37. time_t last_update;
  38. u_int16_t flags;
  39. #define BGP_NEXTHOP_VALID (1 << 0)
  40. #define BGP_NEXTHOP_REGISTERED (1 << 1)
  41. #define BGP_NEXTHOP_CONNECTED (1 << 2)
  42. #define BGP_NEXTHOP_PEER_NOTIFIED (1 << 3)
  43. u_int16_t change_flags;
  44. #define BGP_NEXTHOP_CHANGED (1 << 0)
  45. #define BGP_NEXTHOP_METRIC_CHANGED (1 << 1)
  46. #define BGP_NEXTHOP_CONNECTED_CHANGED (1 << 2)
  47. struct bgp_node *node;
  48. void *nht_info; /* In BGP, peer session */
  49. LIST_HEAD(path_list, bgp_info) paths;
  50. unsigned int path_count;
  51. };
  52. extern int bgp_nexthop_lookup (afi_t, struct peer *peer, struct bgp_info *,
  53. int *, int *);
  54. extern void bgp_connected_add (struct connected *c);
  55. extern void bgp_connected_delete (struct connected *c);
  56. extern int bgp_multiaccess_check_v4 (struct in_addr, struct peer *);
  57. extern int bgp_config_write_scan_time (struct vty *);
  58. extern int bgp_nexthop_onlink (afi_t, struct attr *);
  59. extern int bgp_nexthop_self (struct attr *);
  60. extern void bgp_address_init (void);
  61. extern void bgp_address_destroy (void);
  62. extern void bgp_scan_destroy (void);
  63. extern struct bgp_nexthop_cache *bnc_new(void);
  64. extern void bnc_free(struct bgp_nexthop_cache *bnc);
  65. extern void bnc_nexthop_free(struct bgp_nexthop_cache *bnc);
  66. extern char *bnc_str(struct bgp_nexthop_cache *bnc, char *buf, int size);
  67. extern void bgp_scan_init (void);
  68. extern void bgp_scan_vty_init (void);
  69. #endif /* _QUAGGA_BGP_NEXTHOP_H */