]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_mplsvpn.h
lib: add vty_outln()
[mirror_frr.git] / bgpd / bgp_mplsvpn.h
CommitLineData
718e3744 1/* MPLS-VPN
896014f4
DL
2 * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
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 along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
718e3744 20
00d252cb 21#ifndef _QUAGGA_BGP_MPLSVPN_H
22#define _QUAGGA_BGP_MPLSVPN_H
23
4f280b15
LB
24#include "bgpd/bgp_route.h"
25
718e3744 26#define RD_TYPE_AS 0
27#define RD_TYPE_IP 1
fe770c88 28#define RD_TYPE_AS4 2
65efcfce
LB
29#if ENABLE_BGP_VNC
30#define RD_TYPE_VNC_ETH 0xff00 /* VNC L2VPN */
31#endif
718e3744 32
33#define RD_ADDRSTRLEN 28
34
5ff06872
LB
35#ifdef MPLS_LABEL_MAX
36# undef MPLS_LABEL_MAX
37#endif
38
65efcfce
LB
39typedef enum {
40 MPLS_LABEL_IPV4_EXPLICIT_NULL = 0, /* [RFC3032] */
41 MPLS_LABEL_ROUTER_ALERT = 1, /* [RFC3032] */
42 MPLS_LABEL_IPV6_EXPLICIT_NULL = 2, /* [RFC3032] */
43 MPLS_LABEL_IMPLICIT_NULL = 3, /* [RFC3032] */
44 MPLS_LABEL_UNASSIGNED4 = 4,
45 MPLS_LABEL_UNASSIGNED5 = 5,
46 MPLS_LABEL_UNASSIGNED6 = 6,
47 MPLS_LABEL_ELI = 7, /* Entropy Indicator [RFC6790] */
48 MPLS_LABEL_UNASSIGNED8 = 8,
49 MPLS_LABEL_UNASSIGNED9 = 9,
50 MPLS_LABEL_UNASSIGNED10 = 10,
51 MPLS_LABEL_UNASSIGNED11 = 11,
52 MPLS_LABEL_GAL = 13, /* [RFC5586] */
53 MPLS_LABEL_OAM_ALERT = 14, /* [RFC3429] */
5ff06872
LB
54 MPLS_LABEL_EXTENSION = 15, /* [RFC7274] */
55 MPLS_LABEL_MAX = 1048575,
56 MPLS_LABEL_ILLEGAL = 0xFFFFFFFF /* for internal use only */
65efcfce
LB
57} mpls_special_label_t;
58
59#define MPLS_LABEL_IS_SPECIAL(label) \
60 ((label) <= MPLS_LABEL_EXTENSION)
61#define MPLS_LABEL_IS_NULL(label) \
62 ((label) == MPLS_LABEL_IPV4_EXPLICIT_NULL || \
63 (label) == MPLS_LABEL_IPV6_EXPLICIT_NULL || \
64 (label) == MPLS_LABEL_IMPLICIT_NULL)
65
d6902373 66#define BGP_VPNVX_HELP_STR \
4f280b15
LB
67 "Address Family\n" \
68 "Address Family\n"
d6902373 69
718e3744 70struct rd_as
71{
72 u_int16_t type;
73 as_t as;
74 u_int32_t val;
75};
76
77struct rd_ip
78{
79 u_int16_t type;
80 struct in_addr ip;
81 u_int16_t val;
82};
83
65efcfce
LB
84#if ENABLE_BGP_VNC
85struct rd_vnc_eth
86{
87 u_int16_t type;
88 uint8_t local_nve_id;
89 struct ethaddr macaddr;
90};
91#endif
92
1a39c60a 93extern u_int16_t decode_rd_type (u_char *);
65efcfce 94extern void encode_rd_type (u_int16_t, u_char *);
94f2b392 95extern void bgp_mplsvpn_init (void);
945c8fe9 96extern int bgp_nlri_parse_vpn (struct peer *, struct attr *, struct bgp_nlri *);
94f2b392 97extern u_int32_t decode_label (u_char *);
1a39c60a
LB
98extern void encode_label(u_int32_t, u_char *);
99extern void decode_rd_as (u_char *, struct rd_as *);
100extern void decode_rd_as4 (u_char *, struct rd_as *);
101extern void decode_rd_ip (u_char *, struct rd_ip *);
65efcfce 102#if ENABLE_BGP_VNC
784d3a42
PG
103extern void
104decode_rd_vnc_eth (u_char *pnt, struct rd_vnc_eth *rd_vnc_eth);
65efcfce 105#endif
94f2b392 106extern int str2prefix_rd (const char *, struct prefix_rd *);
94f2b392 107extern char *prefix_rd2str (struct prefix_rd *, char *, size_t);
00d252cb 108
d6902373
PG
109extern int
110argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, int *index, afi_t *afi);
c016b6c7
DS
111extern int bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
112 enum bgp_show_type type, void *output_arg, int tags, u_char use_json);
d6902373 113
00d252cb 114#endif /* _QUAGGA_BGP_MPLSVPN_H */