FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
mpls.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 #ifndef included_vnet_mpls_h
16 #define included_vnet_mpls_h
17 
18 #include <vnet/vnet.h>
19 #include <vnet/mpls/packet.h>
20 #include <vnet/mpls/mpls_types.h>
21 #include <vnet/ip/ip4_packet.h>
22 #include <vnet/ethernet/ethernet.h>
23 #include <vnet/fib/fib_node.h>
24 #include <vnet/adj/adj.h>
25 
26 typedef enum
27 {
28 #define mpls_error(n,s) MPLS_ERROR_##n,
29 #include <vnet/mpls/error.def>
30 #undef mpls_error
32 } mpls_error_t;
33 
34 /**
35  * @brief Definition of a callback for receiving MPLS interface state change
36  * notifications
37  */
39  u32 is_enable);
40 
41 typedef struct
42 {
43  /* MPLS FIB index for each software interface */
45 
46  /** A pool of all the MPLS FIBs */
47  struct fib_table_t_ *fibs;
48 
49  /** A pool of all the MPLS FIBs */
51 
52  /** A hash table to lookup the mpls_fib by table ID */
54 
55  /* Feature arc indices */
58 
59  /* IP4 enabled count by software interface */
61 
64 } mpls_main_t;
65 
66 extern mpls_main_t mpls_main;
67 
69 
74 
78 
79 /* Parse mpls protocol as 0xXXXX or protocol name.
80  In either host or network byte order. */
83 
84 /* Parse mpls header. */
87 
90  u8 is_enable, u8 is_api);
91 
93 
94 int mpls_dest_cmp (void *a1, void *a2);
95 
96 int mpls_fib_index_cmp (void *a1, void *a2);
97 
98 int mpls_label_cmp (void *a1, void *a2);
99 
100 void mpls_table_create (u32 table_id, u8 is_api, const u8 * name);
101 void mpls_table_delete (u32 table_id, u8 is_api);
102 
103 #endif /* included_vnet_mpls_h */
104 
105 /*
106  * fd.io coding-style-patch-verification: ON
107  *
108  * Local Variables:
109  * eval: (c-set-style "gnu")
110  * End:
111  */
adj.h
mpls_table_delete
void mpls_table_delete(u32 table_id, u8 is_api)
Definition: mpls_api.c:41
name
string name[64]
Definition: fib.api:25
mpls_main
mpls_main_t mpls_main
Definition: mpls.c:25
mpls_fib_index_cmp
int mpls_fib_index_cmp(void *a1, void *a2)
Definition: mpls.c:195
mpls_error_t
mpls_error_t
Definition: mpls.h:26
mpls_main_t::fib_index_by_table_id
uword * fib_index_by_table_id
A hash table to lookup the mpls_fib by table ID.
Definition: mpls.h:53
unformat_mpls_label_net_byte_order
unformat_function_t unformat_mpls_label_net_byte_order
Definition: mpls.h:81
mpls_fib_t_
Definition: mpls_fib.h:42
u16
unsigned short u16
Definition: types.h:57
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
mpls_input_node
vlib_node_registration_t mpls_input_node
(constructor) VLIB_REGISTER_NODE (mpls_input_node)
Definition: mpls_input.c:245
packet.h
format_mpls_eos_bit
format_function_t format_mpls_eos_bit
Definition: mpls.h:70
mpls_output_node
vlib_node_registration_t mpls_output_node
(constructor) VLIB_REGISTER_NODE (mpls_output_node)
Definition: mpls_output.c:333
fib_node.h
mpls_dest_cmp
int mpls_dest_cmp(void *a1, void *a2)
Definition: mpls.c:186
ethernet.h
mpls_main_t::mpls_enabled_by_sw_if_index
u8 * mpls_enabled_by_sw_if_index
Definition: mpls.h:60
mpls_table_create
void mpls_table_create(u32 table_id, u8 is_api, const u8 *name)
Definition: mpls_api.c:211
format_mpls_header
format_function_t format_mpls_header
Definition: mpls.h:73
fib_table_t_
A protocol Independent FIB table.
Definition: fib_table.h:71
mpls_feature_init
clib_error_t * mpls_feature_init(vlib_main_t *vm)
mpls_main_t::input_feature_arc_index
u8 input_feature_arc_index
Definition: mpls.h:56
mpls_sw_interface_is_enabled
u8 mpls_sw_interface_is_enabled(u32 sw_if_index)
Definition: interface.c:27
unformat_pg_mpls_header
unformat_function_t unformat_pg_mpls_header
Definition: mpls.h:86
uword
u64 uword
Definition: types.h:112
unformat_mpls_unicast_label
unformat_function_t unformat_mpls_unicast_label
Definition: mpls.h:82
mpls_midchain_node
vlib_node_registration_t mpls_midchain_node
(constructor) VLIB_REGISTER_NODE (mpls_midchain_node)
Definition: mpls_output.c:355
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
mpls_types.h
ip4_packet.h
format_function_t
u8 *() format_function_t(u8 *s, va_list *args)
Definition: format.h:48
u32
unsigned int u32
Definition: types.h:88
mpls_main_t::mpls_lookup_node_index
u32 mpls_lookup_node_index
Definition: mpls.h:62
table_id
u32 table_id
Definition: wireguard.api:102
format_mpls_unicast_header_net_byte_order
format_function_t format_mpls_unicast_header_net_byte_order
Definition: mpls.h:71
unformat_function_t
uword() unformat_function_t(unformat_input_t *input, va_list *args)
Definition: format.h:225
MPLS_N_ERROR
@ MPLS_N_ERROR
Definition: mpls.h:31
vlib_main_t
Definition: main.h:102
mpls_sw_interface_enable_disable
int mpls_sw_interface_enable_disable(mpls_main_t *mm, u32 sw_if_index, u8 is_enable, u8 is_api)
Definition: interface.c:38
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
mpls_label_cmp
int mpls_label_cmp(void *a1, void *a2)
Definition: mpls.c:204
mpls_main_t
Definition: mpls.h:41
unformat_mpls_header
unformat_function_t unformat_mpls_header
Definition: mpls.h:85
mpls_main_t::fib_index_by_sw_if_index
u32 * fib_index_by_sw_if_index
Definition: mpls.h:44
mpls_main_t::fibs
struct fib_table_t_ * fibs
A pool of all the MPLS FIBs.
Definition: mpls.h:47
vnet.h
format_mpls_unicast_label
format_function_t format_mpls_unicast_label
Definition: mpls.h:72
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
mpls_main_t::msg_id_base
u16 msg_id_base
Definition: mpls.h:63
mpls_main_t::mpls_fibs
struct mpls_fib_t_ * mpls_fibs
A pool of all the MPLS FIBs.
Definition: mpls.h:50
mpls_interface_state_change_callback_t
void(* mpls_interface_state_change_callback_t)(u32 sw_if_index, u32 is_enable)
Definition of a callback for receiving MPLS interface state change notifications.
Definition: mpls.h:38
error.def
mpls_main_t::output_feature_arc_index
u8 output_feature_arc_index
Definition: mpls.h:57