paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 |
| 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 |
| 19 | 02111-1307, USA. */ |
| 20 | |
paul | 00d252c | 2005-05-23 14:19:54 +0000 | [diff] [blame] | 21 | #ifndef _QUAGGA_BGP_OPEN_H |
| 22 | #define _QUAGGA_BGP_OPEN_H |
| 23 | |
Paul Jakma | 6d58272 | 2007-08-06 15:21:45 +0000 | [diff] [blame] | 24 | /* Standard header for capability TLV */ |
| 25 | struct capability_header |
| 26 | { |
| 27 | u_char code; |
| 28 | u_char length; |
| 29 | }; |
| 30 | |
| 31 | /* Generic MP capability data */ |
| 32 | struct capability_mp_data |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 33 | { |
Michael Lambert | 4c9641b | 2010-07-22 13:20:55 -0400 | [diff] [blame] | 34 | afi_t afi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 35 | u_char reserved; |
Michael Lambert | 4c9641b | 2010-07-22 13:20:55 -0400 | [diff] [blame] | 36 | safi_t safi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 37 | }; |
| 38 | |
Paul Jakma | 6d58272 | 2007-08-06 15:21:45 +0000 | [diff] [blame] | 39 | #pragma pack(1) |
| 40 | struct capability_orf_entry |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 41 | { |
Paul Jakma | 6d58272 | 2007-08-06 15:21:45 +0000 | [diff] [blame] | 42 | struct capability_mp_data mpc; |
| 43 | u_char num; |
| 44 | struct { |
| 45 | u_char type; |
| 46 | u_char mode; |
| 47 | } orfs[]; |
| 48 | } __attribute__ ((packed)); |
| 49 | #pragma pack() |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 50 | |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 51 | struct capability_as4 |
| 52 | { |
| 53 | uint32_t as4; |
| 54 | }; |
| 55 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 56 | struct graceful_restart_af |
| 57 | { |
Michael Lambert | 4c9641b | 2010-07-22 13:20:55 -0400 | [diff] [blame] | 58 | afi_t afi; |
| 59 | safi_t safi; |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 60 | u_char flag; |
| 61 | }; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 62 | |
Paul Jakma | 6d58272 | 2007-08-06 15:21:45 +0000 | [diff] [blame] | 63 | struct capability_gr |
| 64 | { |
| 65 | u_int16_t restart_flag_time; |
| 66 | struct graceful_restart_af gr[]; |
| 67 | }; |
| 68 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 69 | /* Capability Code */ |
| 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 */ |
Paul Jakma | 6d58272 | 2007-08-06 15:21:45 +0000 | [diff] [blame] | 74 | #define CAPABILITY_CODE_AS4 65 /* 4-octet AS number Capability */ |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 75 | #define CAPABILITY_CODE_DYNAMIC 66 /* Dynamic Capability */ |
| 76 | #define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */ |
| 77 | #define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */ |
| 78 | |
| 79 | /* Capability Length */ |
| 80 | #define CAPABILITY_CODE_MP_LEN 4 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 81 | #define CAPABILITY_CODE_REFRESH_LEN 0 |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 82 | #define CAPABILITY_CODE_DYNAMIC_LEN 0 |
| 83 | #define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */ |
Paul Jakma | 6d58272 | 2007-08-06 15:21:45 +0000 | [diff] [blame] | 84 | #define CAPABILITY_CODE_AS4_LEN 4 |
Donald Sharp | f3cfc46 | 2016-01-07 09:33:28 -0500 | [diff] [blame^] | 85 | #define CAPABILITY_CODE_ORF_LEN 5 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 86 | |
| 87 | /* Cooperative Route Filtering Capability. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 88 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 89 | /* ORF Type */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 90 | #define ORF_TYPE_PREFIX 64 |
| 91 | #define ORF_TYPE_PREFIX_OLD 128 |
| 92 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 93 | /* ORF Mode */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 94 | #define ORF_MODE_RECEIVE 1 |
| 95 | #define ORF_MODE_SEND 2 |
| 96 | #define ORF_MODE_BOTH 3 |
| 97 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 98 | /* Capability Message Action. */ |
| 99 | #define CAPABILITY_ACTION_SET 0 |
| 100 | #define CAPABILITY_ACTION_UNSET 1 |
| 101 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 102 | /* Graceful Restart */ |
| 103 | #define RESTART_R_BIT 0x8000 |
| 104 | #define RESTART_F_BIT 0x80 |
| 105 | |
paul | 94f2b39 | 2005-06-28 12:44:16 +0000 | [diff] [blame] | 106 | extern int bgp_open_option_parse (struct peer *, u_char, int *); |
| 107 | extern void bgp_open_capability (struct stream *, struct peer *); |
| 108 | extern void bgp_capability_vty_out (struct vty *, struct peer *); |
Paul Jakma | 0b2aa3a | 2007-10-14 22:32:21 +0000 | [diff] [blame] | 109 | extern as_t peek_for_as4_capability (struct peer *, u_char); |
Paul Jakma | 6d58272 | 2007-08-06 15:21:45 +0000 | [diff] [blame] | 110 | extern int bgp_afi_safi_valid_indices (afi_t, safi_t *); |
paul | 00d252c | 2005-05-23 14:19:54 +0000 | [diff] [blame] | 111 | |
| 112 | #endif /* _QUAGGA_BGP_OPEN_H */ |