]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_rd.h
isisd: implement the 'lsp-generation' notification
[mirror_frr.git] / bgpd / bgp_rd.h
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
37 struct rd_as {
38 uint16_t type;
39 as_t as;
40 uint32_t val;
41 };
42
43 struct rd_ip {
44 uint16_t type;
45 struct in_addr ip;
46 uint16_t val;
47 };
48
49 #if ENABLE_BGP_VNC
50 struct rd_vnc_eth {
51 uint16_t type;
52 uint8_t local_nve_id;
53 struct ethaddr macaddr;
54 };
55 #endif
56
57 extern uint16_t decode_rd_type(uint8_t *pnt);
58 extern void encode_rd_type(uint16_t, uint8_t *);
59
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);
63 #if ENABLE_BGP_VNC
64 extern void decode_rd_vnc_eth(uint8_t *pnt, struct rd_vnc_eth *rd_vnc_eth);
65 #endif
66
67 extern int str2prefix_rd(const char *, struct prefix_rd *);
68 extern char *prefix_rd2str(struct prefix_rd *, char *, size_t);
69 extern void form_auto_rd(struct in_addr router_id, uint16_t rd_id,
70 struct prefix_rd *prd);
71
72 #endif /* _QUAGGA_BGP_RD_H */