1 /* BGP open message handling
2 Copyright (C) 1999 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 #ifndef _QUAGGA_BGP_OPEN_H
22 #define _QUAGGA_BGP_OPEN_H
24 /* Standard header for capability TLV */
25 struct capability_header
31 /* Generic MP capability data */
32 struct capability_mp_data
40 struct capability_orf_entry
42 struct capability_mp_data mpc
;
48 } __attribute__ ((packed
));
56 struct graceful_restart_af
65 u_int16_t restart_flag_time
;
66 struct graceful_restart_af gr
[];
70 #define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */
71 #define CAPABILITY_CODE_REFRESH 2 /* Route Refresh Capability */
72 #define CAPABILITY_CODE_ORF 3 /* Cooperative Route Filtering Capability */
73 #define CAPABILITY_CODE_RESTART 64 /* Graceful Restart Capability */
74 #define CAPABILITY_CODE_AS4 65 /* 4-octet AS number Capability */
75 #define CAPABILITY_CODE_DYNAMIC_OLD 66 /* Dynamic Capability, deprecated since 2003 */
76 #define CAPABILITY_CODE_DYNAMIC 67 /* Dynamic Capability */
77 #define CAPABILITY_CODE_ADDPATH 69 /* Addpath Capability */
78 #define CAPABILITY_CODE_FQDN 73 /* Advertise hostname capabilty */
79 #define CAPABILITY_CODE_ENHE 5 /* Extended Next Hop Encoding */
80 #define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */
81 #define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */
84 /* Capability Length */
85 #define CAPABILITY_CODE_MP_LEN 4
86 #define CAPABILITY_CODE_REFRESH_LEN 0
87 #define CAPABILITY_CODE_DYNAMIC_LEN 0
88 #define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */
89 #define CAPABILITY_CODE_AS4_LEN 4
90 #define CAPABILITY_CODE_ADDPATH_LEN 4
91 #define CAPABILITY_CODE_ENHE_LEN 6 /* NRLI AFI = 2, SAFI = 2, Nexthop AFI = 2 */
92 #define CAPABILITY_CODE_MIN_FQDN_LEN 2
93 #define CAPABILITY_CODE_ORF_LEN 5
95 /* Cooperative Route Filtering Capability. */
98 #define ORF_TYPE_PREFIX 64
99 #define ORF_TYPE_PREFIX_OLD 128
102 #define ORF_MODE_RECEIVE 1
103 #define ORF_MODE_SEND 2
104 #define ORF_MODE_BOTH 3
106 /* Capability Message Action. */
107 #define CAPABILITY_ACTION_SET 0
108 #define CAPABILITY_ACTION_UNSET 1
110 /* Graceful Restart */
111 #define RESTART_R_BIT 0x8000
112 #define RESTART_F_BIT 0x80
114 extern int bgp_open_option_parse (struct peer
*, u_char
, int *);
115 extern void bgp_open_capability (struct stream
*, struct peer
*);
116 extern void bgp_capability_vty_out (struct vty
*, struct peer
*, u_char
, json_object
*);
117 extern as_t
peek_for_as4_capability (struct peer
*, u_char
);
119 #endif /* _QUAGGA_BGP_OPEN_H */