]>
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 | ||
31 | #if ENABLE_BGP_VNC | |
32 | #define RD_TYPE_VNC_ETH 0xff00 /* VNC L2VPN */ | |
33 | #endif | |
34 | ||
35 | #define RD_ADDRSTRLEN 28 | |
36 | ||
d62a17ae | 37 | struct rd_as { |
d7c0a89a | 38 | uint16_t type; |
d62a17ae | 39 | as_t as; |
d7c0a89a | 40 | uint32_t val; |
8557760c | 41 | }; |
42 | ||
d62a17ae | 43 | struct rd_ip { |
d7c0a89a | 44 | uint16_t type; |
d62a17ae | 45 | struct in_addr ip; |
d7c0a89a | 46 | uint16_t val; |
8557760c | 47 | }; |
48 | ||
49 | #if ENABLE_BGP_VNC | |
d62a17ae | 50 | struct rd_vnc_eth { |
d7c0a89a | 51 | uint16_t type; |
d62a17ae | 52 | uint8_t local_nve_id; |
53 | struct ethaddr macaddr; | |
8557760c | 54 | }; |
55 | #endif | |
56 | ||
d7c0a89a QY |
57 | extern uint16_t decode_rd_type(uint8_t *pnt); |
58 | extern void encode_rd_type(uint16_t, uint8_t *); | |
8557760c | 59 | |
d7c0a89a QY |
60 | extern void decode_rd_as(uint8_t *pnt, struct rd_as *rd_as); |
61 | extern void decode_rd_as4(uint8_t *pnt, struct rd_as *rd_as); | |
62 | extern void decode_rd_ip(uint8_t *pnt, struct rd_ip *rd_ip); | |
8557760c | 63 | #if ENABLE_BGP_VNC |
d7c0a89a | 64 | extern void decode_rd_vnc_eth(uint8_t *pnt, struct rd_vnc_eth *rd_vnc_eth); |
8557760c | 65 | #endif |
66 | ||
d62a17ae | 67 | extern int str2prefix_rd(const char *, struct prefix_rd *); |
68 | extern char *prefix_rd2str(struct prefix_rd *, char *, size_t); | |
92708db6 | 69 | extern void form_auto_rd(struct in_addr router_id, uint16_t rd_id, |
70 | struct prefix_rd *prd); | |
8557760c | 71 | |
72 | #endif /* _QUAGGA_BGP_RD_H */ |