]>
Commit | Line | Data |
---|---|---|
8557760c | 1 | /* BGP RD definitions for BGP-based VPNs (IP/EVPN) |
2 | * -- brought over from bgpd/bgp_mplsvpn.h | |
3 | * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> | |
4 | * | |
5 | * This file is part of FRR. | |
6 | * | |
7 | * FRR is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the | |
9 | * Free Software Foundation; either version 2, or (at your option) any | |
10 | * later version. | |
11 | * | |
12 | * FRR is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with FRR; see the file COPYING. If not, write to the Free | |
19 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
20 | * 02111-1307, USA. | |
21 | */ | |
22 | ||
23 | #ifndef _QUAGGA_BGP_RD_H | |
24 | #define _QUAGGA_BGP_RD_H | |
25 | ||
26 | /* RD types */ | |
27 | #define RD_TYPE_AS 0 | |
28 | #define RD_TYPE_IP 1 | |
29 | #define RD_TYPE_AS4 2 | |
30 | ||
49e5a4a0 | 31 | #ifdef ENABLE_BGP_VNC |
8557760c | 32 | #define RD_TYPE_VNC_ETH 0xff00 /* VNC L2VPN */ |
33 | #endif | |
34 | ||
35 | #define RD_ADDRSTRLEN 28 | |
c44ab6f1 | 36 | #define RD_BYTES 8 |
8557760c | 37 | |
d62a17ae | 38 | struct rd_as { |
d7c0a89a | 39 | uint16_t type; |
d62a17ae | 40 | as_t as; |
d7c0a89a | 41 | uint32_t val; |
8557760c | 42 | }; |
43 | ||
d62a17ae | 44 | struct rd_ip { |
d7c0a89a | 45 | uint16_t type; |
d62a17ae | 46 | struct in_addr ip; |
d7c0a89a | 47 | uint16_t val; |
8557760c | 48 | }; |
49 | ||
49e5a4a0 | 50 | #ifdef ENABLE_BGP_VNC |
d62a17ae | 51 | struct rd_vnc_eth { |
d7c0a89a | 52 | uint16_t type; |
d62a17ae | 53 | uint8_t local_nve_id; |
54 | struct ethaddr macaddr; | |
8557760c | 55 | }; |
56 | #endif | |
57 | ||
1be1693e | 58 | extern uint16_t decode_rd_type(const uint8_t *pnt); |
d7c0a89a | 59 | extern void encode_rd_type(uint16_t, uint8_t *); |
8557760c | 60 | |
1be1693e DS |
61 | extern void decode_rd_as(const uint8_t *pnt, struct rd_as *rd_as); |
62 | extern void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as); | |
5a1ae2c2 | 63 | extern void decode_rd_ip(const uint8_t *pnt, struct rd_ip *rd_ip); |
49e5a4a0 | 64 | #ifdef ENABLE_BGP_VNC |
5f040085 DS |
65 | extern void decode_rd_vnc_eth(const uint8_t *pnt, |
66 | struct rd_vnc_eth *rd_vnc_eth); | |
8557760c | 67 | #endif |
68 | ||
d62a17ae | 69 | extern int str2prefix_rd(const char *, struct prefix_rd *); |
5f040085 | 70 | extern char *prefix_rd2str(const struct prefix_rd *, char *, size_t); |
92708db6 | 71 | extern void form_auto_rd(struct in_addr router_id, uint16_t rd_id, |
72 | struct prefix_rd *prd); | |
8557760c | 73 | |
74 | #endif /* _QUAGGA_BGP_RD_H */ |