34#ifndef NETLINK_XFRM_SP_H_
35#define NETLINK_XFRM_SP_H_
37#include <netlink/netlink.h>
38#include <netlink/cache.h>
39#include <netlink/addr.h>
40#include <netlink/xfrm/template.h>
41#include <netlink/xfrm/lifetime.h>
42#include <linux/xfrm.h>
50extern struct xfrmnl_sp* xfrmnl_sp_alloc(
void);
51extern void xfrmnl_sp_put(
struct xfrmnl_sp *);
53extern int xfrmnl_sp_alloc_cache(
struct nl_sock *,
struct nl_cache **);
54extern struct xfrmnl_sp* xfrmnl_sp_get(
struct nl_cache*,
unsigned int,
unsigned int);
56extern int xfrmnl_sp_parse(
struct nlmsghdr *n,
struct xfrmnl_sp **result);
58extern int xfrmnl_sp_build_get_request(
unsigned int,
unsigned int,
unsigned int,
59 unsigned int,
struct nl_msg **);
60extern int xfrmnl_sp_get_kernel(
struct nl_sock*,
unsigned int,
unsigned int,
61 unsigned int,
unsigned int,
struct xfrmnl_sp**);
63extern int xfrmnl_sp_add(
struct nl_sock*,
struct xfrmnl_sp*,
int);
64extern int xfrmnl_sp_build_add_request(
struct xfrmnl_sp*,
int,
struct nl_msg **);
66extern int xfrmnl_sp_update(
struct nl_sock*,
struct xfrmnl_sp*,
int);
67extern int xfrmnl_sp_build_update_request(
struct xfrmnl_sp*,
int,
struct nl_msg **);
69extern int xfrmnl_sp_delete(
struct nl_sock*,
struct xfrmnl_sp*,
int);
70extern int xfrmnl_sp_build_delete_request(
struct xfrmnl_sp*,
int,
struct nl_msg **);
72extern struct xfrmnl_sel* xfrmnl_sp_get_sel (
struct xfrmnl_sp*);
73extern int xfrmnl_sp_set_sel (
struct xfrmnl_sp*,
struct xfrmnl_sel*);
75extern struct xfrmnl_ltime_cfg* xfrmnl_sp_get_lifetime_cfg (
struct xfrmnl_sp*);
76extern int xfrmnl_sp_set_lifetime_cfg (
struct xfrmnl_sp*,
struct xfrmnl_ltime_cfg*);
78extern int xfrmnl_sp_get_curlifetime (
struct xfrmnl_sp*,
unsigned long long int*,
79 unsigned long long int*,
unsigned long long int*,
80 unsigned long long int*);
82extern int xfrmnl_sp_get_priority (
struct xfrmnl_sp*);
83extern int xfrmnl_sp_set_priority (
struct xfrmnl_sp*,
unsigned int);
85extern int xfrmnl_sp_get_index (
struct xfrmnl_sp*);
86extern int xfrmnl_sp_set_index (
struct xfrmnl_sp*,
unsigned int);
88extern int xfrmnl_sp_get_dir (
struct xfrmnl_sp*);
89extern int xfrmnl_sp_set_dir (
struct xfrmnl_sp*,
unsigned int);
91extern int xfrmnl_sp_get_action (
struct xfrmnl_sp*);
92extern int xfrmnl_sp_set_action (
struct xfrmnl_sp*,
unsigned int);
94extern int xfrmnl_sp_get_flags (
struct xfrmnl_sp*);
95extern int xfrmnl_sp_set_flags (
struct xfrmnl_sp*,
unsigned int);
97extern int xfrmnl_sp_get_share (
struct xfrmnl_sp*);
98extern int xfrmnl_sp_set_share (
struct xfrmnl_sp*,
unsigned int);
100extern int xfrmnl_sp_get_sec_ctx (
struct xfrmnl_sp*,
unsigned int*,
unsigned int*,
101 unsigned int*,
unsigned int*,
unsigned int*,
char*);
102extern int xfrmnl_sp_set_sec_ctx (
struct xfrmnl_sp*,
unsigned int,
unsigned int,
103 unsigned int,
unsigned int,
unsigned int,
char*);
105extern int xfrmnl_sp_get_userpolicy_type (
struct xfrmnl_sp*);
106extern int xfrmnl_sp_set_userpolicy_type (
struct xfrmnl_sp*,
unsigned int);
108extern void xfrmnl_sp_add_usertemplate(
struct xfrmnl_sp*,
struct xfrmnl_user_tmpl*);
109extern void xfrmnl_sp_remove_usertemplate(
struct xfrmnl_sp*,
struct xfrmnl_user_tmpl*);
110extern struct nl_list_head* xfrmnl_sp_get_usertemplates(
struct xfrmnl_sp*);
111extern int xfrmnl_sp_get_nusertemplates(
struct xfrmnl_sp*);
112extern void xfrmnl_sp_foreach_usertemplate(
struct xfrmnl_sp*,
113 void (*cb)(
struct xfrmnl_user_tmpl*,
void *),
115extern struct xfrmnl_user_tmpl* xfrmnl_sp_usertemplate_n(
struct xfrmnl_sp*,
int);
117extern int xfrmnl_sp_get_mark (
struct xfrmnl_sp*,
unsigned int*,
unsigned int*);
118extern int xfrmnl_sp_set_mark (
struct xfrmnl_sp*,
unsigned int,
unsigned int);
120extern char* xfrmnl_sp_action2str(
int,
char *,
size_t);
121extern int xfrmnl_sp_str2action(
const char *);
123extern char* xfrmnl_sp_flags2str(
int,
char *,
size_t);
124extern int xfrmnl_sp_str2flag(
const char *);
126extern char* xfrmnl_sp_type2str(
int,
char *,
size_t);
127extern int xfrmnl_sp_str2type(
const char *);
129extern char* xfrmnl_sp_dir2str(
int,
char *,
size_t);
130extern int xfrmnl_sp_str2dir(
const char *);
132extern char* xfrmnl_sp_share2str(
int,
char *,
size_t);
133extern int xfrmnl_sp_str2share(
const char *);
135extern int xfrmnl_sp_index2dir (
unsigned int);