FD.io VPP  v16.06
Vector Packet Processing
l2tp.h
Go to the documentation of this file.
1 /*
2  * l2tp.h : L2TPv3 tunnel support
3  *
4  * Copyright (c) 2013 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __included_l2tp_h__
19 #define __included_l2tp_h__
20 
21 #include <vlib/vlib.h>
22 #include <vnet/ip/ip.h>
23 #include <vnet/l2tp/packet.h>
24 
25 typedef struct {
26  /* ip6 addresses */
29 
30  /* $$$$ maybe add encap-path lookup fib ID? */
31 
32  /* l2tpv3 header parameters */
33  u64 local_cookie[2];
37 
38  /* tunnel interface */
41 
44  u8 cookie_flags; /* in host byte order */
46 
47 typedef enum {
52 
53 typedef struct {
54  /* session pool */
56 
57  /* ip6 -> l2 hash tables. Make up your minds, people... */
61 
63 
64  /* Counters */
66 
67  /* vector of free l2tpv3 tunnel interfaces */
69 
70  /* show device instance by real device instance */
72 
73  /* convenience */
76 
77 } l2t_main_t;
78 
79 /* Packet trace structure */
80 typedef struct {
85 } l2t_trace_t;
86 
90 
91 enum {
94 };
95 
96 static inline u32 session_index_to_counter_index (u32 session_index,
97  u32 counter_id)
98 {
99  return ((session_index << 1) + counter_id);
100 }
101 
102 u8 * format_l2t_trace (u8 * s, va_list * args);
103 
104 typedef struct {
105  // Any per-interface config would go here
107 
108 uword unformat_pg_l2tp_header (unformat_input_t * input, va_list * args);
109 
110 void l2tp_encap_init (vlib_main_t *vm);
111 void l2tp_decap_init (void);
113  ip6_address_t * client_address,
114  ip6_address_t * our_address,
115  u32 local_session_id,
116  u32 remote_session_id,
117  u64 local_cookie,
118  u64 remote_cookie,
119  int l2_sublayer_present,
120  u32 * sw_if_index);
121 
123  u32 sw_if_index,
124  u64 new_local_cookie,
125  u64 new_remote_cookie);
126 
128  u32 sw_if_index,
129  int enable_disable);
130 
131 #endif /* __included_l2tp_h__ */
int is_user_to_network
Definition: l2tp.h:81
u8 cookie_flags
Definition: l2tp.h:44
ip6_to_l2_lookup_t
Definition: l2tp.h:47
ip6_address_t client_address
Definition: l2tp.h:84
void l2tp_encap_init(vlib_main_t *vm)
Definition: encap.c:209
uword * session_by_session_id
Definition: l2tp.h:60
ip6_address_t our_address
Definition: l2tp.h:27
l2t_main_t l2t_main
Definition: l2tp.h:87
struct _vlib_node_registration vlib_node_registration_t
u64 remote_cookie
Definition: l2tp.h:34
static u32 session_index_to_counter_index(u32 session_index, u32 counter_id)
Definition: l2tp.h:96
ip6_address_t client_address
Definition: l2tp.h:28
unsigned long u64
Definition: types.h:89
u32 hw_if_index
Definition: l2tp.h:39
u8 * format_l2t_trace(u8 *s, va_list *args)
Definition: l2tp.c:29
u32 local_session_id
Definition: l2tp.h:35
vlib_node_registration_t l2t_decap_node
(constructor) VLIB_REGISTER_NODE (l2t_decap_node)
Definition: decap.c:231
int l2tpv3_interface_enable_disable(vnet_main_t *vnm, u32 sw_if_index, int enable_disable)
Definition: l2tp.c:570
vlib_node_registration_t l2t_encap_node
(constructor) VLIB_REGISTER_NODE (l2t_encap_node)
Definition: encap.c:56
ip6_to_l2_lookup_t lookup_type
Definition: l2tp.h:62
ip6_address_t our_address
Definition: l2tp.h:83
u32 * free_l2tpv3_tunnel_hw_if_indices
Definition: l2tp.h:68
uword unformat_pg_l2tp_header(unformat_input_t *input, va_list *args)
Definition: pg.c:39
int l2tpv3_set_tunnel_cookies(l2t_main_t *lm, u32 sw_if_index, u64 new_local_cookie, u64 new_remote_cookie)
Definition: l2tp.c:490
vlib_main_t * vlib_main
Definition: l2tp.h:74
u32 remote_session_id
Definition: l2tp.h:36
unsigned int u32
Definition: types.h:88
vnet_main_t * vnet_main
Definition: l2tp.h:75
uword * session_by_dst_address
Definition: l2tp.h:59
vlib_combined_counter_main_t counter_main
Definition: l2tp.h:65
u64 uword
Definition: types.h:112
u8 l2tp_hdr_size
Definition: l2tp.h:42
unsigned char u8
Definition: types.h:56
l2t_session_t * sessions
Definition: l2tp.h:55
int create_l2tpv3_ipv6_tunnel(l2t_main_t *lm, ip6_address_t *client_address, ip6_address_t *our_address, u32 local_session_id, u32 remote_session_id, u64 local_cookie, u64 remote_cookie, int l2_sublayer_present, u32 *sw_if_index)
Definition: l2tp.c:292
void l2tp_decap_init(void)
Definition: decap.c:250
u32 * dev_inst_by_real
Definition: l2tp.h:71
struct _unformat_input_t unformat_input_t
uword * session_by_src_address
Definition: l2tp.h:58
u8 l2_sublayer_present
Definition: l2tp.h:43
u32 sw_if_index
Definition: l2tp.h:40
u32 session_index
Definition: l2tp.h:82