libnl: /data/src/libnl3/include/netlink/xfrm/sa.h Source File

libnl 3.10.0

sa.h
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the
15 * distribution.
16 *
17 * Neither the name of Texas Instruments Incorporated nor the names of
18 * its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33*/
34#ifndef NETLINK_XFRM_SA_H_
35#define NETLINK_XFRM_SA_H_
36
37#include <netlink/netlink.h>
38#include <netlink/cache.h>
39#include <netlink/addr.h>
40#include <linux/xfrm.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46struct xfrmnl_sa;
47
48extern struct xfrmnl_sa* xfrmnl_sa_alloc(void);
49extern void xfrmnl_sa_put(struct xfrmnl_sa *);
50
51extern int xfrmnl_sa_alloc_cache(struct nl_sock *, struct nl_cache **);
52extern struct xfrmnl_sa* xfrmnl_sa_get(struct nl_cache*, struct nl_addr*, unsigned int, unsigned int);
53
54extern int xfrmnl_sa_parse(struct nlmsghdr *n, struct xfrmnl_sa **result);
55
56extern int xfrmnl_sa_build_get_request(struct nl_addr*, unsigned int, unsigned int,
57 unsigned int, unsigned int, struct nl_msg **);
58extern int xfrmnl_sa_get_kernel(struct nl_sock*, struct nl_addr*, unsigned int,
59 unsigned int, unsigned int, unsigned int, struct xfrmnl_sa**);
60
61extern int xfrmnl_sa_build_add_request(struct xfrmnl_sa*, int, struct nl_msg **);
62extern int xfrmnl_sa_add(struct nl_sock*, struct xfrmnl_sa*, int);
63
64extern int xfrmnl_sa_build_update_request(struct xfrmnl_sa*, int, struct nl_msg **);
65extern int xfrmnl_sa_update(struct nl_sock*, struct xfrmnl_sa*, int);
66
67extern int xfrmnl_sa_build_delete_request(struct xfrmnl_sa*, int, struct nl_msg **);
68extern int xfrmnl_sa_delete(struct nl_sock*, struct xfrmnl_sa*, int);
69
70extern struct xfrmnl_sel* xfrmnl_sa_get_sel (struct xfrmnl_sa*);
71extern int xfrmnl_sa_set_sel (struct xfrmnl_sa*, struct xfrmnl_sel*);
72
73extern struct nl_addr* xfrmnl_sa_get_daddr (struct xfrmnl_sa*);
74extern int xfrmnl_sa_set_daddr (struct xfrmnl_sa*, struct nl_addr*);
75
76extern int xfrmnl_sa_get_spi (struct xfrmnl_sa*);
77extern int xfrmnl_sa_set_spi (struct xfrmnl_sa*, unsigned int);
78
79extern int xfrmnl_sa_get_proto (struct xfrmnl_sa*);
80extern int xfrmnl_sa_set_proto (struct xfrmnl_sa*, unsigned int);
81
82extern struct nl_addr* xfrmnl_sa_get_saddr (struct xfrmnl_sa*);
83extern int xfrmnl_sa_set_saddr (struct xfrmnl_sa*, struct nl_addr*);
84
85extern struct xfrmnl_ltime_cfg* xfrmnl_sa_get_lifetime_cfg (struct xfrmnl_sa*);
86extern int xfrmnl_sa_set_lifetime_cfg (struct xfrmnl_sa*, struct xfrmnl_ltime_cfg*);
87
88extern int xfrmnl_sa_get_curlifetime (struct xfrmnl_sa*, unsigned long long int*,
89 unsigned long long int*, unsigned long long int*,
90 unsigned long long int*);
91
92extern int xfrmnl_sa_get_stats (struct xfrmnl_sa*, unsigned long long int*,
93 unsigned long long int*, unsigned long long int*);
94
95extern int xfrmnl_sa_get_seq (struct xfrmnl_sa*);
96
97extern int xfrmnl_sa_get_reqid (struct xfrmnl_sa*);
98extern int xfrmnl_sa_set_reqid (struct xfrmnl_sa*, unsigned int);
99
100extern int xfrmnl_sa_get_family (struct xfrmnl_sa*);
101extern int xfrmnl_sa_set_family (struct xfrmnl_sa*, unsigned int);
102
103extern int xfrmnl_sa_get_mode (struct xfrmnl_sa*);
104extern int xfrmnl_sa_set_mode (struct xfrmnl_sa*, unsigned int);
105
106extern int xfrmnl_sa_get_replay_window (struct xfrmnl_sa*);
107extern int xfrmnl_sa_set_replay_window (struct xfrmnl_sa*, unsigned int);
108
109extern int xfrmnl_sa_get_flags (struct xfrmnl_sa*);
110extern int xfrmnl_sa_set_flags (struct xfrmnl_sa*, unsigned int);
111
112extern int xfrmnl_sa_get_aead_params (struct xfrmnl_sa*, char*, unsigned int*,
113 unsigned int*, char*);
114extern int xfrmnl_sa_set_aead_params (struct xfrmnl_sa*, const char*, unsigned int,
115 unsigned int, const char*);
116
117extern int xfrmnl_sa_get_auth_params (struct xfrmnl_sa*, char*, unsigned int*,
118 unsigned int*, char*);
119extern int xfrmnl_sa_set_auth_params (struct xfrmnl_sa*, const char*, unsigned int,
120 unsigned int, const char*);
121
122extern int xfrmnl_sa_get_crypto_params (struct xfrmnl_sa*, char*, unsigned int*, char*);
123extern int xfrmnl_sa_set_crypto_params (struct xfrmnl_sa*, const char*, unsigned int,
124 const char*);
125
126extern int xfrmnl_sa_get_comp_params (struct xfrmnl_sa*, char*, unsigned int*, char*);
127extern int xfrmnl_sa_set_comp_params (struct xfrmnl_sa*, const char*, unsigned int,
128 const char*);
129
130extern int xfrmnl_sa_get_encap_tmpl (struct xfrmnl_sa*, unsigned int*, unsigned int*,
131 unsigned int*, struct nl_addr**);
132extern int xfrmnl_sa_set_encap_tmpl (struct xfrmnl_sa*, unsigned int, unsigned int,
133 unsigned int, struct nl_addr*);
134
135extern int xfrmnl_sa_get_tfcpad (struct xfrmnl_sa*);
136extern int xfrmnl_sa_set_tfcpad (struct xfrmnl_sa*, unsigned int);
137
138extern struct nl_addr* xfrmnl_sa_get_coaddr (struct xfrmnl_sa*);
139extern int xfrmnl_sa_set_coaddr (struct xfrmnl_sa*, struct nl_addr*);
140
141extern int xfrmnl_sa_get_mark (struct xfrmnl_sa*, unsigned int*, unsigned int*);
142extern int xfrmnl_sa_set_mark (struct xfrmnl_sa*, unsigned int, unsigned int);
143
144extern int xfrmnl_sa_get_sec_ctx (struct xfrmnl_sa*, unsigned int*, unsigned int*,
145 unsigned int*, unsigned int*, char*);
146extern int xfrmnl_sa_set_sec_ctx (struct xfrmnl_sa*, unsigned int, unsigned int,
147 unsigned int, unsigned int, const char*);
148
149extern int xfrmnl_sa_get_replay_maxage (struct xfrmnl_sa*);
150extern int xfrmnl_sa_set_replay_maxage (struct xfrmnl_sa*, unsigned int);
151
152extern int xfrmnl_sa_get_replay_maxdiff (struct xfrmnl_sa*);
153extern int xfrmnl_sa_set_replay_maxdiff (struct xfrmnl_sa*, unsigned int);
154
155extern int xfrmnl_sa_get_replay_state (struct xfrmnl_sa*, unsigned int*,
156 unsigned int*, unsigned int*);
157extern int xfrmnl_sa_set_replay_state (struct xfrmnl_sa*, unsigned int,
158 unsigned int, unsigned int);
159
160extern int xfrmnl_sa_get_replay_state_esn (struct xfrmnl_sa*, unsigned int*, unsigned int*,
161 unsigned int*, unsigned int*, unsigned int*,
162 unsigned int*, unsigned int*);
163extern int xfrmnl_sa_set_replay_state_esn (struct xfrmnl_sa*, unsigned int, unsigned int,
164 unsigned int, unsigned int, unsigned int,
165 unsigned int, unsigned int*);
166
167extern int xfrmnl_sa_get_user_offload (struct xfrmnl_sa*, int*, uint8_t *);
168extern int xfrmnl_sa_set_user_offload (struct xfrmnl_sa*, int, uint8_t);
169
170extern int xfrmnl_sa_is_expiry_reached (struct xfrmnl_sa*);
171extern int xfrmnl_sa_is_hardexpiry_reached (struct xfrmnl_sa*);
172
173extern char* xfrmnl_sa_flags2str(int, char *, size_t);
174extern int xfrmnl_sa_str2flag(const char *);
175
176extern char* xfrmnl_sa_mode2str(int, char *, size_t);
177extern int xfrmnl_sa_str2mode(const char *);
178
179#ifdef __cplusplus
180}
181#endif
182
183#endif
xfrmnl_ltime_cfg
Definition nl-xfrm.h:11
xfrmnl_sel
Definition selector.c:55