bgp_open.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* BGP open message handling
  2. Copyright (C) 1999 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_OPEN_H
  17. #define _QUAGGA_BGP_OPEN_H
  18. /* Standard header for capability TLV */
  19. struct capability_header
  20. {
  21. u_char code;
  22. u_char length;
  23. };
  24. /* Generic MP capability data */
  25. struct capability_mp_data
  26. {
  27. afi_t afi;
  28. u_char reserved;
  29. safi_t safi;
  30. };
  31. #pragma pack(1)
  32. struct capability_orf_entry
  33. {
  34. struct capability_mp_data mpc;
  35. u_char num;
  36. struct {
  37. u_char type;
  38. u_char mode;
  39. } orfs[];
  40. } __attribute__ ((packed));
  41. #pragma pack()
  42. struct capability_as4
  43. {
  44. uint32_t as4;
  45. };
  46. struct graceful_restart_af
  47. {
  48. afi_t afi;
  49. safi_t safi;
  50. u_char flag;
  51. };
  52. struct capability_gr
  53. {
  54. u_int16_t restart_flag_time;
  55. struct graceful_restart_af gr[];
  56. };
  57. /* Capability Code */
  58. #define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */
  59. #define CAPABILITY_CODE_REFRESH 2 /* Route Refresh Capability */
  60. #define CAPABILITY_CODE_ORF 3 /* Cooperative Route Filtering Capability */
  61. #define CAPABILITY_CODE_RESTART 64 /* Graceful Restart Capability */
  62. #define CAPABILITY_CODE_AS4 65 /* 4-octet AS number Capability */
  63. #define CAPABILITY_CODE_DYNAMIC 66 /* Dynamic Capability */
  64. #define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */
  65. #define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */
  66. /* Capability Length */
  67. #define CAPABILITY_CODE_MP_LEN 4
  68. #define CAPABILITY_CODE_REFRESH_LEN 0
  69. #define CAPABILITY_CODE_DYNAMIC_LEN 0
  70. #define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */
  71. #define CAPABILITY_CODE_AS4_LEN 4
  72. #define CAPABILITY_CODE_ORF_LEN 5
  73. /* Cooperative Route Filtering Capability. */
  74. /* ORF Type */
  75. #define ORF_TYPE_PREFIX 64
  76. #define ORF_TYPE_PREFIX_OLD 128
  77. /* ORF Mode */
  78. #define ORF_MODE_RECEIVE 1
  79. #define ORF_MODE_SEND 2
  80. #define ORF_MODE_BOTH 3
  81. /* Capability Message Action. */
  82. #define CAPABILITY_ACTION_SET 0
  83. #define CAPABILITY_ACTION_UNSET 1
  84. /* Graceful Restart */
  85. #define RESTART_R_BIT 0x8000
  86. #define RESTART_F_BIT 0x80
  87. extern int bgp_open_option_parse (struct peer *, u_char, int *);
  88. extern void bgp_open_capability (struct stream *, struct peer *);
  89. extern void bgp_capability_vty_out (struct vty *, struct peer *);
  90. extern as_t peek_for_as4_capability (struct peer *, u_char);
  91. extern int bgp_afi_safi_valid_indices (afi_t, safi_t *);
  92. #endif /* _QUAGGA_BGP_OPEN_H */