API Reference Manual  1.46.0
ipsec_crypto/odp_ipsec_sa_db.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2014-2018 Linaro Limited
3  */
4 
7 #ifndef ODP_IPSEC_SA_DB_H_
8 #define ODP_IPSEC_SA_DB_H_
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #include <odp_ipsec_misc.h>
15 
16 typedef enum sa_mode_s {
17  IPSEC_SA_MODE_TRANSPORT,
18  IPSEC_SA_MODE_TUNNEL
19 } sa_mode_t;
20 
21 typedef enum sa_flags_s {
22  BIT_MODE_CIPHER = 1,
23  BIT_MODE_AUTH = 2,
24 } sa_flags_t;
25 
29 typedef struct sa_db_entry_s {
30  struct sa_db_entry_s *next;
31  uint32_t src_ip;
32  uint32_t dst_ip;
33  uint32_t spi;
34  ipsec_alg_t alg;
35  ipsec_key_t key;
36  uint32_t block_len;
37  uint32_t iv_len;
38  uint32_t icv_len;
39  sa_mode_t mode;
40  int flags;
41 } sa_db_entry_t;
42 
46 typedef struct sa_db_s {
47  uint32_t index;
48  sa_db_entry_t *list;
49  sa_db_entry_t array[MAX_DB];
50 } sa_db_t;
51 
53 void init_sa_db(void);
54 
65 int create_sa_db_entry(char *input, odp_bool_t cipher);
69 void dump_sa_db(void);
70 
80 sa_db_entry_t *find_sa_db_entry(ip_addr_range_t *src,
81  ip_addr_range_t *dst,
82  odp_bool_t cipher);
83 
87 typedef struct tun_db_entry_s {
88  struct tun_db_entry_s *next;
89  uint32_t src_ip;
90  uint32_t dst_ip;
91  uint32_t tun_src_ip;
92  uint32_t tun_dst_ip;
93 } tun_db_entry_t;
94 
98 typedef struct tun_db_s {
99  uint32_t index;
100  tun_db_entry_t *list;
101  tun_db_entry_t array[MAX_DB];
102 } tun_db_t;
103 
105 void init_tun_db(void);
106 
116 int create_tun_db_entry(char *input);
117 
121 void dump_tun_db(void);
122 
131 tun_db_entry_t *find_tun_db_entry(uint32_t ip_src,
132  uint32_t ip_dst);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif
bool odp_bool_t
Boolean type.