FD.io VPP  v19.08-27-gf4dcae4
Vector Packet Processing
ipsec_tun.h
Go to the documentation of this file.
1 /*
2  * ipsec_tun.h : IPSEC tunnel protection
3  *
4  * Copyright (c) 2015 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 #include <vnet/ipsec/ipsec.h>
19 
21 {
22  IPSEC_PROTECT_L2 = (1 << 0),
24 } __clib_packed ipsec_protect_flags_t;
25 
26 typedef struct ipsec_ep_t_
27 {
28  ip46_address_t src;
29  ip46_address_t dst;
30 } ipsec_ep_t;
31 
32 typedef struct ipsec_tun_protect_t_
33 {
34  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
36 
37  /* not using a vector since we want the memory inline
38  * with this struct */
40  index_t itp_in_sas[4];
41 
43 
45 
46  ipsec_protect_flags_t itp_flags;
47 
49 
51 
52 #define FOR_EACH_IPSEC_PROTECT_INPUT_SAI(_itp, _sai, body) \
53 { \
54  u32 __ii; \
55  for (__ii = 0; __ii < _itp->itp_n_sa_in; __ii++) { \
56  _sai = itp->itp_in_sas[__ii]; \
57  body; \
58  } \
59 }
60 #define FOR_EACH_IPSEC_PROTECT_INPUT_SA(_itp, _sa, body) \
61 { \
62  u32 __ii; \
63  for (__ii = 0; __ii < _itp->itp_n_sa_in; __ii++) { \
64  _sa = ipsec_sa_get(itp->itp_in_sas[__ii]); \
65  body; \
66  } \
67 }
68 
70  u32 sa_ins[2]);
72 
73 typedef walk_rc_t (*ipsec_tun_protect_walk_cb_t) (index_t itpi, void *arg);
75  void *cttx);
77 
78 extern u8 *format_ipsec_tun_protect (u8 * s, va_list * args);
79 
80 // FIXME
83 
84 /*
85  * DP API
86  */
88 
90 {
91  union
92  {
93  struct
94  {
97  };
99  };
101 
104 {
105  return (pool_elt_at_index (ipsec_protect_pool, index));
106 }
107 
108 /*
109  * fd.io coding-style-patch-verification: ON
110  *
111  * Local Variables:
112  * eval: (c-set-style "gnu")
113  * End:
114  */
walk_rc_t(* ipsec_tun_protect_walk_cb_t)(index_t itpi, void *arg)
Definition: ipsec_tun.h:73
struct ipsec_tun_lkup_result_t_ ipsec_tun_lkup_result_t
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition: cache.h:60
vlib_node_registration_t ipsec6_tun_input_node
(constructor) VLIB_REGISTER_NODE (ipsec6_tun_input_node)
Definition: ipsec_tun_in.c:440
unsigned long u64
Definition: types.h:89
struct ipsec_tun_protect_t_ ipsec_tun_protect_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
unsigned char u8
Definition: types.h:56
enum walk_rc_t_ walk_rc_t
Walk return code.
ip46_address_t src
Definition: ipsec_tun.h:28
vl_api_interface_index_t sw_if_index
Definition: gre.api:50
#define always_inline
Definition: clib.h:98
ipsec_protect_flags_t_
Definition: ipsec_tun.h:20
ipsec_ep_t itp_tun
Definition: ipsec_tun.h:48
unsigned int u32
Definition: types.h:88
vlib_node_registration_t ipsec4_tun_input_node
(constructor) VLIB_REGISTER_NODE (ipsec4_tun_input_node)
Definition: ipsec_tun_in.c:415
u32 sa_out
Definition: ipsec.api:350
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:514
index_t ipsec_tun_protect_find(u32 sw_if_index)
Definition: ipsec_tun.c:224
u8 * format_ipsec_tun_protect(u8 *s, va_list *args)
Definition: ipsec_format.c:368
ip46_address_t dst
Definition: ipsec_tun.h:29
static ipsec_tun_protect_t * ipsec_tun_protect_get(u32 index)
Definition: ipsec_tun.h:103
struct ipsec_ep_t_ ipsec_ep_t
void ipsec_tun_protect_walk(ipsec_tun_protect_walk_cb_t fn, void *cttx)
Definition: ipsec_tun.c:379
struct _vlib_node_registration vlib_node_registration_t
ipsec_ep_t itp_crypto
Definition: ipsec_tun.h:44
ipsec_protect_flags_t itp_flags
Definition: ipsec_tun.h:46
int ipsec_tun_protect_update(u32 sw_if_index, u32 sa_out, u32 sa_ins[2])
int ipsec_tun_protect_del(u32 sw_if_index)
Definition: ipsec_tun.c:348
ipsec_tun_protect_t * ipsec_protect_pool
Pool of tunnel protection objects.
Definition: ipsec_tun.c:25
enum ipsec_protect_flags_t_ ipsec_protect_flags_t