34#ifndef NETLINK_XFRM_SA_H_
35#define NETLINK_XFRM_SA_H_
37#include <netlink/netlink.h>
38#include <netlink/cache.h>
39#include <netlink/addr.h>
40#include <linux/xfrm.h>
48extern struct xfrmnl_sa* xfrmnl_sa_alloc(
void);
49extern void xfrmnl_sa_put(
struct xfrmnl_sa *);
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);
54extern int xfrmnl_sa_parse(
struct nlmsghdr *n,
struct xfrmnl_sa **result);
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**);
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);
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);
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);
70extern struct xfrmnl_sel* xfrmnl_sa_get_sel (
struct xfrmnl_sa*);
71extern int xfrmnl_sa_set_sel (
struct xfrmnl_sa*,
struct xfrmnl_sel*);
73extern struct nl_addr* xfrmnl_sa_get_daddr (
struct xfrmnl_sa*);
74extern int xfrmnl_sa_set_daddr (
struct xfrmnl_sa*,
struct nl_addr*);
76extern int xfrmnl_sa_get_spi (
struct xfrmnl_sa*);
77extern int xfrmnl_sa_set_spi (
struct xfrmnl_sa*,
unsigned int);
79extern int xfrmnl_sa_get_proto (
struct xfrmnl_sa*);
80extern int xfrmnl_sa_set_proto (
struct xfrmnl_sa*,
unsigned int);
82extern struct nl_addr* xfrmnl_sa_get_saddr (
struct xfrmnl_sa*);
83extern int xfrmnl_sa_set_saddr (
struct xfrmnl_sa*,
struct nl_addr*);
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*);
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*);
92extern int xfrmnl_sa_get_stats (
struct xfrmnl_sa*,
unsigned long long int*,
93 unsigned long long int*,
unsigned long long int*);
95extern int xfrmnl_sa_get_seq (
struct xfrmnl_sa*);
97extern int xfrmnl_sa_get_reqid (
struct xfrmnl_sa*);
98extern int xfrmnl_sa_set_reqid (
struct xfrmnl_sa*,
unsigned int);
100extern int xfrmnl_sa_get_family (
struct xfrmnl_sa*);
101extern int xfrmnl_sa_set_family (
struct xfrmnl_sa*,
unsigned int);
103extern int xfrmnl_sa_get_mode (
struct xfrmnl_sa*);
104extern int xfrmnl_sa_set_mode (
struct xfrmnl_sa*,
unsigned int);
106extern int xfrmnl_sa_get_replay_window (
struct xfrmnl_sa*);
107extern int xfrmnl_sa_set_replay_window (
struct xfrmnl_sa*,
unsigned int);
109extern int xfrmnl_sa_get_flags (
struct xfrmnl_sa*);
110extern int xfrmnl_sa_set_flags (
struct xfrmnl_sa*,
unsigned int);
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*);
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*);
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,
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,
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*);
135extern int xfrmnl_sa_get_tfcpad (
struct xfrmnl_sa*);
136extern int xfrmnl_sa_set_tfcpad (
struct xfrmnl_sa*,
unsigned int);
138extern struct nl_addr* xfrmnl_sa_get_coaddr (
struct xfrmnl_sa*);
139extern int xfrmnl_sa_set_coaddr (
struct xfrmnl_sa*,
struct nl_addr*);
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);
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*);
149extern int xfrmnl_sa_get_replay_maxage (
struct xfrmnl_sa*);
150extern int xfrmnl_sa_set_replay_maxage (
struct xfrmnl_sa*,
unsigned int);
152extern int xfrmnl_sa_get_replay_maxdiff (
struct xfrmnl_sa*);
153extern int xfrmnl_sa_set_replay_maxdiff (
struct xfrmnl_sa*,
unsigned int);
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);
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*);
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);
170extern int xfrmnl_sa_is_expiry_reached (
struct xfrmnl_sa*);
171extern int xfrmnl_sa_is_hardexpiry_reached (
struct xfrmnl_sa*);
173extern char* xfrmnl_sa_flags2str(
int,
char *,
size_t);
174extern int xfrmnl_sa_str2flag(
const char *);
176extern char* xfrmnl_sa_mode2str(
int,
char *,
size_t);
177extern int xfrmnl_sa_str2mode(
const char *);