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 | |
| 21 | /* MP Capability information. */ |
| 22 | struct capability_mp |
| 23 | { |
| 24 | u_int16_t afi; |
| 25 | u_char reserved; |
| 26 | u_char safi; |
| 27 | }; |
| 28 | |
| 29 | /* BGP open message capability. */ |
| 30 | struct capability |
| 31 | { |
| 32 | u_char code; |
| 33 | u_char length; |
| 34 | struct capability_mp mpc; |
| 35 | }; |
| 36 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 37 | struct graceful_restart_af |
| 38 | { |
| 39 | u_int16_t afi; |
| 40 | u_char safi; |
| 41 | u_char flag; |
| 42 | }; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 43 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 44 | /* Capability Code */ |
| 45 | #define CAPABILITY_CODE_MP 1 /* Multiprotocol Extensions */ |
| 46 | #define CAPABILITY_CODE_REFRESH 2 /* Route Refresh Capability */ |
| 47 | #define CAPABILITY_CODE_ORF 3 /* Cooperative Route Filtering Capability */ |
| 48 | #define CAPABILITY_CODE_RESTART 64 /* Graceful Restart Capability */ |
| 49 | #define CAPABILITY_CODE_4BYTE_AS 65 /* 4-octet AS number Capability */ |
| 50 | #define CAPABILITY_CODE_DYNAMIC 66 /* Dynamic Capability */ |
| 51 | #define CAPABILITY_CODE_REFRESH_OLD 128 /* Route Refresh Capability(cisco) */ |
| 52 | #define CAPABILITY_CODE_ORF_OLD 130 /* Cooperative Route Filtering Capability(cisco) */ |
| 53 | |
| 54 | /* Capability Length */ |
| 55 | #define CAPABILITY_CODE_MP_LEN 4 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 56 | #define CAPABILITY_CODE_REFRESH_LEN 0 |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 57 | #define CAPABILITY_CODE_DYNAMIC_LEN 0 |
| 58 | #define CAPABILITY_CODE_RESTART_LEN 2 /* Receiving only case */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 59 | |
| 60 | /* Cooperative Route Filtering Capability. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 61 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 62 | /* ORF Type */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 63 | #define ORF_TYPE_PREFIX 64 |
| 64 | #define ORF_TYPE_PREFIX_OLD 128 |
| 65 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 66 | /* ORF Mode */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 67 | #define ORF_MODE_RECEIVE 1 |
| 68 | #define ORF_MODE_SEND 2 |
| 69 | #define ORF_MODE_BOTH 3 |
| 70 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 71 | /* Capability Message Action. */ |
| 72 | #define CAPABILITY_ACTION_SET 0 |
| 73 | #define CAPABILITY_ACTION_UNSET 1 |
| 74 | |
hasso | 538621f | 2004-05-21 09:31:30 +0000 | [diff] [blame] | 75 | /* Graceful Restart */ |
| 76 | #define RESTART_R_BIT 0x8000 |
| 77 | #define RESTART_F_BIT 0x80 |
| 78 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 79 | int bgp_open_option_parse (struct peer *, u_char, int *); |
| 80 | void bgp_open_capability (struct stream *, struct peer *); |
| 81 | void bgp_capability_vty_out (struct vty *, struct peer *); |