summaryrefslogtreecommitdiff
path: root/lib/xfrm/nl-xfrm.h
blob: 0469c631be0922d045a36927f9b2c527de96fcb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
 * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
 * Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com>
 */

#ifndef __LIB_XFRM_NL_XFRM_H__
#define __LIB_XFRM_NL_XFRM_H__

/* Lifetime configuration, used for both policy rules (SPD) and SAs. */
struct xfrmnl_ltime_cfg {
	uint32_t refcnt;
	uint64_t soft_byte_limit;
	uint64_t hard_byte_limit;
	uint64_t soft_packet_limit;
	uint64_t hard_packet_limit;
	uint64_t soft_add_expires_seconds;
	uint64_t hard_add_expires_seconds;
	uint64_t soft_use_expires_seconds;
	uint64_t hard_use_expires_seconds;
};

/* Current lifetime, used for both policy rules (SPD) and SAs. */
struct xfrmnl_lifetime_cur {
	uint64_t bytes;
	uint64_t packets;
	uint64_t add_time;
	uint64_t use_time;
};

struct xfrmnl_replay_state {
	uint32_t oseq;
	uint32_t seq;
	uint32_t bitmap;
};

struct xfrmnl_replay_state_esn {
	uint32_t bmp_len;
	uint32_t oseq;
	uint32_t seq;
	uint32_t oseq_hi;
	uint32_t seq_hi;
	uint32_t replay_window;
	uint32_t bmp[0];
};

struct xfrmnl_mark {
	uint32_t v; /* value */
	uint32_t m; /* mask */
};

struct xfrmnl_id {
	struct nl_addr *daddr;
	uint32_t spi;
	uint8_t proto;
};

struct xfrmnl_user_sec_ctx {
	uint16_t len;
	uint16_t exttype;
	uint8_t ctx_alg;
	uint8_t ctx_doi;
	uint16_t ctx_len;
	char ctx[0];
};

struct xfrmnl_user_tmpl {
	struct xfrmnl_id id;
	uint16_t family;
	struct nl_addr *saddr;
	uint32_t reqid;
	uint8_t mode;
	uint8_t share;
	uint8_t optional;
	uint32_t aalgos;
	uint32_t ealgos;
	uint32_t calgos;
	struct nl_list_head utmpl_list;
};

#endif /* __LIB_XFRM_NL_XFRM_H__  */