FD.io VPP  v17.01.1-3-gc6833f8
Vector Packet Processing
mpls_tunnel.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __MPLS_TUNNEL_H__
17 #define __MPLS_TUNNEL_H__
18 
19 #include <vnet/mpls/mpls.h>
20 
21 /**
22  * @brief A uni-directional MPLS tunnel
23  */
24 typedef struct mpls_tunnel_t_
25 {
26  /**
27  * @brief The tunnel hooks into the FIB control plane graph.
28  */
30 
31  /**
32  * @brief If the tunnel is an L2 tunnel, this is the link type ETHERNET
33  * adjacency
34  */
36 
37  /**
38  * @brief on a L2 tunnel this is the VLIB arc from the L2-tx to the l2-midchain
39  */
41 
42  /**
43  * @brief The path-list over which the tunnel's destination is reachable
44  */
46 
47  /**
48  * @brief sibling index on the path-list so notifications are received.
49  */
51 
52  /**
53  * @brief The Label stack to apply to egress packets
54  */
56 
57  /**
58  * @brief Flag to indicate the tunnel is only for L2 traffic, that is
59  * this tunnel belongs in a bridge domain.
60  */
62 
63  /**
64  * @brief The HW interface index of the tunnel interfaces
65  */
67 
68  /**
69  * @brief The SW interface index of the tunnel interfaces
70  */
72 
74 
75 /**
76  * @brief Create a new MPLS tunnel
77  */
78 extern void vnet_mpls_tunnel_add (fib_route_path_t *rpath,
79  mpls_label_t *label_stack,
80  u8 l2_only,
81  u32 *sw_if_index);
82 
83 extern void vnet_mpls_tunnel_del (u32 sw_if_index);
84 
85 extern const mpls_tunnel_t *mpls_tunnel_get(u32 index);
86 
87 /**
88  * @brief Callback function invoked while walking MPLS tunnels
89  */
90 typedef void (*mpls_tunnel_walk_cb_t)(u32 index, void *ctx);
91 
92 /**
93  * @brief Walk all the MPLS tunnels
94  */
96  void *ctx);
97 
98 #endif
mpls_label_t * mt_label_stack
The Label stack to apply to egress packets.
Definition: mpls_tunnel.h:55
A representation of a path as described by a route producer.
Definition: fib_types.h:285
fib_node_index_t mt_path_list
The path-list over which the tunnel&#39;s destination is reachable.
Definition: mpls_tunnel.h:45
A uni-directional MPLS tunnel.
Definition: mpls_tunnel.h:24
u32 mpls_label_t
A label value only, i.e.
Definition: packet.h:24
const mpls_tunnel_t * mpls_tunnel_get(u32 index)
Definition: mpls_tunnel.c:410
fib_node_t mt_node
The tunnel hooks into the FIB control plane graph.
Definition: mpls_tunnel.h:29
u8 mt_l2_only
Flag to indicate the tunnel is only for L2 traffic, that is this tunnel belongs in a bridge domain...
Definition: mpls_tunnel.h:61
void(* mpls_tunnel_walk_cb_t)(u32 index, void *ctx)
Callback function invoked while walking MPLS tunnels.
Definition: mpls_tunnel.h:90
adj_index_t mt_l2_adj
If the tunnel is an L2 tunnel, this is the link type ETHERNET adjacency.
Definition: mpls_tunnel.h:35
u32 mt_l2_tx_arc
on a L2 tunnel this is the VLIB arc from the L2-tx to the l2-midchain
Definition: mpls_tunnel.h:40
void vnet_mpls_tunnel_del(u32 sw_if_index)
Definition: mpls_tunnel.c:431
u32 mt_sibling_index
sibling index on the path-list so notifications are received.
Definition: mpls_tunnel.h:50
An node in the FIB graph.
Definition: fib_node.h:273
struct mpls_tunnel_t_ mpls_tunnel_t
A uni-directional MPLS tunnel.
void mpls_tunnel_walk(mpls_tunnel_walk_cb_t cb, void *ctx)
Walk all the MPLS tunnels.
Definition: mpls_tunnel.c:419
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:28
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
unsigned int u32
Definition: types.h:88
u32 mt_hw_if_index
The HW interface index of the tunnel interfaces.
Definition: mpls_tunnel.h:66
unsigned char u8
Definition: types.h:56
u32 mt_sw_if_index
The SW interface index of the tunnel interfaces.
Definition: mpls_tunnel.h:71
void vnet_mpls_tunnel_add(fib_route_path_t *rpath, mpls_label_t *label_stack, u8 l2_only, u32 *sw_if_index)
Create a new MPLS tunnel.
Definition: mpls_tunnel.c:453