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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __MPLS_TUNNEL_H__
17 #define __MPLS_TUNNEL_H__
19 #include <vnet/mpls/mpls.h>
22 * @brief A uni-directional MPLS tunnel
24 typedef struct mpls_tunnel_t_
27 * @brief The tunnel hooks into the FIB control plane graph.
32 * @brief If the tunnel is an L2 tunnel, this is the link type ETHERNET
35 adj_index_t mt_l2_adj;
38 * @brief on a L2 tunnel this is the VLIB arc from the L2-tx to the l2-midchain
43 * @brief The path-list over which the tunnel's destination is reachable
45 fib_node_index_t mt_path_list;
48 * @brief sibling index on the path-list so notifications are received.
53 * @brief The Label stack to apply to egress packets
55 mpls_label_t *mt_label_stack;
58 * @brief Flag to indicate the tunnel is only for L2 traffic, that is
59 * this tunnel belongs in a bridge domain.
64 * @brief The HW interface index of the tunnel interfaces
69 * @brief The SW interface index of the tunnel interfaces
76 * @brief Create a new MPLS tunnel
78 extern void vnet_mpls_tunnel_add (fib_route_path_t *rpath,
79 mpls_label_t *label_stack,
83 extern void vnet_mpls_tunnel_del (u32 sw_if_index);
85 extern const mpls_tunnel_t *mpls_tunnel_get(u32 index);
88 * @brief Callback function invoked while walking MPLS tunnels
90 typedef void (*mpls_tunnel_walk_cb_t)(u32 index, void *ctx);
93 * @brief Walk all the MPLS tunnels
95 extern void mpls_tunnel_walk(mpls_tunnel_walk_cb_t cb,