]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_open.h
zebra, bgpd, ospfd: 'redistribute table' to 'redistribute table <table-id>'
[mirror_frr.git] / bgpd / bgp_open.h
CommitLineData
718e3744 1/* BGP open message handling
2 Copyright (C) 1999 Kunihiro Ishiguro
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
00d252cb 21#ifndef _QUAGGA_BGP_OPEN_H
22#define _QUAGGA_BGP_OPEN_H
23
b05a1c8b
DS
24#include <json/json.h>
25
6d58272b
PJ
26/* Standard header for capability TLV */
27struct capability_header
28{
29 u_char code;
30 u_char length;
31};
32
33/* Generic MP capability data */
34struct capability_mp_data
718e3744 35{
4c9641ba 36 afi_t afi;
718e3744 37 u_char reserved;
4c9641ba 38 safi_t safi;
718e3744 39};
40
6d58272b
PJ
41#pragma pack(1)
42struct capability_orf_entry
718e3744 43{
6d58272b
PJ
44 struct capability_mp_data mpc;
45 u_char num;
46 struct {
47 u_char type;
48 u_char mode;
49 } orfs[];
50} __attribute__ ((packed));
51#pragma pack()
718e3744 52
0b2aa3a0
PJ
53struct capability_as4
54{
55 uint32_t as4;
56};
57
538621f2 58struct graceful_restart_af
59{
4c9641ba
ML
60 afi_t afi;
61 safi_t safi;
538621f2 62 u_char flag;
63};
64
6d58272b
PJ
65struct capability_gr
66{
67 u_int16_t restart_flag_time;
68 struct graceful_restart_af gr[];
69};
70
538621f2 71/* Capability Code */
72#define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */
73#define CAPABILITY_CODE_REFRESH 2 /* Route Refresh Capability */
74#define CAPABILITY_CODE_ORF 3 /* Cooperative Route Filtering Capability */
75#define CAPABILITY_CODE_RESTART 64 /* Graceful Restart Capability */
6d58272b 76#define CAPABILITY_CODE_AS4 65 /* 4-octet AS number Capability */
89eeecb8
DS
77#define CAPABILITY_CODE_DYNAMIC_OLD 66 /* Dynamic Capability, deprecated since 2003 */
78#define CAPABILITY_CODE_DYNAMIC 67 /* Dynamic Capability */
a82478b9 79#define CAPABILITY_CODE_ADDPATH 69 /* Addpath Capability */
538621f2 80#define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */
81#define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */
6410e93a 82#define CAPABILITY_CODE_HOSTNAME 131 /* Advertise hostname capabilty */
718e3744 83
538621f2 84/* Capability Length */
85#define CAPABILITY_CODE_MP_LEN 4
718e3744 86#define CAPABILITY_CODE_REFRESH_LEN 0
538621f2 87#define CAPABILITY_CODE_DYNAMIC_LEN 0
88#define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */
6d58272b 89#define CAPABILITY_CODE_AS4_LEN 4
a82478b9 90#define CAPABILITY_CODE_ADDPATH_LEN 4
6410e93a 91#define CAPABILITY_CODE_MIN_HOSTNAME_LEN 2
718e3744 92
93/* Cooperative Route Filtering Capability. */
718e3744 94
538621f2 95/* ORF Type */
718e3744 96#define ORF_TYPE_PREFIX 64
97#define ORF_TYPE_PREFIX_OLD 128
98
538621f2 99/* ORF Mode */
718e3744 100#define ORF_MODE_RECEIVE 1
101#define ORF_MODE_SEND 2
102#define ORF_MODE_BOTH 3
103
718e3744 104/* Capability Message Action. */
105#define CAPABILITY_ACTION_SET 0
106#define CAPABILITY_ACTION_UNSET 1
107
538621f2 108/* Graceful Restart */
109#define RESTART_R_BIT 0x8000
110#define RESTART_F_BIT 0x80
111
94f2b392 112extern int bgp_open_option_parse (struct peer *, u_char, int *);
113extern void bgp_open_capability (struct stream *, struct peer *);
114extern void bgp_capability_vty_out (struct vty *, struct peer *);
0b2aa3a0 115extern as_t peek_for_as4_capability (struct peer *, u_char);
6d58272b 116extern int bgp_afi_safi_valid_indices (afi_t, safi_t *);
00d252cb 117
118#endif /* _QUAGGA_BGP_OPEN_H */