]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_open.h
cbd32116b4a40e714fe716f066826fcd0fda3e9e
[mirror_frr.git] / bgpd / bgp_open.h
1 /* BGP open message handling
2 * Copyright (C) 1999 Kunihiro Ishiguro
3 *
4 * This file is part of GNU Zebra.
5 *
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
9 * later version.
10 *
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.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef _QUAGGA_BGP_OPEN_H
22 #define _QUAGGA_BGP_OPEN_H
23
24 /* Standard header for capability TLV */
25 struct capability_header {
26 u_char code;
27 u_char length;
28 };
29
30 /* Generic MP capability data */
31 struct capability_mp_data {
32 iana_afi_t afi;
33 u_char reserved;
34 safi_t safi;
35 };
36
37 struct capability_as4 {
38 uint32_t as4;
39 };
40
41 struct graceful_restart_af {
42 afi_t afi;
43 safi_t safi;
44 u_char flag;
45 };
46
47 struct capability_gr {
48 u_int16_t restart_flag_time;
49 struct graceful_restart_af gr[];
50 };
51
52 /* Capability Code */
53 #define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */
54 #define CAPABILITY_CODE_REFRESH 2 /* Route Refresh Capability */
55 #define CAPABILITY_CODE_ORF 3 /* Cooperative Route Filtering Capability */
56 #define CAPABILITY_CODE_RESTART 64 /* Graceful Restart Capability */
57 #define CAPABILITY_CODE_AS4 65 /* 4-octet AS number Capability */
58 #define CAPABILITY_CODE_DYNAMIC_OLD 66 /* Dynamic Capability, deprecated since 2003 */
59 #define CAPABILITY_CODE_DYNAMIC 67 /* Dynamic Capability */
60 #define CAPABILITY_CODE_ADDPATH 69 /* Addpath Capability */
61 #define CAPABILITY_CODE_FQDN 73 /* Advertise hostname capabilty */
62 #define CAPABILITY_CODE_ENHE 5 /* Extended Next Hop Encoding */
63 #define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */
64 #define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */
65
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_ADDPATH_LEN 4
73 #define CAPABILITY_CODE_ENHE_LEN 6 /* NRLI AFI = 2, SAFI = 2, Nexthop AFI = 2 */
74 #define CAPABILITY_CODE_MIN_FQDN_LEN 2
75 #define CAPABILITY_CODE_ORF_LEN 5
76
77 /* Cooperative Route Filtering Capability. */
78
79 /* ORF Type */
80 #define ORF_TYPE_PREFIX 64
81 #define ORF_TYPE_PREFIX_OLD 128
82
83 /* ORF Mode */
84 #define ORF_MODE_RECEIVE 1
85 #define ORF_MODE_SEND 2
86 #define ORF_MODE_BOTH 3
87
88 /* Capability Message Action. */
89 #define CAPABILITY_ACTION_SET 0
90 #define CAPABILITY_ACTION_UNSET 1
91
92 /* Graceful Restart */
93 #define RESTART_R_BIT 0x8000
94 #define RESTART_F_BIT 0x80
95
96 extern int bgp_open_option_parse(struct peer *, u_char, int *);
97 extern void bgp_open_capability(struct stream *, struct peer *);
98 extern void bgp_capability_vty_out(struct vty *, struct peer *, u_char,
99 json_object *);
100 extern as_t peek_for_as4_capability(struct peer *, u_char);
101
102 #endif /* _QUAGGA_BGP_OPEN_H */