xref: /aosp_15_r20/external/libnl/lib/xfrm/nl-xfrm.h (revision 4dc78e53d49367fa8e61b07018507c90983a077d)
1 /* SPDX-License-Identifier: LGPL-2.1-only */
2 /*
3  * Copyright (c) 2003-2013 Thomas Graf <[email protected]>
4  * Copyright (c) 2013 Sassano Systems LLC <[email protected]>
5  */
6 
7 #ifndef __LIB_XFRM_NL_XFRM_H__
8 #define __LIB_XFRM_NL_XFRM_H__
9 
10 /* Lifetime configuration, used for both policy rules (SPD) and SAs. */
11 struct xfrmnl_ltime_cfg {
12 	uint32_t refcnt;
13 	uint64_t soft_byte_limit;
14 	uint64_t hard_byte_limit;
15 	uint64_t soft_packet_limit;
16 	uint64_t hard_packet_limit;
17 	uint64_t soft_add_expires_seconds;
18 	uint64_t hard_add_expires_seconds;
19 	uint64_t soft_use_expires_seconds;
20 	uint64_t hard_use_expires_seconds;
21 };
22 
23 /* Current lifetime, used for both policy rules (SPD) and SAs. */
24 struct xfrmnl_lifetime_cur {
25 	uint64_t bytes;
26 	uint64_t packets;
27 	uint64_t add_time;
28 	uint64_t use_time;
29 };
30 
31 struct xfrmnl_replay_state {
32 	uint32_t oseq;
33 	uint32_t seq;
34 	uint32_t bitmap;
35 };
36 
37 struct xfrmnl_replay_state_esn {
38 	uint32_t bmp_len;
39 	uint32_t oseq;
40 	uint32_t seq;
41 	uint32_t oseq_hi;
42 	uint32_t seq_hi;
43 	uint32_t replay_window;
44 	uint32_t bmp[0];
45 };
46 
47 struct xfrmnl_mark {
48 	uint32_t v; /* value */
49 	uint32_t m; /* mask */
50 };
51 
52 struct xfrmnl_id {
53 	struct nl_addr *daddr;
54 	uint32_t spi;
55 	uint8_t proto;
56 };
57 
58 struct xfrmnl_user_sec_ctx {
59 	uint16_t len;
60 	uint16_t exttype;
61 	uint8_t ctx_alg;
62 	uint8_t ctx_doi;
63 	uint16_t ctx_len;
64 	char ctx[0];
65 };
66 
67 struct xfrmnl_user_tmpl {
68 	struct xfrmnl_id id;
69 	uint16_t family;
70 	struct nl_addr *saddr;
71 	uint32_t reqid;
72 	uint8_t mode;
73 	uint8_t share;
74 	uint8_t optional;
75 	uint32_t aalgos;
76 	uint32_t ealgos;
77 	uint32_t calgos;
78 	struct nl_list_head utmpl_list;
79 };
80 
81 #endif /* __LIB_XFRM_NL_XFRM_H__  */
82