blob: 049ceca4bbf381e72a705e7bcbd043f2a1c458ad [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001#ifndef IPSEC_CP_MSG_H
2#define IPSEC_CP_MSG_H
3
4#include "ipsec_common_interface.h"
5#ifdef __N3GPP_OVER_DATA__
6#include "network_dev_info_struct.h"
7#endif
8
9
10//MSG_ID_IPSEC_SA_ADD_REQ
11typedef struct
12{
13 LOCAL_PARA_HDR
14
15 kal_uint32 req_id;//req_id
16
17 //selector
18 ipsec_selector_t ipsec_selector[IPSEC_MAX_SELECTOR_NUM];
19 kal_uint32 ipsec_selector_count;/*the selector number in the SA entry, must <= IPSEC_MAX_SELECTOR_NUM*/
20
21 kal_uint32 spi;
22 ipsec_proto_enum ipsec_protocol;//ESP/AH
23 ipsec_mode_enum ipsec_mode;//Transport/Tunnel/Tunnel-UDP_Encap
24 kal_bool esn_flag;
25
26 kal_bool is_combined;
27 ipsec_encry_algo_enum encry_algo;//for ESP
28 ipsec_integ_algo_enum integrity_algo;//for ESP/AH
29 ipsec_com_algo_enum combined_algo;//reserved
30 kal_uint8 integ_key[IPSEC_ALGO_MAX_KEY_LEN];
31 kal_uint8 encry_key[IPSEC_ALGO_MAX_KEY_LEN];
32 kal_uint8 com_key[IPSEC_ALGO_MAX_KEY_LEN];
33 kal_uint32 encry_key_len;
34 kal_uint32 integ_key_len;
35 kal_uint32 com_key_len;
36
37 ipsec_tunnel_info_t tunnel_info;
38 ipsec_lft_t soft_lft;
39 ipsec_lft_t hard_lft;
40
41#ifdef __N3GPP_OVER_DATA__
42 nw_device_id_enum dev_id;
43#endif
44
45}ipsec_sa_add_req_struct;
46
47
48//MSG_ID_IPSEC_SA_ADD_CNF
49typedef struct
50{
51 LOCAL_PARA_HDR
52
53 kal_uint32 req_id;//Used to instead selector to identify the SA, ipsec won't use it but just return to user in CNF msg.
54 kal_uint32 ipsec_said;//0xFFFFFFFF - invalid value
55 ipsec_status_enum status;// the result
56
57} ipsec_sa_add_cnf_struct;
58
59
60//MSG_ID_IPSEC_SP_ADD_REQ
61typedef struct
62{
63 LOCAL_PARA_HDR
64
65 kal_uint32 req_id;
66 kal_uint32 ipsec_said;// the related SA id
67 kal_uint32 interface_id;
68
69 //selector
70 ipsec_selector_t ipsec_selector[IPSEC_MAX_SELECTOR_NUM];
71 kal_uint32 ipsec_selector_count;/*the selector number in the SP entry, must <= IPSEC_MAX_SELECTOR_NUM*/
72
73 ipsec_proto_enum ipsec_protocol;
74 ipsec_mode_enum ipsec_mode;// Transport / Tunnel / Tunnel-UDP_Encap
75 ipsec_direction_enum direction;//int / out
76
77 /* As defined in RFC4301 Page31: Processing info */
78 ipsec_process_info_t *p_process_info;
79
80}ipsec_sp_add_req_struct;
81
82
83//MSG_ID_IPSEC_SP_ADD_CNF
84typedef struct
85{
86 LOCAL_PARA_HDR
87
88 kal_uint32 req_id;
89 kal_uint32 ipsec_spid;
90 ipsec_status_enum status;
91
92} ipsec_sp_add_cnf_struct;
93
94
95//MSG_ID_IPSEC_SP_DELETE_REQ
96typedef struct
97{
98 LOCAL_PARA_HDR
99
100 kal_uint32 ipsec_spid;
101
102} ipsec_sp_delete_req_struct;
103
104//MSG_ID_IPSEC_SA_DELETE_REQ
105typedef struct
106{
107 LOCAL_PARA_HDR
108
109 kal_uint32 ipsec_said;
110
111} ipsec_sa_delete_req_struct;
112
113//MSG_ID_IPSEC_SA_DELETE_CNF
114typedef struct
115{
116 LOCAL_PARA_HDR
117
118 kal_uint32 ipsec_said;
119 ipsec_status_enum status;
120} ipsec_sa_delete_cnf_struct;
121
122//MSG_ID_IPSEC_SP_DELETE_CNF
123typedef struct
124{
125 LOCAL_PARA_HDR
126
127 kal_uint32 ipsec_spid;
128 ipsec_status_enum status;
129} ipsec_sp_delete_cnf_struct;
130
131
132//MSG_ID_IPSEC_MULTI_SA_SP_DELETE_REQ
133typedef struct
134{
135 LOCAL_PARA_HDR
136
137 kal_uint32 req_id;
138
139 kal_uint32 sa_del_cnt;
140 kal_uint32 ipsec_said_list[IPSEC_MAX_SASP_DEL_NUM];
141
142 kal_uint32 sp_del_cnt;
143 kal_uint32 ipsec_spid_list[IPSEC_MAX_SASP_DEL_NUM];
144
145}ipsec_multi_sa_sp_delete_req_struct;
146
147
148//MSG_ID_IPSEC_MULTI_SA_SP_DELETE_CNF
149typedef struct
150{
151 LOCAL_PARA_HDR
152
153 kal_uint32 req_id;
154
155 kal_uint32 sa_del_cnt;
156 kal_uint32 ipsec_said_list[IPSEC_MAX_SASP_DEL_NUM];
157 ipsec_status_enum ipsec_sa_status_list[IPSEC_MAX_SASP_DEL_NUM];
158
159 kal_uint32 sp_del_cnt;
160 kal_uint32 ipsec_spid_list[IPSEC_MAX_SASP_DEL_NUM];
161 ipsec_status_enum ipsec_sp_status_list[IPSEC_MAX_SASP_DEL_NUM];
162
163}ipsec_multi_sa_sp_delete_cnf_struct;
164
165
166//MSG_ID_IPSEC_REKEY_IND
167typedef struct
168{
169 LOCAL_PARA_HDR
170
171 kal_uint32 ipsec_said;
172
173} ipsec_rekey_ind_struct;
174
175//MSG_ID_IPSEC_SA_DEL_IND
176typedef struct
177{
178 LOCAL_PARA_HDR
179
180 kal_uint32 ipsec_said;
181 kal_uint32 cause;//indicate the cause that IPsec deletes SA itself.
182
183} ipsec_sa_del_ind_struct;
184
185
186//MSG_ID_IPSEC_SP_SAID_UPDATE_REQ
187//for N3SAM to update sa link to the sp
188typedef struct
189{
190 LOCAL_PARA_HDR
191
192 kal_uint32 req_id;
193 kal_uint32 new_said;
194 kal_uint32 ipsec_spid;
195} ipsec_sp_said_update_req_struct;
196
197//MSG_ID_IPSEC_SP_SAID_UPDATE_CNF
198typedef struct
199{
200 LOCAL_PARA_HDR
201
202 kal_uint32 req_id;
203 ipsec_status_enum status;
204} ipsec_sp_said_update_cnf_struct;
205
206
207//MSG_ID_IPSEC_SA_TUNNEL_UPDATE_REQ
208//for N3SAM to update tunnel address
209typedef struct
210{
211 LOCAL_PARA_HDR
212
213 kal_uint32 ipsec_said;
214 kal_uint8 new_tunnel_src[MAX_IP_ADDR_SIZE];
215 kal_uint8 new_tunnel_dst[MAX_IP_ADDR_SIZE];
216 ipsec_addr_family_enum new_tunnel_addr_family;
217#ifdef __N3GPP_OVER_DATA__
218 nw_device_id_enum dev_id;
219#endif
220}ipsec_sa_tunnel_update_req_struct;
221
222
223//MSG_ID_IPSEC_SA_TUNNEL_UPDATE_CNF
224typedef struct
225{
226 LOCAL_PARA_HDR
227
228 kal_uint32 ipsec_said;
229 ipsec_status_enum status;
230}ipsec_sa_tunnel_update_cnf_struct;
231
232
233//MSG_ID_IPSEC_SPI_ALLOC_REQ
234typedef struct
235{
236 LOCAL_PARA_HDR
237
238 kal_uint8 req_id;
239 kal_uint32 min_spi;
240 kal_uint32 max_spi;
241 kal_uint8 src_addr[16];
242 kal_uint8 dst_addr[16];
243 ipsec_addr_family_enum addr_family;
244 ipsec_proto_enum ipsec_proto;
245 ipsec_mode_enum ipsec_mode;
246 kal_uint32 max_wait_time; //seconds
247}ipsec_spi_alloc_req_struct;
248
249
250//MSG_ID_IPSEC_SPI_ALLOC_CNF
251typedef struct
252{
253 LOCAL_PARA_HDR
254
255 kal_uint8 req_id;
256 kal_uint32 spi;
257 ipsec_status_enum status;
258
259}ipsec_spi_alloc_cnf_struct;
260
261
262//MSG_ID_IPSEC_SPI_FREE_REQ
263typedef struct
264{
265 LOCAL_PARA_HDR
266
267 kal_uint8 req_id;
268 kal_uint8 src_addr[16];
269 kal_uint8 dst_addr[16];
270 ipsec_addr_family_enum addr_family;
271 ipsec_proto_enum ipsec_proto;
272 kal_uint32 spi;
273
274}ipsec_spi_free_req_struct;
275
276//MSG_ID_IPSEC_MULTI_SPI_FREE_REQ
277typedef struct
278{
279 LOCAL_PARA_HDR
280
281 kal_uint8 req_id;
282 kal_uint32 spi_del_cnt;
283 kal_uint8 src_addr_list[16*IPSEC_MAX_SASP_DEL_NUM];
284 kal_uint8 dst_addr_list[16*IPSEC_MAX_SASP_DEL_NUM];
285 ipsec_addr_family_enum addr_family_list[IPSEC_MAX_SASP_DEL_NUM];
286 ipsec_proto_enum ipsec_proto_list[IPSEC_MAX_SASP_DEL_NUM];
287 kal_uint32 spi_del_list[IPSEC_MAX_SASP_DEL_NUM];
288
289}ipsec_multi_spi_free_req_struct;
290
291//MSG_ID_IPSEC_MULTI_SPI_FREE_CNF
292typedef struct
293{
294 LOCAL_PARA_HDR
295
296 kal_uint8 req_id;
297 kal_uint32 spi_del_cnt;
298 kal_uint32 spi_del_list[IPSEC_MAX_SASP_DEL_NUM];
299 ipsec_status_enum spi_del_status_list[IPSEC_MAX_SASP_DEL_NUM];
300
301}ipsec_multi_spi_free_cnf_struct;
302
303
304//MSG_ID_IPSEC_SPI_FREE_CNF
305typedef struct
306{
307 LOCAL_PARA_HDR
308
309 kal_uint8 req_id;
310 ipsec_status_enum status;
311
312}ipsec_spi_free_cnf_struct;
313
314#endif