2 * ipsec_tun.h : IPSEC tunnel protection
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:
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <vnet/ipsec/ipsec.h>
20 typedef enum ipsec_protect_flags_t_
22 IPSEC_PROTECT_L2 = (1 << 0),
23 IPSEC_PROTECT_ENCAPED = (1 << 1),
24 } __clib_packed ipsec_protect_flags_t;
26 typedef struct ipsec_ep_t_
32 typedef struct ipsec_tun_protect_t_
34 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
37 /* not using a vector since we want the memory inline
40 index_t itp_in_sas[4];
44 ipsec_ep_t itp_crypto;
46 ipsec_protect_flags_t itp_flags;
50 } ipsec_tun_protect_t;
52 #define FOR_EACH_IPSEC_PROTECT_INPUT_SAI(_itp, _sai, body) \
55 for (__ii = 0; __ii < _itp->itp_n_sa_in; __ii++) { \
56 _sai = itp->itp_in_sas[__ii]; \
60 #define FOR_EACH_IPSEC_PROTECT_INPUT_SA(_itp, _sa, body) \
63 for (__ii = 0; __ii < _itp->itp_n_sa_in; __ii++) { \
64 _sa = ipsec_sa_get(itp->itp_in_sas[__ii]); \
69 extern int ipsec_tun_protect_update (u32 sw_if_index, u32 sa_out,
71 extern int ipsec_tun_protect_del (u32 sw_if_index);
73 typedef walk_rc_t (*ipsec_tun_protect_walk_cb_t) (index_t itpi, void *arg);
74 extern void ipsec_tun_protect_walk (ipsec_tun_protect_walk_cb_t fn,
76 extern index_t ipsec_tun_protect_find (u32 sw_if_index);
78 extern u8 *format_ipsec_tun_protect (u8 * s, va_list * args);
81 extern vlib_node_registration_t ipsec4_tun_input_node;
82 extern vlib_node_registration_t ipsec6_tun_input_node;
87 extern ipsec_tun_protect_t *ipsec_protect_pool;
89 typedef struct ipsec_tun_lkup_result_t_
100 } ipsec_tun_lkup_result_t;
102 always_inline ipsec_tun_protect_t *
103 ipsec_tun_protect_get (u32 index)
105 return (pool_elt_at_index (ipsec_protect_pool, index));
109 * fd.io coding-style-patch-verification: ON
112 * eval: (c-set-style "gnu")