API Reference Manual  1.46.0
ipsec_api/odp_ipsec_cache.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2014-2018 Linaro Limited
3  */
4 
7 #ifndef ODP_IPSEC_CACHE_H_
8 #define ODP_IPSEC_CACHE_H_
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #include <odp_api.h>
15 #include <odp/helper/ipsec.h>
16 
17 #include <odp_ipsec_misc.h>
18 #include <odp_ipsec_sa_db.h>
19 
23 typedef struct ipsec_cache_entry_s {
24  struct ipsec_cache_entry_s *next;
25  uint32_t src_ip;
26  uint32_t dst_ip;
27  sa_mode_t mode;
28  uint32_t tun_src_ip;
29  uint32_t tun_dst_ip;
30  struct {
31  odp_cipher_alg_t alg;
32  uint32_t spi;
33  uint32_t block_len;
34  uint32_t iv_len;
35  ipsec_key_t key;
36  } esp;
37  struct {
38  odp_auth_alg_t alg;
39  uint32_t spi;
40  uint32_t icv_len;
41  ipsec_key_t key;
42  } ah;
43 
44  odp_ipsec_sa_t ipsec_sa;
45 } ipsec_cache_entry_t;
46 
50 typedef struct ipsec_cache_s {
51  uint32_t index;
52  ipsec_cache_entry_t *in_list;
53  ipsec_cache_entry_t *out_list;
54  ipsec_cache_entry_t array[MAX_DB];
55 } ipsec_cache_t;
56 
58 extern ipsec_cache_t *ipsec_cache;
59 
61 void init_ipsec_cache(void);
62 
74 int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
75  sa_db_entry_t *auth_sa,
76  tun_db_entry_t *tun,
77  odp_bool_t in,
78  odp_queue_t completionq);
79 
90 ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
91  uint32_t dst_ip,
92  odph_ahhdr_t *ah,
93  odph_esphdr_t *esp);
94 
104 ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
105  uint32_t dst_ip,
106  uint8_t proto);
107 
108 int destroy_ipsec_cache(void);
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif
odp_cipher_alg_t
Crypto API cipher algorithm.
odp_auth_alg_t
Crypto API authentication algorithm.
bool odp_bool_t
Boolean type.
The OpenDataPlane API.