]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_rd.h
*: auto-convert to SPDX License IDs
[mirror_frr.git] / bgpd / bgp_rd.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* BGP RD definitions for BGP-based VPNs (IP/EVPN)
3 * -- brought over from bgpd/bgp_mplsvpn.h
4 * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
5 */
6
7 #ifndef _QUAGGA_BGP_RD_H
8 #define _QUAGGA_BGP_RD_H
9
10 /* RD types */
11 #define RD_TYPE_AS 0
12 #define RD_TYPE_IP 1
13 #define RD_TYPE_AS4 2
14
15 #ifdef ENABLE_BGP_VNC
16 #define RD_TYPE_VNC_ETH 0xff00 /* VNC L2VPN */
17 #endif
18
19 #define RD_ADDRSTRLEN 28
20 #define RD_BYTES 8
21
22 struct rd_as {
23 uint16_t type;
24 as_t as;
25 uint32_t val;
26 };
27
28 struct rd_ip {
29 uint16_t type;
30 struct in_addr ip;
31 uint16_t val;
32 };
33
34 #ifdef ENABLE_BGP_VNC
35 struct rd_vnc_eth {
36 uint16_t type;
37 uint8_t local_nve_id;
38 struct ethaddr macaddr;
39 };
40 #endif
41
42 extern uint16_t decode_rd_type(const uint8_t *pnt);
43 extern void encode_rd_type(uint16_t, uint8_t *);
44
45 extern void decode_rd_as(const uint8_t *pnt, struct rd_as *rd_as);
46 extern void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as);
47 extern void decode_rd_ip(const uint8_t *pnt, struct rd_ip *rd_ip);
48 #ifdef ENABLE_BGP_VNC
49 extern void decode_rd_vnc_eth(const uint8_t *pnt,
50 struct rd_vnc_eth *rd_vnc_eth);
51 #endif
52
53 extern int str2prefix_rd(const char *, struct prefix_rd *);
54 extern char *prefix_rd2str(const struct prefix_rd *, char *, size_t);
55 extern void form_auto_rd(struct in_addr router_id, uint16_t rd_id,
56 struct prefix_rd *prd);
57
58 #endif /* _QUAGGA_BGP_RD_H */