| Server IP : 170.10.162.208 / Your IP : 216.73.216.181 Web Server : LiteSpeed System : Linux altar19.supremepanel19.com 4.18.0-553.69.1.lve.el8.x86_64 #1 SMP Wed Aug 13 19:53:59 UTC 2025 x86_64 User : deltahospital ( 1806) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/deltahospital/test.delta-hospital.com/ |
Upload File : |
msg.h 0000644 00000010241 15051120407 0005474 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_MSG_H_
#define NETLINK_MSG_H_
#include <netlink/netlink.h>
#include <netlink/object.h>
#include <netlink/attr.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nlmsghdr;
#define NL_DONTPAD 0
/**
* @ingroup msg
* @brief
* Will cause the netlink port to be set to the port assigned to
* the netlink icoket ust before sending the message off.
*
* @note Requires the use of nl_send_auto()!
*/
#define NL_AUTO_PORT 0
#define NL_AUTO_PID NL_AUTO_PORT
/**
* @ingroup msg
* @brief
* May be used to refer to a sequence number which should be
* automatically set just before sending the message off.
*
* @note Requires the use of nl_send_auto()!
*/
#define NL_AUTO_SEQ 0
struct nl_msg;
struct nl_tree;
struct ucred;
extern int nlmsg_size(int);
extern int nlmsg_total_size(int);
extern int nlmsg_padlen(int);
extern void * nlmsg_data(const struct nlmsghdr *);
extern int nlmsg_datalen(const struct nlmsghdr *);
extern void * nlmsg_tail(const struct nlmsghdr *);
/* attribute access */
extern struct nlattr * nlmsg_attrdata(const struct nlmsghdr *, int);
extern int nlmsg_attrlen(const struct nlmsghdr *, int);
/* message parsing */
extern int nlmsg_valid_hdr(const struct nlmsghdr *, int);
extern int nlmsg_ok(const struct nlmsghdr *, int);
extern struct nlmsghdr * nlmsg_next(struct nlmsghdr *, int *);
extern int nlmsg_parse(struct nlmsghdr *, int, struct nlattr **,
int, const struct nla_policy *);
extern struct nlattr * nlmsg_find_attr(struct nlmsghdr *, int, int);
extern int nlmsg_validate(struct nlmsghdr *, int, int,
const struct nla_policy *);
extern struct nl_msg * nlmsg_alloc(void);
extern struct nl_msg * nlmsg_alloc_size(size_t);
extern struct nl_msg * nlmsg_alloc_simple(int, int);
extern void nlmsg_set_default_size(size_t);
extern struct nl_msg * nlmsg_inherit(struct nlmsghdr *);
extern struct nl_msg * nlmsg_convert(struct nlmsghdr *);
extern void * nlmsg_reserve(struct nl_msg *, size_t, int);
extern int nlmsg_append(struct nl_msg *, void *, size_t, int);
extern int nlmsg_expand(struct nl_msg *, size_t);
extern struct nlmsghdr * nlmsg_put(struct nl_msg *, uint32_t, uint32_t,
int, int, int);
extern struct nlmsghdr * nlmsg_hdr(struct nl_msg *);
extern void nlmsg_get(struct nl_msg *);
extern void nlmsg_free(struct nl_msg *);
/* attribute modification */
extern void nlmsg_set_proto(struct nl_msg *, int);
extern int nlmsg_get_proto(struct nl_msg *);
extern size_t nlmsg_get_max_size(struct nl_msg *);
extern void nlmsg_set_src(struct nl_msg *, struct sockaddr_nl *);
extern struct sockaddr_nl *nlmsg_get_src(struct nl_msg *);
extern void nlmsg_set_dst(struct nl_msg *, struct sockaddr_nl *);
extern struct sockaddr_nl *nlmsg_get_dst(struct nl_msg *);
extern void nlmsg_set_creds(struct nl_msg *, struct ucred *);
extern struct ucred * nlmsg_get_creds(struct nl_msg *);
extern char * nl_nlmsgtype2str(int, char *, size_t);
extern int nl_str2nlmsgtype(const char *);
extern char * nl_nlmsg_flags2str(int, char *, size_t);
extern int nl_msg_parse(struct nl_msg *,
void (*cb)(struct nl_object *, void *),
void *);
extern void nl_msg_dump(struct nl_msg *, FILE *);
/**
* @name Iterators
* @{
*/
/**
* @ingroup msg
* Iterate over a stream of attributes in a message
* @arg pos loop counter, set to current attribute
* @arg nlh netlink message header
* @arg hdrlen length of family header
* @arg rem initialized to len, holds bytes currently remaining in stream
*/
#define nlmsg_for_each_attr(pos, nlh, hdrlen, rem) \
nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \
nlmsg_attrlen(nlh, hdrlen), rem)
/**
* Iterate over a stream of messages
* @arg pos loop counter, set to current message
* @arg head head of message stream
* @arg len length of message stream
*/
#define nlmsg_for_each(pos, head, len) \
for (int rem = len, pos = head; \
nlmsg_ok(pos, rem); \
pos = nlmsg_next(pos, &rem))
#define nlmsg_for_each_msg(pos, head, len, rem) \
nlmsg_for_each(pos, head, len)
/** @} */
#ifdef __cplusplus
}
#endif
#endif
errno.h 0000644 00000002350 15051120407 0006035 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_ERRNO_H_
#define NETLINK_ERRNO_H_
#ifdef __cplusplus
extern "C" {
#endif
#define NLE_SUCCESS 0
#define NLE_FAILURE 1
#define NLE_INTR 2
#define NLE_BAD_SOCK 3
#define NLE_AGAIN 4
#define NLE_NOMEM 5
#define NLE_EXIST 6
#define NLE_INVAL 7
#define NLE_RANGE 8
#define NLE_MSGSIZE 9
#define NLE_OPNOTSUPP 10
#define NLE_AF_NOSUPPORT 11
#define NLE_OBJ_NOTFOUND 12
#define NLE_NOATTR 13
#define NLE_MISSING_ATTR 14
#define NLE_AF_MISMATCH 15
#define NLE_SEQ_MISMATCH 16
#define NLE_MSG_OVERFLOW 17
#define NLE_MSG_TRUNC 18
#define NLE_NOADDR 19
#define NLE_SRCRT_NOSUPPORT 20
#define NLE_MSG_TOOSHORT 21
#define NLE_MSGTYPE_NOSUPPORT 22
#define NLE_OBJ_MISMATCH 23
#define NLE_NOCACHE 24
#define NLE_BUSY 25
#define NLE_PROTO_MISMATCH 26
#define NLE_NOACCESS 27
#define NLE_PERM 28
#define NLE_PKTLOC_FILE 29
#define NLE_PARSE_ERR 30
#define NLE_NODEV 31
#define NLE_IMMUTABLE 32
#define NLE_DUMP_INTR 33
#define NLE_ATTRSIZE 34
#define NLE_MAX NLE_ATTRSIZE
extern const char * nl_geterror(int);
extern void nl_perror(int, const char *);
extern int nl_syserr2nlerr(int);
#ifdef __cplusplus
}
#endif
#endif
addr.h 0000644 00000004025 15051120407 0005623 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_ADDR_H_
#define NETLINK_ADDR_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nlattr;
struct nl_addr;
/* Creation */
extern struct nl_addr * nl_addr_alloc(size_t);
extern struct nl_addr * nl_addr_alloc_attr(const struct nlattr *, int);
extern struct nl_addr * nl_addr_build(int, const void *, size_t);
extern int nl_addr_parse(const char *, int, struct nl_addr **);
extern struct nl_addr * nl_addr_clone(const struct nl_addr *);
/* Usage Management */
extern struct nl_addr * nl_addr_get(struct nl_addr *);
extern void nl_addr_put(struct nl_addr *);
extern int nl_addr_shared(const struct nl_addr *);
extern int nl_addr_cmp(const struct nl_addr *,
const struct nl_addr *);
extern int nl_addr_cmp_prefix(const struct nl_addr *,
const struct nl_addr *);
extern int nl_addr_iszero(const struct nl_addr *);
extern int nl_addr_valid(const char *, int);
extern int nl_addr_guess_family(const struct nl_addr *);
extern int nl_addr_fill_sockaddr(const struct nl_addr *,
struct sockaddr *, socklen_t *);
extern int nl_addr_info(const struct nl_addr *,
struct addrinfo **);
extern int nl_addr_resolve(const struct nl_addr *, char *, size_t);
/* Access Functions */
extern void nl_addr_set_family(struct nl_addr *, int);
extern int nl_addr_get_family(const struct nl_addr *);
extern int nl_addr_set_binary_addr(struct nl_addr *, const void *,
size_t);
extern void * nl_addr_get_binary_addr(const struct nl_addr *);
extern unsigned int nl_addr_get_len(const struct nl_addr *);
extern void nl_addr_set_prefixlen(struct nl_addr *, int);
extern unsigned int nl_addr_get_prefixlen(const struct nl_addr *);
/* Address Family Translations */
extern char * nl_af2str(int, char *, size_t);
extern int nl_str2af(const char *);
/* Translations to Strings */
extern char * nl_addr2str(const struct nl_addr *, char *, size_t);
#ifdef __cplusplus
}
#endif
#endif
data.h 0000644 00000001511 15051120407 0005617 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_DATA_H_
#define NETLINK_DATA_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nlattr;
struct nl_data;
/* General */
extern struct nl_data * nl_data_alloc(const void *, size_t);
extern struct nl_data * nl_data_alloc_attr(const struct nlattr *);
extern struct nl_data * nl_data_clone(const struct nl_data *);
extern int nl_data_append(struct nl_data *, const void *, size_t);
extern void nl_data_free(struct nl_data *);
/* Access Functions */
extern void * nl_data_get(const struct nl_data *);
extern size_t nl_data_get_size(const struct nl_data *);
/* Misc */
extern int nl_data_cmp(const struct nl_data *,
const struct nl_data *);
#ifdef __cplusplus
}
#endif
#endif
netlink.h 0000644 00000005620 15051120407 0006357 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_NETLINK_H_
#define NETLINK_NETLINK_H_
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <poll.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/time.h>
#include <netdb.h>
#include <netlink/netlink-compat.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/genetlink.h>
#include <linux/netfilter/nfnetlink.h>
#include <netinet/tcp.h>
#include <netlink/version.h>
#include <netlink/errno.h>
#include <netlink/types.h>
#include <netlink/handlers.h>
#include <netlink/socket.h>
#include <netlink/object.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nlmsghdr;
struct ucred;
struct nl_cache_ops;
struct nl_parser_param;
struct nl_object;
struct nl_sock;
extern int nl_debug;
extern struct nl_dump_params nl_debug_dp;
/* Connection Management */
extern int nl_connect(struct nl_sock *, int);
extern void nl_close(struct nl_sock *);
/* Send */
extern int nl_sendto(struct nl_sock *, void *, size_t);
extern int nl_sendmsg(struct nl_sock *, struct nl_msg *,
struct msghdr *);
extern int nl_send(struct nl_sock *, struct nl_msg *);
extern int nl_send_iovec(struct nl_sock *, struct nl_msg *,
struct iovec *, unsigned);
extern void nl_complete_msg(struct nl_sock *,
struct nl_msg *);
extern void nl_auto_complete(struct nl_sock *,
struct nl_msg *);
extern int nl_send_auto(struct nl_sock *, struct nl_msg *);
extern int nl_send_auto_complete(struct nl_sock *,
struct nl_msg *);
extern int nl_send_sync(struct nl_sock *, struct nl_msg *);
extern int nl_send_simple(struct nl_sock *, int, int,
void *, size_t);
/* Receive */
extern int nl_recv(struct nl_sock *,
struct sockaddr_nl *, unsigned char **,
struct ucred **);
extern int nl_recvmsgs(struct nl_sock *, struct nl_cb *);
extern int nl_recvmsgs_report(struct nl_sock *, struct nl_cb *);
extern int nl_recvmsgs_default(struct nl_sock *);
extern int nl_wait_for_ack(struct nl_sock *);
extern int nl_pickup(struct nl_sock *,
int (*parser)(struct nl_cache_ops *,
struct sockaddr_nl *,
struct nlmsghdr *,
struct nl_parser_param *),
struct nl_object **);
extern int nl_pickup_keep_syserr(struct nl_sock *sk,
int (*parser)(struct nl_cache_ops *, struct sockaddr_nl *,
struct nlmsghdr *, struct nl_parser_param *),
struct nl_object **result,
int *syserror);
/* Netlink Family Translations */
extern char * nl_nlfamily2str(int, char *, size_t);
extern int nl_str2nlfamily(const char *);
#ifdef __cplusplus
}
#endif
#endif
attr.h 0000644 00000022466 15051120407 0005674 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_ATTR_H_
#define NETLINK_ATTR_H_
#include <netlink/netlink.h>
#include <netlink/object.h>
#include <netlink/addr.h>
#include <netlink/data.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nlattr;
struct nl_msg;
/**
* @name Basic Attribute Data Types
* @{
*/
/**
* @ingroup attr
* Basic attribute data types
*
* See section @core_doc{core_attr_parse,Attribute Parsing} for more details.
*/
enum {
NLA_UNSPEC, /**< Unspecified type, binary data chunk */
NLA_U8, /**< 8 bit integer */
NLA_U16, /**< 16 bit integer */
NLA_U32, /**< 32 bit integer */
NLA_U64, /**< 64 bit integer */
NLA_STRING, /**< NUL terminated character string */
NLA_FLAG, /**< Flag */
NLA_MSECS, /**< Micro seconds (64bit) */
NLA_NESTED, /**< Nested attributes */
NLA_NESTED_COMPAT,
NLA_NUL_STRING,
NLA_BINARY,
NLA_S8,
NLA_S16,
NLA_S32,
NLA_S64,
__NLA_TYPE_MAX,
};
#define NLA_TYPE_MAX (__NLA_TYPE_MAX - 1)
/** @} */
/**
* @ingroup attr
* Attribute validation policy.
*
* See section @core_doc{core_attr_parse,Attribute Parsing} for more details.
*/
struct nla_policy {
/** Type of attribute or NLA_UNSPEC */
uint16_t type;
/** Minimal length of payload required */
uint16_t minlen;
/** Maximal length of payload allowed */
uint16_t maxlen;
};
/* Size calculations */
extern int nla_attr_size(int payload);
extern int nla_total_size(int payload);
extern int nla_padlen(int payload);
/* Attribute parsing */
extern int nla_type(const struct nlattr *);
extern void * nla_data(const struct nlattr *);
extern int nla_len(const struct nlattr *);
extern int nla_ok(const struct nlattr *, int);
extern struct nlattr * nla_next(const struct nlattr *, int *);
extern int nla_parse(struct nlattr **, int, struct nlattr *,
int, const struct nla_policy *);
extern int nla_validate(const struct nlattr *, int, int,
const struct nla_policy *);
extern struct nlattr * nla_find(const struct nlattr *, int, int);
/* Helper Functions */
extern int nla_memcpy(void *, const struct nlattr *, int);
extern size_t nla_strlcpy(char *, const struct nlattr *, size_t);
extern int nla_memcmp(const struct nlattr *, const void *, size_t);
extern int nla_strcmp(const struct nlattr *, const char *);
/* Unspecific attribute */
extern struct nlattr * nla_reserve(struct nl_msg *, int, int);
extern int nla_put(struct nl_msg *, int, int, const void *);
extern int nla_put_data(struct nl_msg *, int,
const struct nl_data *);
extern int nla_put_addr(struct nl_msg *, int, struct nl_addr *);
/* Integer attribute */
extern int8_t nla_get_s8(const struct nlattr *);
extern int nla_put_s8(struct nl_msg *, int, int8_t);
extern uint8_t nla_get_u8(const struct nlattr *);
extern int nla_put_u8(struct nl_msg *, int, uint8_t);
extern int16_t nla_get_s16(const struct nlattr *);
extern int nla_put_s16(struct nl_msg *, int, int16_t);
extern uint16_t nla_get_u16(const struct nlattr *);
extern int nla_put_u16(struct nl_msg *, int, uint16_t);
extern int32_t nla_get_s32(const struct nlattr *);
extern int nla_put_s32(struct nl_msg *, int, int32_t);
extern uint32_t nla_get_u32(const struct nlattr *);
extern int nla_put_u32(struct nl_msg *, int, uint32_t);
extern int64_t nla_get_s64(const struct nlattr *);
extern int nla_put_s64(struct nl_msg *, int, int64_t);
extern uint64_t nla_get_u64(const struct nlattr *);
extern int nla_put_u64(struct nl_msg *, int, uint64_t);
/* String attribute */
extern char * nla_get_string(const struct nlattr *);
extern char * nla_strdup(const struct nlattr *);
extern int nla_put_string(struct nl_msg *, int, const char *);
/* Flag attribute */
extern int nla_get_flag(const struct nlattr *);
extern int nla_put_flag(struct nl_msg *, int);
/* Msec attribute */
extern unsigned long nla_get_msecs(const struct nlattr *);
extern int nla_put_msecs(struct nl_msg *, int, unsigned long);
/* Attribute nesting */
extern int nla_put_nested(struct nl_msg *, int,
const struct nl_msg *);
extern struct nlattr * nla_nest_start(struct nl_msg *, int);
extern int nla_nest_end(struct nl_msg *, struct nlattr *);
extern int nla_nest_end_keep_empty(struct nl_msg *, struct nlattr *);
extern void nla_nest_cancel(struct nl_msg *, const struct nlattr *);
extern int nla_parse_nested(struct nlattr **, int, struct nlattr *,
const struct nla_policy *);
extern int nla_is_nested(const struct nlattr *);
/**
* @name Attribute Construction (Exception Based)
* @{
*/
/**
* @ingroup attr
* Add unspecific attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg attrlen Length of attribute payload.
* @arg data Head of attribute payload.
*/
#define NLA_PUT(msg, attrtype, attrlen, data) \
do { \
if (nla_put(msg, attrtype, attrlen, data) < 0) \
goto nla_put_failure; \
} while(0)
/**
* @ingroup attr
* Add atomic type attribute to netlink message.
* @arg msg Netlink message.
* @arg type Atomic type.
* @arg attrtype Attribute type.
* @arg value Head of attribute payload.
*/
#define NLA_PUT_TYPE(msg, type, attrtype, value) \
do { \
type __tmp = value; \
NLA_PUT(msg, attrtype, sizeof(type), &__tmp); \
} while(0)
/**
* Add 8 bit signed integer attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value Numeric value.
*/
#define NLA_PUT_S8(msg, attrtype, value) \
NLA_PUT_TYPE(msg, int8_t, attrtype, value)
/**
* Add 8 bit integer attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value Numeric value.
*/
#define NLA_PUT_U8(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint8_t, attrtype, value)
/**
* Add 16 bit signed integer attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value Numeric value.
*/
#define NLA_PUT_S16(msg, attrtype, value) \
NLA_PUT_TYPE(msg, int16_t, attrtype, value)
/**
* Add 16 bit integer attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value Numeric value.
*/
#define NLA_PUT_U16(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint16_t, attrtype, value)
/**
* Add 32 bit signed integer attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value Numeric value.
*/
#define NLA_PUT_S32(msg, attrtype, value) \
NLA_PUT_TYPE(msg, int32_t, attrtype, value)
/**
* Add 32 bit integer attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value Numeric value.
*/
#define NLA_PUT_U32(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint32_t, attrtype, value)
/**
* Add 64 bit signed integer attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value Numeric value.
*/
#define NLA_PUT_S64(msg, attrtype, value) \
NLA_PUT_TYPE(msg, int64_t, attrtype, value)
/**
* Add 64 bit integer attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value Numeric value.
*/
#define NLA_PUT_U64(msg, attrtype, value) \
NLA_PUT_TYPE(msg, uint64_t, attrtype, value)
/**
* Add string attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg value NUL terminated character string.
*/
#define NLA_PUT_STRING(msg, attrtype, value) \
NLA_PUT(msg, attrtype, (int) strlen(value) + 1, value)
/**
* Add flag attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
*/
#define NLA_PUT_FLAG(msg, attrtype) \
NLA_PUT(msg, attrtype, 0, NULL)
/**
* Add msecs attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg msecs Numeric value in micro seconds.
*/
#define NLA_PUT_MSECS(msg, attrtype, msecs) \
NLA_PUT_U64(msg, attrtype, msecs)
/**
* Add address attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg addr Abstract address object.
*/
#define NLA_PUT_ADDR(msg, attrtype, addr) \
NLA_PUT(msg, attrtype, nl_addr_get_len(addr), \
nl_addr_get_binary_addr(addr))
/**
* Add abstract data attribute to netlink message.
* @arg msg Netlink message.
* @arg attrtype Attribute type.
* @arg data Abstract data object.
*/
#define NLA_PUT_DATA(msg, attrtype, data) \
NLA_PUT(msg, attrtype, nl_data_get_size(data), \
nl_data_get(data))
/** @} */
/**
* @name Iterators
* @{
*/
/**
* @ingroup attr
* Iterate over a stream of attributes
* @arg pos loop counter, set to current attribute
* @arg head head of attribute stream
* @arg len length of attribute stream
* @arg rem initialized to len, holds bytes currently remaining in stream
*/
#define nla_for_each_attr(pos, head, len, rem) \
for (pos = head, rem = len; \
nla_ok(pos, rem); \
pos = nla_next(pos, &(rem)))
/**
* @ingroup attr
* Iterate over a stream of nested attributes
* @arg pos loop counter, set to current attribute
* @arg nla attribute containing the nested attributes
* @arg rem initialized to len, holds bytes currently remaining in stream
*/
#define nla_for_each_nested(pos, nla, rem) \
for (pos = (struct nlattr *) nla_data(nla), rem = nla_len(nla); \
nla_ok(pos, rem); \
pos = nla_next(pos, &(rem)))
/** @} */
#ifdef __cplusplus
}
#endif
#endif
types.h 0000644 00000003662 15051120407 0006063 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_TYPES_H_
#define __NETLINK_TYPES_H_
#include <stdio.h>
/**
* @ingroup utils
* Enumeration of dumping variations (dp_type)
*/
enum nl_dump_type {
NL_DUMP_LINE, /**< Dump object briefly on one line */
NL_DUMP_DETAILS, /**< Dump all attributes but no statistics */
NL_DUMP_STATS, /**< Dump all attributes including statistics */
__NL_DUMP_MAX,
};
#define NL_DUMP_MAX (__NL_DUMP_MAX - 1)
/**
* @ingroup utils
* Dumping parameters
*/
struct nl_dump_params
{
/**
* Specifies the type of dump that is requested.
*/
enum nl_dump_type dp_type;
/**
* Specifies the number of whitespaces to be put in front
* of every new line (indentation).
*/
int dp_prefix;
/**
* Causes the cache index to be printed for each element.
*/
int dp_print_index;
/**
* Causes each element to be prefixed with the message type.
*/
int dp_dump_msgtype;
/**
* A callback invoked for output
*
* Passed arguments are:
* - dumping parameters
* - string to append to the output
*/
void (*dp_cb)(struct nl_dump_params *, char *);
/**
* A callback invoked for every new line, can be used to
* customize the indentation.
*
* Passed arguments are:
* - dumping parameters
* - line number starting from 0
*/
void (*dp_nl_cb)(struct nl_dump_params *, int);
/**
* User data pointer, can be used to pass data to callbacks.
*/
void *dp_data;
/**
* File descriptor the dumping output should go to
*/
FILE * dp_fd;
/**
* Alternatively the output may be redirected into a buffer
*/
char * dp_buf;
/**
* Length of the buffer dp_buf
*/
size_t dp_buflen;
/**
* PRIVATE
* Set if a dump was performed prior to the actual dump handler.
*/
int dp_pre_dump;
/**
* PRIVATE
* Owned by the current caller
*/
int dp_ivar;
unsigned int dp_line;
};
#endif
cli/addr.h 0000644 00000002017 15051120407 0006371 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_ADDR_H_
#define __NETLINK_CLI_ADDR_H_
#include <netlink/route/addr.h>
#ifdef __cplusplus
extern "C" {
#endif
#define nl_cli_addr_alloc_cache(sk) \
nl_cli_alloc_cache((sk), "address", rtnl_addr_alloc_cache)
extern struct rtnl_addr *nl_cli_addr_alloc(void);
extern void nl_cli_addr_parse_family(struct rtnl_addr *, char *);
extern void nl_cli_addr_parse_local(struct rtnl_addr *, char *);
extern void nl_cli_addr_parse_dev(struct rtnl_addr *, struct nl_cache *,char *);
extern void nl_cli_addr_parse_label(struct rtnl_addr *, char *);
extern void nl_cli_addr_parse_peer(struct rtnl_addr *, char *);
extern void nl_cli_addr_parse_scope(struct rtnl_addr *, char *);
extern void nl_cli_addr_parse_broadcast(struct rtnl_addr *, char *);
extern void nl_cli_addr_parse_preferred(struct rtnl_addr *, char *);
extern void nl_cli_addr_parse_valid(struct rtnl_addr *, char *);
#ifdef __cplusplus
}
#endif
#endif
cli/qdisc.h 0000644 00000000712 15051120407 0006562 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_QDISC_H_
#define __NETLINK_CLI_QDISC_H_
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
#define nl_cli_qdisc_alloc_cache(sk) \
nl_cli_alloc_cache((sk), "queueing disciplines", \
rtnl_qdisc_alloc_cache)
extern struct rtnl_qdisc *nl_cli_qdisc_alloc(void);
#ifdef __cplusplus
}
#endif
#endif
cli/tc.h 0000644 00000002265 15051120407 0006072 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2010-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_TC_H_
#define __NETLINK_CLI_TC_H_
#include <netlink/route/tc.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_tc_ops;
extern void nl_cli_tc_parse_dev(struct rtnl_tc *, struct nl_cache *, char *);
extern void nl_cli_tc_parse_parent(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_handle(struct rtnl_tc *, char *, int);
extern void nl_cli_tc_parse_mtu(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_mpu(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_overhead(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_linktype(struct rtnl_tc *, char *);
extern void nl_cli_tc_parse_kind(struct rtnl_tc *, char *);
struct nl_cli_tc_module
{
const char * tm_name;
enum rtnl_tc_type tm_type;
struct rtnl_tc_ops * tm_ops;
void (*tm_parse_argv)(struct rtnl_tc *, int, char **);
struct nl_list_head tm_list;
};
extern struct nl_cli_tc_module *nl_cli_tc_lookup(struct rtnl_tc_ops *);
extern void nl_cli_tc_register(struct nl_cli_tc_module *);
extern void nl_cli_tc_unregister(struct nl_cli_tc_module *);
#ifdef __cplusplus
}
#endif
#endif
cli/neigh.h 0000644 00000001500 15051120407 0006545 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_NEIGH_H_
#define __NETLINK_CLI_NEIGH_H_
#include <netlink/route/neighbour.h>
#ifdef __cplusplus
extern "C" {
#endif
#define nl_cli_neigh_alloc_cache(sk) \
nl_cli_alloc_cache_flags((sk), "neighbour", NL_CACHE_AF_ITER, \
rtnl_neigh_alloc_cache_flags)
extern struct rtnl_neigh *nl_cli_neigh_alloc(void);
extern void nl_cli_neigh_parse_dst(struct rtnl_neigh *, char *);
extern void nl_cli_neigh_parse_lladdr(struct rtnl_neigh *, char *);
extern void nl_cli_neigh_parse_dev(struct rtnl_neigh *, struct nl_cache *, char *);
extern void nl_cli_neigh_parse_family(struct rtnl_neigh *, char *);
extern void nl_cli_neigh_parse_state(struct rtnl_neigh *, char *);
#ifdef __cplusplus
}
#endif
#endif
cli/utils.h 0000644 00000004256 15051120407 0006626 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2009 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_UTILS_H_
#define __NETLINK_CLI_UTILS_H_
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <limits.h>
#include <inttypes.h>
#include <errno.h>
#include <stdint.h>
#include <ctype.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netlink/netlink.h>
#include <netlink/utils.h>
#include <netlink/addr.h>
#include <netlink/list.h>
#include <netlink/route/rtnl.h>
#include <netlink/route/link.h>
#include <netlink/route/addr.h>
#include <netlink/route/neighbour.h>
#include <netlink/route/neightbl.h>
#include <netlink/route/route.h>
#include <netlink/route/rule.h>
#include <netlink/route/qdisc.h>
#include <netlink/route/class.h>
#include <netlink/route/classifier.h>
#include <netlink/route/cls/ematch.h>
#include <netlink/fib_lookup/lookup.h>
#include <netlink/fib_lookup/request.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
#include <netlink/genl/mngt.h>
#include <netlink/netfilter/ct.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __init
#define __init __attribute__((constructor))
#endif
#ifndef __exit
#define __exit __attribute__((destructor))
#endif
extern uint32_t nl_cli_parse_u32(const char *);
extern void nl_cli_print_version(void)
__attribute__((noreturn));
extern void nl_cli_fatal(int, const char *, ...)
__attribute__((noreturn));
extern struct nl_addr * nl_cli_addr_parse(const char *, int);
extern int nl_cli_connect(struct nl_sock *, int);
extern struct nl_sock * nl_cli_alloc_socket(void);
extern int nl_cli_parse_dumptype(const char *);
extern int nl_cli_confirm(struct nl_object *,
struct nl_dump_params *, int);
extern struct nl_cache *nl_cli_alloc_cache(struct nl_sock *, const char *,
int (*ac)(struct nl_sock *, struct nl_cache **));
extern struct nl_cache *nl_cli_alloc_cache_flags(struct nl_sock *, const char *,
unsigned int flags,
int (*ac)(struct nl_sock *, struct nl_cache **, unsigned int));
extern void nl_cli_load_module(const char *, const char *);
#ifdef __cplusplus
}
#endif
#endif
cli/link.h 0000644 00000002230 15051120407 0006411 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_LINK_H_
#define __NETLINK_CLI_LINK_H_
#include <netlink/route/link.h>
#include <netlink/cli/utils.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *nl_cli_link_alloc(void);
extern struct nl_cache *nl_cli_link_alloc_cache_family(struct nl_sock *, int);
extern struct nl_cache *nl_cli_link_alloc_cache_family_flags(struct nl_sock *, int,
unsigned int);
extern struct nl_cache *nl_cli_link_alloc_cache(struct nl_sock *);
extern struct nl_cache *nl_cli_link_alloc_cache_flags(struct nl_sock *,
unsigned int);
extern void nl_cli_link_parse_family(struct rtnl_link *, char *);
extern void nl_cli_link_parse_name(struct rtnl_link *, char *);
extern void nl_cli_link_parse_mtu(struct rtnl_link *, char *);
extern void nl_cli_link_parse_ifindex(struct rtnl_link *, char *);
extern void nl_cli_link_parse_txqlen(struct rtnl_link *, char *);
extern void nl_cli_link_parse_weight(struct rtnl_link *, char *);
extern void nl_cli_link_parse_ifalias(struct rtnl_link *, char *);
#ifdef __cplusplus
}
#endif
#endif
cli/route.h 0000644 00000002345 15051120407 0006621 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_ROUTE_H_
#define __NETLINK_CLI_ROUTE_H_
#include <netlink/route/route.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_route *nl_cli_route_alloc(void);
extern struct nl_cache *nl_cli_route_alloc_cache(struct nl_sock *, int);
extern void nl_cli_route_parse_family(struct rtnl_route *, char *);
extern void nl_cli_route_parse_dst(struct rtnl_route *, char *);
extern void nl_cli_route_parse_src(struct rtnl_route *, char *);
extern void nl_cli_route_parse_pref_src(struct rtnl_route *, char *);
extern void nl_cli_route_parse_metric(struct rtnl_route *, char *);
extern void nl_cli_route_parse_nexthop(struct rtnl_route *, char *, struct nl_cache *);
extern void nl_cli_route_parse_table(struct rtnl_route *, char *);
extern void nl_cli_route_parse_prio(struct rtnl_route *, char *);
extern void nl_cli_route_parse_scope(struct rtnl_route *, char *);
extern void nl_cli_route_parse_protocol(struct rtnl_route *, char *);
extern void nl_cli_route_parse_type(struct rtnl_route *, char *);
extern void nl_cli_route_parse_iif(struct rtnl_route *, char *, struct nl_cache *);
#ifdef __cplusplus
}
#endif
#endif
cli/ct.h 0000644 00000002351 15051120407 0006066 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_CT_H_
#define __NETLINK_CLI_CT_H_
#include <netlink/netfilter/ct.h>
#include <linux/netfilter/nf_conntrack_common.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct nfnl_ct *nl_cli_ct_alloc(void);
extern struct nl_cache *nl_cli_ct_alloc_cache(struct nl_sock *);
extern void nl_cli_ct_parse_family(struct nfnl_ct *, char *);
extern void nl_cli_ct_parse_protocol(struct nfnl_ct *, char *);
extern void nl_cli_ct_parse_mark(struct nfnl_ct *, char *);
extern void nl_cli_ct_parse_timeout(struct nfnl_ct *, char *);
extern void nl_cli_ct_parse_id(struct nfnl_ct *, char *);
extern void nl_cli_ct_parse_use(struct nfnl_ct *, char *);
extern void nl_cli_ct_parse_src(struct nfnl_ct *, int, char *);
extern void nl_cli_ct_parse_dst(struct nfnl_ct *, int, char *);
extern void nl_cli_ct_parse_src_port(struct nfnl_ct *, int, char *);
extern void nl_cli_ct_parse_dst_port(struct nfnl_ct *, int, char *);
extern void nl_cli_ct_parse_tcp_state(struct nfnl_ct *, char *);
extern void nl_cli_ct_parse_status(struct nfnl_ct *, char *);
extern void nl_cli_ct_parse_zone(struct nfnl_ct *, char *);
#ifdef __cplusplus
}
#endif
#endif
cli/class.h 0000644 00000000656 15051120407 0006573 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_CLASS_H_
#define __NETLINK_CLI_CLASS_H_
#include <netlink/route/class.h>
#include <netlink/cli/tc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_class *nl_cli_class_alloc(void);
extern struct nl_cache *nl_cli_class_alloc_cache(struct nl_sock *, int);
#ifdef __cplusplus
}
#endif
#endif
cli/cls.h 0000644 00000001127 15051120407 0006241 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_CLS_H_
#define __NETLINK_CLI_CLS_H_
#include <netlink/route/classifier.h>
#include <netlink/cli/tc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_cls * nl_cli_cls_alloc(void);
extern struct nl_cache * nl_cli_cls_alloc_cache(struct nl_sock *,
int, uint32_t);
extern void nl_cli_cls_parse_proto(struct rtnl_cls *, char *);
extern struct rtnl_ematch_tree *nl_cli_cls_parse_ematch(struct rtnl_cls *, char *);
#ifdef __cplusplus
}
#endif
#endif
cli/rule.h 0000644 00000000716 15051120407 0006432 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_RULE_H_
#define __NETLINK_CLI_RULE_H_
#include <netlink/route/rule.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_rule *nl_cli_rule_alloc(void);
extern struct nl_cache *nl_cli_rule_alloc_cache(struct nl_sock *);
extern void nl_cli_rule_parse_family(struct rtnl_rule *, char *);
#ifdef __cplusplus
}
#endif
#endif
cli/mdb.h 0000644 00000000406 15051120407 0006221 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
#ifndef __NETLINK_CLI_MDB_H_
#define __NETLINK_CLI_MDB_H_
#include <netlink/route/mdb.h>
#define nl_cli_mdb_alloc_cache(sk) \
nl_cli_alloc_cache_flags((sk), "mdb", NL_CACHE_AF_ITER, rtnl_mdb_alloc_cache)
#endif
cli/exp.h 0000644 00000003150 15051120407 0006252 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2012 Rich Fought <Rich.Fought@watchguard.com>
* Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
*/
#ifndef __NETLINK_CLI_EXP_H_
#define __NETLINK_CLI_EXP_H_
#include <netlink/netfilter/exp.h>
#include <linux/netfilter/nf_conntrack_common.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct nfnl_exp *nl_cli_exp_alloc(void);
extern struct nl_cache *nl_cli_exp_alloc_cache(struct nl_sock *);
extern void nl_cli_exp_parse_family(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_timeout(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_id(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_helper_name(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_zone(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_flags(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_class(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_nat_dir(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_fn(struct nfnl_exp *, char *);
extern void nl_cli_exp_parse_src(struct nfnl_exp *, int, char *);
extern void nl_cli_exp_parse_dst(struct nfnl_exp *, int, char *);
extern void nl_cli_exp_parse_l4protonum(struct nfnl_exp *, int, char *);
extern void nl_cli_exp_parse_src_port(struct nfnl_exp *, int, char *);
extern void nl_cli_exp_parse_dst_port(struct nfnl_exp *, int, char *);
extern void nl_cli_exp_parse_icmp_id(struct nfnl_exp *, int, char *);
extern void nl_cli_exp_parse_icmp_type(struct nfnl_exp *, int, char *);
extern void nl_cli_exp_parse_icmp_code(struct nfnl_exp *, int, char *);
#ifdef __cplusplus
}
#endif
#endif
utils.h 0000644 00000030141 15051120407 0006047 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_UTILS_H_
#define NETLINK_UTILS_H_
#include <netlink/netlink.h>
#include <netlink/list.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__GNUC__) && __GNUC__ > 5
#define _nl_attribute_printf(a, b) __attribute__((__format__(printf, a, b)))
#else
#define _nl_attribute_printf(a, b)
#endif
/**
* @name Probability Constants
* @{
*/
/**
* Lower probability limit
* @ingroup utils
*/
#define NL_PROB_MIN 0x0
/**
* Upper probability limit nl_dump_type
* @ingroup utils
*/
#define NL_PROB_MAX 0xffffffff
/** @} */
enum {
NL_BYTE_RATE,
NL_BIT_RATE,
};
/* unit pretty-printing */
extern double nl_cancel_down_bytes(unsigned long long, char **);
extern double nl_cancel_down_bits(unsigned long long, char **);
extern int nl_rate2str(unsigned long long, int, char *, size_t);
extern double nl_cancel_down_us(uint32_t, char **);
/* generic unit translations */
extern long nl_size2int(const char *);
extern char * nl_size2str(const size_t, char *, const size_t);
extern long nl_prob2int(const char *);
/* time translations */
extern int nl_get_user_hz(void);
extern int nl_get_psched_hz(void);
extern uint32_t nl_us2ticks(uint32_t);
extern uint32_t nl_ticks2us(uint32_t);
extern int nl_str2msec(const char *, uint64_t *);
extern char * nl_msec2str(uint64_t, char *, size_t);
/* link layer protocol translations */
extern char * nl_llproto2str(int, char *, size_t);
extern int nl_str2llproto(const char *);
/* ethernet protocol translations */
extern char * nl_ether_proto2str(int, char *, size_t);
extern int nl_str2ether_proto(const char *);
/* IP protocol translations */
extern char * nl_ip_proto2str(int, char *, size_t);
extern int nl_str2ip_proto(const char *);
/* Dumping helpers */
extern void nl_new_line(struct nl_dump_params *);
extern void nl_dump(struct nl_dump_params *, const char *, ...) _nl_attribute_printf(2, 3);
extern void nl_dump_line(struct nl_dump_params *, const char *, ...) _nl_attribute_printf(2, 3);
enum {
NL_CAPABILITY_NONE,
/**
* rtnl_route_build_msg() no longer guesses the route scope
* if explicitly set to RT_SCOPE_NOWHERE.
* @ingroup utils
*/
NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE = 1,
#define NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE
/**
* rtnl_link_veth_get_peer() now returns a reference that is owned by the
* caller and must be released by the caller with rtnl_link_put().
*/
NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE = 2,
#define NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE
/**
* rtnl_u32_add_action() and rtnl_basic_add_action() now grab a reference to act
* caller are free to release its own
*/
NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE = 3,
#define NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE
/**
* Indicate that the local port is unspecified until the user accesses
* it (via nl_socket_get_local_port()) or until nl_connect(). More importantly,
* if the port is left unspecified, nl_connect() will retry generating another
* port when bind() fails with ADDRINUSE.
*/
NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE = 4,
#define NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE
/**
* Indicate that rtnl_link_get_kernel() fails with -NLE_OPNOTSUPP in case
* of older kernals not supporting lookup by ifname. This changes behavior
* from returning -NLE_INVAL to return -NLE_OPNOTSUPP.
*/
NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP = 5,
#define NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP
/**
* Also consider the a_cacheinfo field (ADDR_ATTR_CACHEINFO) that contains the
* address timestamps and expiry when comparing struct rtnl_addr objects with
* nl_object_diff().
*/
NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO = 6,
#define NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO
/**
* The library version is libnl3 3.2.26 or newer. This capability should never be backported.
*/
NL_CAPABILITY_VERSION_3_2_26 = 7,
#define NL_CAPABILITY_VERSION_3_2_26 NL_CAPABILITY_VERSION_3_2_26
/**
* nl_recv() fails with NLE_MSG_TRUNC if a message got truncated
* with NL_MSG_PEEK disabled. Previously, the failed message was wrongly
* discarded and the next message received.
*/
NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK = 8,
#define NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK
/**
* rtnl_link_build_change_request() and rtnl_link_change() would set ifi.ifi_flags but leave
* ifi.ifi_change at zero. This was later fixed to set ifi.ifi_change to the flags that are actually
* set in changes.
*/
NL_CAPABILITY_LINK_BUILD_CHANGE_REQUEST_SET_CHANGE = 9,
#define NL_CAPABILITY_LINK_BUILD_CHANGE_REQUEST_SET_CHANGE NL_CAPABILITY_LINK_BUILD_CHANGE_REQUEST_SET_CHANGE
/**
* Between 3.2.14 (64fcb47a36ec12d7e7f00605f6a8952ce985dd08) and 3.2.22 (8571f58f23763d8db7365d02c9b27832ad3d7005),
* rtnl_neigh_get() behaved differently and only returned objects with family AF_UNSPEC.
* This capability indicates, that the function was fixed. The absense of the capability,
* doesn't indicate however which behavior the function will have. So beware. */
NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX = 10,
#define NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX
/**
* The library version is libnl3 3.2.27 or newer. This capability should never be backported.
*/
NL_CAPABILITY_VERSION_3_2_27 = 11,
#define NL_CAPABILITY_VERSION_3_2_27 NL_CAPABILITY_VERSION_3_2_27
/**
* Properly serialize vlan protocol IFLA_VLAN_PROTOCOL.
*/
NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE = 12,
#define NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE
/**
* Properly read gre REMOTE port.
*/
NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE = 13,
#define NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE
/**
* Don't skip over vlan ingress-map entries with "to" field zero when serializing
* a netlink message. Previously such entires would be ignored which inhibits the
* user from clearing ingress map entries.
*/
NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR = 14,
#define NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR
/**
* Consider vxlan link info for nl_object_diff().
*/
NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE = 15,
#define NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE
/**
* Support 64 bit attributes for nl_object_diff().
*/
NL_CAPABILITY_NL_OBJECT_DIFF64 = 16,
#define NL_CAPABILITY_NL_OBJECT_DIFF64 NL_CAPABILITY_NL_OBJECT_DIFF64
/**
* Support omitting @key argument to xfrmnl_sa_get_*_params() to check
* for required buffer size for key.
*/
NL_CAPABILITY_XFRM_SA_KEY_SIZE = 17,
#define NL_CAPABILITY_XFRM_SA_KEY_SIZE NL_CAPABILITY_XFRM_SA_KEY_SIZE
/**
* Properly handle nl_object_identity() for AF_INET and AF_INET6 addresses
* and properly handle the peer/IFA_ADDRESS for IPv4 addresses.
*/
NL_CAPABILITY_RTNL_ADDR_PEER_FIX = 18,
#define NL_CAPABILITY_RTNL_ADDR_PEER_FIX NL_CAPABILITY_RTNL_ADDR_PEER_FIX
/**
* The library version is libnl3 3.2.28 or newer. This capability should never be backported.
*/
NL_CAPABILITY_VERSION_3_2_28 = 19,
#define NL_CAPABILITY_VERSION_3_2_28 NL_CAPABILITY_VERSION_3_2_28
/**
* After NL_CAPABILITY_RTNL_ADDR_PEER_FIX, a follow up regression to lookup
* IPv4 addresses in the cache was fixed (PR#105).
*/
NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX = 20,
#define NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX
/**
* nl_addr_fill_sockaddr() properly checks that the provided address to
* avoid read-out-of-bounds for invalid addresses.
*/
NL_CAPABILITY_NL_ADDR_FILL_SOCKADDR = 21,
#define NL_CAPABILITY_NL_ADDR_FILL_SOCKADDR NL_CAPABILITY_NL_ADDR_FILL_SOCKADDR
/**
* Support omitting @ctx_str argument to xfrmnl_sa_get_sec_ctx() to check
* for required buffer size for context string.
*/
NL_CAPABILITY_XFRM_SEC_CTX_LEN = 22,
#define NL_CAPABILITY_XFRM_SEC_CTX_LEN NL_CAPABILITY_XFRM_SEC_CTX_LEN
/**
* rtnl_link_build_add_request() would set ifi.ifi_flags but leave ifi.ifi_change at zero.
* This was later fixed to set ifi.ifi_change to the flags that are actually
* set
*/
NL_CAPABILITY_LINK_BUILD_ADD_REQUEST_SET_CHANGE = 23,
#define NL_CAPABILITY_LINK_BUILD_ADD_REQUEST_SET_CHANGE NL_CAPABILITY_LINK_BUILD_ADD_REQUEST_SET_CHANGE
/* Older versions of libnl3 would not use MSG_PEEK for nl_recvmsgs() unless calling
* nl_socket_enable_msg_peek(). Instead, the user had to specify the buffer size via
* nl_socket_set_msg_buf_size(), which in turn would default to 4*getpagesize().
*
* The default value might not be large enough, so users who were not aware of the
* problem easily ended up using a too small receive buffer. Usually, one wants to
* avoid MSG_PEEK for recvmsg() because it requires an additional syscall.
*
* Now, as indicated by this capability, nl_recvmsgs() would use MSG_PEEK by default. The
* user still can explicitly disable MSG_PEEK by calling nl_socket_disable_msg_peek() or
* by setting the nl_socket_set_msg_buf_size() to a non-zero value.
*/
NL_CAPABILITY_NL_RECVMSGS_PEEK_BY_DEFAULT = 24,
#define NL_CAPABILITY_NL_RECVMSGS_PEEK_BY_DEFAULT NL_CAPABILITY_NL_RECVMSGS_PEEK_BY_DEFAULT
/**
* The library version is libnl3 3.2.29 or newer. This capability should never be backported.
*/
NL_CAPABILITY_VERSION_3_2_29 = 25,
#define NL_CAPABILITY_VERSION_3_2_29 NL_CAPABILITY_VERSION_3_2_29
/**
* Support omitting @ctx_str argument to xfrmnl_sp_get_sec_ctx() to check
* for required buffer size for context string.
*/
NL_CAPABILITY_XFRM_SP_SEC_CTX_LEN = 26,
#define NL_CAPABILITY_XFRM_SP_SEC_CTX_LEN NL_CAPABILITY_XFRM_SP_SEC_CTX_LEN
/**
* The library version is libnl3 3.3.0 or newer. This capability should never be backported.
*/
NL_CAPABILITY_VERSION_3_3_0 = 27,
#define NL_CAPABILITY_VERSION_3_3_0 NL_CAPABILITY_VERSION_3_3_0
/**
* The library version is libnl3 3.4.0 or newer. This capability should never be backported.
*/
NL_CAPABILITY_VERSION_3_4_0 = 28,
#define NL_CAPABILITY_VERSION_3_4_0 NL_CAPABILITY_VERSION_3_4_0
/**
* Fixed memory corruption in rtnl_link_vlan_set_egress_map(). Previously, if you tried
* to add more then 4 mappings, a buffer overflow occured. Also fixed nl_object_clone()
* for VLAN links.
*/
NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP = 29,
#define NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP
/**
* The library version is libnl3 3.5.0 or newer. This capability should never be backported.
*/
NL_CAPABILITY_VERSION_3_5_0 = 30,
#define NL_CAPABILITY_VERSION_3_5_0 NL_CAPABILITY_VERSION_3_5_0
/**
* nl_object_identical() can consider objects identical, if they both lack the same
* set of ID attributes.
*/
NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL = 31,
#define NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL
/**
* The library version is libnl3 3.6.0 or newer. This capability should never be backported.
*/
NL_CAPABILITY_VERSION_3_6_0 = 32,
#define NL_CAPABILITY_VERSION_3_6_0 NL_CAPABILITY_VERSION_3_6_0
/**
* The library version is libnl3 3.7.0 or newer. This capability should never be backported.
*/
NL_CAPABILITY_VERSION_3_7_0 = 33,
#define NL_CAPABILITY_VERSION_3_7_0 NL_CAPABILITY_VERSION_3_7_0
__NL_CAPABILITY_MAX,
NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
#define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
/**
* The range 0x7000 to 0x7FFF is reserved for private capabilities. Upstream libnl3 will
* not register capabilities in this range. However, instead of adding private capabilities,
* better register their number with upstream libnl3. */
#define NL_CAPABILITY_IS_USER_RESERVED(cap) ( ((cap) & ~0x0FFF) == 0x7000 )
};
int nl_has_capability (int capability);
#ifdef __cplusplus
}
#endif
#endif
netfilter/nfnl.h 0000644 00000002040 15051120407 0007635 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
* Copyright (c) 2007 Secure Computing Corporation
*/
#ifndef NETLINK_NFNL_H_
#define NETLINK_NFNL_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NFNL_HDRLEN NLMSG_ALIGN(sizeof(struct nfgenmsg))
#define NFNLMSG_TYPE(subsys, subtype) (((subsys) << 8) | (subtype))
extern int nfnl_connect(struct nl_sock *);
extern uint8_t nfnlmsg_subsys(struct nlmsghdr *);
extern uint8_t nfnlmsg_subtype(struct nlmsghdr *);
extern uint8_t nfnlmsg_family(struct nlmsghdr *);
extern uint16_t nfnlmsg_res_id(struct nlmsghdr *);
extern int nfnl_send_simple(struct nl_sock *, uint8_t, uint8_t,
int, uint8_t, uint16_t);
extern struct nl_msg * nfnlmsg_alloc_simple(uint8_t, uint8_t, int,
uint8_t, uint16_t);
extern int nfnlmsg_put(struct nl_msg *, uint32_t, uint32_t,
uint8_t, uint8_t, int, uint8_t, uint16_t);
#ifdef __cplusplus
}
#endif
#endif
netfilter/queue_msg.h 0000644 00000010543 15051120407 0010701 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2007, 2008 Patrick McHardy <kaber@trash.net>
*/
#ifndef NETLINK_QUEUE_MSG_H_
#define NETLINK_QUEUE_MSG_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nl_sock;
struct nlmsghdr;
struct nfnl_queue_msg;
extern struct nl_object_ops queue_msg_obj_ops;
/* General */
extern struct nfnl_queue_msg * nfnl_queue_msg_alloc(void);
extern int nfnlmsg_queue_msg_parse(struct nlmsghdr *,
struct nfnl_queue_msg **);
extern void nfnl_queue_msg_get(struct nfnl_queue_msg *);
extern void nfnl_queue_msg_put(struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_group(struct nfnl_queue_msg *, uint16_t);
extern int nfnl_queue_msg_test_group(const struct nfnl_queue_msg *);
extern uint16_t nfnl_queue_msg_get_group(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_family(struct nfnl_queue_msg *, uint8_t);
extern int nfnl_queue_msg_test_family(const struct nfnl_queue_msg *);
extern uint8_t nfnl_queue_msg_get_family(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_packetid(struct nfnl_queue_msg *, uint32_t);
extern int nfnl_queue_msg_test_packetid(const struct nfnl_queue_msg *);
extern uint32_t nfnl_queue_msg_get_packetid(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_hwproto(struct nfnl_queue_msg *, uint16_t);
extern int nfnl_queue_msg_test_hwproto(const struct nfnl_queue_msg *);
extern uint16_t nfnl_queue_msg_get_hwproto(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_hook(struct nfnl_queue_msg *, uint8_t);
extern int nfnl_queue_msg_test_hook(const struct nfnl_queue_msg *);
extern uint8_t nfnl_queue_msg_get_hook(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_mark(struct nfnl_queue_msg *, uint32_t);
extern int nfnl_queue_msg_test_mark(const struct nfnl_queue_msg *);
extern uint32_t nfnl_queue_msg_get_mark(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_timestamp(struct nfnl_queue_msg *,
struct timeval *);
extern int nfnl_queue_msg_test_timestamp(const struct nfnl_queue_msg *);
extern const struct timeval * nfnl_queue_msg_get_timestamp(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_indev(struct nfnl_queue_msg *, uint32_t);
extern int nfnl_queue_msg_test_indev(const struct nfnl_queue_msg *);
extern uint32_t nfnl_queue_msg_get_indev(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_outdev(struct nfnl_queue_msg *, uint32_t);
extern int nfnl_queue_msg_test_outdev(const struct nfnl_queue_msg *);
extern uint32_t nfnl_queue_msg_get_outdev(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_physindev(struct nfnl_queue_msg *, uint32_t);
extern int nfnl_queue_msg_test_physindev(const struct nfnl_queue_msg *);
extern uint32_t nfnl_queue_msg_get_physindev(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_physoutdev(struct nfnl_queue_msg *, uint32_t);
extern int nfnl_queue_msg_test_physoutdev(const struct nfnl_queue_msg *);
extern uint32_t nfnl_queue_msg_get_physoutdev(const struct nfnl_queue_msg *);
extern void nfnl_queue_msg_set_hwaddr(struct nfnl_queue_msg *, uint8_t *, int);
extern int nfnl_queue_msg_test_hwaddr(const struct nfnl_queue_msg *);
extern const uint8_t * nfnl_queue_msg_get_hwaddr(const struct nfnl_queue_msg *, int *);
extern int nfnl_queue_msg_set_payload(struct nfnl_queue_msg *, uint8_t *, int);
extern int nfnl_queue_msg_test_payload(const struct nfnl_queue_msg *);
extern const void * nfnl_queue_msg_get_payload(const struct nfnl_queue_msg *, int *);
extern void nfnl_queue_msg_set_verdict(struct nfnl_queue_msg *,
unsigned int);
extern int nfnl_queue_msg_test_verdict(const struct nfnl_queue_msg *);
extern unsigned int nfnl_queue_msg_get_verdict(const struct nfnl_queue_msg *);
extern struct nl_msg * nfnl_queue_msg_build_verdict(const struct nfnl_queue_msg *);
extern int nfnl_queue_msg_send_verdict(struct nl_sock *,
const struct nfnl_queue_msg *);
extern struct nl_msg * nfnl_queue_msg_build_verdict_batch(const struct nfnl_queue_msg *msg);
extern int nfnl_queue_msg_send_verdict_batch(struct nl_sock *,
const struct nfnl_queue_msg *);
extern int nfnl_queue_msg_send_verdict_payload(struct nl_sock *,
const struct nfnl_queue_msg *,
const void *, unsigned );
#ifdef __cplusplus
}
#endif
#endif
netfilter/netfilter.h 0000644 00000001002 15051120407 0010671 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008 Patrick McHardy <kaber@trash.net>
*/
#ifndef NETLINK_NETFILTER_H_
#define NETLINK_NETFILTER_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
extern char * nfnl_verdict2str(unsigned int, char *, size_t);
extern unsigned int nfnl_str2verdict(const char *);
extern char * nfnl_inet_hook2str(unsigned int, char *, size_t);
extern unsigned int nfnl_str2inet_hook(const char *);
#ifdef __cplusplus
}
#endif
#endif
netfilter/ct.h 0000644 00000012117 15051120407 0007314 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
* Copyright (c) 2007 Secure Computing Corporation
*/
#ifndef NETLINK_CT_H_
#define NETLINK_CT_H_
#include <netlink/netlink.h>
#include <netlink/addr.h>
#include <netlink/cache.h>
#include <netlink/msg.h>
#include <netlink/attr.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nfnl_ct;
struct nfnl_ct_timestamp {
uint64_t start;
uint64_t stop;
};
extern struct nl_object_ops ct_obj_ops;
extern struct nfnl_ct * nfnl_ct_alloc(void);
extern int nfnl_ct_alloc_cache(struct nl_sock *, struct nl_cache **);
extern int nfnlmsg_ct_group(struct nlmsghdr *);
extern int nfnlmsg_ct_parse(struct nlmsghdr *, struct nfnl_ct **);
extern int nfnlmsg_ct_parse_nested(struct nlattr *, struct nfnl_ct **);
extern void nfnl_ct_get(struct nfnl_ct *);
extern void nfnl_ct_put(struct nfnl_ct *);
extern int nfnl_ct_dump_request(struct nl_sock *);
extern int nfnl_ct_build_add_request(const struct nfnl_ct *, int,
struct nl_msg **);
extern int nfnl_ct_add(struct nl_sock *, const struct nfnl_ct *, int);
extern int nfnl_ct_build_delete_request(const struct nfnl_ct *, int,
struct nl_msg **);
extern int nfnl_ct_del(struct nl_sock *, const struct nfnl_ct *, int);
extern int nfnl_ct_build_query_request(const struct nfnl_ct *, int,
struct nl_msg **);
extern int nfnl_ct_query(struct nl_sock *, const struct nfnl_ct *, int);
extern void nfnl_ct_set_family(struct nfnl_ct *, uint8_t);
extern uint8_t nfnl_ct_get_family(const struct nfnl_ct *);
extern void nfnl_ct_set_proto(struct nfnl_ct *, uint8_t);
extern int nfnl_ct_test_proto(const struct nfnl_ct *);
extern uint8_t nfnl_ct_get_proto(const struct nfnl_ct *);
extern void nfnl_ct_set_tcp_state(struct nfnl_ct *, uint8_t);
extern int nfnl_ct_test_tcp_state(const struct nfnl_ct *);
extern uint8_t nfnl_ct_get_tcp_state(const struct nfnl_ct *);
extern char * nfnl_ct_tcp_state2str(uint8_t, char *, size_t);
extern int nfnl_ct_str2tcp_state(const char *name);
extern void nfnl_ct_set_status(struct nfnl_ct *, uint32_t);
extern void nfnl_ct_unset_status(struct nfnl_ct *, uint32_t);
extern int nfnl_ct_test_status(const struct nfnl_ct *ct);
extern uint32_t nfnl_ct_get_status(const struct nfnl_ct *);
extern char * nfnl_ct_status2str(int, char *, size_t);
extern int nfnl_ct_str2status(const char *);
extern void nfnl_ct_set_timeout(struct nfnl_ct *, uint32_t);
extern int nfnl_ct_test_timeout(const struct nfnl_ct *);
extern uint32_t nfnl_ct_get_timeout(const struct nfnl_ct *);
extern void nfnl_ct_set_mark(struct nfnl_ct *, uint32_t);
extern int nfnl_ct_test_mark(const struct nfnl_ct *);
extern uint32_t nfnl_ct_get_mark(const struct nfnl_ct *);
extern void nfnl_ct_set_use(struct nfnl_ct *, uint32_t);
extern int nfnl_ct_test_use(const struct nfnl_ct *);
extern uint32_t nfnl_ct_get_use(const struct nfnl_ct *);
extern void nfnl_ct_set_id(struct nfnl_ct *, uint32_t);
extern int nfnl_ct_test_id(const struct nfnl_ct *);
extern uint32_t nfnl_ct_get_id(const struct nfnl_ct *);
extern void nfnl_ct_set_zone(struct nfnl_ct *, uint16_t);
extern int nfnl_ct_test_zone(const struct nfnl_ct *);
extern uint16_t nfnl_ct_get_zone(const struct nfnl_ct *);
extern int nfnl_ct_set_src(struct nfnl_ct *, int, struct nl_addr *);
extern struct nl_addr * nfnl_ct_get_src(const struct nfnl_ct *, int);
extern int nfnl_ct_set_dst(struct nfnl_ct *, int, struct nl_addr *);
extern struct nl_addr * nfnl_ct_get_dst(const struct nfnl_ct *, int);
extern void nfnl_ct_set_src_port(struct nfnl_ct *, int, uint16_t);
extern int nfnl_ct_test_src_port(const struct nfnl_ct *, int);
extern uint16_t nfnl_ct_get_src_port(const struct nfnl_ct *, int);
extern void nfnl_ct_set_dst_port(struct nfnl_ct *, int, uint16_t);
extern int nfnl_ct_test_dst_port(const struct nfnl_ct *, int);
extern uint16_t nfnl_ct_get_dst_port(const struct nfnl_ct *, int);
extern void nfnl_ct_set_icmp_id(struct nfnl_ct *, int, uint16_t);
extern int nfnl_ct_test_icmp_id(const struct nfnl_ct *, int);
extern uint16_t nfnl_ct_get_icmp_id(const struct nfnl_ct *, int);
extern void nfnl_ct_set_icmp_type(struct nfnl_ct *, int, uint8_t);
extern int nfnl_ct_test_icmp_type(const struct nfnl_ct *, int);
extern uint8_t nfnl_ct_get_icmp_type(const struct nfnl_ct *, int);
extern void nfnl_ct_set_icmp_code(struct nfnl_ct *, int, uint8_t);
extern int nfnl_ct_test_icmp_code(const struct nfnl_ct *, int);
extern uint8_t nfnl_ct_get_icmp_code(const struct nfnl_ct *, int);
extern void nfnl_ct_set_packets(struct nfnl_ct *, int, uint64_t);
extern int nfnl_ct_test_packets(const struct nfnl_ct *, int);
extern uint64_t nfnl_ct_get_packets(const struct nfnl_ct *,int);
extern void nfnl_ct_set_bytes(struct nfnl_ct *, int, uint64_t);
extern int nfnl_ct_test_bytes(const struct nfnl_ct *, int);
extern uint64_t nfnl_ct_get_bytes(const struct nfnl_ct *, int);
extern void nfnl_ct_set_timestamp(struct nfnl_ct *, uint64_t, uint64_t);
extern int nfnl_ct_test_timestamp(const struct nfnl_ct *);
extern const struct nfnl_ct_timestamp *nfnl_ct_get_timestamp(const struct nfnl_ct *);
#ifdef __cplusplus
}
#endif
#endif
netfilter/log_msg.h 0000644 00000012341 15051120407 0010334 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
* Copyright (c) 2007 Secure Computing Corporation
* Copyright (c) 2008 Patrick McHardy <kaber@trash.net>
*/
#ifndef NETLINK_LOG_MSG_H_
#define NETLINK_LOG_MSG_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nlmsghdr;
struct nfnl_log_msg;
struct nfnl_ct;
extern struct nl_object_ops log_msg_obj_ops;
/* General */
extern struct nfnl_log_msg *nfnl_log_msg_alloc(void);
extern int nfnlmsg_log_msg_parse(struct nlmsghdr *,
struct nfnl_log_msg **);
extern void nfnl_log_msg_get(struct nfnl_log_msg *);
extern void nfnl_log_msg_put(struct nfnl_log_msg *);
extern void nfnl_log_msg_set_family(struct nfnl_log_msg *, uint8_t);
extern uint8_t nfnl_log_msg_get_family(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_hwproto(struct nfnl_log_msg *, uint16_t);
extern int nfnl_log_msg_test_hwproto(const struct nfnl_log_msg *);
extern uint16_t nfnl_log_msg_get_hwproto(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_hook(struct nfnl_log_msg *, uint8_t);
extern int nfnl_log_msg_test_hook(const struct nfnl_log_msg *);
extern uint8_t nfnl_log_msg_get_hook(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_mark(struct nfnl_log_msg *, uint32_t);
extern int nfnl_log_msg_test_mark(const struct nfnl_log_msg *);
extern uint32_t nfnl_log_msg_get_mark(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_timestamp(struct nfnl_log_msg *,
struct timeval *);
extern const struct timeval *nfnl_log_msg_get_timestamp(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_indev(struct nfnl_log_msg *, uint32_t);
extern uint32_t nfnl_log_msg_get_indev(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_outdev(struct nfnl_log_msg *, uint32_t);
extern uint32_t nfnl_log_msg_get_outdev(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_physindev(struct nfnl_log_msg *, uint32_t);
extern uint32_t nfnl_log_msg_get_physindev(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_physoutdev(struct nfnl_log_msg *, uint32_t);
extern uint32_t nfnl_log_msg_get_physoutdev(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_hwaddr(struct nfnl_log_msg *, uint8_t *, int);
extern const uint8_t * nfnl_log_msg_get_hwaddr(const struct nfnl_log_msg *, int *);
extern int nfnl_log_msg_set_payload(struct nfnl_log_msg *, uint8_t *, int);
extern const void * nfnl_log_msg_get_payload(const struct nfnl_log_msg *, int *);
extern int nfnl_log_msg_set_prefix(struct nfnl_log_msg *, void *);
extern const char * nfnl_log_msg_get_prefix(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_uid(struct nfnl_log_msg *, uint32_t);
extern int nfnl_log_msg_test_uid(const struct nfnl_log_msg *);
extern uint32_t nfnl_log_msg_get_uid(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_gid(struct nfnl_log_msg *, uint32_t);
extern int nfnl_log_msg_test_gid(const struct nfnl_log_msg *);
extern uint32_t nfnl_log_msg_get_gid(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_seq(struct nfnl_log_msg *, uint32_t);
extern int nfnl_log_msg_test_seq(const struct nfnl_log_msg *);
extern uint32_t nfnl_log_msg_get_seq(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_seq_global(struct nfnl_log_msg *, uint32_t);
extern int nfnl_log_msg_test_seq_global(const struct nfnl_log_msg *);
extern uint32_t nfnl_log_msg_get_seq_global(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_hwtype(struct nfnl_log_msg *, uint16_t);
extern int nfnl_log_msg_test_hwtype(const struct nfnl_log_msg *);
extern uint16_t nfnl_log_msg_get_hwtype(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_hwlen(struct nfnl_log_msg *, uint16_t);
extern int nfnl_log_msg_test_hwlen(const struct nfnl_log_msg *);
extern uint16_t nfnl_log_msg_get_hwlen(const struct nfnl_log_msg *);
extern int nfnl_log_msg_set_hwheader(struct nfnl_log_msg *, void *, int);
extern int nfnl_log_msg_test_hwheader(const struct nfnl_log_msg *);
extern const void * nfnl_log_msg_get_hwheader(const struct nfnl_log_msg *, int *);
extern void nfnl_log_msg_set_vlan_proto(struct nfnl_log_msg *, uint16_t);
extern int nfnl_log_msg_test_vlan_proto(const struct nfnl_log_msg *);
extern uint16_t nfnl_log_msg_get_vlan_proto(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_vlan_tag(struct nfnl_log_msg *, uint16_t);
extern int nfnl_log_msg_test_vlan_tag(const struct nfnl_log_msg *);
extern uint16_t nfnl_log_msg_get_vlan_tag(const struct nfnl_log_msg *);
extern uint16_t nfnl_log_msg_get_vlan_id(const struct nfnl_log_msg *);
extern uint16_t nfnl_log_msg_get_vlan_cfi(const struct nfnl_log_msg *);
extern uint16_t nfnl_log_msg_get_vlan_prio(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_ct_info(struct nfnl_log_msg *, uint32_t);
extern int nfnl_log_msg_test_ct_info(const struct nfnl_log_msg *);
extern uint32_t nfnl_log_msg_get_ct_info(const struct nfnl_log_msg *);
extern void nfnl_log_msg_set_ct(struct nfnl_log_msg *, struct nfnl_ct *);
extern int nfnl_log_msg_test_ct(const struct nfnl_log_msg *);
extern struct nfnl_ct * nfnl_log_msg_get_ct(const struct nfnl_log_msg *);
#ifdef __cplusplus
}
#endif
#endif
netfilter/queue.h 0000644 00000004723 15051120407 0010036 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2007, 2008 Patrick McHardy <kaber@trash.net>
*/
#ifndef NETLINK_QUEUE_H_
#define NETLINK_QUEUE_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nl_sock;
struct nlmsghdr;
struct nfnl_queue;
extern struct nl_object_ops queue_obj_ops;
enum nfnl_queue_copy_mode {
NFNL_QUEUE_COPY_NONE,
NFNL_QUEUE_COPY_META,
NFNL_QUEUE_COPY_PACKET,
};
/* General */
extern struct nl_sock * nfnl_queue_socket_alloc(void);
extern struct nfnl_queue * nfnl_queue_alloc(void);
extern void nfnl_queue_get(struct nfnl_queue *);
extern void nfnl_queue_put(struct nfnl_queue *);
/* Attributes */
extern void nfnl_queue_set_group(struct nfnl_queue *, uint16_t);
extern int nfnl_queue_test_group(const struct nfnl_queue *);
extern uint16_t nfnl_queue_get_group(const struct nfnl_queue *);
extern void nfnl_queue_set_maxlen(struct nfnl_queue *, uint32_t);
extern int nfnl_queue_test_maxlen(const struct nfnl_queue *);
extern uint32_t nfnl_queue_get_maxlen(const struct nfnl_queue *);
extern void nfnl_queue_set_copy_mode(struct nfnl_queue *,
enum nfnl_queue_copy_mode);
extern int nfnl_queue_test_copy_mode(const struct nfnl_queue *);
extern enum nfnl_queue_copy_mode nfnl_queue_get_copy_mode(const struct nfnl_queue *);
extern char * nfnl_queue_copy_mode2str(enum nfnl_queue_copy_mode,
char *, size_t);
extern int nfnl_queue_str2copy_mode(const char *);
extern void nfnl_queue_set_copy_range(struct nfnl_queue *,
uint32_t);
extern int nfnl_queue_test_copy_range(const struct nfnl_queue *);
extern uint32_t nfnl_queue_get_copy_range(const struct nfnl_queue *);
extern int nfnl_queue_build_pf_bind(uint8_t, struct nl_msg **);
extern int nfnl_queue_pf_bind(struct nl_sock *, uint8_t);
extern int nfnl_queue_build_pf_unbind(uint8_t, struct nl_msg **);
extern int nfnl_queue_pf_unbind(struct nl_sock *, uint8_t);
extern int nfnl_queue_build_create_request(const struct nfnl_queue *,
struct nl_msg **);
extern int nfnl_queue_create(struct nl_sock *,
const struct nfnl_queue *);
extern int nfnl_queue_build_change_request(const struct nfnl_queue *,
struct nl_msg **);
extern int nfnl_queue_change(struct nl_sock *,
const struct nfnl_queue *);
extern int nfnl_queue_build_delete_request(const struct nfnl_queue *,
struct nl_msg **);
extern int nfnl_queue_delete(struct nl_sock *,
const struct nfnl_queue *);
#ifdef __cplusplus
}
#endif
#endif
netfilter/log.h 0000644 00000006601 15051120407 0007470 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
* Copyright (c) 2007 Secure Computing Corporation
* Copyright (c) 2008 Patrick McHardy <kaber@trash.net>
*/
#ifndef NETLINK_LOG_H_
#define NETLINK_LOG_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nl_sock;
struct nlmsghdr;
struct nfnl_log;
extern struct nl_object_ops log_obj_ops;
enum nfnl_log_copy_mode {
NFNL_LOG_COPY_NONE,
NFNL_LOG_COPY_META,
NFNL_LOG_COPY_PACKET,
};
enum nfnl_log_flags {
NFNL_LOG_FLAG_SEQ = 0x1,
NFNL_LOG_FLAG_SEQ_GLOBAL = 0x2,
NFNL_LOG_FLAG_CONNTRACK = 0x4,
};
/* General */
extern struct nfnl_log * nfnl_log_alloc(void);
extern int nfnlmsg_log_parse(struct nlmsghdr *,
struct nfnl_log **);
extern void nfnl_log_get(struct nfnl_log *);
extern void nfnl_log_put(struct nfnl_log *);
/* Attributes */
extern void nfnl_log_set_group(struct nfnl_log *, uint16_t);
extern int nfnl_log_test_group(const struct nfnl_log *);
extern uint16_t nfnl_log_get_group(const struct nfnl_log *);
extern void nfnl_log_set_copy_mode(struct nfnl_log *,
enum nfnl_log_copy_mode);
extern int nfnl_log_test_copy_mode(const struct nfnl_log *);
extern enum nfnl_log_copy_mode nfnl_log_get_copy_mode(const struct nfnl_log *);
extern char * nfnl_log_copy_mode2str(enum nfnl_log_copy_mode,
char *, size_t);
extern int nfnl_log_str2copy_mode(const char *);
extern void nfnl_log_set_copy_range(struct nfnl_log *, uint32_t);
extern int nfnl_log_test_copy_range(const struct nfnl_log *);
extern uint32_t nfnl_log_get_copy_range(const struct nfnl_log *);
extern void nfnl_log_set_flush_timeout(struct nfnl_log *, uint32_t);
extern int nfnl_log_test_flush_timeout(const struct nfnl_log *);
extern uint32_t nfnl_log_get_flush_timeout(const struct nfnl_log *);
extern void nfnl_log_set_alloc_size(struct nfnl_log *, uint32_t);
extern int nfnl_log_test_alloc_size(const struct nfnl_log *);
extern uint32_t nfnl_log_get_alloc_size(const struct nfnl_log *);
extern void nfnl_log_set_queue_threshold(struct nfnl_log *, uint32_t);
extern int nfnl_log_test_queue_threshold(const struct nfnl_log *);
extern uint32_t nfnl_log_get_queue_threshold(const struct nfnl_log *);
extern void nfnl_log_set_flags(struct nfnl_log *, unsigned int);
extern void nfnl_log_unset_flags(struct nfnl_log *, unsigned int);
extern unsigned int nfnl_log_get_flags(const struct nfnl_log *);
extern char * nfnl_log_flags2str(unsigned int, char *, size_t);
extern unsigned int nfnl_log_str2flags(const char *);
extern int nfnl_log_build_pf_bind(uint8_t, struct nl_msg **);
extern int nfnl_log_pf_bind(struct nl_sock *, uint8_t);
extern int nfnl_log_build_pf_unbind(uint8_t, struct nl_msg **);
extern int nfnl_log_pf_unbind(struct nl_sock *, uint8_t);
extern int nfnl_log_build_create_request(const struct nfnl_log *,
struct nl_msg **);
extern int nfnl_log_create(struct nl_sock *, const struct nfnl_log *);
extern int nfnl_log_build_change_request(const struct nfnl_log *,
struct nl_msg **);
extern int nfnl_log_change(struct nl_sock *, const struct nfnl_log *);
extern int nfnl_log_build_delete_request(const struct nfnl_log *,
struct nl_msg **);
extern int nfnl_log_delete(struct nl_sock *, const struct nfnl_log *);
#ifdef __cplusplus
}
#endif
#endif
netfilter/exp.h 0000644 00000011256 15051120407 0007505 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
* Copyright (c) 2007 Secure Computing Corporation
* Copyright (c) 2012 Rich Fought <rich.fought@watchguard.com>
*/
#ifndef NETLINK_EXP_H_
#define NETLINK_EXP_H_
#include <netlink/netlink.h>
#include <netlink/addr.h>
#include <netlink/cache.h>
#include <netlink/msg.h>
#include <linux/version.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nfnl_exp;
enum nfnl_exp_tuples {
NFNL_EXP_TUPLE_EXPECT,
NFNL_EXP_TUPLE_MASTER,
NFNL_EXP_TUPLE_MASK,
NFNL_EXP_TUPLE_NAT,
NFNL_EXP_TUPLE_MAX
};
extern struct nl_object_ops exp_obj_ops;
extern struct nfnl_exp * nfnl_exp_alloc(void);
extern int nfnl_exp_alloc_cache(struct nl_sock *, struct nl_cache **);
extern int nfnlmsg_exp_group(struct nlmsghdr *);
extern int nfnlmsg_exp_parse(struct nlmsghdr *, struct nfnl_exp **);
extern void nfnl_exp_get(struct nfnl_exp *);
extern void nfnl_exp_put(struct nfnl_exp *);
extern int nfnl_exp_dump_request(struct nl_sock *);
extern int nfnl_exp_build_add_request(const struct nfnl_exp *, int,
struct nl_msg **);
extern int nfnl_exp_add(struct nl_sock *, const struct nfnl_exp *, int);
extern int nfnl_exp_build_delete_request(const struct nfnl_exp *, int,
struct nl_msg **);
extern int nfnl_exp_del(struct nl_sock *, const struct nfnl_exp *, int);
extern int nfnl_exp_build_query_request(const struct nfnl_exp *, int,
struct nl_msg **);
extern int nfnl_exp_query(struct nl_sock *, const struct nfnl_exp *, int);
extern void nfnl_exp_set_family(struct nfnl_exp *, uint8_t);
extern uint8_t nfnl_exp_get_family(const struct nfnl_exp *);
extern void nfnl_exp_set_timeout(struct nfnl_exp *, uint32_t);
extern int nfnl_exp_test_timeout(const struct nfnl_exp *);
extern uint32_t nfnl_exp_get_timeout(const struct nfnl_exp *);
extern void nfnl_exp_set_id(struct nfnl_exp *, uint32_t);
extern int nfnl_exp_test_id(const struct nfnl_exp *);
extern uint32_t nfnl_exp_get_id(const struct nfnl_exp *);
extern int nfnl_exp_set_helper_name(struct nfnl_exp *, void *);
extern int nfnl_exp_test_helper_name(const struct nfnl_exp *);
extern const char * nfnl_exp_get_helper_name(const struct nfnl_exp *);
extern void nfnl_exp_set_zone(struct nfnl_exp *, uint16_t);
extern int nfnl_exp_test_zone(const struct nfnl_exp *);
extern uint16_t nfnl_exp_get_zone(const struct nfnl_exp *);
extern void nfnl_exp_set_flags(struct nfnl_exp *, uint32_t);
extern int nfnl_exp_test_flags(const struct nfnl_exp *);
extern void nfnl_exp_unset_flags(struct nfnl_exp *exp, uint32_t flags);
extern uint32_t nfnl_exp_get_flags(const struct nfnl_exp *);
extern char * nfnl_exp_flags2str(int flags, char *buf, size_t len);
int nfnl_exp_str2flags(const char *name);
extern void nfnl_exp_set_class(struct nfnl_exp *, uint32_t);
extern int nfnl_exp_test_class(const struct nfnl_exp *);
extern uint32_t nfnl_exp_get_class(const struct nfnl_exp *);
extern int nfnl_exp_set_fn(struct nfnl_exp *, void *);
extern int nfnl_exp_test_fn(const struct nfnl_exp *);
extern const char * nfnl_exp_get_fn(const struct nfnl_exp *);
extern void nfnl_exp_set_nat_dir(struct nfnl_exp *, uint8_t);
extern int nfnl_exp_test_nat_dir(const struct nfnl_exp *);
extern uint8_t nfnl_exp_get_nat_dir(const struct nfnl_exp *);
// The int argument specifies which nfnl_exp_dir (expect, master, mask or nat)
// Expectation objects only use orig, not reply
extern int nfnl_exp_set_src(struct nfnl_exp *, int, struct nl_addr *);
extern int nfnl_exp_test_src(const struct nfnl_exp *, int);
extern struct nl_addr * nfnl_exp_get_src(const struct nfnl_exp *, int);
extern int nfnl_exp_set_dst(struct nfnl_exp *, int, struct nl_addr *);
extern int nfnl_exp_test_dst(const struct nfnl_exp *, int);
extern struct nl_addr * nfnl_exp_get_dst(const struct nfnl_exp *, int);
extern void nfnl_exp_set_l4protonum(struct nfnl_exp *, int, uint8_t);
extern int nfnl_exp_test_l4protonum(const struct nfnl_exp *, int);
extern uint8_t nfnl_exp_get_l4protonum(const struct nfnl_exp *, int);
extern void nfnl_exp_set_ports(struct nfnl_exp *, int, uint16_t, uint16_t);
extern int nfnl_exp_test_ports(const struct nfnl_exp *, int);
extern uint16_t nfnl_exp_get_src_port(const struct nfnl_exp *, int);
extern uint16_t nfnl_exp_get_dst_port(const struct nfnl_exp *, int);
extern void nfnl_exp_set_icmp(struct nfnl_exp *, int, uint16_t, uint8_t, uint8_t);
extern int nfnl_exp_test_icmp(const struct nfnl_exp *, int);
extern uint16_t nfnl_exp_get_icmp_id(const struct nfnl_exp *, int);
extern uint8_t nfnl_exp_get_icmp_type(const struct nfnl_exp *, int);
extern uint8_t nfnl_exp_get_icmp_code(const struct nfnl_exp *, int);
#ifdef __cplusplus
}
#endif
#endif
netlink-compat.h 0000644 00000001447 15051120407 0007643 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_COMPAT_H_
#define NETLINK_COMPAT_H_
#if !defined _LINUX_SOCKET_H && !defined _BITS_SOCKADDR_H
typedef unsigned short sa_family_t;
#endif
#ifndef IFNAMSIZ
/** Maximum length of a interface name */
#define IFNAMSIZ 16
#endif
/* patch 2.4.x if_arp */
#ifndef ARPHRD_INFINIBAND
#define ARPHRD_INFINIBAND 32
#endif
/* patch 2.4.x eth header file */
#ifndef ETH_P_MPLS_UC
#define ETH_P_MPLS_UC 0x8847
#endif
#ifndef ETH_P_MPLS_MC
#define ETH_P_MPLS_MC 0x8848
#endif
#ifndef ETH_P_EDP2
#define ETH_P_EDP2 0x88A2
#endif
#ifndef ETH_P_HDLC
#define ETH_P_HDLC 0x0019
#endif
#ifndef AF_LLC
#define AF_LLC 26
#endif
#ifndef AF_MPLS
#define AF_MPLS 28
#endif
#endif
fib_lookup/request.h 0000644 00000002350 15051120407 0010531 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_FIB_LOOKUP_REQUEST_H_
#define NETLINK_FIB_LOOKUP_REQUEST_H_
#include <netlink/netlink.h>
#include <netlink/addr.h>
#ifdef __cplusplus
extern "C" {
#endif
struct flnl_request;
#define REQUEST_CAST(ptr) ((struct flnl_request *) (ptr))
extern struct flnl_request * flnl_request_alloc(void);
extern void flnl_request_set_fwmark(struct flnl_request *,
uint64_t);
extern uint64_t flnl_request_get_fwmark(struct flnl_request *);
extern void flnl_request_set_tos(struct flnl_request *,
int);
extern int flnl_request_get_tos(struct flnl_request *);
extern void flnl_request_set_scope(struct flnl_request *,
int);
extern int flnl_request_get_scope(struct flnl_request *);
extern void flnl_request_set_table(struct flnl_request *,
int);
extern int flnl_request_get_table(struct flnl_request *);
extern int flnl_request_set_addr(struct flnl_request *,
struct nl_addr *);
extern struct nl_addr * flnl_request_get_addr(struct flnl_request *);
extern int flnl_request_cmp(struct flnl_request *,
struct flnl_request *);
#ifdef __cplusplus
}
#endif
#endif
fib_lookup/lookup.h 0000644 00000002151 15051120407 0010351 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_FIB_LOOKUP_H_
#define NETLINK_FIB_LOOKUP_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <netlink/fib_lookup/request.h>
#ifdef __cplusplus
extern "C" {
#endif
struct flnl_result;
extern struct flnl_result * flnl_result_alloc(void);
extern void flnl_result_put(struct flnl_result *);
extern struct nl_cache * flnl_result_alloc_cache(void);
extern int flnl_lookup_build_request(struct flnl_request *,
int,
struct nl_msg **);
extern int flnl_lookup(struct nl_sock *,
struct flnl_request *,
struct nl_cache *);
extern int flnl_result_get_table_id(struct flnl_result *res);
extern int flnl_result_get_prefixlen(struct flnl_result *res);
extern int flnl_result_get_nexthop_sel(struct flnl_result *res);
extern int flnl_result_get_type(struct flnl_result *res);
extern int flnl_result_get_scope(struct flnl_result *res);
extern int flnl_result_get_error(struct flnl_result *res);
#ifdef __cplusplus
}
#endif
#endif
cache-api.h 0000644 00000000501 15051120407 0006516 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_DUMMY_CACHE_API_H_
#define NETLINK_DUMMY_CACHE_API_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#warning "You are including a deprecated header file, include <netlink/cache.h>."
#endif
object.h 0000644 00000004447 15051120407 0006167 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_OBJECT_H_
#define NETLINK_OBJECT_H_
#include <netlink/netlink.h>
#include <netlink/utils.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nl_cache;
struct nl_object;
struct nl_object_ops;
#define OBJ_CAST(ptr) ((struct nl_object *) (ptr))
/* General */
extern struct nl_object * nl_object_alloc(struct nl_object_ops *);
extern int nl_object_alloc_name(const char *,
struct nl_object **);
extern void nl_object_free(struct nl_object *);
extern struct nl_object * nl_object_clone(struct nl_object *obj);
extern int nl_object_update(struct nl_object *dst,
struct nl_object *src);
extern void nl_object_get(struct nl_object *);
extern void nl_object_put(struct nl_object *);
extern int nl_object_shared(struct nl_object *);
extern void nl_object_dump(struct nl_object *,
struct nl_dump_params *);
extern void nl_object_dump_buf(struct nl_object *, char *, size_t);
extern int nl_object_identical(struct nl_object *,
struct nl_object *);
extern uint32_t nl_object_diff(struct nl_object *,
struct nl_object *);
extern uint64_t nl_object_diff64(struct nl_object *,
struct nl_object *);
extern int nl_object_match_filter(struct nl_object *,
struct nl_object *);
extern char * nl_object_attrs2str(struct nl_object *,
uint32_t attrs, char *buf,
size_t);
extern char * nl_object_attr_list(struct nl_object *,
char *, size_t);
extern void nl_object_keygen(struct nl_object *,
uint32_t *, uint32_t);
/* Marks */
extern void nl_object_mark(struct nl_object *);
extern void nl_object_unmark(struct nl_object *);
extern int nl_object_is_marked(struct nl_object *);
/* Access Functions */
extern int nl_object_get_refcnt(struct nl_object *);
extern struct nl_cache * nl_object_get_cache(struct nl_object *);
extern const char * nl_object_get_type(const struct nl_object *);
extern int nl_object_get_msgtype(const struct nl_object *);
struct nl_object_ops * nl_object_get_ops(const struct nl_object *);
uint32_t nl_object_get_id_attrs(struct nl_object *obj);
static inline void * nl_object_priv(struct nl_object *obj)
{
return obj;
}
#ifdef __cplusplus
}
#endif
#endif
xfrm/template.h 0000644 00000011357 15051120407 0007506 0 ustar 00 /*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef NETLINK_XFRM_TEMPL_H_
#define NETLINK_XFRM_TEMPL_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <linux/xfrm.h>
#ifdef __cplusplus
extern "C" {
#endif
struct xfrmnl_user_tmpl;
/* Creation */
extern struct xfrmnl_user_tmpl* xfrmnl_user_tmpl_alloc(void);
extern struct xfrmnl_user_tmpl* xfrmnl_user_tmpl_clone(struct xfrmnl_user_tmpl*);
extern void xfrmnl_user_tmpl_free(struct xfrmnl_user_tmpl* utmpl);
/* Utility functions */
extern int xfrmnl_user_tmpl_cmp(struct xfrmnl_user_tmpl*, struct xfrmnl_user_tmpl*);
extern void xfrmnl_user_tmpl_dump(struct xfrmnl_user_tmpl*, struct nl_dump_params*);
/* Access Functions */
extern struct nl_addr* xfrmnl_user_tmpl_get_daddr (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_daddr (struct xfrmnl_user_tmpl*, struct nl_addr*);
extern int xfrmnl_user_tmpl_get_spi (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_spi (struct xfrmnl_user_tmpl*, unsigned int);
extern int xfrmnl_user_tmpl_get_proto (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_proto (struct xfrmnl_user_tmpl*, unsigned int);
extern int xfrmnl_user_tmpl_get_family (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_family (struct xfrmnl_user_tmpl*, unsigned int);
extern struct nl_addr* xfrmnl_user_tmpl_get_saddr (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_saddr (struct xfrmnl_user_tmpl*, struct nl_addr*);
extern int xfrmnl_user_tmpl_get_reqid (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_reqid (struct xfrmnl_user_tmpl*, unsigned int);
extern int xfrmnl_user_tmpl_get_mode (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_mode (struct xfrmnl_user_tmpl*, unsigned int);
extern int xfrmnl_user_tmpl_get_share (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_share (struct xfrmnl_user_tmpl*, unsigned int);
extern int xfrmnl_user_tmpl_get_optional (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_optional (struct xfrmnl_user_tmpl*, unsigned int);
extern int xfrmnl_user_tmpl_get_aalgos (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_aalgos (struct xfrmnl_user_tmpl*, unsigned int);
extern int xfrmnl_user_tmpl_get_ealgos (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_ealgos (struct xfrmnl_user_tmpl*, unsigned int);
extern int xfrmnl_user_tmpl_get_calgos (struct xfrmnl_user_tmpl*);
extern int xfrmnl_user_tmpl_set_calgos (struct xfrmnl_user_tmpl*, unsigned int);
extern char* xfrmnl_user_tmpl_mode2str(int, char *, size_t);
extern int xfrmnl_user_tmpl_str2mode(const char *);
#ifdef __cplusplus
}
#endif
#endif
xfrm/lifetime.h 0000644 00000010125 15051120407 0007461 0 ustar 00 /*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef NETLINK_XFRM_LTIME_H_
#define NETLINK_XFRM_LTIME_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <linux/xfrm.h>
#ifdef __cplusplus
extern "C" {
#endif
struct xfrmnl_ltime_cfg;
/* Creation */
extern struct xfrmnl_ltime_cfg* xfrmnl_ltime_cfg_alloc(void);
extern struct xfrmnl_ltime_cfg* xfrmnl_ltime_cfg_clone(struct xfrmnl_ltime_cfg*);
/* Usage Management */
extern struct xfrmnl_ltime_cfg* xfrmnl_ltime_cfg_get(struct xfrmnl_ltime_cfg*);
extern void xfrmnl_ltime_cfg_put(struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_shared(struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_cmp(struct xfrmnl_ltime_cfg*, struct xfrmnl_ltime_cfg*);
/* Access Functions */
extern unsigned long long xfrmnl_ltime_cfg_get_soft_bytelimit (struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_set_soft_bytelimit (struct xfrmnl_ltime_cfg*, unsigned long long);
extern unsigned long long xfrmnl_ltime_cfg_get_hard_bytelimit (struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_set_hard_bytelimit (struct xfrmnl_ltime_cfg*, unsigned long long);
extern unsigned long long xfrmnl_ltime_cfg_get_soft_packetlimit (struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_set_soft_packetlimit (struct xfrmnl_ltime_cfg*, unsigned long long);
extern unsigned long long xfrmnl_ltime_cfg_get_hard_packetlimit (struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_set_hard_packetlimit (struct xfrmnl_ltime_cfg*, unsigned long long);
extern unsigned long long xfrmnl_ltime_cfg_get_soft_addexpires (struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_set_soft_addexpires (struct xfrmnl_ltime_cfg*, unsigned long long);
extern unsigned long long xfrmnl_ltime_cfg_get_hard_addexpires (struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_set_hard_addexpires (struct xfrmnl_ltime_cfg*, unsigned long long);
extern unsigned long long xfrmnl_ltime_cfg_get_soft_useexpires (struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_set_soft_useexpires (struct xfrmnl_ltime_cfg*, unsigned long long);
extern unsigned long long xfrmnl_ltime_cfg_get_hard_useexpires (struct xfrmnl_ltime_cfg*);
extern int xfrmnl_ltime_cfg_set_hard_useexpires (struct xfrmnl_ltime_cfg*, unsigned long long);
#ifdef __cplusplus
}
#endif
#endif
xfrm/ae.h 0000644 00000012521 15051120407 0006252 0 ustar 00 /*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef NETLINK_XFRM_AE_H_
#define NETLINK_XFRM_AE_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <linux/xfrm.h>
#ifdef __cplusplus
extern "C" {
#endif
struct xfrmnl_ae;
extern struct xfrmnl_ae*xfrmnl_ae_alloc(void);
extern void xfrmnl_ae_put(struct xfrmnl_ae *);
extern int xfrmnl_ae_get_kernel(struct nl_sock*, struct nl_addr*, unsigned int, unsigned int,
unsigned int, unsigned int, struct xfrmnl_ae**);
extern int xfrmnl_ae_set(struct nl_sock*, struct xfrmnl_ae*, int);
extern int xfrmnl_ae_parse(struct nlmsghdr*, struct xfrmnl_ae **);
extern int xfrmnl_ae_build_get_request(struct nl_addr*, unsigned int, unsigned int,
unsigned int, unsigned int, struct nl_msg **);
extern struct nl_addr* xfrmnl_ae_get_daddr (struct xfrmnl_ae*);
extern int xfrmnl_ae_set_daddr (struct xfrmnl_ae*, struct nl_addr*);
extern int xfrmnl_ae_get_spi (struct xfrmnl_ae*);
extern int xfrmnl_ae_set_spi (struct xfrmnl_ae*, unsigned int);
extern int xfrmnl_ae_get_family (struct xfrmnl_ae*);
extern int xfrmnl_ae_set_family (struct xfrmnl_ae*, unsigned int);
extern int xfrmnl_ae_get_proto (struct xfrmnl_ae*);
extern int xfrmnl_ae_set_proto (struct xfrmnl_ae*, unsigned int);
extern struct nl_addr* xfrmnl_ae_get_saddr (struct xfrmnl_ae*);
extern int xfrmnl_ae_set_saddr (struct xfrmnl_ae*, struct nl_addr*);
extern int xfrmnl_ae_get_flags (struct xfrmnl_ae*);
extern int xfrmnl_ae_set_flags (struct xfrmnl_ae*, unsigned int);
extern int xfrmnl_ae_get_reqid (struct xfrmnl_ae*);
extern int xfrmnl_ae_set_reqid (struct xfrmnl_ae*, unsigned int);
extern int xfrmnl_ae_get_mark (struct xfrmnl_ae*, unsigned int*, unsigned int*);
extern int xfrmnl_ae_set_mark (struct xfrmnl_ae*, unsigned int, unsigned int);
extern int xfrmnl_ae_get_curlifetime (struct xfrmnl_ae*, unsigned long long int*,
unsigned long long int*, unsigned long long int*,
unsigned long long int*);
extern int xfrmnl_ae_set_curlifetime (struct xfrmnl_ae*, unsigned long long int,
unsigned long long int, unsigned long long int,
unsigned long long int);
extern int xfrmnl_ae_get_replay_maxage (struct xfrmnl_ae*);
extern int xfrmnl_ae_set_replay_maxage (struct xfrmnl_ae*, unsigned int);
extern int xfrmnl_ae_get_replay_maxdiff (struct xfrmnl_ae*);
extern int xfrmnl_ae_set_replay_maxdiff (struct xfrmnl_ae*, unsigned int);
extern int xfrmnl_ae_get_replay_state (struct xfrmnl_ae*, unsigned int*, unsigned int*, unsigned int*);
extern int xfrmnl_ae_set_replay_state (struct xfrmnl_ae*, unsigned int, unsigned int, unsigned int);
extern int xfrmnl_ae_get_replay_state_esn (struct xfrmnl_ae*, unsigned int*, unsigned int*, unsigned int*,
unsigned int*, unsigned int*, unsigned int*, unsigned int*);
extern int xfrmnl_ae_set_replay_state_esn (struct xfrmnl_ae*, unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int, unsigned int*);
extern char* xfrmnl_ae_flags2str(int, char *, size_t);
extern int xfrmnl_ae_str2flag(const char *);
#ifdef __cplusplus
}
#endif
#endif
xfrm/selector.h 0000644 00000010633 15051120407 0007507 0 ustar 00 /*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef NETLINK_XFRM_SEL_H_
#define NETLINK_XFRM_SEL_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <linux/xfrm.h>
#ifdef __cplusplus
extern "C" {
#endif
struct xfrmnl_sel;
/* Creation */
extern struct xfrmnl_sel* xfrmnl_sel_alloc(void);
extern struct xfrmnl_sel* xfrmnl_sel_clone(struct xfrmnl_sel*);
/* Usage Management */
extern struct xfrmnl_sel* xfrmnl_sel_get(struct xfrmnl_sel*);
extern void xfrmnl_sel_put(struct xfrmnl_sel*);
extern int xfrmnl_sel_shared(struct xfrmnl_sel*);
extern int xfrmnl_sel_cmp(struct xfrmnl_sel*, struct xfrmnl_sel*);
extern void xfrmnl_sel_dump(struct xfrmnl_sel*, struct nl_dump_params *);
/* Access Functions */
extern struct nl_addr* xfrmnl_sel_get_daddr (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_daddr (struct xfrmnl_sel*, struct nl_addr*);
extern struct nl_addr* xfrmnl_sel_get_saddr (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_saddr (struct xfrmnl_sel*, struct nl_addr*);
extern int xfrmnl_sel_get_dport (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_dport (struct xfrmnl_sel*, unsigned int);
extern int xfrmnl_sel_get_dportmask (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_dportmask (struct xfrmnl_sel*, unsigned int);
extern int xfrmnl_sel_get_sport (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_sport (struct xfrmnl_sel*, unsigned int);
extern int xfrmnl_sel_get_sportmask (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_sportmask (struct xfrmnl_sel*, unsigned int);
extern int xfrmnl_sel_get_family (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_family (struct xfrmnl_sel*, unsigned int);
extern int xfrmnl_sel_get_prefixlen_d (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_prefixlen_d (struct xfrmnl_sel*, unsigned int);
extern int xfrmnl_sel_get_prefixlen_s (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_prefixlen_s (struct xfrmnl_sel*, unsigned int);
extern int xfrmnl_sel_get_proto (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_proto (struct xfrmnl_sel*, unsigned int);
extern int xfrmnl_sel_get_ifindex (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_ifindex (struct xfrmnl_sel*, unsigned int);
extern int xfrmnl_sel_get_userid (struct xfrmnl_sel*);
extern int xfrmnl_sel_set_userid (struct xfrmnl_sel*, unsigned int);
#ifdef __cplusplus
}
#endif
#endif
xfrm/sa.h 0000644 00000024202 15051120407 0006267 0 ustar 00 /*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef NETLINK_XFRM_SA_H_
#define NETLINK_XFRM_SA_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <linux/xfrm.h>
#ifdef __cplusplus
extern "C" {
#endif
struct xfrmnl_sa;
extern struct xfrmnl_sa* xfrmnl_sa_alloc(void);
extern void xfrmnl_sa_put(struct xfrmnl_sa *);
extern int xfrmnl_sa_alloc_cache(struct nl_sock *, struct nl_cache **);
extern struct xfrmnl_sa* xfrmnl_sa_get(struct nl_cache*, struct nl_addr*, unsigned int, unsigned int);
extern int xfrmnl_sa_parse(struct nlmsghdr *n, struct xfrmnl_sa **result);
extern int xfrmnl_sa_build_get_request(struct nl_addr*, unsigned int, unsigned int,
unsigned int, unsigned int, struct nl_msg **);
extern int xfrmnl_sa_get_kernel(struct nl_sock*, struct nl_addr*, unsigned int,
unsigned int, unsigned int, unsigned int, struct xfrmnl_sa**);
extern int xfrmnl_sa_build_add_request(struct xfrmnl_sa*, int, struct nl_msg **);
extern int xfrmnl_sa_add(struct nl_sock*, struct xfrmnl_sa*, int);
extern int xfrmnl_sa_build_update_request(struct xfrmnl_sa*, int, struct nl_msg **);
extern int xfrmnl_sa_update(struct nl_sock*, struct xfrmnl_sa*, int);
extern int xfrmnl_sa_build_delete_request(struct xfrmnl_sa*, int, struct nl_msg **);
extern int xfrmnl_sa_delete(struct nl_sock*, struct xfrmnl_sa*, int);
extern struct xfrmnl_sel* xfrmnl_sa_get_sel (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_sel (struct xfrmnl_sa*, struct xfrmnl_sel*);
extern struct nl_addr* xfrmnl_sa_get_daddr (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_daddr (struct xfrmnl_sa*, struct nl_addr*);
extern int xfrmnl_sa_get_spi (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_spi (struct xfrmnl_sa*, unsigned int);
extern int xfrmnl_sa_get_proto (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_proto (struct xfrmnl_sa*, unsigned int);
extern struct nl_addr* xfrmnl_sa_get_saddr (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_saddr (struct xfrmnl_sa*, struct nl_addr*);
extern struct xfrmnl_ltime_cfg* xfrmnl_sa_get_lifetime_cfg (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_lifetime_cfg (struct xfrmnl_sa*, struct xfrmnl_ltime_cfg*);
extern int xfrmnl_sa_get_curlifetime (struct xfrmnl_sa*, unsigned long long int*,
unsigned long long int*, unsigned long long int*,
unsigned long long int*);
extern int xfrmnl_sa_get_stats (struct xfrmnl_sa*, unsigned long long int*,
unsigned long long int*, unsigned long long int*);
extern int xfrmnl_sa_get_seq (struct xfrmnl_sa*);
extern int xfrmnl_sa_get_reqid (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_reqid (struct xfrmnl_sa*, unsigned int);
extern int xfrmnl_sa_get_family (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_family (struct xfrmnl_sa*, unsigned int);
extern int xfrmnl_sa_get_mode (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_mode (struct xfrmnl_sa*, unsigned int);
extern int xfrmnl_sa_get_replay_window (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_replay_window (struct xfrmnl_sa*, unsigned int);
extern int xfrmnl_sa_get_flags (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_flags (struct xfrmnl_sa*, unsigned int);
extern int xfrmnl_sa_get_aead_params (struct xfrmnl_sa*, char*, unsigned int*,
unsigned int*, char*);
extern int xfrmnl_sa_set_aead_params (struct xfrmnl_sa*, const char*, unsigned int,
unsigned int, const char*);
extern int xfrmnl_sa_get_auth_params (struct xfrmnl_sa*, char*, unsigned int*,
unsigned int*, char*);
extern int xfrmnl_sa_set_auth_params (struct xfrmnl_sa*, const char*, unsigned int,
unsigned int, const char*);
extern int xfrmnl_sa_get_crypto_params (struct xfrmnl_sa*, char*, unsigned int*, char*);
extern int xfrmnl_sa_set_crypto_params (struct xfrmnl_sa*, const char*, unsigned int,
const char*);
extern int xfrmnl_sa_get_comp_params (struct xfrmnl_sa*, char*, unsigned int*, char*);
extern int xfrmnl_sa_set_comp_params (struct xfrmnl_sa*, const char*, unsigned int,
const char*);
extern int xfrmnl_sa_get_encap_tmpl (struct xfrmnl_sa*, unsigned int*, unsigned int*,
unsigned int*, struct nl_addr**);
extern int xfrmnl_sa_set_encap_tmpl (struct xfrmnl_sa*, unsigned int, unsigned int,
unsigned int, struct nl_addr*);
extern int xfrmnl_sa_get_tfcpad (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_tfcpad (struct xfrmnl_sa*, unsigned int);
extern struct nl_addr* xfrmnl_sa_get_coaddr (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_coaddr (struct xfrmnl_sa*, struct nl_addr*);
extern int xfrmnl_sa_get_mark (struct xfrmnl_sa*, unsigned int*, unsigned int*);
extern int xfrmnl_sa_set_mark (struct xfrmnl_sa*, unsigned int, unsigned int);
extern int xfrmnl_sa_get_sec_ctx (struct xfrmnl_sa*, unsigned int*, unsigned int*,
unsigned int*, unsigned int*, char*);
extern int xfrmnl_sa_set_sec_ctx (struct xfrmnl_sa*, unsigned int, unsigned int,
unsigned int, unsigned int, const char*);
extern int xfrmnl_sa_get_replay_maxage (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_replay_maxage (struct xfrmnl_sa*, unsigned int);
extern int xfrmnl_sa_get_replay_maxdiff (struct xfrmnl_sa*);
extern int xfrmnl_sa_set_replay_maxdiff (struct xfrmnl_sa*, unsigned int);
extern int xfrmnl_sa_get_replay_state (struct xfrmnl_sa*, unsigned int*,
unsigned int*, unsigned int*);
extern int xfrmnl_sa_set_replay_state (struct xfrmnl_sa*, unsigned int,
unsigned int, unsigned int);
extern int xfrmnl_sa_get_replay_state_esn (struct xfrmnl_sa*, unsigned int*, unsigned int*,
unsigned int*, unsigned int*, unsigned int*,
unsigned int*, unsigned int*);
extern int xfrmnl_sa_set_replay_state_esn (struct xfrmnl_sa*, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int*);
extern int xfrmnl_sa_get_user_offload (struct xfrmnl_sa*, int*, uint8_t *);
extern int xfrmnl_sa_set_user_offload (struct xfrmnl_sa*, int, uint8_t);
extern int xfrmnl_sa_is_expiry_reached (struct xfrmnl_sa*);
extern int xfrmnl_sa_is_hardexpiry_reached (struct xfrmnl_sa*);
extern char* xfrmnl_sa_flags2str(int, char *, size_t);
extern int xfrmnl_sa_str2flag(const char *);
extern char* xfrmnl_sa_mode2str(int, char *, size_t);
extern int xfrmnl_sa_str2mode(const char *);
#ifdef __cplusplus
}
#endif
#endif
xfrm/sp.h 0000644 00000016151 15051120407 0006312 0 ustar 00 /*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef NETLINK_XFRM_SP_H_
#define NETLINK_XFRM_SP_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <netlink/xfrm/template.h>
#include <netlink/xfrm/lifetime.h>
#include <linux/xfrm.h>
#ifdef __cplusplus
extern "C" {
#endif
struct xfrmnl_sp;
extern struct xfrmnl_sp* xfrmnl_sp_alloc(void);
extern void xfrmnl_sp_put(struct xfrmnl_sp *);
extern int xfrmnl_sp_alloc_cache(struct nl_sock *, struct nl_cache **);
extern struct xfrmnl_sp* xfrmnl_sp_get(struct nl_cache*, unsigned int, unsigned int);
extern int xfrmnl_sp_parse(struct nlmsghdr *n, struct xfrmnl_sp **result);
extern int xfrmnl_sp_build_get_request(unsigned int, unsigned int, unsigned int,
unsigned int, struct nl_msg **);
extern int xfrmnl_sp_get_kernel(struct nl_sock*, unsigned int, unsigned int,
unsigned int, unsigned int, struct xfrmnl_sp**);
extern int xfrmnl_sp_add(struct nl_sock*, struct xfrmnl_sp*, int);
extern int xfrmnl_sp_build_add_request(struct xfrmnl_sp*, int, struct nl_msg **);
extern int xfrmnl_sp_update(struct nl_sock*, struct xfrmnl_sp*, int);
extern int xfrmnl_sp_build_update_request(struct xfrmnl_sp*, int, struct nl_msg **);
extern int xfrmnl_sp_delete(struct nl_sock*, struct xfrmnl_sp*, int);
extern int xfrmnl_sp_build_delete_request(struct xfrmnl_sp*, int, struct nl_msg **);
extern struct xfrmnl_sel* xfrmnl_sp_get_sel (struct xfrmnl_sp*);
extern int xfrmnl_sp_set_sel (struct xfrmnl_sp*, struct xfrmnl_sel*);
extern struct xfrmnl_ltime_cfg* xfrmnl_sp_get_lifetime_cfg (struct xfrmnl_sp*);
extern int xfrmnl_sp_set_lifetime_cfg (struct xfrmnl_sp*, struct xfrmnl_ltime_cfg*);
extern int xfrmnl_sp_get_curlifetime (struct xfrmnl_sp*, unsigned long long int*,
unsigned long long int*, unsigned long long int*,
unsigned long long int*);
extern int xfrmnl_sp_get_priority (struct xfrmnl_sp*);
extern int xfrmnl_sp_set_priority (struct xfrmnl_sp*, unsigned int);
extern int xfrmnl_sp_get_index (struct xfrmnl_sp*);
extern int xfrmnl_sp_set_index (struct xfrmnl_sp*, unsigned int);
extern int xfrmnl_sp_get_dir (struct xfrmnl_sp*);
extern int xfrmnl_sp_set_dir (struct xfrmnl_sp*, unsigned int);
extern int xfrmnl_sp_get_action (struct xfrmnl_sp*);
extern int xfrmnl_sp_set_action (struct xfrmnl_sp*, unsigned int);
extern int xfrmnl_sp_get_flags (struct xfrmnl_sp*);
extern int xfrmnl_sp_set_flags (struct xfrmnl_sp*, unsigned int);
extern int xfrmnl_sp_get_share (struct xfrmnl_sp*);
extern int xfrmnl_sp_set_share (struct xfrmnl_sp*, unsigned int);
extern int xfrmnl_sp_get_sec_ctx (struct xfrmnl_sp*, unsigned int*, unsigned int*,
unsigned int*, unsigned int*, unsigned int*, char*);
extern int xfrmnl_sp_set_sec_ctx (struct xfrmnl_sp*, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int, char*);
extern int xfrmnl_sp_get_userpolicy_type (struct xfrmnl_sp*);
extern int xfrmnl_sp_set_userpolicy_type (struct xfrmnl_sp*, unsigned int);
extern void xfrmnl_sp_add_usertemplate(struct xfrmnl_sp*, struct xfrmnl_user_tmpl*);
extern void xfrmnl_sp_remove_usertemplate(struct xfrmnl_sp*, struct xfrmnl_user_tmpl*);
extern struct nl_list_head* xfrmnl_sp_get_usertemplates(struct xfrmnl_sp*);
extern int xfrmnl_sp_get_nusertemplates(struct xfrmnl_sp*);
extern void xfrmnl_sp_foreach_usertemplate(struct xfrmnl_sp*,
void (*cb)(struct xfrmnl_user_tmpl*, void *),
void *arg);
extern struct xfrmnl_user_tmpl* xfrmnl_sp_usertemplate_n(struct xfrmnl_sp*, int);
extern int xfrmnl_sp_get_mark (struct xfrmnl_sp*, unsigned int*, unsigned int*);
extern int xfrmnl_sp_set_mark (struct xfrmnl_sp*, unsigned int, unsigned int);
extern char* xfrmnl_sp_action2str(int, char *, size_t);
extern int xfrmnl_sp_str2action(const char *);
extern char* xfrmnl_sp_flags2str(int, char *, size_t);
extern int xfrmnl_sp_str2flag(const char *);
extern char* xfrmnl_sp_type2str(int, char *, size_t);
extern int xfrmnl_sp_str2type(const char *);
extern char* xfrmnl_sp_dir2str(int, char *, size_t);
extern int xfrmnl_sp_str2dir(const char *);
extern char* xfrmnl_sp_share2str(int, char *, size_t);
extern int xfrmnl_sp_str2share(const char *);
extern int xfrmnl_sp_index2dir (unsigned int);
#ifdef __cplusplus
}
#endif
#endif
socket.h 0000644 00000004604 15051120407 0006204 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_SOCKET_H_
#define NETLINK_SOCKET_H_
#include <netlink/types.h>
#include <netlink/handlers.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct nl_sock * nl_socket_alloc(void);
extern struct nl_sock * nl_socket_alloc_cb(struct nl_cb *);
extern void nl_socket_free(struct nl_sock *);
extern uint32_t nl_socket_get_local_port(const struct nl_sock *);
extern void nl_socket_set_local_port(struct nl_sock *, uint32_t);
extern int nl_socket_add_memberships(struct nl_sock *, int, ...);
extern int nl_socket_add_membership(struct nl_sock *, int);
extern int nl_socket_drop_memberships(struct nl_sock *, int, ...);
extern int nl_socket_drop_membership(struct nl_sock *,
int);
extern void nl_join_groups(struct nl_sock *, int);
extern uint32_t nl_socket_get_peer_port(const struct nl_sock *);
extern void nl_socket_set_peer_port(struct nl_sock *,
uint32_t);
extern uint32_t nl_socket_get_peer_groups(const struct nl_sock *sk);
extern void nl_socket_set_peer_groups(struct nl_sock *sk, uint32_t groups);
extern struct nl_cb * nl_socket_get_cb(const struct nl_sock *);
extern void nl_socket_set_cb(struct nl_sock *,
struct nl_cb *);
extern int nl_socket_modify_cb(struct nl_sock *, enum nl_cb_type,
enum nl_cb_kind,
nl_recvmsg_msg_cb_t, void *);
extern int nl_socket_modify_err_cb(struct nl_sock *, enum nl_cb_kind,
nl_recvmsg_err_cb_t, void *);
extern int nl_socket_set_buffer_size(struct nl_sock *, int, int);
extern int nl_socket_set_msg_buf_size(struct nl_sock *, size_t);
extern size_t nl_socket_get_msg_buf_size(struct nl_sock *);
extern int nl_socket_set_passcred(struct nl_sock *, int);
extern int nl_socket_recv_pktinfo(struct nl_sock *, int);
extern void nl_socket_disable_seq_check(struct nl_sock *);
extern unsigned int nl_socket_use_seq(struct nl_sock *);
extern void nl_socket_disable_auto_ack(struct nl_sock *);
extern void nl_socket_enable_auto_ack(struct nl_sock *);
extern int nl_socket_get_fd(const struct nl_sock *);
extern int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd);
extern int nl_socket_set_nonblocking(const struct nl_sock *);
extern void nl_socket_enable_msg_peek(struct nl_sock *);
extern void nl_socket_disable_msg_peek(struct nl_sock *);
#ifdef __cplusplus
}
#endif
#endif
hashtable.h 0000644 00000002114 15051120407 0006641 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2012 Cumulus Networks, Inc
*/
#ifndef NETLINK_HASHTABLE_H_
#define NETLINK_HASHTABLE_H_
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct nl_hash_node {
uint32_t key;
uint32_t key_size;
struct nl_object * obj;
struct nl_hash_node * next;
} nl_hash_node_t;
typedef struct nl_hash_table {
int size;
nl_hash_node_t ** nodes;
} nl_hash_table_t;
/* Default hash table size */
#define NL_MAX_HASH_ENTRIES 1024
/* Access Functions */
extern nl_hash_table_t * nl_hash_table_alloc(int size);
extern void nl_hash_table_free(nl_hash_table_t *ht);
extern int nl_hash_table_add(nl_hash_table_t *ht,
struct nl_object *obj);
extern int nl_hash_table_del(nl_hash_table_t *ht,
struct nl_object *obj);
extern struct nl_object * nl_hash_table_lookup(nl_hash_table_t *ht,
struct nl_object *obj);
extern uint32_t nl_hash(void *k, size_t length,
uint32_t initval);
#ifdef __cplusplus
}
#endif
#endif /* NETLINK_HASHTABLE_H_ */
route/addr.h 0000644 00000006254 15051120407 0006767 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2003-2006 Baruch Even <baruch@ev-en.org>
* Copyright (c) 2003-2006 Mediatrix Telecom, inc. <ericb@mediatrix.com>
*/
#ifndef NETADDR_ADDR_H_
#define NETADDR_ADDR_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_addr;
/* General */
extern struct rtnl_addr *rtnl_addr_alloc(void);
extern void rtnl_addr_put(struct rtnl_addr *);
extern int rtnl_addr_alloc_cache(struct nl_sock *, struct nl_cache **);
extern struct rtnl_addr *
rtnl_addr_get(struct nl_cache *, int, struct nl_addr *);
extern int rtnl_addr_build_add_request(struct rtnl_addr *, int,
struct nl_msg **);
extern int rtnl_addr_add(struct nl_sock *, struct rtnl_addr *, int);
extern int rtnl_addr_build_delete_request(struct rtnl_addr *, int,
struct nl_msg **);
extern int rtnl_addr_delete(struct nl_sock *,
struct rtnl_addr *, int);
extern char * rtnl_addr_flags2str(int, char *, size_t);
extern int rtnl_addr_str2flags(const char *);
extern int rtnl_addr_set_label(struct rtnl_addr *, const char *);
extern char * rtnl_addr_get_label(struct rtnl_addr *);
extern void rtnl_addr_set_ifindex(struct rtnl_addr *, int);
extern int rtnl_addr_get_ifindex(struct rtnl_addr *);
extern void rtnl_addr_set_link(struct rtnl_addr *, struct rtnl_link *);
extern struct rtnl_link *
rtnl_addr_get_link(struct rtnl_addr *);
extern void rtnl_addr_set_family(struct rtnl_addr *, int);
extern int rtnl_addr_get_family(struct rtnl_addr *);
extern void rtnl_addr_set_prefixlen(struct rtnl_addr *, int);
extern int rtnl_addr_get_prefixlen(struct rtnl_addr *);
extern void rtnl_addr_set_scope(struct rtnl_addr *, int);
extern int rtnl_addr_get_scope(struct rtnl_addr *);
extern void rtnl_addr_set_flags(struct rtnl_addr *, unsigned int);
extern void rtnl_addr_unset_flags(struct rtnl_addr *, unsigned int);
extern unsigned int rtnl_addr_get_flags(struct rtnl_addr *);
extern int rtnl_addr_set_local(struct rtnl_addr *,
struct nl_addr *);
extern struct nl_addr *rtnl_addr_get_local(struct rtnl_addr *);
extern int rtnl_addr_set_peer(struct rtnl_addr *, struct nl_addr *);
extern struct nl_addr *rtnl_addr_get_peer(struct rtnl_addr *);
extern int rtnl_addr_set_broadcast(struct rtnl_addr *, struct nl_addr *);
extern struct nl_addr *rtnl_addr_get_broadcast(struct rtnl_addr *);
extern int rtnl_addr_set_multicast(struct rtnl_addr *, struct nl_addr *);
extern struct nl_addr *rtnl_addr_get_multicast(struct rtnl_addr *);
extern int rtnl_addr_set_anycast(struct rtnl_addr *, struct nl_addr *);
extern struct nl_addr *rtnl_addr_get_anycast(struct rtnl_addr *);
extern uint32_t rtnl_addr_get_valid_lifetime(struct rtnl_addr *);
extern void rtnl_addr_set_valid_lifetime(struct rtnl_addr *, uint32_t);
extern uint32_t rtnl_addr_get_preferred_lifetime(struct rtnl_addr *);
extern void rtnl_addr_set_preferred_lifetime(struct rtnl_addr *, uint32_t);
extern uint32_t rtnl_addr_get_create_time(struct rtnl_addr *);
extern uint32_t rtnl_addr_get_last_update_time(struct rtnl_addr *);
#ifdef __cplusplus
}
#endif
#endif
route/link/team.h 0000644 00000000707 15051120407 0007735 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2015 Jonas Johansson <jonasj76@gmail.com>
*/
#ifndef NETLINK_LINK_TEAM_H_
#define NETLINK_LINK_TEAM_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_team_alloc(void);
extern int rtnl_link_team_add(struct nl_sock *, const char *,
struct rtnl_link *);
#ifdef __cplusplus
}
#endif
#endif
route/link/vlan.h 0000644 00000002642 15051120407 0007747 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_LINK_VLAN_H_
#define NETLINK_LINK_VLAN_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
struct vlan_map
{
uint32_t vm_from;
uint32_t vm_to;
};
#define VLAN_PRIO_MAX 7
extern struct rtnl_link *rtnl_link_vlan_alloc(void);
extern int rtnl_link_is_vlan(struct rtnl_link *);
extern char * rtnl_link_vlan_flags2str(int, char *, size_t);
extern int rtnl_link_vlan_str2flags(const char *);
extern int rtnl_link_vlan_set_protocol(struct rtnl_link *link, uint16_t);
extern int rtnl_link_vlan_get_protocol(struct rtnl_link *link);
extern int rtnl_link_vlan_set_id(struct rtnl_link *, uint16_t);
extern int rtnl_link_vlan_get_id(struct rtnl_link *);
extern int rtnl_link_vlan_set_flags(struct rtnl_link *,
unsigned int);
extern int rtnl_link_vlan_unset_flags(struct rtnl_link *,
unsigned int);
extern int rtnl_link_vlan_get_flags(struct rtnl_link *);
extern int rtnl_link_vlan_set_ingress_map(struct rtnl_link *,
int, uint32_t);
extern uint32_t * rtnl_link_vlan_get_ingress_map(struct rtnl_link *);
extern int rtnl_link_vlan_set_egress_map(struct rtnl_link *,
uint32_t, int);
extern struct vlan_map *rtnl_link_vlan_get_egress_map(struct rtnl_link *,
int *);
#ifdef __cplusplus
}
#endif
#endif
route/link/vrf.h 0000644 00000001162 15051120407 0007600 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2015 Cumulus Networks. All rights reserved.
* Copyright (c) 2015 David Ahern <dsa@cumulusnetworks.com>
*/
#ifndef NETLINK_LINK_VRF_H_
#define NETLINK_LINK_VRF_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_vrf_alloc(void);
extern int rtnl_link_is_vrf(struct rtnl_link *link);
extern int rtnl_link_vrf_get_tableid(struct rtnl_link *link, uint32_t *id);
extern int rtnl_link_vrf_set_tableid(struct rtnl_link *link, uint32_t id);
#ifdef __cplusplus
}
#endif
#endif
route/link/info-api.h 0000644 00000000523 15051120407 0010505 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_DUMMY_LINK_INFO_API_H_
#define NETLINK_DUMMY_LINK_INFO_API_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#warning "You are including a deprecated header file, include <netlink/route/link.h>."
#endif
route/link/bonding.h 0000644 00000001405 15051120407 0010423 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2011-2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_LINK_BONDING_H_
#define NETLINK_LINK_BONDING_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_bond_alloc(void);
extern int rtnl_link_bond_add(struct nl_sock *, const char *,
struct rtnl_link *);
extern int rtnl_link_bond_enslave_ifindex(struct nl_sock *, int, int);
extern int rtnl_link_bond_enslave(struct nl_sock *, struct rtnl_link *,
struct rtnl_link *);
extern int rtnl_link_bond_release_ifindex(struct nl_sock *, int);
extern int rtnl_link_bond_release(struct nl_sock *, struct rtnl_link *);
#ifdef __cplusplus
}
#endif
#endif
route/link/ppp.h 0000644 00000000750 15051120407 0007604 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2016 Jonas Johansson <jonasj76@gmail.com>
*/
#ifndef NETLINK_LINK_PPP_H_
#define NETLINK_LINK_PPP_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_ppp_alloc(void);
extern int rtnl_link_ppp_set_fd(struct rtnl_link *, int32_t);
extern int rtnl_link_ppp_get_fd(struct rtnl_link *, int32_t *);
#ifdef __cplusplus
}
#endif
#endif
route/link/api.h 0000644 00000000511 15051120407 0007551 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_DUMMY_LINK_API_H_
#define NETLINK_DUMMY_LINK_API_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#warning "You are including a deprecated header file, include <netlink/route/link.h>."
#endif
route/link/sit.h 0000644 00000004653 15051120407 0007612 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2014 Susant Sahani <susant@redhat.com>
*/
#ifndef NETLINK_LINK_SIT_H_
#define NETLINK_LINK_SIT_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_sit_alloc(void);
extern int rtnl_link_sit_add(struct nl_sock *sk, const char *name);
extern int rtnl_link_is_sit(struct rtnl_link *link);
extern int rtnl_link_sit_set_link(struct rtnl_link *link, uint32_t index);
extern uint32_t rtnl_link_sit_get_link(struct rtnl_link *link);
extern int rtnl_link_sit_set_local(struct rtnl_link *link, uint32_t addr);
extern uint32_t rtnl_link_sit_get_local(struct rtnl_link *link);
extern int rtnl_link_sit_set_remote(struct rtnl_link *link, uint32_t addr);
extern uint32_t rtnl_link_sit_get_remote(struct rtnl_link *link);
extern int rtnl_link_sit_set_ttl(struct rtnl_link *link, uint8_t ttl);
extern uint8_t rtnl_link_sit_get_ttl(struct rtnl_link *link);
extern int rtnl_link_sit_set_tos(struct rtnl_link *link, uint8_t tos);
extern uint8_t rtnl_link_sit_get_tos(struct rtnl_link *link);
extern int rtnl_link_sit_set_pmtudisc(struct rtnl_link *link, uint8_t pmtudisc);
extern uint8_t rtnl_link_sit_get_pmtudisc(struct rtnl_link *link);
extern int rtnl_link_sit_set_flags(struct rtnl_link *link, uint16_t flags);
extern uint16_t rtnl_link_sit_get_flags(struct rtnl_link *link);
int rtnl_link_sit_set_proto(struct rtnl_link *link, uint8_t proto);
uint8_t rtnl_link_sit_get_proto(struct rtnl_link *link);
int rtnl_link_sit_set_ip6rd_prefix(struct rtnl_link *link, const struct in6_addr *prefix);
int rtnl_link_sit_get_ip6rd_prefix(const struct rtnl_link *link, struct in6_addr *prefix);
int rtnl_link_sit_set_ip6rd_prefixlen(struct rtnl_link *link, uint16_t prefixlen);
int rtnl_link_sit_get_ip6rd_prefixlen(struct rtnl_link *link, uint16_t *prefixlen);
int rtnl_link_sit_set_ip6rd_relay_prefix(struct rtnl_link *link, uint32_t prefix);
int rtnl_link_sit_get_ip6rd_relay_prefix(const struct rtnl_link *link, uint32_t *prefix);
int rtnl_link_sit_set_ip6rd_relay_prefixlen(struct rtnl_link *link, uint16_t prefix);
int rtnl_link_sit_get_ip6rd_relay_prefixlen(struct rtnl_link *link, uint16_t *prefix);
extern int rtnl_link_sit_set_fwmark(struct rtnl_link *link, uint32_t fwmark);
extern int rtnl_link_sit_get_fwmark(struct rtnl_link *link, uint32_t *fwmark);
#ifdef __cplusplus
}
#endif
#endif
route/link/geneve.h 0000644 00000003515 15051120407 0010260 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
#ifndef NETLINK_LINK_GENEVE_H_
#define NETLINK_LINK_GENEVE_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RTNL_GENEVE_ID_MAX 16777215
#define RTNL_LINK_GENEVE_F_COLLECT_METADATA (1<<0)
extern struct rtnl_link *rtnl_link_geneve_alloc(void);
extern int rtnl_link_is_geneve(struct rtnl_link *);
extern int rtnl_link_geneve_set_id(struct rtnl_link *, uint32_t);
extern int rtnl_link_geneve_get_id(struct rtnl_link *, uint32_t *);
extern int rtnl_link_geneve_set_remote(struct rtnl_link *, struct nl_addr *);
extern int rtnl_link_geneve_get_remote(struct rtnl_link *, struct nl_addr **);
extern int rtnl_link_geneve_set_ttl(struct rtnl_link *, uint8_t);
extern int rtnl_link_geneve_get_ttl(struct rtnl_link *);
extern int rtnl_link_geneve_set_tos(struct rtnl_link *, uint8_t);
extern int rtnl_link_geneve_get_tos(struct rtnl_link *);
extern int rtnl_link_geneve_set_port(struct rtnl_link *, uint32_t);
extern int rtnl_link_geneve_get_port(struct rtnl_link *, uint32_t *);
extern int rtnl_link_geneve_set_label(struct rtnl_link *, uint32_t);
extern int rtnl_link_geneve_get_label(struct rtnl_link *, uint32_t *);
extern int rtnl_link_geneve_set_udp_csum(struct rtnl_link *, uint8_t);
extern int rtnl_link_geneve_get_udp_csum(struct rtnl_link *);
extern int rtnl_link_geneve_set_udp_zero_csum6_tx(struct rtnl_link *, uint8_t);
extern int rtnl_link_geneve_get_udp_zero_csum6_tx(struct rtnl_link *);
extern int rtnl_link_geneve_set_udp_zero_csum6_rx(struct rtnl_link *, uint8_t);
extern int rtnl_link_geneve_get_udp_zero_csum6_rx(struct rtnl_link *);
extern int rtnl_link_geneve_set_flags(struct rtnl_link *, uint8_t flags, int enable);
extern int rtnl_link_geneve_get_flags(struct rtnl_link *, uint8_t *flags);
#ifdef __cplusplus
}
#endif
#endif
route/link/inet.h 0000644 00000001105 15051120407 0007737 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_LINK_INET_H_
#define NETLINK_LINK_INET_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
extern const char * rtnl_link_inet_devconf2str(int, char *, size_t);
extern int rtnl_link_inet_str2devconf(const char *);
extern int rtnl_link_inet_get_conf(struct rtnl_link *,
const unsigned int, uint32_t *);
extern int rtnl_link_inet_set_conf(struct rtnl_link *,
const unsigned int, uint32_t);
#ifdef __cplusplus
}
#endif
#endif
route/link/ipip.h 0000644 00000002752 15051120407 0007752 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2014 Susant Sahani <susant@redhat.com>
*/
#ifndef NETLINK_LINK_IPIP_H_
#define NETLINK_LINK_IPIP_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_ipip_alloc(void);
extern int rtnl_link_ipip_add(struct nl_sock *sk, const char *name);
extern int rtnl_link_is_ipip(struct rtnl_link *link);
extern uint32_t rtnl_link_ipip_get_link(struct rtnl_link *link);
extern int rtnl_link_ipip_set_link(struct rtnl_link *link, uint32_t index);
extern int rtnl_link_ipip_set_local(struct rtnl_link *link, uint32_t addr);
extern uint32_t rtnl_link_ipip_get_local(struct rtnl_link *link);
extern int rtnl_link_ipip_set_remote(struct rtnl_link *link, uint32_t addr);
extern uint32_t rtnl_link_ipip_get_remote(struct rtnl_link *link);
extern int rtnl_link_ipip_set_ttl(struct rtnl_link *link, uint8_t ttl);
extern uint8_t rtnl_link_ipip_get_ttl(struct rtnl_link *link);
extern int rtnl_link_ipip_set_tos(struct rtnl_link *link, uint8_t tos);
extern uint8_t rtnl_link_ipip_get_tos(struct rtnl_link *link);
extern int rtnl_link_ipip_set_pmtudisc(struct rtnl_link *link, uint8_t pmtudisc);
extern uint8_t rtnl_link_ipip_get_pmtudisc(struct rtnl_link *link);
extern int rtnl_link_ipip_set_fwmark(struct rtnl_link *link, uint32_t fwmark);
extern int rtnl_link_ipip_get_fwmark(struct rtnl_link *link, uint32_t *fwmark);
#ifdef __cplusplus
}
#endif
#endif
route/link/veth.h 0000644 00000001241 15051120407 0007747 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com>
*/
#ifndef NETLINK_LINK_VETH_H_
#define NETLINK_LINK_VETH_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_veth_alloc(void);
extern void rtnl_link_veth_release(struct rtnl_link *);
extern int rtnl_link_is_veth(struct rtnl_link *);
extern struct rtnl_link *rtnl_link_veth_get_peer(struct rtnl_link *);
extern int rtnl_link_veth_add(struct nl_sock *sock, const char *name,
const char *peer, pid_t pid);
#ifdef __cplusplus
}
#endif
#endif
route/link/macvtap.h 0000644 00000002413 15051120407 0010436 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2015 Beniamino Galvani <bgalvani@redhat.com>
*/
#ifndef NETLINK_LINK_MACVTAP_H_
#define NETLINK_LINK_MACVTAP_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_macvtap_alloc(void);
extern int rtnl_link_is_macvtap(struct rtnl_link *);
extern char * rtnl_link_macvtap_mode2str(int, char *, size_t);
extern int rtnl_link_macvtap_str2mode(const char *);
extern char * rtnl_link_macvtap_flags2str(int, char *, size_t);
extern int rtnl_link_macvtap_str2flags(const char *);
extern int rtnl_link_macvtap_set_mode(struct rtnl_link *,
uint32_t);
extern uint32_t rtnl_link_macvtap_get_mode(struct rtnl_link *);
extern int rtnl_link_macvtap_set_flags(struct rtnl_link *,
uint16_t);
extern int rtnl_link_macvtap_unset_flags(struct rtnl_link *,
uint16_t);
extern uint16_t rtnl_link_macvtap_get_flags(struct rtnl_link *);
#ifdef __cplusplus
}
#endif
#endif
route/link/macvlan.h 0000644 00000003424 15051120407 0010427 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Michael Braun <michael-dev@fami-braun.de>
*/
#ifndef NETLINK_LINK_MACVLAN_H_
#define NETLINK_LINK_MACVLAN_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_macvlan_alloc(void);
extern int rtnl_link_is_macvlan(struct rtnl_link *);
extern char * rtnl_link_macvlan_mode2str(int, char *, size_t);
extern int rtnl_link_macvlan_str2mode(const char *);
extern char * rtnl_link_macvlan_flags2str(int, char *, size_t);
extern int rtnl_link_macvlan_str2flags(const char *);
extern char * rtnl_link_macvlan_macmode2str(int, char *, size_t);
extern int rtnl_link_macvlan_str2macmode(const char *);
extern int rtnl_link_macvlan_set_mode(struct rtnl_link *,
uint32_t);
extern uint32_t rtnl_link_macvlan_get_mode(struct rtnl_link *);
extern int rtnl_link_macvlan_set_flags(struct rtnl_link *,
uint16_t);
extern int rtnl_link_macvlan_unset_flags(struct rtnl_link *,
uint16_t);
extern uint16_t rtnl_link_macvlan_get_flags(struct rtnl_link *);
extern int rtnl_link_macvlan_set_macmode(struct rtnl_link *,
uint32_t);
extern int rtnl_link_macvlan_get_macmode(struct rtnl_link *link,
uint32_t *out_macmode);
extern int rtnl_link_macvlan_count_macaddr(struct rtnl_link *link,
uint32_t *out_count);
extern int rtnl_link_macvlan_get_macaddr(struct rtnl_link *link,
uint32_t idx,
const struct nl_addr **addr);
extern int rtnl_link_macvlan_add_macaddr(struct rtnl_link *link,
struct nl_addr *addr);
extern int rtnl_link_macvlan_del_macaddr(struct rtnl_link *link,
struct nl_addr *addr);
#ifdef __cplusplus
}
#endif
#endif
route/link/xfrmi.h 0000644 00000001426 15051120407 0010133 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2019 Eyal Birger <eyal.birger@gmail.com>
*
* Based on netlink/route/link/ipvti.h
*/
#ifndef NETLINK_LINK_XFRMI_H_
#define NETLINK_LINK_XFRMI_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_xfrmi_alloc(void);
extern int rtnl_link_is_xfrmi(struct rtnl_link *link);
extern int rtnl_link_xfrmi_set_link(struct rtnl_link *link, uint32_t index);
extern int rtnl_link_xfrmi_get_link(struct rtnl_link *link, uint32_t *out_link);
extern int rtnl_link_xfrmi_set_if_id(struct rtnl_link *link, uint32_t if_id);
extern int rtnl_link_xfrmi_get_if_id(struct rtnl_link *link, uint32_t *out_if_id);
#ifdef __cplusplus
}
#endif
#endif
route/link/ipgre.h 0000644 00000004415 15051120407 0010115 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2014 Susant Sahani <susant@redhat.com>
*/
#ifndef NETLINK_LINK_IPGRE_H_
#define NETLINK_LINK_IPGRE_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_link_is_ipgre(struct rtnl_link *link);
extern int rtnl_link_is_ipgretap(struct rtnl_link *link);
extern struct rtnl_link *rtnl_link_ipgre_alloc(void);
extern struct rtnl_link *rtnl_link_ipgretap_alloc(void);
extern int rtnl_link_ipgre_add(struct nl_sock *sk, const char *name);
extern int rtnl_link_ipgretap_add(struct nl_sock *sk, const char *name);
extern int rtnl_link_ipgre_set_link(struct rtnl_link *link, uint32_t index);
extern uint32_t rtnl_link_ipgre_get_link(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_iflags(struct rtnl_link *link, uint16_t iflags);
extern uint16_t rtnl_link_ipgre_get_iflags(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_oflags(struct rtnl_link *link, uint16_t oflags);
extern uint16_t rtnl_link_ipgre_get_oflags(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_ikey(struct rtnl_link *link, uint32_t ikey);
extern uint32_t rtnl_link_ipgre_get_ikey(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_okey(struct rtnl_link *link, uint32_t okey);
extern uint32_t rtnl_link_ipgre_get_okey(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_local(struct rtnl_link *link, uint32_t addr);
extern uint32_t rtnl_link_ipgre_get_local(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_remote(struct rtnl_link *link, uint32_t addr);
extern uint32_t rtnl_link_ipgre_get_remote(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_ttl(struct rtnl_link *link, uint8_t ttl);
extern uint8_t rtnl_link_ipgre_get_ttl(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_tos(struct rtnl_link *link, uint8_t tos);
extern uint8_t rtnl_link_ipgre_get_tos(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_pmtudisc(struct rtnl_link *link, uint8_t pmtudisc);
extern uint8_t rtnl_link_ipgre_get_pmtudisc(struct rtnl_link *link);
extern int rtnl_link_ipgre_set_fwmark(struct rtnl_link *link, uint32_t fwmark);
extern int rtnl_link_ipgre_get_fwmark(struct rtnl_link *link, uint32_t *fwmark);
#ifdef __cplusplus
}
#endif
#endif
route/link/ip6gre.h 0000644 00000004602 15051120407 0010201 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
#ifndef NETLINK_LINK_IP6GRE_H_
#define NETLINK_LINK_IP6GRE_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_link_is_ip6gre(struct rtnl_link *link);
extern struct rtnl_link *rtnl_link_ip6gre_alloc(void);
extern int rtnl_link_ip6gre_add(struct nl_sock *sk, const char *name);
extern int rtnl_link_ip6gre_set_link(struct rtnl_link *link, uint32_t index);
extern int rtnl_link_ip6gre_get_link(struct rtnl_link *link, uint32_t *index);
extern int rtnl_link_ip6gre_set_iflags(struct rtnl_link *link, uint16_t iflags);
extern int rtnl_link_ip6gre_get_iflags(struct rtnl_link *link, uint16_t *iflags);
extern int rtnl_link_ip6gre_set_oflags(struct rtnl_link *link, uint16_t oflags);
extern int rtnl_link_ip6gre_get_oflags(struct rtnl_link *link, uint16_t *oflags);
extern int rtnl_link_ip6gre_set_ikey(struct rtnl_link *link, uint32_t ikey);
extern int rtnl_link_ip6gre_get_ikey(struct rtnl_link *link, uint32_t *ikey);
extern int rtnl_link_ip6gre_set_okey(struct rtnl_link *link, uint32_t okey);
extern int rtnl_link_ip6gre_get_okey(struct rtnl_link *link, uint32_t *okey);
extern int rtnl_link_ip6gre_set_local(struct rtnl_link *link, struct in6_addr *local);
extern int rtnl_link_ip6gre_get_local(struct rtnl_link *link, struct in6_addr *local);
extern int rtnl_link_ip6gre_set_remote(struct rtnl_link *link, struct in6_addr *remote);
extern int rtnl_link_ip6gre_get_remote(struct rtnl_link *link, struct in6_addr *remote);
extern int rtnl_link_ip6gre_set_ttl(struct rtnl_link *link, uint8_t ttl);
extern int rtnl_link_ip6gre_get_ttl(struct rtnl_link *link, uint8_t *ttl);
extern int rtnl_link_ip6gre_set_encaplimit(struct rtnl_link *link, uint8_t encaplimit);
extern int rtnl_link_ip6gre_get_encaplimit(struct rtnl_link *link, uint8_t *encaplimit);
extern int rtnl_link_ip6gre_set_flowinfo(struct rtnl_link *link, uint32_t flowinfo);
extern int rtnl_link_ip6gre_get_flowinfo(struct rtnl_link *link, uint32_t *flowinfo);
extern int rtnl_link_ip6gre_set_flags(struct rtnl_link *link, uint32_t flags);
extern int rtnl_link_ip6gre_get_flags(struct rtnl_link *link, uint32_t *flags);
extern int rtnl_link_ip6gre_set_fwmark(struct rtnl_link *link, uint32_t fwmark);
extern int rtnl_link_ip6gre_get_fwmark(struct rtnl_link *link, uint32_t *fwmark);
#ifdef __cplusplus
}
#endif
#endif
route/link/sriov.h 0000644 00000010653 15051120407 0010152 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2016 Intel Corp. All rights reserved.
* Copyright (c) 2016 Jef Oliver <jef.oliver@intel.com>
*/
#ifndef NETLINK_LINK_SRIOV_H_
#define NETLINK_LINK_SRIOV_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RTNL_VF_GUID_STR_LEN 23
/**
* @ingroup sriov
*/
typedef enum {
RTNL_LINK_VF_RATE_API_UNSPEC, /*!< Unspecified API type */
RTNL_LINK_VF_RATE_API_OLD, /*!< Old Rate setting API */
RTNL_LINK_VF_RATE_API_NEW, /*!< New Rate setting API */
__RTNL_LINK_VF_RATE_API_MAX,
} rtnl_link_rate_api_t;
#define RTNL_LINK_VF_RATE_API_MAX (__RTNL_LINK_VF_RATE_API_MAX - 1)
/**
* @ingroup sriov
*/
typedef enum {
RTNL_LINK_VF_STATS_RX_PACKETS, /*!< Packets Received */
RTNL_LINK_VF_STATS_TX_PACKETS, /*!< Packets Sent */
RTNL_LINK_VF_STATS_RX_BYTES, /*!< Bytes Recieved */
RTNL_LINK_VF_STATS_TX_BYTES, /*!< Bytes Sent */
RTNL_LINK_VF_STATS_BROADCAST, /*!< Broadcast packets received */
RTNL_LINK_VF_STATS_MULTICAST, /*!< Multicast packets received */
__RTNL_LINK_VF_STATS_MAX,
} rtnl_link_vf_stats_t;
#define RTNL_LINK_VF_STATS_MAX (__RTNL_LINK_VF_STATS_MAX - 1)
/**
* @struct rtnl_link_vf sriov.h "netlink/route/link/sriov.h"
* @brief SRIOV VF object
* @ingroup sriov
*
* @copydoc private_struct
*/
struct rtnl_link_vf;
/**
* @brief SRIOV VF VFLAN settings
* @ingroup sriov
*/
typedef struct nl_vf_vlan_info {
uint32_t vf_vlan; /*!< VLAN number */
uint32_t vf_vlan_qos; /*!< VLAN QOS value */
uint16_t vf_vlan_proto; /*!< VLAN protocol */
} nl_vf_vlan_info_t;
/**
* @brief SRIOV VF VLANs information
* @ingroup sriov
*/
typedef struct nl_vf_vlans {
int ce_refcnt; /*!< Reference counter. Don't change this value */
int size; /*!< Number of VLANs on the SRIOV VF */
nl_vf_vlan_info_t * vlans; /*!< nl_vf_vlan_info_t array of SRIOV VF VLANs */
} nl_vf_vlans_t;
/**
* @brief VF Rate information structure
* @ingroup sriov
*/
struct nl_vf_rate {
int api; /*!< rtnl_link_rate_api_t API Version to use */
uint32_t rate; /*!< Old API Max Rate in Mbps */
uint32_t max_tx_rate; /*!< New API Max Rate in Mbps */
uint32_t min_tx_rate; /*!< New API Mix Rate in Mbps */
};
extern int rtnl_link_vf_add(struct rtnl_link *, struct rtnl_link_vf *);
extern struct rtnl_link_vf *rtnl_link_vf_alloc(void);
extern void rtnl_link_vf_free(struct rtnl_link_vf *);
extern struct rtnl_link_vf *rtnl_link_vf_get(struct rtnl_link *, uint32_t);
extern void rtnl_link_vf_put(struct rtnl_link_vf *);
extern int rtnl_link_vf_get_addr(struct rtnl_link_vf *, struct nl_addr **);
extern void rtnl_link_vf_set_addr(struct rtnl_link_vf *, struct nl_addr *);
extern void rtnl_link_vf_set_ib_node_guid(struct rtnl_link_vf *, uint64_t);
extern void rtnl_link_vf_set_ib_port_guid(struct rtnl_link_vf *, uint64_t);
extern int rtnl_link_vf_get_index(struct rtnl_link_vf *, uint32_t *);
extern void rtnl_link_vf_set_index(struct rtnl_link_vf *, uint32_t);
extern int rtnl_link_vf_get_linkstate(struct rtnl_link_vf *, uint32_t *);
extern void rtnl_link_vf_set_linkstate(struct rtnl_link_vf *, uint32_t);
extern int rtnl_link_vf_get_rate(struct rtnl_link_vf *, struct nl_vf_rate *);
extern void rtnl_link_vf_set_rate(struct rtnl_link_vf *, struct nl_vf_rate *);
extern int rtnl_link_vf_get_rss_query_en(struct rtnl_link_vf *, uint32_t *);
extern void rtnl_link_vf_set_rss_query_en(struct rtnl_link_vf *, uint32_t);
extern int rtnl_link_vf_get_spoofchk(struct rtnl_link_vf *, uint32_t *);
extern void rtnl_link_vf_set_spoofchk(struct rtnl_link_vf *, uint32_t);
extern int rtnl_link_vf_get_stat(struct rtnl_link_vf *, rtnl_link_vf_stats_t,
uint64_t *);
extern int rtnl_link_vf_get_trust(struct rtnl_link_vf *, uint32_t *);
extern void rtnl_link_vf_set_trust(struct rtnl_link_vf *, uint32_t);
extern int rtnl_link_vf_get_vlans(struct rtnl_link_vf *, nl_vf_vlans_t **);
extern void rtnl_link_vf_set_vlans(struct rtnl_link_vf *, nl_vf_vlans_t *);
extern int rtnl_link_vf_vlan_alloc(nl_vf_vlans_t **, int);
extern void rtnl_link_vf_vlan_free(nl_vf_vlans_t *vf_vlans);
extern void rtnl_link_vf_vlan_put(nl_vf_vlans_t *);
/* Utility functions */
extern char *rtnl_link_vf_linkstate2str(uint32_t, char *, size_t);
extern int rtnl_link_vf_str2linkstate(const char *);
extern char *rtnl_link_vf_vlanproto2str(uint16_t, char *, size_t);
extern int rtnl_link_vf_str2vlanproto(const char *);
extern int rtnl_link_vf_str2guid(uint64_t *, const char *);
#ifdef __cplusplus
}
#endif
#endif
route/link/vxlan.h 0000644 00000011125 15051120407 0010133 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Yasunobu Chiba <yasu@dsl.gr.jp>
*/
#ifndef NETLINK_LINK_VXLAN_H_
#define NETLINK_LINK_VXLAN_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
struct ifla_vxlan_port_range;
#define VXLAN_ID_MAX 16777215
enum {
RTNL_LINK_VXLAN_F_GBP = 1 << 0,
#define RTNL_LINK_VXLAN_F_GBP RTNL_LINK_VXLAN_F_GBP
RTNL_LINK_VXLAN_F_GPE = 1 << 1,
#define RTNL_LINK_VXLAN_F_GPE RTNL_LINK_VXLAN_F_GPE
RTNL_LINK_VXLAN_F_REMCSUM_NOPARTIAL = 1 << 2,
#define RTNL_LINK_VXLAN_F_REMCSUM_NOPARTIAL RTNL_LINK_VXLAN_F_REMCSUM_NOPARTIAL
};
extern struct rtnl_link *rtnl_link_vxlan_alloc(void);
extern int rtnl_link_is_vxlan(struct rtnl_link *);
extern int rtnl_link_vxlan_set_id(struct rtnl_link *, uint32_t);
extern int rtnl_link_vxlan_get_id(struct rtnl_link *, uint32_t *);
extern int rtnl_link_vxlan_set_group(struct rtnl_link *, struct nl_addr *);
extern int rtnl_link_vxlan_get_group(struct rtnl_link *, struct nl_addr **);
extern int rtnl_link_vxlan_set_link(struct rtnl_link *, uint32_t);
extern int rtnl_link_vxlan_get_link(struct rtnl_link *, uint32_t *);
extern int rtnl_link_vxlan_set_local(struct rtnl_link *, struct nl_addr *);
extern int rtnl_link_vxlan_get_local(struct rtnl_link *, struct nl_addr **);
extern int rtnl_link_vxlan_set_ttl(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_ttl(struct rtnl_link *);
extern int rtnl_link_vxlan_set_tos(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_tos(struct rtnl_link *);
extern int rtnl_link_vxlan_set_learning(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_learning(struct rtnl_link *);
extern int rtnl_link_vxlan_enable_learning(struct rtnl_link *);
extern int rtnl_link_vxlan_disable_learning(struct rtnl_link *);
extern int rtnl_link_vxlan_set_ageing(struct rtnl_link *, uint32_t);
extern int rtnl_link_vxlan_get_ageing(struct rtnl_link *, uint32_t *);
extern int rtnl_link_vxlan_set_limit(struct rtnl_link *, uint32_t);
extern int rtnl_link_vxlan_get_limit(struct rtnl_link *, uint32_t *);
extern int rtnl_link_vxlan_set_port_range(struct rtnl_link *,
struct ifla_vxlan_port_range *);
extern int rtnl_link_vxlan_get_port_range(struct rtnl_link *,
struct ifla_vxlan_port_range *);
extern int rtnl_link_vxlan_set_proxy(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_proxy(struct rtnl_link *);
extern int rtnl_link_vxlan_enable_proxy(struct rtnl_link *);
extern int rtnl_link_vxlan_disable_proxy(struct rtnl_link *);
extern int rtnl_link_vxlan_set_rsc(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_rsc(struct rtnl_link *);
extern int rtnl_link_vxlan_enable_rsc(struct rtnl_link *);
extern int rtnl_link_vxlan_disable_rsc(struct rtnl_link *);
extern int rtnl_link_vxlan_set_l2miss(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_l2miss(struct rtnl_link *);
extern int rtnl_link_vxlan_enable_l2miss(struct rtnl_link *);
extern int rtnl_link_vxlan_disable_l2miss(struct rtnl_link *);
extern int rtnl_link_vxlan_set_l3miss(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_l3miss(struct rtnl_link *);
extern int rtnl_link_vxlan_enable_l3miss(struct rtnl_link *);
extern int rtnl_link_vxlan_disable_l3miss(struct rtnl_link *);
extern int rtnl_link_vxlan_set_port(struct rtnl_link *, uint32_t);
extern int rtnl_link_vxlan_get_port(struct rtnl_link *, uint32_t *);
extern int rtnl_link_vxlan_set_udp_csum(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_udp_csum(struct rtnl_link *);
extern int rtnl_link_vxlan_set_udp_zero_csum6_tx(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_udp_zero_csum6_tx(struct rtnl_link *);
extern int rtnl_link_vxlan_set_udp_zero_csum6_rx(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_udp_zero_csum6_rx(struct rtnl_link *);
extern int rtnl_link_vxlan_set_remcsum_tx(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_remcsum_tx(struct rtnl_link *);
extern int rtnl_link_vxlan_set_remcsum_rx(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_remcsum_rx(struct rtnl_link *);
extern int rtnl_link_vxlan_set_flags(struct rtnl_link *, uint32_t flags, int enable);
extern int rtnl_link_vxlan_get_flags(struct rtnl_link *, uint32_t *out_flags);
extern int rtnl_link_vxlan_set_collect_metadata(struct rtnl_link *, uint8_t);
extern int rtnl_link_vxlan_get_collect_metadata(struct rtnl_link *);
extern int rtnl_link_vxlan_set_label(struct rtnl_link *, uint32_t);
extern int rtnl_link_vxlan_get_label(struct rtnl_link *, uint32_t *);
#ifdef __cplusplus
}
#endif
#endif
route/link/ip6vti.h 0000644 00000002624 15051120407 0010230 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
#ifndef NETLINK_LINK_IP6VTI_H_
#define NETLINK_LINK_IP6VTI_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
int rtnl_link_is_ip6vti(struct rtnl_link *link);
extern struct rtnl_link *rtnl_link_ip6vti_alloc(void);
extern int rtnl_link_ip6vti_add(struct nl_sock *sk, const char *name);
extern int rtnl_link_ip6vti_set_link(struct rtnl_link *link, uint32_t index);
extern int rtnl_link_ip6vti_get_link(struct rtnl_link *link, uint32_t *index);
extern int rtnl_link_ip6vti_set_ikey(struct rtnl_link *link, uint32_t ikey);
extern int rtnl_link_ip6vti_get_ikey(struct rtnl_link *link, uint32_t *ikey);
extern int rtnl_link_ip6vti_set_okey(struct rtnl_link *link, uint32_t okey);
extern int rtnl_link_ip6vti_get_okey(struct rtnl_link *link, uint32_t *okey);
extern int rtnl_link_ip6vti_set_local(struct rtnl_link *link, struct in6_addr *local);
extern int rtnl_link_ip6vti_get_local(struct rtnl_link *link, struct in6_addr *remote);
extern int rtnl_link_ip6vti_set_remote(struct rtnl_link *link, struct in6_addr *remote);
extern int rtnl_link_ip6vti_get_remote(struct rtnl_link *link, struct in6_addr *remote);
extern int rtnl_link_ip6vti_set_fwmark(struct rtnl_link *link, uint32_t fwmark);
extern int rtnl_link_ip6vti_get_fwmark(struct rtnl_link *link, uint32_t *fwmark);
#ifdef __cplusplus
}
#endif
#endif
route/link/ipvti.h 0000644 00000002554 15051120407 0010144 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2014 Susant Sahani <susant@redhat.com>
*/
#ifndef NETLINK_LINK_IPVTI_H_
#define NETLINK_LINK_IPVTI_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_ipvti_alloc(void);
extern int rtnl_link_ipvti_add(struct nl_sock *sk, const char *name);
extern int rtnl_link_is_ipvti(struct rtnl_link *link);
extern int rtnl_link_ipvti_set_link(struct rtnl_link *link, uint32_t index);
extern uint32_t rtnl_link_ipvti_get_link(struct rtnl_link *link);
extern int rtnl_link_ipvti_set_ikey(struct rtnl_link *link, uint32_t ikey);
extern uint32_t rtnl_link_ipvti_get_ikey(struct rtnl_link *link);
extern int rtnl_link_ipvti_set_okey(struct rtnl_link *link, uint32_t okey);
extern uint32_t rtnl_link_ipvti_get_okey(struct rtnl_link *link);
extern int rtnl_link_ipvti_set_local(struct rtnl_link *link, uint32_t addr);
extern uint32_t rtnl_link_ipvti_get_local(struct rtnl_link *link);
extern int rtnl_link_ipvti_set_remote(struct rtnl_link *link, uint32_t addr);
extern uint32_t rtnl_link_ipvti_get_remote(struct rtnl_link *link);
extern int rtnl_link_ipvti_set_fwmark(struct rtnl_link *link, uint32_t fwmark);
extern int rtnl_link_ipvti_get_fwmark(struct rtnl_link *link, uint32_t *fwmark);
#ifdef __cplusplus
}
#endif
#endif
route/link/inet6.h 0000644 00000002107 15051120407 0010030 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2014 Dan Williams <dcbw@redhat.com>
*/
#ifndef NETLINK_LINK_INET6_H_
#define NETLINK_LINK_INET6_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
const char * rtnl_link_inet6_addrgenmode2str (uint8_t mode,
char *buf,
size_t len);
uint8_t rtnl_link_inet6_str2addrgenmode (const char *mode);
extern int rtnl_link_inet6_get_token(struct rtnl_link *,
struct nl_addr **);
extern int rtnl_link_inet6_set_token(struct rtnl_link *,
struct nl_addr *);
extern int rtnl_link_inet6_get_addr_gen_mode(struct rtnl_link *,
uint8_t *);
extern int rtnl_link_inet6_set_addr_gen_mode(struct rtnl_link *,
uint8_t);
extern int rtnl_link_inet6_get_flags(struct rtnl_link *,
uint32_t *);
extern int rtnl_link_inet6_set_flags(struct rtnl_link *,
uint32_t);
/* Link Flags Translations */
extern char * rtnl_link_inet6_flags2str(int, char *, size_t);
extern int rtnl_link_inet6_str2flags(const char *);
#ifdef __cplusplus
}
#endif
#endif
route/link/bridge.h 0000644 00000005404 15051120407 0010242 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_LINK_BRIDGE_H_
#define NETLINK_LINK_BRIDGE_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RTNL_LINK_BRIDGE_VLAN_BITMAP_MAX 4096
#define RTNL_LINK_BRIDGE_VLAN_BITMAP_LEN (RTNL_LINK_BRIDGE_VLAN_BITMAP_MAX / 32)
struct rtnl_link_bridge_vlan
{
uint16_t pvid;
uint32_t vlan_bitmap[RTNL_LINK_BRIDGE_VLAN_BITMAP_LEN];
uint32_t untagged_bitmap[RTNL_LINK_BRIDGE_VLAN_BITMAP_LEN];
};
/**
* Bridge flags
* @ingroup bridge
*/
enum rtnl_link_bridge_flags {
RTNL_BRIDGE_HAIRPIN_MODE = 0x0001,
RTNL_BRIDGE_BPDU_GUARD = 0x0002,
RTNL_BRIDGE_ROOT_BLOCK = 0x0004,
RTNL_BRIDGE_FAST_LEAVE = 0x0008,
RTNL_BRIDGE_UNICAST_FLOOD = 0x0010,
RTNL_BRIDGE_LEARNING = 0x0020,
RTNL_BRIDGE_LEARNING_SYNC = 0x0040,
};
#define RTNL_BRIDGE_HWMODE_VEB BRIDGE_MODE_VEB
#define RTNL_BRIDGE_HWMODE_VEPA BRIDGE_MODE_VEPA
#define RTNL_BRIDGE_HWMODE_MAX BRIDGE_MODE_VEPA
#define RTNL_BRIDGE_HWMODE_UNDEF BRIDGE_MODE_UNDEF
extern struct rtnl_link *rtnl_link_bridge_alloc(void);
extern int rtnl_link_is_bridge(struct rtnl_link *);
extern int rtnl_link_bridge_has_ext_info(struct rtnl_link *);
extern int rtnl_link_bridge_set_port_state(struct rtnl_link *, uint8_t );
extern int rtnl_link_bridge_get_port_state(struct rtnl_link *);
extern int rtnl_link_bridge_set_priority(struct rtnl_link *, uint16_t);
extern int rtnl_link_bridge_get_priority(struct rtnl_link *);
extern int rtnl_link_bridge_set_cost(struct rtnl_link *, uint32_t);
extern int rtnl_link_bridge_get_cost(struct rtnl_link *, uint32_t *);
extern int rtnl_link_bridge_unset_flags(struct rtnl_link *, unsigned int);
extern int rtnl_link_bridge_set_flags(struct rtnl_link *, unsigned int);
extern int rtnl_link_bridge_get_flags(struct rtnl_link *);
extern int rtnl_link_bridge_set_self(struct rtnl_link *);
extern int rtnl_link_bridge_get_hwmode(struct rtnl_link *, uint16_t *);
extern int rtnl_link_bridge_set_hwmode(struct rtnl_link *, uint16_t);
extern char * rtnl_link_bridge_flags2str(int, char *, size_t);
extern int rtnl_link_bridge_str2flags(const char *);
extern char * rtnl_link_bridge_portstate2str(int, char *, size_t);
extern int rtnl_link_bridge_str2portstate(const char *);
extern char * rtnl_link_bridge_hwmode2str(uint16_t, char *, size_t);
extern uint16_t rtnl_link_bridge_str2hwmode(const char *);
extern int rtnl_link_bridge_add(struct nl_sock *sk, const char *name);
extern int rtnl_link_bridge_pvid(struct rtnl_link *link);
extern int rtnl_link_bridge_has_vlan(struct rtnl_link *link);
extern struct rtnl_link_bridge_vlan *rtnl_link_bridge_get_port_vlan(struct rtnl_link *link);
#ifdef __cplusplus
}
#endif
#endif
route/link/macsec.h 0000644 00000004460 15051120407 0010242 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2016 Sabrina Dubroca <sd@queasysnail.net>
*/
#ifndef NETLINK_LINK_MACSEC_H_
#define NETLINK_LINK_MACSEC_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#include <linux/if_link.h>
#include <linux/if_macsec.h>
#ifdef __cplusplus
extern "C" {
#endif
enum macsec_validation_type;
struct rtnl_link *rtnl_link_macsec_alloc(void);
int rtnl_link_macsec_set_sci(struct rtnl_link *, uint64_t);
int rtnl_link_macsec_get_sci(struct rtnl_link *, uint64_t *);
int rtnl_link_macsec_set_port(struct rtnl_link *, uint16_t);
int rtnl_link_macsec_get_port(struct rtnl_link *, uint16_t *);
int rtnl_link_macsec_set_cipher_suite(struct rtnl_link *, uint64_t);
int rtnl_link_macsec_get_cipher_suite(struct rtnl_link *, uint64_t *);
int rtnl_link_macsec_set_icv_len(struct rtnl_link *, uint16_t);
int rtnl_link_macsec_get_icv_len(struct rtnl_link *, uint16_t *);
int rtnl_link_macsec_set_protect(struct rtnl_link *, uint8_t);
int rtnl_link_macsec_get_protect(struct rtnl_link *, uint8_t *);
int rtnl_link_macsec_set_encrypt(struct rtnl_link *, uint8_t);
int rtnl_link_macsec_get_encrypt(struct rtnl_link *, uint8_t *);
int rtnl_link_macsec_set_offload(struct rtnl_link *, uint8_t);
int rtnl_link_macsec_get_offload(struct rtnl_link *, uint8_t *);
int rtnl_link_macsec_set_encoding_sa(struct rtnl_link *, uint8_t);
int rtnl_link_macsec_get_encoding_sa(struct rtnl_link *, uint8_t *);
int rtnl_link_macsec_set_validation_type(struct rtnl_link *,
enum macsec_validation_type);
int rtnl_link_macsec_get_validation_type(struct rtnl_link *,
enum macsec_validation_type *);
int rtnl_link_macsec_set_replay_protect(struct rtnl_link *, uint8_t);
int rtnl_link_macsec_get_replay_protect(struct rtnl_link *, uint8_t *);
int rtnl_link_macsec_set_window(struct rtnl_link *, uint32_t);
int rtnl_link_macsec_get_window(struct rtnl_link *, uint32_t *);
int rtnl_link_macsec_set_send_sci(struct rtnl_link *, uint8_t);
int rtnl_link_macsec_get_send_sci(struct rtnl_link *, uint8_t *);
int rtnl_link_macsec_set_end_station(struct rtnl_link *, uint8_t);
int rtnl_link_macsec_get_end_station(struct rtnl_link *, uint8_t *);
int rtnl_link_macsec_set_scb(struct rtnl_link *, uint8_t);
int rtnl_link_macsec_get_scb(struct rtnl_link *, uint8_t *);
#ifdef __cplusplus
}
#endif
#endif
route/link/ipvlan.h 0000644 00000001315 15051120407 0010274 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2015 Cong Wang <cwang@twopensource.com>
*/
#ifndef NETLINK_LINK_IPVLAN_H_
#define NETLINK_LINK_IPVLAN_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_ipvlan_alloc(void);
extern int rtnl_link_is_ipvlan(struct rtnl_link *);
extern char * rtnl_link_ipvlan_mode2str(int, char *, size_t);
extern int rtnl_link_ipvlan_str2mode(const char *);
extern int rtnl_link_ipvlan_set_mode(struct rtnl_link *,
uint16_t);
extern int rtnl_link_ipvlan_get_mode(struct rtnl_link *, uint16_t *out_mode);
#ifdef __cplusplus
}
#endif
#endif
route/link/can.h 0000644 00000005007 15051120407 0007546 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2012 Benedikt Spranger <b.spranger@linutronix.de>
*/
#ifndef NETLINK_LINK_CAN_H_
#define NETLINK_LINK_CAN_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#include <linux/can/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
struct can_bittiming_const;
struct can_bittiming;
struct can_berr_counter;
extern int rtnl_link_is_can(struct rtnl_link *link);
extern char *rtnl_link_can_ctrlmode2str(int, char *, size_t);
extern int rtnl_link_can_str2ctrlmode(const char *);
extern int rtnl_link_can_restart(struct rtnl_link *);
extern int rtnl_link_can_freq(struct rtnl_link *, uint32_t *);
extern int rtnl_link_can_state(struct rtnl_link *, uint32_t *);
extern int rtnl_link_can_berr_rx(struct rtnl_link *);
extern int rtnl_link_can_berr_tx(struct rtnl_link *);
extern int rtnl_link_can_berr(struct rtnl_link *, struct can_berr_counter *);
extern int rtnl_link_can_get_bt_const(struct rtnl_link *,
struct can_bittiming_const *);
extern int rtnl_link_can_get_bittiming(struct rtnl_link *,
struct can_bittiming *);
extern int rtnl_link_can_set_bittiming(struct rtnl_link *,
const struct can_bittiming *);
extern int rtnl_link_can_get_bitrate(struct rtnl_link *, uint32_t *);
extern int rtnl_link_can_set_bitrate(struct rtnl_link *, uint32_t);
extern int rtnl_link_can_get_sample_point(struct rtnl_link *, uint32_t *);
extern int rtnl_link_can_set_sample_point(struct rtnl_link *, uint32_t);
extern int rtnl_link_can_get_restart_ms(struct rtnl_link *, uint32_t *);
extern int rtnl_link_can_set_restart_ms(struct rtnl_link *, uint32_t);
extern int rtnl_link_can_get_ctrlmode(struct rtnl_link *, uint32_t *);
extern int rtnl_link_can_set_ctrlmode(struct rtnl_link *, uint32_t);
extern int rtnl_link_can_unset_ctrlmode(struct rtnl_link *, uint32_t);
extern int rtnl_link_can_get_data_bittiming_const(struct rtnl_link *,
struct can_bittiming_const *);
extern int rtnl_link_can_set_data_bittiming_const(struct rtnl_link *,
const struct can_bittiming_const *);
extern int rtnl_link_can_get_data_bittiming(struct rtnl_link *,
struct can_bittiming *);
extern int rtnl_link_can_set_data_bittiming(struct rtnl_link *,
const struct can_bittiming *);
#ifdef __cplusplus
}
#endif
#endif
route/link/ip6tnl.h 0000644 00000004040 15051120407 0010215 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2014 Susant Sahani <susant@redhat.com>
*/
#ifndef NETLINK_LINK_IP6TNL_H_
#define NETLINK_LINK_IP6TNL_H_
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_link *rtnl_link_ip6_tnl_alloc(void);
extern int rtnl_link_ip6_tnl_add(struct nl_sock *sk, const char *name);
extern int rtnl_link_is_ip6_tnl(struct rtnl_link *link);
extern int rtnl_link_ip6_tnl_set_link(struct rtnl_link *link, uint32_t index);
extern uint32_t rtnl_link_ip6_tnl_get_link(struct rtnl_link *link);
extern int rtnl_link_ip6_tnl_set_local(struct rtnl_link *link, struct in6_addr *);
extern int rtnl_link_ip6_tnl_get_local(struct rtnl_link *link, struct in6_addr *addr);
extern int rtnl_link_ip6_tnl_set_remote(struct rtnl_link *link, struct in6_addr *);
extern int rtnl_link_ip6_tnl_get_remote(struct rtnl_link *link, struct in6_addr *);
extern int rtnl_link_ip6_tnl_set_ttl(struct rtnl_link *link, uint8_t ttl);
extern uint8_t rtnl_link_ip6_tnl_get_ttl(struct rtnl_link *link);
extern int rtnl_link_ip6_tnl_set_tos(struct rtnl_link *link, uint8_t tos);
extern uint8_t rtnl_link_ip6_tnl_get_tos(struct rtnl_link *link);
extern int rtnl_link_ip6_tnl_set_encaplimit(struct rtnl_link *link, uint8_t encap_limit);
extern uint8_t rtnl_link_ip6_tnl_get_encaplimit(struct rtnl_link *link);
extern int rtnl_link_ip6_tnl_set_flags(struct rtnl_link *link, uint32_t flags);
extern uint32_t rtnl_link_ip6_tnl_get_flags(struct rtnl_link *link);
extern uint32_t rtnl_link_ip6_tnl_get_flowinfo(struct rtnl_link *link);
extern int rtnl_link_ip6_tnl_set_flowinfo(struct rtnl_link *link, uint32_t flowinfo);
extern int rtnl_link_ip6_tnl_set_proto(struct rtnl_link *link, uint8_t proto);
extern uint8_t rtnl_link_ip6_tnl_get_proto(struct rtnl_link *link);
extern int rtnl_link_ip6_tnl_set_fwmark(struct rtnl_link *link, uint32_t fwmark);
extern int rtnl_link_ip6_tnl_get_fwmark(struct rtnl_link *link, uint32_t *fwmark);
#ifdef __cplusplus
}
#endif
#endif
route/classifier.h 0000644 00000003247 15051120407 0010200 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLASSIFIER_H_
#define NETLINK_CLASSIFIER_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/tc.h>
#include <netlink/utils.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_cls *rtnl_cls_alloc(void);
extern void rtnl_cls_put(struct rtnl_cls *);
extern int rtnl_cls_alloc_cache(struct nl_sock *, int, uint32_t,
struct nl_cache **);
extern struct rtnl_cls *rtnl_cls_find_by_handle(struct nl_cache *cache, int ifindex,
uint32_t parent, uint32_t handle);
extern struct rtnl_cls *rtnl_cls_find_by_prio(struct nl_cache *cache, int ifindex,
uint32_t parent, uint16_t prio);
extern void rtnl_cls_cache_set_tc_params(struct nl_cache *, int, uint32_t);
extern int rtnl_cls_build_add_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_add(struct nl_sock *, struct rtnl_cls *, int);
extern int rtnl_cls_change(struct nl_sock *, struct rtnl_cls *, int);
extern int rtnl_cls_build_change_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_build_delete_request(struct rtnl_cls *, int,
struct nl_msg **);
extern int rtnl_cls_delete(struct nl_sock *, struct rtnl_cls *,
int);
extern void rtnl_cls_set_prio(struct rtnl_cls *, uint16_t);
extern uint16_t rtnl_cls_get_prio(struct rtnl_cls *);
extern void rtnl_cls_set_protocol(struct rtnl_cls *, uint16_t);
extern uint16_t rtnl_cls_get_protocol(struct rtnl_cls *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc.h 0000644 00000003721 15051120407 0007154 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_QDISC_H_
#define NETLINK_QDISC_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/tc.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_qdisc;
extern struct rtnl_qdisc *
rtnl_qdisc_alloc(void);
extern void rtnl_qdisc_put(struct rtnl_qdisc *);
extern int rtnl_qdisc_alloc_cache(struct nl_sock *, struct nl_cache **);
extern struct rtnl_qdisc *
rtnl_qdisc_get(struct nl_cache *, int, uint32_t);
extern struct rtnl_qdisc *
rtnl_qdisc_get_by_parent(struct nl_cache *, int, uint32_t);
extern struct rtnl_qdisc *rtnl_qdisc_get_by_kind(struct nl_cache *cache,
int ifindex, char *kind);
extern int rtnl_qdisc_build_add_request(struct rtnl_qdisc *, int,
struct nl_msg **);
extern int rtnl_qdisc_add(struct nl_sock *, struct rtnl_qdisc *, int);
extern int rtnl_qdisc_build_update_request(struct rtnl_qdisc *,
struct rtnl_qdisc *,
int, struct nl_msg **);
extern int rtnl_qdisc_update(struct nl_sock *, struct rtnl_qdisc *,
struct rtnl_qdisc *, int);
extern int rtnl_qdisc_build_delete_request(struct rtnl_qdisc *,
struct nl_msg **);
extern int rtnl_qdisc_delete(struct nl_sock *, struct rtnl_qdisc *);
/* Deprecated functions */
extern void rtnl_qdisc_foreach_child(struct rtnl_qdisc *, struct nl_cache *,
void (*cb)(struct nl_object *, void *),
void *) __attribute__ ((deprecated));
extern void rtnl_qdisc_foreach_cls(struct rtnl_qdisc *, struct nl_cache *,
void (*cb)(struct nl_object *, void *),
void *) __attribute__ ((deprecated));
extern int rtnl_qdisc_build_change_request(struct rtnl_qdisc *,
struct rtnl_qdisc *,
struct nl_msg **)
__attribute__ ((deprecated));
extern int rtnl_qdisc_change(struct nl_sock *, struct rtnl_qdisc *,
struct rtnl_qdisc *) __attribute__ ((deprecated));
#ifdef __cplusplus
}
#endif
#endif
route/neightbl.h 0000644 00000004631 15051120407 0007646 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_NEIGHTBL_H_
#define NETLINK_NEIGHTBL_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_neightbl;
extern struct rtnl_neightbl *rtnl_neightbl_alloc(void);
extern void rtnl_neightbl_put(struct rtnl_neightbl *);
extern void rtnl_neightbl_free(struct rtnl_neightbl *);
extern int rtnl_neightbl_alloc_cache(struct nl_sock *, struct nl_cache **);
extern struct rtnl_neightbl *rtnl_neightbl_get(struct nl_cache *,
const char *, int);
extern void rtnl_neightbl_dump(struct rtnl_neightbl *, FILE *,
struct nl_dump_params *);
extern int rtnl_neightbl_build_change_request(struct rtnl_neightbl *,
struct rtnl_neightbl *,
struct nl_msg **);
extern int rtnl_neightbl_change(struct nl_sock *, struct rtnl_neightbl *,
struct rtnl_neightbl *);
extern void rtnl_neightbl_set_family(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_gc_tresh1(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_gc_tresh2(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_gc_tresh3(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_gc_interval(struct rtnl_neightbl *, uint64_t);
extern void rtnl_neightbl_set_name(struct rtnl_neightbl *, const char *);
extern void rtnl_neightbl_set_dev(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_queue_len(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_proxy_queue_len(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_app_probes(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_ucast_probes(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_mcast_probes(struct rtnl_neightbl *, int);
extern void rtnl_neightbl_set_base_reachable_time(struct rtnl_neightbl *,
uint64_t);
extern void rtnl_neightbl_set_retrans_time(struct rtnl_neightbl *, uint64_t);
extern void rtnl_neightbl_set_gc_stale_time(struct rtnl_neightbl *, uint64_t);
extern void rtnl_neightbl_set_delay_probe_time(struct rtnl_neightbl *,
uint64_t);
extern void rtnl_neightbl_set_anycast_delay(struct rtnl_neightbl *, uint64_t);
extern void rtnl_neightbl_set_proxy_delay(struct rtnl_neightbl *, uint64_t);
extern void rtnl_neightbl_set_locktime(struct rtnl_neightbl *, uint64_t);
#ifdef __cplusplus
}
#endif
#endif
route/tc.h 0000644 00000006555 15051120407 0006467 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_TC_H_
#define NETLINK_TC_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/data.h>
#include <netlink/route/link.h>
#include <linux/pkt_sched.h>
#include <linux/pkt_cls.h>
#ifdef __cplusplus
extern "C" {
#endif
enum rtnl_tc_type {
RTNL_TC_TYPE_QDISC,
RTNL_TC_TYPE_CLASS,
RTNL_TC_TYPE_CLS,
RTNL_TC_TYPE_ACT,
__RTNL_TC_TYPE_MAX,
};
#define RTNL_TC_TYPE_MAX (__RTNL_TC_TYPE_MAX - 1)
/**
* Compute tc handle based on major and minor parts
* @ingroup tc
*/
#define TC_HANDLE(maj, min) (TC_H_MAJ((maj) << 16) | TC_H_MIN(min))
/**
* Traffic control object
* @ingroup tc
*/
struct rtnl_tc;
/**
* Macro to cast qdisc/class/classifier to tc object
* @ingroup tc
*
* @code
* rtnl_tc_set_mpu(TC_CAST(qdisc), 40);
* @endcode
*/
#define TC_CAST(ptr) ((struct rtnl_tc *) (ptr))
/**
* Traffic control statistical identifier
* @ingroup tc
*
* @code
* uint64_t n = rtnl_tc_get_stat(TC_CAST(class), RTNL_TC_PACKETS);
* @endcode
*/
enum rtnl_tc_stat {
RTNL_TC_PACKETS, /**< Number of packets seen */
RTNL_TC_BYTES, /**< Total bytes seen */
RTNL_TC_RATE_BPS, /**< Current bits/s (rate estimator) */
RTNL_TC_RATE_PPS, /**< Current packet/s (rate estimator) */
RTNL_TC_QLEN, /**< Current queue length */
RTNL_TC_BACKLOG, /**< Current backlog length */
RTNL_TC_DROPS, /**< Total number of packets dropped */
RTNL_TC_REQUEUES, /**< Total number of requeues */
RTNL_TC_OVERLIMITS, /**< Total number of overlimits */
__RTNL_TC_STATS_MAX,
};
#define RTNL_TC_STATS_MAX (__RTNL_TC_STATS_MAX - 1)
extern void rtnl_tc_set_ifindex(struct rtnl_tc *, int);
extern int rtnl_tc_get_ifindex(struct rtnl_tc *);
extern void rtnl_tc_set_link(struct rtnl_tc *, struct rtnl_link *);
extern struct rtnl_link *rtnl_tc_get_link(struct rtnl_tc *);
extern void rtnl_tc_set_mtu(struct rtnl_tc *, uint32_t);
extern uint32_t rtnl_tc_get_mtu(struct rtnl_tc *);
extern void rtnl_tc_set_mpu(struct rtnl_tc *, uint32_t);
extern uint32_t rtnl_tc_get_mpu(struct rtnl_tc *);
extern void rtnl_tc_set_overhead(struct rtnl_tc *, uint32_t);
extern uint32_t rtnl_tc_get_overhead(struct rtnl_tc *);
extern void rtnl_tc_set_linktype(struct rtnl_tc *, uint32_t);
extern uint32_t rtnl_tc_get_linktype(struct rtnl_tc *);
extern void rtnl_tc_set_handle(struct rtnl_tc *, uint32_t);
extern uint32_t rtnl_tc_get_handle(struct rtnl_tc *);
extern void rtnl_tc_set_parent(struct rtnl_tc *, uint32_t);
extern uint32_t rtnl_tc_get_parent(struct rtnl_tc *);
extern int rtnl_tc_set_kind(struct rtnl_tc *, const char *);
extern char * rtnl_tc_get_kind(struct rtnl_tc *);
extern uint64_t rtnl_tc_get_stat(struct rtnl_tc *, enum rtnl_tc_stat);
extern char * rtnl_tc_stat2str(enum rtnl_tc_stat, char *, size_t);
extern int rtnl_tc_str2stat(const char *);
extern int rtnl_tc_calc_txtime(int, int);
extern int rtnl_tc_calc_bufsize(int, int);
extern int rtnl_tc_calc_cell_log(int);
extern int rtnl_tc_read_classid_file(void);
extern char * rtnl_tc_handle2str(uint32_t, char *, size_t);
extern int rtnl_tc_str2handle(const char *, uint32_t *);
extern int rtnl_classid_generate(const char *, uint32_t *,
uint32_t);
extern void rtnl_tc_set_chain(struct rtnl_tc *, uint32_t);
extern int rtnl_tc_get_chain(struct rtnl_tc *, uint32_t *);
#ifdef __cplusplus
}
#endif
#endif
route/cls/flower.h 0000644 00000004111 15051120407 0010122 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2018 Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se>
*/
#ifndef NETLINK_FLOWER_H_
#define NETLINK_FLOWER_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/classifier.h>
#include <netlink/route/action.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_flower_set_proto(struct rtnl_cls *cls, uint16_t);
extern int rtnl_flower_get_proto(struct rtnl_cls *cls, uint16_t *);
extern int rtnl_flower_set_vlan_id(struct rtnl_cls *, uint16_t);
extern int rtnl_flower_get_vlan_id(struct rtnl_cls *, uint16_t *);
extern int rtnl_flower_set_vlan_prio(struct rtnl_cls *, uint8_t);
extern int rtnl_flower_get_vlan_prio(struct rtnl_cls *, uint8_t *);
extern int rtnl_flower_set_vlan_ethtype(struct rtnl_cls *, uint16_t);
extern int rtnl_flower_set_dst_mac(struct rtnl_cls *, unsigned char *,
unsigned char *);
extern int rtnl_flower_get_dst_mac(struct rtnl_cls *, unsigned char *,
unsigned char *);
extern int rtnl_flower_set_src_mac(struct rtnl_cls *, unsigned char *,
unsigned char *);
extern int rtnl_flower_get_src_mac(struct rtnl_cls *, unsigned char *,
unsigned char *);
extern int rtnl_flower_set_ip_dscp(struct rtnl_cls *, uint8_t, uint8_t);
extern int rtnl_flower_get_ip_dscp(struct rtnl_cls *, uint8_t *, uint8_t *);
extern int rtnl_flower_set_ipv4_src(struct rtnl_cls *, in_addr_t, in_addr_t);
extern int rtnl_flower_get_ipv4_src(struct rtnl_cls *, in_addr_t *,
in_addr_t *);
extern int rtnl_flower_set_ipv4_dst(struct rtnl_cls *, in_addr_t, in_addr_t);
extern int rtnl_flower_get_ipv4_dst(struct rtnl_cls *, in_addr_t *,
in_addr_t *);
extern int rtnl_flower_set_flags(struct rtnl_cls *, int);
extern int rtnl_flower_append_action(struct rtnl_cls *, struct rtnl_act *);
extern int rtnl_flower_del_action(struct rtnl_cls *, struct rtnl_act *);
extern struct rtnl_act* rtnl_flower_get_action(struct rtnl_cls *);
#ifdef __cplusplus
}
#endif
#endif
route/cls/basic.h 0000644 00000001561 15051120407 0007713 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_BASIC_H_
#define NETLINK_BASIC_H_
#include <netlink/netlink.h>
#include <netlink/route/classifier.h>
#include <netlink/route/cls/ematch.h>
#include <netlink/route/action.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void rtnl_basic_set_target(struct rtnl_cls *, uint32_t);
extern uint32_t rtnl_basic_get_target(struct rtnl_cls *);
extern void rtnl_basic_set_ematch(struct rtnl_cls *,
struct rtnl_ematch_tree *);
extern struct rtnl_ematch_tree *rtnl_basic_get_ematch(struct rtnl_cls *);
extern int rtnl_basic_add_action(struct rtnl_cls *, struct rtnl_act *);
extern int rtnl_basic_del_action(struct rtnl_cls *, struct rtnl_act *);
extern struct rtnl_act* rtnl_basic_get_action(struct rtnl_cls *);
#ifdef __cplusplus
}
#endif
#endif
route/cls/cgroup.h 0000644 00000001032 15051120407 0010122 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2009-2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLS_CGROUP_H_
#define NETLINK_CLS_CGROUP_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/classifier.h>
#include <netlink/route/cls/ematch.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void rtnl_cgroup_set_ematch(struct rtnl_cls *,
struct rtnl_ematch_tree *);
struct rtnl_ematch_tree * rtnl_cgroup_get_ematch(struct rtnl_cls *);
#ifdef __cplusplus
}
#endif
#endif
route/cls/ematch.h 0000644 00000005340 15051120407 0010072 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLS_EMATCH_H_
#define NETLINK_CLS_EMATCH_H_
#include <netlink/netlink.h>
#include <netlink/msg.h>
#include <netlink/route/classifier.h>
#include <linux/pkt_cls.h>
#ifdef __cplusplus
extern "C" {
#endif
/* FIXME: Should be moved to the kernel header at some point */
#define RTNL_EMATCH_PROGID 2
struct rtnl_ematch;
struct rtnl_ematch_tree;
/**
* Extended Match Operations
*/
struct rtnl_ematch_ops
{
int eo_kind;
const char * eo_name;
size_t eo_minlen;
size_t eo_datalen;
int (*eo_parse)(struct rtnl_ematch *, void *, size_t);
void (*eo_dump)(struct rtnl_ematch *,
struct nl_dump_params *);
int (*eo_fill)(struct rtnl_ematch *, struct nl_msg *);
void (*eo_free)(struct rtnl_ematch *);
struct nl_list_head eo_list;
};
extern int rtnl_ematch_register(struct rtnl_ematch_ops *);
extern struct rtnl_ematch_ops * rtnl_ematch_lookup_ops(int);
extern struct rtnl_ematch_ops * rtnl_ematch_lookup_ops_by_name(const char *);
extern struct rtnl_ematch * rtnl_ematch_alloc(void);
extern int rtnl_ematch_add_child(struct rtnl_ematch *,
struct rtnl_ematch *);
extern void rtnl_ematch_unlink(struct rtnl_ematch *);
extern void rtnl_ematch_free(struct rtnl_ematch *);
extern void * rtnl_ematch_data(struct rtnl_ematch *);
extern void rtnl_ematch_set_flags(struct rtnl_ematch *,
uint16_t);
extern void rtnl_ematch_unset_flags(struct rtnl_ematch *,
uint16_t);
extern uint16_t rtnl_ematch_get_flags(struct rtnl_ematch *);
extern int rtnl_ematch_set_ops(struct rtnl_ematch *,
struct rtnl_ematch_ops *);
extern int rtnl_ematch_set_kind(struct rtnl_ematch *,
uint16_t);
extern int rtnl_ematch_set_name(struct rtnl_ematch *,
const char *);
extern struct rtnl_ematch_tree *rtnl_ematch_tree_alloc(uint16_t);
extern void rtnl_ematch_tree_free(struct rtnl_ematch_tree *);
extern void rtnl_ematch_tree_add(struct rtnl_ematch_tree *,
struct rtnl_ematch *);
extern struct rtnl_ematch_tree *rtnl_ematch_tree_clone(struct rtnl_ematch_tree *);
extern int rtnl_ematch_parse_attr(struct nlattr *,
struct rtnl_ematch_tree **);
extern int rtnl_ematch_fill_attr(struct nl_msg *, int,
struct rtnl_ematch_tree *);
extern void rtnl_ematch_tree_dump(struct rtnl_ematch_tree *,
struct nl_dump_params *);
extern int rtnl_ematch_parse_expr(const char *, char **,
struct rtnl_ematch_tree **);
extern char * rtnl_ematch_offset2txt(uint8_t, uint16_t,
char *, size_t);
extern char * rtnl_ematch_opnd2txt(uint8_t, char *, size_t);
#ifdef __cplusplus
}
#endif
#endif
route/cls/ematch/nbyte.h 0000644 00000001470 15051120407 0011213 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLS_EMATCH_NBYTE_H_
#define NETLINK_CLS_EMATCH_NBYTE_H_
#include <netlink/netlink.h>
#include <netlink/route/cls/ematch.h>
#include <linux/tc_ematch/tc_em_nbyte.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void rtnl_ematch_nbyte_set_offset(struct rtnl_ematch *,
uint8_t, uint16_t);
extern uint16_t rtnl_ematch_nbyte_get_offset(struct rtnl_ematch *);
extern uint8_t rtnl_ematch_nbyte_get_layer(struct rtnl_ematch *);
extern void rtnl_ematch_nbyte_set_pattern(struct rtnl_ematch *,
uint8_t *, size_t);
extern uint8_t * rtnl_ematch_nbyte_get_pattern(struct rtnl_ematch *);
extern size_t rtnl_ematch_nbyte_get_len(struct rtnl_ematch *);
#ifdef __cplusplus
}
#endif
#endif
route/cls/ematch/text.h 0000644 00000002215 15051120407 0011054 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLS_EMATCH_TEXT_H_
#define NETLINK_CLS_EMATCH_TEXT_H_
#include <netlink/netlink.h>
#include <netlink/route/cls/ematch.h>
#include <linux/tc_ematch/tc_em_text.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void rtnl_ematch_text_set_from(struct rtnl_ematch *,
uint8_t, uint16_t);
extern uint16_t rtnl_ematch_text_get_from_offset(struct rtnl_ematch *);
extern uint8_t rtnl_ematch_text_get_from_layer(struct rtnl_ematch *);
extern void rtnl_ematch_text_set_to(struct rtnl_ematch *,
uint8_t, uint16_t);
extern uint16_t rtnl_ematch_text_get_to_offset(struct rtnl_ematch *);
extern uint8_t rtnl_ematch_text_get_to_layer(struct rtnl_ematch *);
extern void rtnl_ematch_text_set_pattern(struct rtnl_ematch *,
char *, size_t);
extern char * rtnl_ematch_text_get_pattern(struct rtnl_ematch *);
extern size_t rtnl_ematch_text_get_len(struct rtnl_ematch *);
extern void rtnl_ematch_text_set_algo(struct rtnl_ematch *, const char *);
extern char * rtnl_ematch_text_get_algo(struct rtnl_ematch *);
#ifdef __cplusplus
}
#endif
#endif
route/cls/ematch/meta.h 0000644 00000001674 15051120407 0011026 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLS_EMATCH_META_H_
#define NETLINK_CLS_EMATCH_META_H_
#include <netlink/netlink.h>
#include <netlink/route/cls/ematch.h>
#include <linux/tc_ematch/tc_em_meta.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_meta_value;
extern struct rtnl_meta_value * rtnl_meta_value_alloc_int(uint64_t);
extern struct rtnl_meta_value * rtnl_meta_value_alloc_var(void *, size_t);
extern struct rtnl_meta_value * rtnl_meta_value_alloc_id(uint8_t, uint16_t,
uint8_t, uint64_t);
extern void rtnl_meta_value_put(struct rtnl_meta_value *);
extern void rtnl_ematch_meta_set_lvalue(struct rtnl_ematch *,
struct rtnl_meta_value *);
void rtnl_ematch_meta_set_rvalue(struct rtnl_ematch *,
struct rtnl_meta_value *);
extern void rtnl_ematch_meta_set_operand(struct rtnl_ematch *, uint8_t);
#ifdef __cplusplus
}
#endif
#endif
route/cls/ematch/cmp.h 0000644 00000001031 15051120407 0010642 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLS_EMATCH_CMP_H_
#define NETLINK_CLS_EMATCH_CMP_H_
#include <netlink/netlink.h>
#include <netlink/route/cls/ematch.h>
#include <linux/tc_ematch/tc_em_cmp.h>
#ifdef __cplusplus
extern "C" {
#endif
struct tcf_em_cmp;
extern void rtnl_ematch_cmp_set(struct rtnl_ematch *,
struct tcf_em_cmp *);
extern struct tcf_em_cmp *
rtnl_ematch_cmp_get(struct rtnl_ematch *);
#ifdef __cplusplus
}
#endif
#endif
route/cls/police.h 0000644 00000000611 15051120407 0010100 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLS_POLICE_H_
#define NETLINK_CLS_POLICE_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#ifdef __cplusplus
extern "C" {
#endif
extern char * nl_police2str(int, char *, size_t);
extern int nl_str2police(const char *);
#ifdef __cplusplus
}
#endif
#endif
route/cls/fw.h 0000644 00000001016 15051120407 0007241 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2006 Petr Gotthard <petr.gotthard@siemens.com>
* Copyright (c) 2006 Siemens AG Oesterreich
*/
#ifndef NETLINK_FW_H_
#define NETLINK_FW_H_
#include <netlink/netlink.h>
#include <netlink/route/classifier.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_fw_set_classid(struct rtnl_cls *, uint32_t);
extern int rtnl_fw_set_mask(struct rtnl_cls *, uint32_t);
#ifdef __cplusplus
}
#endif
#endif
route/cls/matchall.h 0000644 00000001530 15051120407 0010413 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2017 Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>
*/
#ifndef NETLINK_MATCHALL_H_
#define NETLINK_MATCHALL_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/classifier.h>
#include <netlink/route/action.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_mall_set_classid(struct rtnl_cls *, uint32_t);
extern int rtnl_mall_get_classid(struct rtnl_cls *, uint32_t *);
extern int rtnl_mall_set_flags(struct rtnl_cls *, uint32_t);
extern int rtnl_mall_get_flags(struct rtnl_cls *, uint32_t *);
extern int rtnl_mall_append_action(struct rtnl_cls *, struct rtnl_act *);
extern struct rtnl_act *rtnl_mall_get_first_action(struct rtnl_cls *);
extern int rtnl_mall_del_action(struct rtnl_cls *, struct rtnl_act *);
#ifdef __cplusplus
}
#endif
#endif
route/cls/u32.h 0000644 00000003726 15051120407 0007250 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_U32_H_
#define NETLINK_U32_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/classifier.h>
#include <netlink/route/action.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void rtnl_u32_set_handle(struct rtnl_cls *, int, int, int);
extern int rtnl_u32_set_classid(struct rtnl_cls *, uint32_t);
extern int rtnl_u32_get_classid(struct rtnl_cls *, uint32_t *);
extern int rtnl_u32_set_divisor(struct rtnl_cls *, uint32_t);
extern int rtnl_u32_set_link(struct rtnl_cls *, uint32_t);
extern int rtnl_u32_set_hashtable(struct rtnl_cls *, uint32_t);
extern int rtnl_u32_set_hashmask(struct rtnl_cls *, uint32_t, uint32_t);
extern int rtnl_u32_set_selector(struct rtnl_cls *, int, uint32_t, char, uint16_t, char);
extern int rtnl_u32_set_cls_terminal(struct rtnl_cls *);
extern int rtnl_u32_set_flags(struct rtnl_cls *, int);
extern int rtnl_u32_add_mark(struct rtnl_cls *, uint32_t, uint32_t);
extern int rtnl_u32_del_mark(struct rtnl_cls *);
extern int rtnl_u32_add_key(struct rtnl_cls *, uint32_t, uint32_t,
int, int);
extern int rtnl_u32_get_key(struct rtnl_cls *, uint8_t, uint32_t *, uint32_t *,
int *, int *);
extern int rtnl_u32_add_key_uint8(struct rtnl_cls *, uint8_t, uint8_t,
int, int);
extern int rtnl_u32_add_key_uint16(struct rtnl_cls *, uint16_t, uint16_t,
int, int);
extern int rtnl_u32_add_key_uint32(struct rtnl_cls *, uint32_t, uint32_t,
int, int);
extern int rtnl_u32_add_key_in_addr(struct rtnl_cls *, const struct in_addr *,
uint8_t, int, int);
extern int rtnl_u32_add_key_in6_addr(struct rtnl_cls *, const struct in6_addr *,
uint8_t, int, int);
extern int rtnl_u32_add_action(struct rtnl_cls *, struct rtnl_act *);
extern int rtnl_u32_del_action(struct rtnl_cls *, struct rtnl_act *);
extern struct rtnl_act* rtnl_u32_get_action(struct rtnl_cls *);
#ifdef __cplusplus
}
#endif
#endif
route/link.h 0000644 00000030063 15051120407 0007005 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_LINK_H_
#define NETLINK_LINK_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @struct rtnl_link link.h "netlink/route/link.h"
* @brief Link object
* @implements nl_object
* @ingroup link
*
* @copydoc private_struct
*/
struct rtnl_link;
/**
* @ingroup link
*/
typedef enum {
RTNL_LINK_RX_PACKETS, /*!< Packets received */
RTNL_LINK_TX_PACKETS, /*!< Packets sent */
RTNL_LINK_RX_BYTES, /*!< Bytes received */
RTNL_LINK_TX_BYTES, /*!< Bytes sent */
RTNL_LINK_RX_ERRORS, /*!< Receive errors */
RTNL_LINK_TX_ERRORS, /*!< Send errors */
RTNL_LINK_RX_DROPPED, /*!< Received packets dropped */
RTNL_LINK_TX_DROPPED, /*!< Packets dropped during transmit */
RTNL_LINK_RX_COMPRESSED, /*!< Compressed packets received */
RTNL_LINK_TX_COMPRESSED, /*!< Compressed packets sent */
RTNL_LINK_RX_FIFO_ERR, /*!< Receive FIFO errors */
RTNL_LINK_TX_FIFO_ERR, /*!< Send FIFO errors */
RTNL_LINK_RX_LEN_ERR, /*!< Length errors */
RTNL_LINK_RX_OVER_ERR, /*!< Over errors */
RTNL_LINK_RX_CRC_ERR, /*!< CRC errors */
RTNL_LINK_RX_FRAME_ERR, /*!< Frame errors */
RTNL_LINK_RX_MISSED_ERR, /*!< Missed errors */
RTNL_LINK_TX_ABORT_ERR, /*!< Aborted errors */
RTNL_LINK_TX_CARRIER_ERR, /*!< Carrier errors */
RTNL_LINK_TX_HBEAT_ERR, /*!< Heartbeat errors */
RTNL_LINK_TX_WIN_ERR, /*!< Window errors */
RTNL_LINK_COLLISIONS, /*!< Send collisions */
RTNL_LINK_MULTICAST, /*!< Multicast */
RTNL_LINK_IP6_INPKTS, /*!< IPv6 SNMP InReceives */
RTNL_LINK_IP6_INHDRERRORS, /*!< IPv6 SNMP InHdrErrors */
RTNL_LINK_IP6_INTOOBIGERRORS, /*!< IPv6 SNMP InTooBigErrors */
RTNL_LINK_IP6_INNOROUTES, /*!< IPv6 SNMP InNoRoutes */
RTNL_LINK_IP6_INADDRERRORS, /*!< IPv6 SNMP InAddrErrors */
RTNL_LINK_IP6_INUNKNOWNPROTOS, /*!< IPv6 SNMP InUnknownProtos */
RTNL_LINK_IP6_INTRUNCATEDPKTS, /*!< IPv6 SNMP InTruncatedPkts */
RTNL_LINK_IP6_INDISCARDS, /*!< IPv6 SNMP InDiscards */
RTNL_LINK_IP6_INDELIVERS, /*!< IPv6 SNMP InDelivers */
RTNL_LINK_IP6_OUTFORWDATAGRAMS, /*!< IPv6 SNMP OutForwDatagrams */
RTNL_LINK_IP6_OUTPKTS, /*!< IPv6 SNMP OutRequests */
RTNL_LINK_IP6_OUTDISCARDS, /*!< IPv6 SNMP OutDiscards */
RTNL_LINK_IP6_OUTNOROUTES, /*!< IPv6 SNMP OutNoRoutes */
RTNL_LINK_IP6_REASMTIMEOUT, /*!< IPv6 SNMP ReasmTimeout */
RTNL_LINK_IP6_REASMREQDS, /*!< IPv6 SNMP ReasmReqds */
RTNL_LINK_IP6_REASMOKS, /*!< IPv6 SNMP ReasmOKs */
RTNL_LINK_IP6_REASMFAILS, /*!< IPv6 SNMP ReasmFails */
RTNL_LINK_IP6_FRAGOKS, /*!< IPv6 SNMP FragOKs */
RTNL_LINK_IP6_FRAGFAILS, /*!< IPv6 SNMP FragFails */
RTNL_LINK_IP6_FRAGCREATES, /*!< IPv6 SNMP FragCreates */
RTNL_LINK_IP6_INMCASTPKTS, /*!< IPv6 SNMP InMcastPkts */
RTNL_LINK_IP6_OUTMCASTPKTS, /*!< IPv6 SNMP OutMcastPkts */
RTNL_LINK_IP6_INBCASTPKTS, /*!< IPv6 SNMP InBcastPkts */
RTNL_LINK_IP6_OUTBCASTPKTS, /*!< IPv6 SNMP OutBcastPkts */
RTNL_LINK_IP6_INOCTETS, /*!< IPv6 SNMP InOctets */
RTNL_LINK_IP6_OUTOCTETS, /*!< IPv6 SNMP OutOctets */
RTNL_LINK_IP6_INMCASTOCTETS, /*!< IPv6 SNMP InMcastOctets */
RTNL_LINK_IP6_OUTMCASTOCTETS, /*!< IPv6 SNMP OutMcastOctets */
RTNL_LINK_IP6_INBCASTOCTETS, /*!< IPv6 SNMP InBcastOctets */
RTNL_LINK_IP6_OUTBCASTOCTETS, /*!< IPv6 SNMP OutBcastOctets */
RTNL_LINK_ICMP6_INMSGS, /*!< ICMPv6 SNMP InMsgs */
RTNL_LINK_ICMP6_INERRORS, /*!< ICMPv6 SNMP InErrors */
RTNL_LINK_ICMP6_OUTMSGS, /*!< ICMPv6 SNMP OutMsgs */
RTNL_LINK_ICMP6_OUTERRORS, /*!< ICMPv6 SNMP OutErrors */
RTNL_LINK_ICMP6_CSUMERRORS, /*!< ICMPv6 SNMP InCsumErrors */
RTNL_LINK_IP6_CSUMERRORS, /*!< IPv6 SNMP InCsumErrors */
RTNL_LINK_IP6_NOECTPKTS, /*!< IPv6 SNMP InNoECTPkts */
RTNL_LINK_IP6_ECT1PKTS, /*!< IPv6 SNMP InECT1Pkts */
RTNL_LINK_IP6_ECT0PKTS, /*!< IPv6 SNMP InECT0Pkts */
RTNL_LINK_IP6_CEPKTS, /*!< IPv6 SNMP InCEPkts */
RTNL_LINK_RX_NOHANDLER, /*!< Received packets dropped on inactive device */
RTNL_LINK_REASM_OVERLAPS, /*!< SNMP ReasmOverlaps */
__RTNL_LINK_STATS_MAX,
} rtnl_link_stat_id_t;
#define RTNL_LINK_STATS_MAX (__RTNL_LINK_STATS_MAX - 1)
extern struct nla_policy rtln_link_policy[];
extern struct rtnl_link *rtnl_link_alloc(void);
extern void rtnl_link_put(struct rtnl_link *);
extern int rtnl_link_alloc_cache(struct nl_sock *, int, struct nl_cache **);
extern int rtnl_link_alloc_cache_flags(struct nl_sock *, int,
struct nl_cache **,
unsigned int flags);
extern struct rtnl_link *rtnl_link_get(struct nl_cache *, int);
extern struct rtnl_link *rtnl_link_get_by_name(struct nl_cache *, const char *);
extern int rtnl_link_build_add_request(struct rtnl_link *, int,
struct nl_msg **);
extern int rtnl_link_add(struct nl_sock *, struct rtnl_link *, int);
extern int rtnl_link_build_change_request(struct rtnl_link *,
struct rtnl_link *, int,
struct nl_msg **);
extern int rtnl_link_change(struct nl_sock *, struct rtnl_link *,
struct rtnl_link *, int);
extern int rtnl_link_build_delete_request(const struct rtnl_link *,
struct nl_msg **);
extern int rtnl_link_delete(struct nl_sock *, const struct rtnl_link *);
extern int rtnl_link_build_get_request(int, const char *,
struct nl_msg **);
extern int rtnl_link_get_kernel(struct nl_sock *, int, const char *,
struct rtnl_link **);
/* Name <-> Index Translations */
extern char * rtnl_link_i2name(struct nl_cache *, int, char *, size_t);
extern int rtnl_link_name2i(struct nl_cache *, const char *);
/* Name <-> Statistic Translations */
extern char * rtnl_link_stat2str(int, char *, size_t);
extern int rtnl_link_str2stat(const char *);
/* Link Flags Translations */
extern char * rtnl_link_flags2str(int, char *, size_t);
extern int rtnl_link_str2flags(const char *);
extern char * rtnl_link_operstate2str(uint8_t, char *, size_t);
extern int rtnl_link_str2operstate(const char *);
extern char * rtnl_link_mode2str(uint8_t, char *, size_t);
extern int rtnl_link_str2mode(const char *);
/* Carrier State Translations */
extern char * rtnl_link_carrier2str(uint8_t, char *, size_t);
extern int rtnl_link_str2carrier(const char *);
/* Access Functions */
extern void rtnl_link_set_qdisc(struct rtnl_link *, const char *);
extern char * rtnl_link_get_qdisc(struct rtnl_link *);
extern void rtnl_link_set_name(struct rtnl_link *, const char *);
extern char * rtnl_link_get_name(struct rtnl_link *);
extern void rtnl_link_set_group(struct rtnl_link *, uint32_t);
extern uint32_t rtnl_link_get_group(struct rtnl_link *);
extern void rtnl_link_set_flags(struct rtnl_link *, unsigned int);
extern void rtnl_link_unset_flags(struct rtnl_link *, unsigned int);
extern unsigned int rtnl_link_get_flags(struct rtnl_link *);
extern void rtnl_link_set_mtu(struct rtnl_link *, unsigned int);
extern unsigned int rtnl_link_get_mtu(struct rtnl_link *);
extern void rtnl_link_set_txqlen(struct rtnl_link *, unsigned int);
extern unsigned int rtnl_link_get_txqlen(struct rtnl_link *);
extern void rtnl_link_set_ifindex(struct rtnl_link *, int);
extern int rtnl_link_get_ifindex(struct rtnl_link *);
extern void rtnl_link_set_family(struct rtnl_link *, int);
extern int rtnl_link_get_family(struct rtnl_link *);
extern void rtnl_link_set_arptype(struct rtnl_link *, unsigned int);
extern unsigned int rtnl_link_get_arptype(struct rtnl_link *);
extern void rtnl_link_set_addr(struct rtnl_link *, struct nl_addr *);
extern struct nl_addr *rtnl_link_get_addr(struct rtnl_link *);
extern void rtnl_link_set_broadcast(struct rtnl_link *, struct nl_addr *);
extern struct nl_addr *rtnl_link_get_broadcast(struct rtnl_link *);
extern void rtnl_link_set_link(struct rtnl_link *, int);
extern int rtnl_link_get_link(struct rtnl_link *);
extern void rtnl_link_set_master(struct rtnl_link *, int);
extern int rtnl_link_get_master(struct rtnl_link *);
extern void rtnl_link_set_carrier(struct rtnl_link *, uint8_t);
extern uint8_t rtnl_link_get_carrier(struct rtnl_link *);
extern int rtnl_link_get_carrier_changes(struct rtnl_link *, uint32_t *);
extern void rtnl_link_set_operstate(struct rtnl_link *, uint8_t);
extern uint8_t rtnl_link_get_operstate(struct rtnl_link *);
extern void rtnl_link_set_linkmode(struct rtnl_link *, uint8_t);
extern uint8_t rtnl_link_get_linkmode(struct rtnl_link *);
int rtnl_link_set_link_netnsid(struct rtnl_link *link, int32_t link_netnsid);
int rtnl_link_get_link_netnsid(const struct rtnl_link *link, int32_t *out_link_netnsid);
extern const char * rtnl_link_get_ifalias(struct rtnl_link *);
extern void rtnl_link_set_ifalias(struct rtnl_link *, const char *);
extern int rtnl_link_get_num_vf(struct rtnl_link *, uint32_t *);
extern uint64_t rtnl_link_get_stat(struct rtnl_link *, rtnl_link_stat_id_t);
extern int rtnl_link_set_stat(struct rtnl_link *, rtnl_link_stat_id_t,
const uint64_t);
extern int rtnl_link_set_type(struct rtnl_link *, const char *);
extern char * rtnl_link_get_type(struct rtnl_link *);
extern int rtnl_link_set_slave_type(struct rtnl_link *, const char *);
extern const char * rtnl_link_get_slave_type(const struct rtnl_link *);
extern void rtnl_link_set_promiscuity(struct rtnl_link *, uint32_t);
extern uint32_t rtnl_link_get_promiscuity(struct rtnl_link *);
extern void rtnl_link_set_num_tx_queues(struct rtnl_link *, uint32_t);
extern uint32_t rtnl_link_get_num_tx_queues(struct rtnl_link *);
extern void rtnl_link_set_num_rx_queues(struct rtnl_link *, uint32_t);
extern uint32_t rtnl_link_get_num_rx_queues(struct rtnl_link *);
extern int rtnl_link_get_gso_max_segs(struct rtnl_link *, uint32_t *);
extern int rtnl_link_get_gso_max_size(struct rtnl_link *, uint32_t *);
extern struct nl_data * rtnl_link_get_phys_port_id(struct rtnl_link *);
extern char* rtnl_link_get_phys_port_name(struct rtnl_link *);
extern struct nl_data * rtnl_link_get_phys_switch_id(struct rtnl_link *);
extern void rtnl_link_set_ns_fd(struct rtnl_link *, int);
extern int rtnl_link_get_ns_fd(struct rtnl_link *);
extern void rtnl_link_set_ns_pid(struct rtnl_link *, pid_t);
extern pid_t rtnl_link_get_ns_pid(struct rtnl_link *);
extern int rtnl_link_enslave_ifindex(struct nl_sock *, int, int);
extern int rtnl_link_enslave(struct nl_sock *, struct rtnl_link *,
struct rtnl_link *);
extern int rtnl_link_release_ifindex(struct nl_sock *, int);
extern int rtnl_link_release(struct nl_sock *, struct rtnl_link *);
extern int rtnl_link_fill_info(struct nl_msg *, struct rtnl_link *);
extern int rtnl_link_info_parse(struct rtnl_link *, struct nlattr **);
extern int rtnl_link_has_vf_list(struct rtnl_link *);
extern void rtnl_link_set_vf_list(struct rtnl_link *);
extern void rtnl_link_unset_vf_list(struct rtnl_link *);
/* deprecated */
extern int rtnl_link_set_info_type(struct rtnl_link *, const char *) __attribute__((deprecated));
extern char * rtnl_link_get_info_type(struct rtnl_link *) __attribute__((deprecated));
extern void rtnl_link_set_weight(struct rtnl_link *, unsigned int) __attribute__((deprecated));
extern unsigned int rtnl_link_get_weight(struct rtnl_link *) __attribute__((deprecated));
#ifdef __cplusplus
}
#endif
#endif
route/route.h 0000644 00000011305 15051120407 0007204 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_ROUTE_H_
#define NETLINK_ROUTE_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <netlink/data.h>
#include <netlink/route/nexthop.h>
#include <netlink/route/rtnl.h>
#include <linux/in_route.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup route
* When passed to rtnl_route_alloc_cache() the cache will
* correspond to the contents of the routing cache instead
* of the actual routes.
*/
#define ROUTE_CACHE_CONTENT 1
struct rtnl_route;
struct rtnl_rtcacheinfo
{
uint32_t rtci_clntref;
uint32_t rtci_last_use;
uint32_t rtci_expires;
int32_t rtci_error;
uint32_t rtci_used;
uint32_t rtci_id;
uint32_t rtci_ts;
uint32_t rtci_tsage;
};
extern struct nl_object_ops route_obj_ops;
extern struct rtnl_route * rtnl_route_alloc(void);
extern void rtnl_route_put(struct rtnl_route *);
extern int rtnl_route_alloc_cache(struct nl_sock *, int, int,
struct nl_cache **);
extern void rtnl_route_get(struct rtnl_route *);
extern int rtnl_route_parse(struct nlmsghdr *, struct rtnl_route **);
extern int rtnl_route_build_msg(struct nl_msg *, struct rtnl_route *);
extern int rtnl_route_lookup(struct nl_sock *sk, struct nl_addr *dst,
struct rtnl_route **result);
extern int rtnl_route_build_add_request(struct rtnl_route *, int,
struct nl_msg **);
extern int rtnl_route_add(struct nl_sock *, struct rtnl_route *, int);
extern int rtnl_route_build_del_request(struct rtnl_route *, int,
struct nl_msg **);
extern int rtnl_route_delete(struct nl_sock *, struct rtnl_route *, int);
extern void rtnl_route_set_table(struct rtnl_route *, uint32_t);
extern uint32_t rtnl_route_get_table(struct rtnl_route *);
extern void rtnl_route_set_scope(struct rtnl_route *, uint8_t);
extern uint8_t rtnl_route_get_scope(struct rtnl_route *);
extern void rtnl_route_set_tos(struct rtnl_route *, uint8_t);
extern uint8_t rtnl_route_get_tos(struct rtnl_route *);
extern void rtnl_route_set_protocol(struct rtnl_route *, uint8_t);
extern uint8_t rtnl_route_get_protocol(struct rtnl_route *);
extern void rtnl_route_set_priority(struct rtnl_route *, uint32_t);
extern uint32_t rtnl_route_get_priority(struct rtnl_route *);
extern int rtnl_route_set_family(struct rtnl_route *, uint8_t);
extern uint8_t rtnl_route_get_family(struct rtnl_route *);
extern int rtnl_route_set_type(struct rtnl_route *, uint8_t);
extern uint8_t rtnl_route_get_type(struct rtnl_route *);
extern void rtnl_route_set_flags(struct rtnl_route *, uint32_t);
extern void rtnl_route_unset_flags(struct rtnl_route *, uint32_t);
extern uint32_t rtnl_route_get_flags(struct rtnl_route *);
extern int rtnl_route_set_metric(struct rtnl_route *, int, unsigned int);
extern int rtnl_route_unset_metric(struct rtnl_route *, int);
extern int rtnl_route_get_metric(struct rtnl_route *, int, uint32_t *);
extern int rtnl_route_set_dst(struct rtnl_route *, struct nl_addr *);
extern struct nl_addr *rtnl_route_get_dst(struct rtnl_route *);
extern int rtnl_route_set_src(struct rtnl_route *, struct nl_addr *);
extern struct nl_addr *rtnl_route_get_src(struct rtnl_route *);
extern int rtnl_route_set_pref_src(struct rtnl_route *, struct nl_addr *);
extern struct nl_addr *rtnl_route_get_pref_src(struct rtnl_route *);
extern void rtnl_route_set_iif(struct rtnl_route *, int);
extern int rtnl_route_get_iif(struct rtnl_route *);
extern int rtnl_route_get_src_len(struct rtnl_route *);
extern void rtnl_route_set_ttl_propagate(struct rtnl_route *route,
uint8_t ttl_prop);
extern int rtnl_route_get_ttl_propagate(struct rtnl_route *route);
extern void rtnl_route_add_nexthop(struct rtnl_route *,
struct rtnl_nexthop *);
extern void rtnl_route_remove_nexthop(struct rtnl_route *,
struct rtnl_nexthop *);
extern struct nl_list_head *rtnl_route_get_nexthops(struct rtnl_route *);
extern int rtnl_route_get_nnexthops(struct rtnl_route *);
extern void rtnl_route_foreach_nexthop(struct rtnl_route *r,
void (*cb)(struct rtnl_nexthop *, void *),
void *arg);
extern struct rtnl_nexthop * rtnl_route_nexthop_n(struct rtnl_route *r, int n);
extern int rtnl_route_guess_scope(struct rtnl_route *);
extern char * rtnl_route_table2str(int, char *, size_t);
extern int rtnl_route_str2table(const char *);
extern int rtnl_route_read_table_names(const char *);
extern char * rtnl_route_proto2str(int, char *, size_t);
extern int rtnl_route_str2proto(const char *);
extern int rtnl_route_read_protocol_names(const char *);
extern char * rtnl_route_metric2str(int, char *, size_t);
extern int rtnl_route_str2metric(const char *);
#ifdef __cplusplus
}
#endif
#endif
route/tc-api.h 0000644 00000000532 15051120407 0007223 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_DUMMY_TC_API_H_
#define NETLINK_DUMMY_TC_API_H_
#include <netlink/netlink.h>
#include <netlink/msg.h>
#include <netlink/route/tc.h>
#warning "You are including a deprecated header file, include <netlink/route/tc.h>."
#endif
route/netconf.h 0000644 00000002271 15051120407 0007504 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2017 David Ahern <dsa@cumulusnetworks.com>
*/
#ifndef NETCONF_H_
#define NETCONF_H_
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_netconf;
int rtnl_netconf_alloc_cache(struct nl_sock *sk, struct nl_cache **result);
struct rtnl_netconf *rtnl_netconf_get_by_idx(struct nl_cache *cache, int family,
int ifindex);
struct rtnl_netconf *rtnl_netconf_get_all(struct nl_cache *cache,
int family);
struct rtnl_netconf *rtnl_netconf_get_default(struct nl_cache *cache,
int family);
void rtnl_netconf_put(struct rtnl_netconf *nc);
int rtnl_netconf_get_family(struct rtnl_netconf *nc, int *val);
int rtnl_netconf_get_ifindex(struct rtnl_netconf *nc, int *val);
int rtnl_netconf_get_forwarding(struct rtnl_netconf *nc, int *val);
int rtnl_netconf_get_mc_forwarding(struct rtnl_netconf *nc, int *val);
int rtnl_netconf_get_rp_filter(struct rtnl_netconf *nc, int *val);
int rtnl_netconf_get_proxy_neigh(struct rtnl_netconf *nc, int *val);
int rtnl_netconf_get_ignore_routes_linkdown(struct rtnl_netconf *nc, int *val);
int rtnl_netconf_get_input(struct rtnl_netconf *nc, int *val);
#ifdef __cplusplus
}
#endif
#endif
route/action.h 0000644 00000002534 15051120407 0007327 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com>
*/
#ifndef NETLINK_ACTION_H_
#define NETLINK_ACTION_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/tc.h>
#include <netlink/utils.h>
#ifdef __cplusplus
extern "C" {
#endif
extern struct rtnl_act *rtnl_act_alloc(void);
extern struct rtnl_act *rtnl_act_next(struct rtnl_act *);
extern void rtnl_act_get(struct rtnl_act *);
extern void rtnl_act_put(struct rtnl_act *);
extern int rtnl_act_build_add_request(struct rtnl_act *, int,
struct nl_msg **);
extern int rtnl_act_add(struct nl_sock *, struct rtnl_act *, int);
extern int rtnl_act_change(struct nl_sock *, struct rtnl_act *, int);
extern int rtnl_act_build_change_request(struct rtnl_act *, int,
struct nl_msg **);
extern int rtnl_act_build_delete_request(struct rtnl_act *, int,
struct nl_msg **);
extern int rtnl_act_delete(struct nl_sock *, struct rtnl_act *,
int);
extern int rtnl_act_append(struct rtnl_act **, struct rtnl_act *);
extern int rtnl_act_remove(struct rtnl_act **, struct rtnl_act *);
extern int rtnl_act_fill(struct nl_msg *, int, struct rtnl_act *);
extern void rtnl_act_put_all(struct rtnl_act **);
extern int rtnl_act_parse(struct rtnl_act **, struct nlattr *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/hfsc.h 0000644 00000002123 15051120407 0010072 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2014 Cong Wang <xiyou.wangcong@gmail.com>
*/
#ifndef NETLINK_HFSC_H_
#define NETLINK_HFSC_H_
#include <netlink/netlink.h>
#include <netlink/route/tc.h>
#include <netlink/route/qdisc.h>
#include <netlink/route/class.h>
#ifdef __cplusplus
extern "C" {
#endif
struct tc_service_curve;
extern uint32_t rtnl_qdisc_hfsc_get_defcls(const struct rtnl_qdisc *);
extern int rtnl_qdisc_hfsc_set_defcls(struct rtnl_qdisc *, uint32_t);
extern int rtnl_class_hfsc_get_rsc(const struct rtnl_class *cls, struct tc_service_curve *tsc);
extern int rtnl_class_hfsc_set_rsc(struct rtnl_class *cls, const struct tc_service_curve *tsc);
extern int rtnl_class_hfsc_get_fsc(const struct rtnl_class *cls, struct tc_service_curve *tsc);
extern int rtnl_class_hfsc_set_fsc(struct rtnl_class *cls, const struct tc_service_curve *tsc);
extern int rtnl_class_hfsc_get_usc(const struct rtnl_class *cls, struct tc_service_curve *tsc);
extern int rtnl_class_hfsc_set_usc(struct rtnl_class *cls, const struct tc_service_curve *tsc);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/htb.h 0000644 00000003470 15051120407 0007732 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
* Copyright (c) 2005 Petr Gotthard <petr.gotthard@siemens.com>
* Copyright (c) 2005 Siemens AG Oesterreich
*/
#ifndef NETLINK_HTB_H_
#define NETLINK_HTB_H_
#include <netlink/netlink.h>
#include <netlink/route/tc.h>
#include <netlink/route/qdisc.h>
#include <netlink/route/class.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t rtnl_htb_get_rate2quantum(struct rtnl_qdisc *);
extern int rtnl_htb_set_rate2quantum(struct rtnl_qdisc *, uint32_t);
extern uint32_t rtnl_htb_get_defcls(struct rtnl_qdisc *);
extern int rtnl_htb_set_defcls(struct rtnl_qdisc *, uint32_t);
extern uint32_t rtnl_htb_get_prio(struct rtnl_class *);
extern int rtnl_htb_set_prio(struct rtnl_class *, uint32_t);
extern uint32_t rtnl_htb_get_rate(struct rtnl_class *);
extern int rtnl_htb_set_rate(struct rtnl_class *, uint32_t);
extern uint32_t rtnl_htb_get_ceil(struct rtnl_class *);
extern int rtnl_htb_set_ceil(struct rtnl_class *, uint32_t);
extern int rtnl_htb_get_rate64(struct rtnl_class *, uint64_t *);
extern int rtnl_htb_set_rate64(struct rtnl_class *, uint64_t);
extern int rtnl_htb_get_ceil64(struct rtnl_class *, uint64_t *);
extern int rtnl_htb_set_ceil64(struct rtnl_class *, uint64_t);
extern uint32_t rtnl_htb_get_rbuffer(struct rtnl_class *);
extern int rtnl_htb_set_rbuffer(struct rtnl_class *, uint32_t);
extern uint32_t rtnl_htb_get_cbuffer(struct rtnl_class *);
extern int rtnl_htb_set_cbuffer(struct rtnl_class *, uint32_t);
extern uint32_t rtnl_htb_get_quantum(struct rtnl_class *);
extern int rtnl_htb_set_quantum(struct rtnl_class *, uint32_t);
extern int rtnl_htb_set_level(struct rtnl_class *, int);
extern int rtnl_htb_get_level(struct rtnl_class *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/tbf.h 0000644 00000002032 15051120407 0007721 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_TBF_H_
#define NETLINK_TBF_H_
#include <netlink/netlink.h>
#include <netlink/route/tc.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void rtnl_qdisc_tbf_set_limit(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_tbf_set_limit_by_latency(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_tbf_get_limit(struct rtnl_qdisc *);
extern void rtnl_qdisc_tbf_set_rate(struct rtnl_qdisc *, int, int, int);
extern int rtnl_qdisc_tbf_get_rate(struct rtnl_qdisc *);
extern int rtnl_qdisc_tbf_get_rate_bucket(struct rtnl_qdisc *);
extern int rtnl_qdisc_tbf_get_rate_cell(struct rtnl_qdisc *);
extern int rtnl_qdisc_tbf_set_peakrate(struct rtnl_qdisc *, int, int, int);
extern int rtnl_qdisc_tbf_get_peakrate(struct rtnl_qdisc *);
extern int rtnl_qdisc_tbf_get_peakrate_bucket(struct rtnl_qdisc *);
extern int rtnl_qdisc_tbf_get_peakrate_cell(struct rtnl_qdisc *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/red.h 0000644 00000000500 15051120407 0007716 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_RED_H_
#define NETLINK_RED_H_
#include <netlink/netlink.h>
extern void rtnl_red_set_limit(struct rtnl_qdisc *qdisc, int limit);
extern int rtnl_red_get_limit(struct rtnl_qdisc *qdisc);
#endif
route/qdisc/mqprio.h 0000644 00000003526 15051120407 0010466 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2018 Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se>
*/
#ifndef NETLINK_MQPRIO_H_
#define NETLINK_MQPRIO_H_
#include <netlink/netlink.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_qdisc_mqprio_set_num_tc(struct rtnl_qdisc *qdisc, int num_tc);
extern int rtnl_qdisc_mqprio_get_num_tc(struct rtnl_qdisc *qdisc);
extern int rtnl_qdisc_mqprio_set_priomap(struct rtnl_qdisc *qdisc, uint8_t priomap[],
int len);
extern uint8_t *rtnl_qdisc_mqprio_get_priomap(struct rtnl_qdisc *qdisc);
extern int rtnl_qdisc_mqprio_hw_offload(struct rtnl_qdisc *qdisc, int offload);
extern int rtnl_qdisc_mqprio_get_hw_offload(struct rtnl_qdisc *qdisc);
extern int rtnl_qdisc_mqprio_set_queue(struct rtnl_qdisc *qdisc, uint16_t count[],
uint16_t offset[], int len);
extern int rtnl_qdisc_mqprio_get_queue(struct rtnl_qdisc *qdisc, uint16_t *count,
uint16_t *offset);
extern int rtnl_qdisc_mqprio_set_mode(struct rtnl_qdisc *qdisc, uint16_t mode);
extern int rtnl_qdisc_mqprio_get_mode(struct rtnl_qdisc *qdisc);
extern int rtnl_qdisc_mqprio_set_shaper(struct rtnl_qdisc *qdisc, uint16_t shaper);
extern int rtnl_qdisc_mqprio_get_shaper(struct rtnl_qdisc *qdisc);
extern int rtnl_qdisc_mqprio_set_min_rate(struct rtnl_qdisc *qdisc, uint64_t min[],
int len);
extern int rtnl_qdisc_mqprio_get_min_rate(struct rtnl_qdisc *qdisc, uint64_t *min);
extern int rtnl_qdisc_mqprio_set_max_rate(struct rtnl_qdisc *qdisc, uint64_t max[],
int len);
extern int rtnl_qdisc_mqprio_get_max_rate(struct rtnl_qdisc *qdisc, uint64_t *max);
#ifdef __cplusplus
}
#endif
#endif /* NETLINK_MQPRIO_H_ */
route/qdisc/plug.h 0000644 00000001052 15051120407 0010116 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2012 Shriram Rajagopalan <rshriram@cs.ubc.ca>
*/
#ifndef NETLINK_PLUG_H_
#define NETLINK_PLUG_H_
#include <netlink/netlink.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_qdisc_plug_set_limit(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_plug_buffer(struct rtnl_qdisc *);
extern int rtnl_qdisc_plug_release_one(struct rtnl_qdisc *);
extern int rtnl_qdisc_plug_release_indefinite(struct rtnl_qdisc *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/fifo.h 0000644 00000000644 15051120407 0010100 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_FIFO_H_
#define NETLINK_FIFO_H_
#include <netlink/netlink.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_qdisc_fifo_set_limit(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_fifo_get_limit(struct rtnl_qdisc *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/prio.h 0000644 00000001655 15051120407 0010131 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_PRIO_H_
#define NETLINK_PRIO_H_
#include <netlink/netlink.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Default Values
* @{
*/
/**
* Default number of bands.
* @ingroup prio
*/
#define QDISC_PRIO_DEFAULT_BANDS 3
/**
* Default priority mapping.
* @ingroup prio
*/
#define QDISC_PRIO_DEFAULT_PRIOMAP \
{ 1, 2, 2, 2, 1, 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 }
/** @} */
extern void rtnl_qdisc_prio_set_bands(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_prio_get_bands(struct rtnl_qdisc *);
extern int rtnl_qdisc_prio_set_priomap(struct rtnl_qdisc *, uint8_t[], int);
extern uint8_t *rtnl_qdisc_prio_get_priomap(struct rtnl_qdisc *);
extern char * rtnl_prio2str(int, char *, size_t);
extern int rtnl_str2prio(const char *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/cbq.h 0000644 00000000653 15051120407 0007722 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CBQ_H_
#define NETLINK_CBQ_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern char * nl_ovl_strategy2str(int, char *, size_t);
extern int nl_str2ovl_strategy(const char *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/sfq.h 0000644 00000001262 15051120407 0007743 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_SFQ_H_
#define NETLINK_SFQ_H_
#include <netlink/netlink.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void rtnl_sfq_set_quantum(struct rtnl_qdisc *, int);
extern int rtnl_sfq_get_quantum(struct rtnl_qdisc *);
extern void rtnl_sfq_set_limit(struct rtnl_qdisc *, int);
extern int rtnl_sfq_get_limit(struct rtnl_qdisc *);
extern void rtnl_sfq_set_perturb(struct rtnl_qdisc *, int);
extern int rtnl_sfq_get_perturb(struct rtnl_qdisc *);
extern int rtnl_sfq_get_divisor(struct rtnl_qdisc *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/netem.h 0000644 00000004664 15051120407 0010273 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_NETEM_H_
#define NETLINK_NETEM_H_
#include <netlink/netlink.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void rtnl_netem_set_limit(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_limit(struct rtnl_qdisc *);
/* Packet Re-ordering */
extern void rtnl_netem_set_gap(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_gap(struct rtnl_qdisc *);
extern void rtnl_netem_set_reorder_probability(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_reorder_probability(struct rtnl_qdisc *);
extern void rtnl_netem_set_reorder_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_reorder_correlation(struct rtnl_qdisc *);
/* Corruption */
extern void rtnl_netem_set_corruption_probability(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_corruption_probability(struct rtnl_qdisc *);
extern void rtnl_netem_set_corruption_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_corruption_correlation(struct rtnl_qdisc *);
/* Packet Loss */
extern void rtnl_netem_set_loss(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_loss(struct rtnl_qdisc *);
extern void rtnl_netem_set_loss_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_loss_correlation(struct rtnl_qdisc *);
/* Packet Duplication */
extern void rtnl_netem_set_duplicate(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_duplicate(struct rtnl_qdisc *);
extern void rtnl_netem_set_duplicate_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_duplicate_correlation(struct rtnl_qdisc *);
/* Packet Delay */
extern void rtnl_netem_set_delay(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_delay(struct rtnl_qdisc *);
extern void rtnl_netem_set_jitter(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_jitter(struct rtnl_qdisc *);
extern void rtnl_netem_set_delay_correlation(struct rtnl_qdisc *, int);
extern int rtnl_netem_get_delay_correlation(struct rtnl_qdisc *);
/* Delay Distribution */
#define MAXDIST 65536
extern int rtnl_netem_set_delay_distribution(struct rtnl_qdisc *, const char *);
extern int rtnl_netem_set_delay_distribution_data(struct rtnl_qdisc *, const int16_t *, size_t len);
extern int rtnl_netem_get_delay_distribution_size(struct rtnl_qdisc *);
extern int rtnl_netem_get_delay_distribution(struct rtnl_qdisc *, int16_t **);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/dsmark.h 0000644 00000002017 15051120407 0010432 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_DSMARK_H_
#define NETLINK_DSMARK_H_
#include <netlink/netlink.h>
#include <netlink/route/qdisc.h>
#include <netlink/route/class.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_class_dsmark_set_bitmask(struct rtnl_class *, uint8_t);
extern int rtnl_class_dsmark_get_bitmask(struct rtnl_class *);
extern int rtnl_class_dsmark_set_value(struct rtnl_class *, uint8_t);
extern int rtnl_class_dsmark_get_value(struct rtnl_class *);
extern int rtnl_qdisc_dsmark_set_indices(struct rtnl_qdisc *, uint16_t);
extern int rtnl_qdisc_dsmark_get_indices(struct rtnl_qdisc *);
extern int rtnl_qdisc_dsmark_set_default_index(struct rtnl_qdisc *,
uint16_t);
extern int rtnl_qdisc_dsmark_get_default_index(struct rtnl_qdisc *);
extern int rtnl_qdisc_dsmark_set_set_tc_index(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_dsmark_get_set_tc_index(struct rtnl_qdisc *);
#ifdef __cplusplus
}
#endif
#endif
route/qdisc/fq_codel.h 0000644 00000002162 15051120407 0010726 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com>
*/
#ifndef NETLINK_FQ_CODEL_H_
#define NETLINK_FQ_CODEL_H_
#include <netlink/netlink.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_qdisc_fq_codel_set_limit(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_fq_codel_get_limit(struct rtnl_qdisc *);
extern int rtnl_qdisc_fq_codel_set_target(struct rtnl_qdisc *, uint32_t);
extern uint32_t rtnl_qdisc_fq_codel_get_target(struct rtnl_qdisc *);
extern int rtnl_qdisc_fq_codel_set_interval(struct rtnl_qdisc *, uint32_t);
extern uint32_t rtnl_qdisc_fq_codel_get_interval(struct rtnl_qdisc *);
extern int rtnl_qdisc_fq_codel_set_quantum(struct rtnl_qdisc *, uint32_t);
extern uint32_t rtnl_qdisc_fq_codel_get_quantum(struct rtnl_qdisc *);
extern int rtnl_qdisc_fq_codel_set_flows(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_fq_codel_get_flows(struct rtnl_qdisc *);
extern int rtnl_qdisc_fq_codel_set_ecn(struct rtnl_qdisc *, int);
extern int rtnl_qdisc_fq_codel_get_ecn(struct rtnl_qdisc *);
#ifdef __cplusplus
}
#endif
#endif
route/class.h 0000644 00000003105 15051120407 0007152 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CLASS_H_
#define NETLINK_CLASS_H_
#include <netlink/netlink.h>
#include <netlink/route/tc.h>
#include <netlink/route/qdisc.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_class;
extern struct rtnl_class *
rtnl_class_alloc(void);
extern void rtnl_class_put(struct rtnl_class *);
extern int rtnl_class_alloc_cache(struct nl_sock *, int,
struct nl_cache **);
extern struct rtnl_class *
rtnl_class_get(struct nl_cache *, int, uint32_t);
extern struct rtnl_class *
rtnl_class_get_by_parent(struct nl_cache *, int, uint32_t);
extern struct rtnl_qdisc *
rtnl_class_leaf_qdisc(struct rtnl_class *,
struct nl_cache *);
extern int rtnl_class_build_add_request(struct rtnl_class *, int,
struct nl_msg **);
extern int rtnl_class_add(struct nl_sock *, struct rtnl_class *,
int);
extern int rtnl_class_build_delete_request(struct rtnl_class *,
struct nl_msg **);
extern int rtnl_class_delete(struct nl_sock *,
struct rtnl_class *);
/* deprecated functions */
extern void rtnl_class_foreach_child(struct rtnl_class *,
struct nl_cache *,
void (*cb)(struct nl_object *,
void *),
void *)
__attribute__((deprecated));
extern void rtnl_class_foreach_cls(struct rtnl_class *,
struct nl_cache *,
void (*cb)(struct nl_object *,
void *),
void *)
__attribute__((deprecated));
#ifdef __cplusplus
}
#endif
#endif
route/pktloc.h 0000644 00000001522 15051120407 0007342 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_PKTLOC_H_
#define NETLINK_PKTLOC_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/tc.h>
#include <linux/tc_ematch/tc_em_cmp.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_pktloc
{
char * name;
uint8_t layer;
uint8_t shift;
uint16_t offset;
uint16_t align;
uint32_t mask;
uint32_t refcnt;
struct nl_list_head list;
};
extern int rtnl_pktloc_lookup(const char *, struct rtnl_pktloc **);
extern struct rtnl_pktloc *rtnl_pktloc_alloc(void);
extern void rtnl_pktloc_put(struct rtnl_pktloc *);
extern int rtnl_pktloc_add(struct rtnl_pktloc *);
extern void rtnl_pktloc_foreach(void (*cb)(struct rtnl_pktloc *, void *),
void *);
#ifdef __cplusplus
}
#endif
#endif
route/act/vlan.h 0000644 00000002075 15051120407 0007561 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2018 Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>
*/
#ifndef NETLINK_VLAN_H_
#define NETLINK_VLAN_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/action.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_vlan_set_mode(struct rtnl_act *act, int mode);
extern int rtnl_vlan_get_mode(struct rtnl_act *act, int *out_mode);
extern int rtnl_vlan_set_action(struct rtnl_act *act, int action);
extern int rtnl_vlan_get_action(struct rtnl_act *act, int *out_action);
extern int rtnl_vlan_set_protocol(struct rtnl_act *act, uint16_t protocol);
extern int rtnl_vlan_get_protocol(struct rtnl_act *act, uint16_t *out_protocol);
extern int rtnl_vlan_set_vlan_id(struct rtnl_act *act, uint16_t vid);
extern int rtnl_vlan_get_vlan_id(struct rtnl_act *act, uint16_t *out_vid);
extern int rtnl_vlan_set_vlan_prio(struct rtnl_act *act, uint8_t prio);
extern int rtnl_vlan_get_vlan_prio(struct rtnl_act *act, uint8_t *out_prio);
#ifdef __cplusplus
}
#endif
#endif /* NETLINK_VLAN_H_ */
route/act/skbedit.h 0000644 00000001675 15051120407 0010253 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2015 Cong Wang <xiyou.wangcong@gmail.com>
*/
#ifndef NETLINK_SKBEDIT_H_
#define NETLINK_SKBEDIT_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/action.h>
#include <linux/tc_act/tc_skbedit.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_skbedit_set_action(struct rtnl_act *act, int action);
extern int rtnl_skbedit_get_action(struct rtnl_act *act);
extern int rtnl_skbedit_set_queue_mapping(struct rtnl_act *act, uint16_t index);
extern int rtnl_skbedit_get_queue_mapping(struct rtnl_act *act, uint16_t *index);
extern int rtnl_skbedit_set_mark(struct rtnl_act *act, uint32_t mark);
extern int rtnl_skbedit_get_mark(struct rtnl_act *act, uint32_t *mark);
extern int rtnl_skbedit_set_priority(struct rtnl_act *act, uint32_t prio);
extern int rtnl_skbedit_get_priority(struct rtnl_act *act, uint32_t *prio);
#ifdef __cplusplus
}
#endif
#endif
route/act/mirred.h 0000644 00000001320 15051120407 0010073 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com>
*/
#ifndef NETLINK_MIRRED_H_
#define NETLINK_MIRRED_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/action.h>
#include <linux/tc_act/tc_mirred.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_mirred_set_action(struct rtnl_act *, int);
extern int rtnl_mirred_get_action(struct rtnl_act *);
extern int rtnl_mirred_set_ifindex(struct rtnl_act *, uint32_t);
extern uint32_t rtnl_mirred_get_ifindex(struct rtnl_act *);
extern int rtnl_mirred_set_policy(struct rtnl_act *, int);
extern int rtnl_mirred_get_policy(struct rtnl_act *);
#ifdef __cplusplus
}
#endif
#endif
route/act/nat.h 0000644 00000002132 15051120407 0007375 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2016 Magnus Öberg <magnus.oberg@westermo.se>
*/
#ifndef NETLINK_NAT_H_
#define NETLINK_NAT_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/action.h>
#include <linux/tc_act/tc_nat.h>
#include <netinet/in.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_nat_set_old_addr(struct rtnl_act *act, in_addr_t addr);
extern int rtnl_nat_get_old_addr(struct rtnl_act *act, in_addr_t *addr);
extern int rtnl_nat_set_new_addr(struct rtnl_act *act, in_addr_t addr);
extern int rtnl_nat_get_new_addr(struct rtnl_act *act, in_addr_t *addr);
extern int rtnl_nat_set_mask(struct rtnl_act *act, in_addr_t bitmask);
extern int rtnl_nat_get_mask(struct rtnl_act *act, in_addr_t *bitmask);
extern int rtnl_nat_set_flags(struct rtnl_act *act, uint32_t flags);
extern int rtnl_nat_get_flags(struct rtnl_act *act, uint32_t *flags);
extern int rtnl_nat_set_action(struct rtnl_act *act, int action);
extern int rtnl_nat_get_action(struct rtnl_act *act, int *action);
#ifdef __cplusplus
}
#endif
#endif /* NETLINK_NAT_H */
route/act/gact.h 0000644 00000000752 15051120407 0007537 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2016 Sushma Sitaram <sushma.sitaram@intel.com>
*/
#ifndef NETLINK_GACT_H_
#define NETLINK_GACT_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/action.h>
#include <linux/tc_act/tc_gact.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rtnl_gact_set_action(struct rtnl_act *act, int action);
extern int rtnl_gact_get_action(struct rtnl_act *act);
#ifdef __cplusplus
}
#endif
#endif
route/rtnl.h 0000644 00000002170 15051120407 0007025 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_RTNL_H_
#define NETLINK_RTNL_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Realms
* @{
*/
/**
* Mask specying the size of each realm part
* @ingroup rtnl
*/
#define RTNL_REALM_MASK (0xFFFF)
/**
* Extract FROM realm from a realms field
*/
#define RTNL_REALM_FROM(realm) ((realm) >> 16)
/**
* Extract TO realm from a realms field
*/
#define RTNL_REALM_TO(realm) ((realm) & RTNL_REALM_MASK)
/**
* Build a realms field
*/
#define RTNL_MAKE_REALM(from, to) \
((RTNL_REALM_TO(from) << 16) & RTNL_REALM_TO(to))
/** @} */
/* General */
extern int nl_rtgen_request(struct nl_sock *, int, int, int);
/* Routing Type Translations */
extern char * nl_rtntype2str(int, char *, size_t);
extern int nl_str2rtntype(const char *);
/* Scope Translations */
extern char * rtnl_scope2str(int, char *, size_t);
extern int rtnl_str2scope(const char *);
/* Realms Translations */
extern char * rtnl_realms2str(uint32_t, char *, size_t);
#ifdef __cplusplus
}
#endif
#endif
route/rule.h 0000644 00000006726 15051120407 0007030 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_RULE_H_
#define NETLINK_RULE_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#include <netlink/route/route.h>
#include <linux/fib_rules.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_rule;
/* General */
extern struct rtnl_rule * rtnl_rule_alloc(void);
extern void rtnl_rule_put(struct rtnl_rule *);
extern int rtnl_rule_alloc_cache(struct nl_sock *, int,
struct nl_cache **);
extern void rtnl_rule_dump(struct rtnl_rule *, FILE *, struct nl_dump_params *);
extern int rtnl_rule_build_add_request(struct rtnl_rule *, int,
struct nl_msg **);
extern int rtnl_rule_add(struct nl_sock *, struct rtnl_rule *, int);
extern int rtnl_rule_build_delete_request(struct rtnl_rule *, int,
struct nl_msg **);
extern int rtnl_rule_delete(struct nl_sock *, struct rtnl_rule *, int);
/* attribute modification */
extern void rtnl_rule_set_family(struct rtnl_rule *, int);
extern int rtnl_rule_get_family(struct rtnl_rule *);
extern void rtnl_rule_set_prio(struct rtnl_rule *, uint32_t);
extern uint32_t rtnl_rule_get_prio(struct rtnl_rule *);
extern void rtnl_rule_set_mark(struct rtnl_rule *, uint32_t);
extern uint32_t rtnl_rule_get_mark(struct rtnl_rule *);
extern void rtnl_rule_set_mask(struct rtnl_rule *, uint32_t);
extern uint32_t rtnl_rule_get_mask(struct rtnl_rule *);
extern void rtnl_rule_set_table(struct rtnl_rule *, uint32_t);
extern uint32_t rtnl_rule_get_table(struct rtnl_rule *);
extern void rtnl_rule_set_dsfield(struct rtnl_rule *, uint8_t);
extern uint8_t rtnl_rule_get_dsfield(struct rtnl_rule *);
extern int rtnl_rule_set_src(struct rtnl_rule *, struct nl_addr *);
extern struct nl_addr * rtnl_rule_get_src(struct rtnl_rule *);
extern int rtnl_rule_set_dst(struct rtnl_rule *, struct nl_addr *);
extern struct nl_addr * rtnl_rule_get_dst(struct rtnl_rule *);
extern void rtnl_rule_set_action(struct rtnl_rule *, uint8_t);
extern uint8_t rtnl_rule_get_action(struct rtnl_rule *);
extern int rtnl_rule_set_iif(struct rtnl_rule *, const char *);
extern char * rtnl_rule_get_iif(struct rtnl_rule *);
extern int rtnl_rule_set_oif(struct rtnl_rule *, const char *);
extern char * rtnl_rule_get_oif(struct rtnl_rule *);
extern void rtnl_rule_set_realms(struct rtnl_rule *, uint32_t);
extern uint32_t rtnl_rule_get_realms(struct rtnl_rule *);
extern void rtnl_rule_set_goto(struct rtnl_rule *, uint32_t);
extern uint32_t rtnl_rule_get_goto(struct rtnl_rule *);
extern void rtnl_rule_set_l3mdev(struct rtnl_rule *, int);
extern int rtnl_rule_get_l3mdev(struct rtnl_rule *);
extern int rtnl_rule_set_protocol(struct rtnl_rule *, uint8_t);
extern int rtnl_rule_get_protocol(struct rtnl_rule *, uint8_t *);
extern int rtnl_rule_set_ipproto(struct rtnl_rule *, uint8_t);
extern int rtnl_rule_get_ipproto(struct rtnl_rule *, uint8_t *);
extern int rtnl_rule_set_sport(struct rtnl_rule *, uint16_t start);
extern int rtnl_rule_set_sport_range(struct rtnl_rule *,
uint16_t start,
uint16_t end);
extern int rtnl_rule_get_sport(struct rtnl_rule *, uint16_t *start,
uint16_t *end);
extern int rtnl_rule_set_dport(struct rtnl_rule *, uint16_t start);
extern int rtnl_rule_set_dport_range(struct rtnl_rule *,
uint16_t start,
uint16_t end);
extern int rtnl_rule_get_dport(struct rtnl_rule *, uint16_t *start,
uint16_t *end);
#ifdef __cplusplus
}
#endif
#endif
route/neighbour.h 0000644 00000005361 15051120407 0010035 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_NEIGHBOUR_H_
#define NETLINK_NEIGHBOUR_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_neigh;
extern struct rtnl_neigh *rtnl_neigh_alloc(void);
extern void rtnl_neigh_put(struct rtnl_neigh *);
extern int rtnl_neigh_alloc_cache(struct nl_sock *, struct nl_cache **);
extern int rtnl_neigh_alloc_cache_flags(struct nl_sock *,
struct nl_cache **,
unsigned int);
extern struct rtnl_neigh *rtnl_neigh_get(struct nl_cache *, int,
struct nl_addr *);
extern struct rtnl_neigh *rtnl_neigh_get_by_vlan(struct nl_cache *, int,
struct nl_addr *, int);
extern int rtnl_neigh_parse(struct nlmsghdr *, struct rtnl_neigh **);
extern char * rtnl_neigh_state2str(int, char *, size_t);
extern int rtnl_neigh_str2state(const char *);
extern char * rtnl_neigh_flags2str(int, char *, size_t);
extern int rtnl_neigh_str2flag(const char *);
extern int rtnl_neigh_add(struct nl_sock *, struct rtnl_neigh *, int);
extern int rtnl_neigh_build_add_request(struct rtnl_neigh *, int,
struct nl_msg **);
extern int rtnl_neigh_delete(struct nl_sock *, struct rtnl_neigh *, int);
extern int rtnl_neigh_build_delete_request(struct rtnl_neigh *, int,
struct nl_msg **);
extern void rtnl_neigh_set_state(struct rtnl_neigh *, int);
extern int rtnl_neigh_get_state(struct rtnl_neigh *);
extern void rtnl_neigh_unset_state(struct rtnl_neigh *,
int);
extern void rtnl_neigh_set_flags(struct rtnl_neigh *,
unsigned int);
extern void rtnl_neigh_unset_flags(struct rtnl_neigh *,
unsigned int);
extern unsigned int rtnl_neigh_get_flags(struct rtnl_neigh *);
extern void rtnl_neigh_set_ifindex(struct rtnl_neigh *,
int);
extern int rtnl_neigh_get_ifindex(struct rtnl_neigh *);
extern void rtnl_neigh_set_lladdr(struct rtnl_neigh *,
struct nl_addr *);
extern struct nl_addr * rtnl_neigh_get_lladdr(struct rtnl_neigh *);
extern int rtnl_neigh_set_dst(struct rtnl_neigh *,
struct nl_addr *);
extern struct nl_addr * rtnl_neigh_get_dst(struct rtnl_neigh *);
extern void rtnl_neigh_set_type(struct rtnl_neigh *, int);
extern int rtnl_neigh_get_type(struct rtnl_neigh *);
extern void rtnl_neigh_set_family(struct rtnl_neigh *, int);
extern int rtnl_neigh_get_family(struct rtnl_neigh *);
extern void rtnl_neigh_set_vlan(struct rtnl_neigh *, int);
extern int rtnl_neigh_get_vlan(struct rtnl_neigh *);
extern void rtnl_neigh_set_master(struct rtnl_neigh *, int);
extern int rtnl_neigh_get_master(struct rtnl_neigh *);
#ifdef __cplusplus
}
#endif
#endif
route/mdb.h 0000644 00000002222 15051120407 0006606 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
#ifndef NETLINK_MDB_H_
#define NETLINK_MDB_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/link.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_mdb;
struct rtnl_mdb_entry;
struct rtnl_mdb *rtnl_mdb_alloc(void);
void rtnl_mdb_put(struct rtnl_mdb *mdb);
int rtnl_mdb_alloc_cache(struct nl_sock *sk, struct nl_cache **result);
int rtnl_mdb_alloc_cache_flags(struct nl_sock *sock,
struct nl_cache **result,
unsigned int flags);
uint32_t rtnl_mdb_get_ifindex(struct rtnl_mdb *mdb);
void rtnl_mdb_add_entry(struct rtnl_mdb *mdb,
struct rtnl_mdb_entry *_entry);
void rtnl_mdb_foreach_entry(struct rtnl_mdb *mdb,
void (*cb)(struct rtnl_mdb_entry *, void *),
void *arg);
int rtnl_mdb_entry_get_ifindex(struct rtnl_mdb_entry *mdb_entry);
int rtnl_mdb_entry_get_vid(struct rtnl_mdb_entry *mdb_entry);
int rtnl_mdb_entry_get_state(struct rtnl_mdb_entry *mdb_entry);
struct nl_addr *rtnl_mdb_entry_get_addr(struct rtnl_mdb_entry
*mdb_entry);
uint16_t rtnl_mdb_entry_get_proto(struct rtnl_mdb_entry *mdb_entry);
#ifdef __cplusplus
}
#endif
#endif
route/nexthop.h 0000644 00000004521 15051120407 0007535 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_ROUTE_NEXTHOP_H_
#define NETLINK_ROUTE_NEXTHOP_H_
#include <netlink/netlink.h>
#include <netlink/addr.h>
#ifdef __cplusplus
extern "C" {
#endif
struct rtnl_nexthop;
enum {
NH_DUMP_FROM_ONELINE = -2,
NH_DUMP_FROM_DETAILS = -1,
NH_DUMP_FROM_ENV = 0,
/* > 0 reserved for nexthop index */
};
extern struct rtnl_nexthop * rtnl_route_nh_alloc(void);
extern struct rtnl_nexthop * rtnl_route_nh_clone(struct rtnl_nexthop *);
extern void rtnl_route_nh_free(struct rtnl_nexthop *);
extern int rtnl_route_nh_compare(struct rtnl_nexthop *,
struct rtnl_nexthop *,
uint32_t, int);
extern void rtnl_route_nh_dump(struct rtnl_nexthop *,
struct nl_dump_params *);
extern void rtnl_route_nh_set_weight(struct rtnl_nexthop *, uint8_t);
extern uint8_t rtnl_route_nh_get_weight(struct rtnl_nexthop *);
extern void rtnl_route_nh_set_ifindex(struct rtnl_nexthop *, int);
extern int rtnl_route_nh_get_ifindex(struct rtnl_nexthop *);
extern void rtnl_route_nh_set_gateway(struct rtnl_nexthop *,
struct nl_addr *);
extern struct nl_addr * rtnl_route_nh_get_gateway(struct rtnl_nexthop *);
extern void rtnl_route_nh_set_flags(struct rtnl_nexthop *,
unsigned int);
extern void rtnl_route_nh_unset_flags(struct rtnl_nexthop *,
unsigned int);
extern unsigned int rtnl_route_nh_get_flags(struct rtnl_nexthop *);
extern void rtnl_route_nh_set_realms(struct rtnl_nexthop *,
uint32_t);
extern uint32_t rtnl_route_nh_get_realms(struct rtnl_nexthop *);
extern int rtnl_route_nh_set_newdst(struct rtnl_nexthop *,
struct nl_addr *);
extern struct nl_addr * rtnl_route_nh_get_newdst(struct rtnl_nexthop *);
extern int rtnl_route_nh_set_via(struct rtnl_nexthop *,
struct nl_addr *);
extern struct nl_addr * rtnl_route_nh_get_via(struct rtnl_nexthop *);
extern char * rtnl_route_nh_flags2str(int, char *, size_t);
extern int rtnl_route_nh_str2flags(const char *);
/*
* nexthop encapsulations
*/
extern int rtnl_route_nh_encap_mpls(struct rtnl_nexthop *nh,
struct nl_addr *addr,
uint8_t ttl);
extern struct nl_addr * rtnl_route_nh_get_encap_mpls_dst(struct rtnl_nexthop *);
extern uint8_t rtnl_route_nh_get_encap_mpls_ttl(struct rtnl_nexthop *);
#ifdef __cplusplus
}
#endif
#endif
object-api.h 0000644 00000000414 15051120407 0006724 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_DUMMY_OBJECT_API_H_
#define NETLINK_DUMMY_OBJECT_API_H_
#include <netlink/netlink.h>
#include <netlink/utils.h>
#include <netlink/object.h>
#endif
hash.h 0000644 00000003674 15051120407 0005645 0 ustar 00 /*
* This file was taken from http://ccodearchive.net/info/hash.html
* Changes to the original file include cleanups and removal of unwanted code
* and also code that depended on build_asert
*/
#ifndef CCAN_HASH_H
#define CCAN_HASH_H
#include <stdint.h>
#include <stdlib.h>
#include <endian.h>
/* Stolen mostly from: lookup3.c, by Bob Jenkins, May 2006, Public Domain.
*
* http://burtleburtle.net/bob/c/lookup3.c
*/
#ifdef __LITTLE_ENDIAN
# define HAVE_LITTLE_ENDIAN 1
#elif __BIG_ENDIAN
# define HAVE_BIG_ENDIAN 1
#else
#error Unknown endianness. Failure in endian.h
#endif
/**
* hash - fast hash of an array for internal use
* @p: the array or pointer to first element
* @num: the number of elements to hash
* @base: the base number to roll into the hash (usually 0)
*
* The memory region pointed to by p is combined with the base to form
* a 32-bit hash.
*
* This hash will have different results on different machines, so is
* only useful for internal hashes (ie. not hashes sent across the
* network or saved to disk).
*
* It may also change with future versions: it could even detect at runtime
* what the fastest hash to use is.
*
* See also: hash64, hash_stable.
*
* Example:
* #include <ccan/hash/hash.h>
* #include <err.h>
* #include <stdio.h>
* #include <string.h>
*
* // Simple demonstration: idential strings will have the same hash, but
* // two different strings will probably not.
* int main(int argc, char *argv[])
* {
* uint32_t hash1, hash2;
*
* if (argc != 3)
* err(1, "Usage: %s <string1> <string2>", argv[0]);
*
* hash1 = __nl_hash(argv[1], strlen(argv[1]), 0);
* hash2 = __nl_hash(argv[2], strlen(argv[2]), 0);
* printf("Hash is %s\n", hash1 == hash2 ? "same" : "different");
* return 0;
* }
*/
#define __nl_hash(p, num, base) nl_hash_any((p), (num)*sizeof(*(p)), (base))
/* Our underlying operations. */
uint32_t nl_hash_any(const void *key, size_t length, uint32_t base);
#endif /* HASH_H */
netlink-kernel.h 0000644 00000012353 15051120407 0007636 0 ustar 00 #ifndef __NETLINK_KERNEL_H_
#define __NETLINK_KERNEL_H_
#if 0
/*
* FIXME: Goal is to preseve the documentation but make it simple
* to keep linux/netlink.h in sync. Maybe use named documentation
* sections.
*/
/**
* Netlink socket address
* @ingroup nl
*/
struct sockaddr_nl
{
/** socket family (AF_NETLINK) */
sa_family_t nl_family;
/** Padding (unused) */
unsigned short nl_pad;
/** Unique process ID */
uint32_t nl_pid;
/** Multicast group subscriptions */
uint32_t nl_groups;
};
/**
* @addtogroup msg
* @{
*/
/**
* Netlink message header
*/
struct nlmsghdr
{
/** Length of message including header and padding. */
uint32_t nlmsg_len;
/** Message type (content type) */
uint16_t nlmsg_type;
/** Message flags */
uint16_t nlmsg_flags;
/** Sequence number of message \see core_sk_seq_num. */
uint32_t nlmsg_seq;
/** Netlink port */
uint32_t nlmsg_pid;
};
/**
* @name Standard message flags
* @{
*/
/**
* Must be set on all request messages (typically from user space to
* kernel space).
*/
#define NLM_F_REQUEST 1
/**
* Indicates the message is part of a multipart message terminated
* by NLMSG_DONE.
*/
#define NLM_F_MULTI 2
/**
* Request for an acknowledgment on success.
*/
#define NLM_F_ACK 4
/**
* Echo this request
*/
#define NLM_F_ECHO 8
/** @} */
/**
* @name Additional message flags for GET requests
* @{
*/
/**
* Return the complete table instead of a single entry.
*/
#define NLM_F_ROOT 0x100
/**
* Return all entries matching criteria passed in message content.
*/
#define NLM_F_MATCH 0x200
/**
* Return an atomic snapshot of the table being referenced. This
* may require special privileges because it has the potential to
* interrupt service in the FE for a longer time.
*/
#define NLM_F_ATOMIC 0x400
/**
* Dump all entries
*/
#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
/** @} */
/**
* @name Additional messsage flags for NEW requests
* @{
*/
/**
* Replace existing matching config object with this request.
*/
#define NLM_F_REPLACE 0x100
/**
* Don't replace the config object if it already exists.
*/
#define NLM_F_EXCL 0x200
/**
* Create config object if it doesn't already exist.
*/
#define NLM_F_CREATE 0x400
/**
* Add to the end of the object list.
*/
#define NLM_F_APPEND 0x800
/** @} */
/**
* @name Standard Message types
* @{
*/
/**
* No operation, message must be ignored
*/
#define NLMSG_NOOP 0x1
/**
* The message signals an error and the payload contains a nlmsgerr
* structure. This can be looked at as a NACK and typically it is
* from FEC to CPC.
*/
#define NLMSG_ERROR 0x2
/**
* Message terminates a multipart message.
*/
#define NLMSG_DONE 0x3
/**
* The message signals that data got lost
*/
#define NLMSG_OVERRUN 0x4
/**
* Lower limit of reserved message types
*/
#define NLMSG_MIN_TYPE 0x10
/** @} */
/**
* Netlink error message header
*/
struct nlmsgerr
{
/** Error code (errno number) */
int error;
/** Original netlink message causing the error */
struct nlmsghdr msg;
};
struct nl_pktinfo
{
__u32 group;
};
/**
* Netlink alignment constant, all boundries within messages must be align to this.
*
* See \ref core_msg_fmt_align for more information on message alignment.
*/
#define NLMSG_ALIGNTO 4
/**
* Returns \p len properly aligned to NLMSG_ALIGNTO.
*
* See \ref core_msg_fmt_align for more information on message alignment.
*/
#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
/**
* Length of a netlink message header including padding.
*
* See \ref core_msg_fmt_align for more information on message alignment.
*/
#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
/** @} */
/**
* @addtogroup attr
* @{
*/
/*
*/
/**
* Netlink attribute structure
*
* @code
* <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
* +---------------------+- - -+- - - - - - - - - -+- - -+
* | Header | Pad | Payload | Pad |
* | (struct nlattr) | ing | | ing |
* +---------------------+- - -+- - - - - - - - - -+- - -+
* <-------------- nlattr->nla_len -------------->
* @endcode
*/
struct nlattr {
/**
* Attribute length in bytes including header
*/
__u16 nla_len;
/**
* Netlink attribute type
*/
__u16 nla_type;
};
/**
* @name Attribute Type Flags
*
* @code
* nla_type (16 bits)
* +---+---+-------------------------------+
* | N | O | Attribute Type |
* +---+---+-------------------------------+
* N := Carries nested attributes
* O := Payload stored in network byte order
* @endcode
*
* @note The N and O flag are mutually exclusive.
*
* @{
*/
/*
*/
#define NLA_F_NESTED (1 << 15)
#define NLA_F_NET_BYTEORDER (1 << 14)
#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
/** @} */
#define NLA_ALIGNTO 4
/**
* Returns \p len properly aligned to NLA_ALIGNTO.
*
* See \ref core_msg_fmt_align for more information on message alignment.
*/
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
/**
* Length of a netlink attribute header including padding.
*
* See \ref core_msg_fmt_align for more information on message alignment.
*/
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
/** @} */
#endif
#endif /* __LINUX_NETLINK_H */
genl/genl.h 0000644 00000002535 15051120407 0006567 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_GENL_H_
#define NETLINK_GENL_H_
#include <netlink/netlink.h>
#include <netlink/msg.h>
#include <netlink/attr.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int genl_connect(struct nl_sock *);
extern int genl_send_simple(struct nl_sock *, int, int,
int, int);
extern void * genlmsg_put(struct nl_msg *, uint32_t, uint32_t,
int, int, int, uint8_t, uint8_t);
extern int genlmsg_valid_hdr(struct nlmsghdr *, int);
extern int genlmsg_validate(struct nlmsghdr *, int, int,
const struct nla_policy *);
extern int genlmsg_parse(struct nlmsghdr *, int, struct nlattr **,
int, const struct nla_policy *);
extern struct genlmsghdr *
genlmsg_hdr(struct nlmsghdr *);
extern void * genlmsg_data(const struct genlmsghdr *);
extern void * genlmsg_user_hdr(const struct genlmsghdr *);
extern void * genlmsg_user_data(const struct genlmsghdr *, const int);
extern int genlmsg_user_datalen(const struct genlmsghdr *,
const int);
extern int genlmsg_len(const struct genlmsghdr *);
extern struct nlattr * genlmsg_attrdata(const struct genlmsghdr *, int);
extern int genlmsg_attrlen(const struct genlmsghdr *, int);
extern char * genl_op2name(int, int, char *, size_t);
#ifdef __cplusplus
}
#endif
#endif
genl/mngt.h 0000644 00000007404 15051120407 0006607 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_GENL_MNGT_H_
#define NETLINK_GENL_MNGT_H_
#include <netlink/netlink.h>
#include <netlink/attr.h>
#include <netlink/list.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nl_cache_ops;
/**
* @ingroup genl_mngt
* @struct genl_info netlink/genl/mngt.h
*
* Informative structure passed on to message parser callbacks
*
* This structure is passed on to all message parser callbacks and contains
* information about the sender of the message as well as pointers to all
* relevant sections of the parsed message.
*
* @see genl_cmd::c_msg_parser
*/
struct genl_info
{
/** Socket address of sender */
struct sockaddr_nl * who;
/** Pointer to Netlink message header */
struct nlmsghdr * nlh;
/** Pointer to Generic Netlink message header */
struct genlmsghdr * genlhdr;
/** Pointer to user header */
void * userhdr;
/** Pointer to array of parsed attributes */
struct nlattr ** attrs;
};
/**
* @ingroup genl_mngt
* @struct genl_cmd netlink/genl/mngt.h
*
* Definition of a Generic Netlink command.
*
* This structure is used to define the list of available commands on the
* receiving side.
*
* @par Example:
* @code
* static struct genl_cmd foo_cmds[] = {
* {
* .c_id = FOO_CMD_NEW,
* .c_name = "NEWFOO" ,
* .c_maxattr = FOO_ATTR_MAX,
* .c_attr_policy = foo_policy,
* .c_msg_parser = foo_msg_parser,
* },
* {
* .c_id = FOO_CMD_DEL,
* .c_name = "DELFOO" ,
* },
* };
*
* static struct genl_ops my_genl_ops = {
* [...]
* .o_cmds = foo_cmds,
* .o_ncmds = ARRAY_SIZE(foo_cmds),
* };
* @endcode
*/
struct genl_cmd
{
/** Numeric command identifier (required) */
int c_id;
/** Human readable name (required) */
char * c_name;
/** Maximum attribute identifier that the command is prepared to handle. */
int c_maxattr;
/** Called whenever a message for this command is received */
int (*c_msg_parser)(struct nl_cache_ops *,
struct genl_cmd *,
struct genl_info *, void *);
/** Attribute validation policy, enforced before the callback is called */
struct nla_policy * c_attr_policy;
};
/**
* @ingroup genl_mngt
* @struct genl_ops netlink/genl/mngt.h
*
* Definition of a Generic Netlink family
*
* @par Example:
* @code
* static struct genl_cmd foo_cmds[] = {
* [...]
* };
*
* static struct genl_ops my_genl_ops = {
* .o_name = "foo",
* .o_hdrsize = sizeof(struct my_hdr),
* .o_cmds = foo_cmds,
* .o_ncmds = ARRAY_SIZE(foo_cmds),
* };
*
* if ((err = genl_register_family(&my_genl_ops)) < 0)
* // ERROR
* @endcode
*
* @see genl_cmd
*/
struct genl_ops
{
/** Length of user header */
unsigned int o_hdrsize;
/** Numeric identifier, automatically filled in by genl_ops_resolve() */
int o_id;
/** Human readable name, used by genl_ops_resolve() to resolve numeric id */
char * o_name;
/**
* If registered via genl_register(), will point to the related
* cache operations.
*/
struct nl_cache_ops * o_cache_ops;
/** Optional array defining the available Generic Netlink commands */
struct genl_cmd * o_cmds;
/** Number of elements in \c o_cmds array */
int o_ncmds;
/**
* @private
* Used internally to link together all registered operations.
*/
struct nl_list_head o_list;
};
extern int genl_register_family(struct genl_ops *);
extern int genl_unregister_family(struct genl_ops *);
extern int genl_handle_msg(struct nl_msg *, void *);
extern int genl_register(struct nl_cache_ops *);
extern void genl_unregister(struct nl_cache_ops *);
extern int genl_ops_resolve(struct nl_sock *, struct genl_ops *);
extern int genl_mngt_resolve(struct nl_sock *);
#ifdef __cplusplus
}
#endif
#endif
genl/ctrl.h 0000644 00000001425 15051120407 0006603 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_GENL_CTRL_H_
#define NETLINK_GENL_CTRL_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/addr.h>
#ifdef __cplusplus
extern "C" {
#endif
struct genl_family;
extern int genl_ctrl_alloc_cache(struct nl_sock *,
struct nl_cache **);
extern struct genl_family * genl_ctrl_search(struct nl_cache *, int);
extern struct genl_family * genl_ctrl_search_by_name(struct nl_cache *,
const char *);
extern int genl_ctrl_resolve(struct nl_sock *,
const char *);
extern int genl_ctrl_resolve_grp(struct nl_sock *sk,
const char *family,
const char *grp);
#ifdef __cplusplus
}
#endif
#endif
genl/family.h 0000644 00000002357 15051120407 0007125 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_GENL_FAMILY_H_
#define NETLINK_GENL_FAMILY_H_
#include <netlink/netlink.h>
#include <netlink/cache.h>
#ifdef __cplusplus
extern "C" {
#endif
struct genl_family;
extern struct genl_family * genl_family_alloc(void);
extern void genl_family_put(struct genl_family *);
extern unsigned int genl_family_get_id(struct genl_family *);
extern void genl_family_set_id(struct genl_family *, unsigned int);
extern char * genl_family_get_name(struct genl_family *);
extern void genl_family_set_name(struct genl_family *, const char *);
extern uint8_t genl_family_get_version(struct genl_family *);
extern void genl_family_set_version(struct genl_family *, uint8_t);
extern uint32_t genl_family_get_hdrsize(struct genl_family *);
extern void genl_family_set_hdrsize(struct genl_family *, uint32_t);
extern uint32_t genl_family_get_maxattr(struct genl_family *);
extern void genl_family_set_maxattr(struct genl_family *, uint32_t);
extern int genl_family_add_op(struct genl_family *, int, int);
extern int genl_family_add_grp(struct genl_family *, uint32_t ,
const char *);
#ifdef __cplusplus
}
#endif
#endif
handlers.h 0000644 00000006640 15051120407 0006516 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_HANDLERS_H_
#define NETLINK_HANDLERS_H_
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <netlink/netlink-compat.h>
#include <netlink/netlink-kernel.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nlmsgerr;
struct sockaddr_nl;
struct ucred;
struct nl_cb;
struct nl_sock;
struct nl_msg;
/**
* @name Callback Typedefs
* @{
*/
/**
* nl_recvmsgs() callback for message processing customization
* @ingroup cb
* @arg msg netlink message being processed
* @arg arg argument passed on through caller
*/
typedef int (*nl_recvmsg_msg_cb_t)(struct nl_msg *msg, void *arg);
/**
* nl_recvmsgs() callback for error message processing customization
* @ingroup cb
* @arg nla netlink address of the peer
* @arg nlerr netlink error message being processed
* @arg arg argument passed on through caller
*/
typedef int (*nl_recvmsg_err_cb_t)(struct sockaddr_nl *nla,
struct nlmsgerr *nlerr, void *arg);
/** @} */
/**
* Callback actions
* @ingroup cb
*/
enum nl_cb_action {
/** Proceed with whatever would come next */
NL_OK,
/** Skip this message */
NL_SKIP,
/** Stop parsing altogether and discard remaining messages */
NL_STOP,
};
/**
* Callback kinds
* @ingroup cb
*/
enum nl_cb_kind {
/** Default handlers (quiet) */
NL_CB_DEFAULT,
/** Verbose default handlers (error messages printed) */
NL_CB_VERBOSE,
/** Debug handlers for debugging */
NL_CB_DEBUG,
/** Customized handler specified by the user */
NL_CB_CUSTOM,
__NL_CB_KIND_MAX,
};
#define NL_CB_KIND_MAX (__NL_CB_KIND_MAX - 1)
/**
* Callback types
* @ingroup cb
*/
enum nl_cb_type {
/** Message is valid */
NL_CB_VALID,
/** Last message in a series of multi part messages received */
NL_CB_FINISH,
/** Report received that data was lost */
NL_CB_OVERRUN,
/** Message wants to be skipped */
NL_CB_SKIPPED,
/** Message is an acknowledgement */
NL_CB_ACK,
/** Called for every message received */
NL_CB_MSG_IN,
/** Called for every message sent out except for nl_sendto() */
NL_CB_MSG_OUT,
/** Message is malformed and invalid */
NL_CB_INVALID,
/** Called instead of internal sequence number checking */
NL_CB_SEQ_CHECK,
/** Sending of an acknowledge message has been requested */
NL_CB_SEND_ACK,
/** Flag NLM_F_DUMP_INTR is set in message */
NL_CB_DUMP_INTR,
__NL_CB_TYPE_MAX,
};
#define NL_CB_TYPE_MAX (__NL_CB_TYPE_MAX - 1)
extern struct nl_cb * nl_cb_alloc(enum nl_cb_kind);
extern struct nl_cb * nl_cb_clone(struct nl_cb *);
extern struct nl_cb * nl_cb_get(struct nl_cb *);
extern void nl_cb_put(struct nl_cb *);
extern int nl_cb_set(struct nl_cb *, enum nl_cb_type, enum nl_cb_kind,
nl_recvmsg_msg_cb_t, void *);
extern int nl_cb_set_all(struct nl_cb *, enum nl_cb_kind,
nl_recvmsg_msg_cb_t, void *);
extern int nl_cb_err(struct nl_cb *, enum nl_cb_kind, nl_recvmsg_err_cb_t,
void *);
extern void nl_cb_overwrite_recvmsgs(struct nl_cb *,
int (*func)(struct nl_sock *,
struct nl_cb *));
extern void nl_cb_overwrite_recv(struct nl_cb *,
int (*func)(struct nl_sock *,
struct sockaddr_nl *,
unsigned char **,
struct ucred **));
extern void nl_cb_overwrite_send(struct nl_cb *,
int (*func)(struct nl_sock *,
struct nl_msg *));
extern enum nl_cb_type nl_cb_active_type(struct nl_cb *cb);
#ifdef __cplusplus
}
#endif
#endif
list.h 0000644 00000004416 15051120407 0005670 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_LIST_H_
#define NETLINK_LIST_H_
#include <stddef.h>
struct nl_list_head
{
struct nl_list_head * next;
struct nl_list_head * prev;
};
static inline void NL_INIT_LIST_HEAD(struct nl_list_head *list)
{
list->next = list;
list->prev = list;
}
static inline void __nl_list_add(struct nl_list_head *obj,
struct nl_list_head *prev,
struct nl_list_head *next)
{
prev->next = obj;
obj->prev = prev;
next->prev = obj;
obj->next = next;
}
static inline void nl_list_add_tail(struct nl_list_head *obj,
struct nl_list_head *head)
{
__nl_list_add(obj, head->prev, head);
}
static inline void nl_list_add_head(struct nl_list_head *obj,
struct nl_list_head *head)
{
__nl_list_add(obj, head, head->next);
}
static inline void nl_list_del(struct nl_list_head *obj)
{
obj->next->prev = obj->prev;
obj->prev->next = obj->next;
}
static inline int nl_list_empty(struct nl_list_head *head)
{
return head->next == head;
}
#define nl_container_of(ptr, type, member) ({ \
const __typeof__( ((type *)0)->member ) *__mptr = (ptr);\
(type *)( (char *)__mptr - (offsetof(type, member)));})
#define nl_list_entry(ptr, type, member) \
nl_container_of(ptr, type, member)
#define nl_list_at_tail(pos, head, member) \
((pos)->member.next == (head))
#define nl_list_at_head(pos, head, member) \
((pos)->member.prev == (head))
#define NL_LIST_HEAD(name) \
struct nl_list_head name = { &(name), &(name) }
#define nl_list_first_entry(head, type, member) \
nl_list_entry((head)->next, type, member)
#define nl_list_for_each_entry(pos, head, member) \
for (pos = nl_list_entry((head)->next, __typeof__(*pos), member); \
&(pos)->member != (head); \
(pos) = nl_list_entry((pos)->member.next, __typeof__(*(pos)), member))
#define nl_list_for_each_entry_safe(pos, n, head, member) \
for (pos = nl_list_entry((head)->next, __typeof__(*pos), member), \
n = nl_list_entry(pos->member.next, __typeof__(*pos), member); \
&(pos)->member != (head); \
pos = n, n = nl_list_entry(n->member.next, __typeof__(*n), member))
#define nl_init_list_head(head) \
do { (head)->next = (head); (head)->prev = (head); } while (0)
#endif
version.h 0000644 00000001323 15051120407 0006374 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2008-2011 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_VERSION_H_
#define NETLINK_VERSION_H_
/* Compile Time Versioning Information */
#define LIBNL_STRING "libnl 3.7.0"
#define LIBNL_VERSION "3.7.0"
#define LIBNL_VER_MAJ 3
#define LIBNL_VER_MIN 7
#define LIBNL_VER_MIC 0
#define LIBNL_VER(maj,min) ((maj) << 8 | (min))
#define LIBNL_VER_NUM LIBNL_VER(LIBNL_VER_MAJ, LIBNL_VER_MIN)
#define LIBNL_CURRENT 226
#define LIBNL_REVISION 0
#define LIBNL_AGE 26
/* Run-time version information */
extern const int nl_ver_num;
extern const int nl_ver_maj;
extern const int nl_ver_min;
extern const int nl_ver_mic;
#endif
idiag/msg.h 0000644 00000007732 15051120407 0006564 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com>
*/
#ifndef NETLINK_IDIAGNL_MSG_H_
#define NETLINK_IDIAGNL_MSG_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
struct idiagnl_msg;
/* @deprecated: DO NOT USE this variable. */
extern struct nl_object_ops idiagnl_msg_obj_ops;
extern struct idiagnl_msg * idiagnl_msg_alloc(void);
extern int idiagnl_msg_alloc_cache(struct nl_sock *, int, int,
struct nl_cache**);
extern void idiagnl_msg_get(struct idiagnl_msg *);
extern void idiagnl_msg_put(struct idiagnl_msg *);
extern uint8_t idiagnl_msg_get_family(const struct idiagnl_msg *);
extern void idiagnl_msg_set_family(struct idiagnl_msg *, uint8_t);
extern uint8_t idiagnl_msg_get_state(const struct idiagnl_msg *);
extern void idiagnl_msg_set_state(struct idiagnl_msg *, uint8_t);
extern uint8_t idiagnl_msg_get_timer(const struct idiagnl_msg *);
extern void idiagnl_msg_set_timer(struct idiagnl_msg *, uint8_t);
extern uint8_t idiagnl_msg_get_retrans(const struct idiagnl_msg *);
extern void idiagnl_msg_set_retrans(struct idiagnl_msg *, uint8_t);
extern uint16_t idiagnl_msg_get_sport(struct idiagnl_msg *);
extern void idiagnl_msg_set_sport(struct idiagnl_msg *, uint16_t);
extern uint16_t idiagnl_msg_get_dport(struct idiagnl_msg *);
extern void idiagnl_msg_set_dport(struct idiagnl_msg *, uint16_t);
extern struct nl_addr * idiagnl_msg_get_src(const struct idiagnl_msg *);
extern int idiagnl_msg_set_src(struct idiagnl_msg *,
struct nl_addr *);
extern struct nl_addr * idiagnl_msg_get_dst(const struct idiagnl_msg *);
extern int idiagnl_msg_set_dst(struct idiagnl_msg *,
struct nl_addr *);
extern uint32_t idiagnl_msg_get_ifindex(const struct idiagnl_msg *);
extern void idiagnl_msg_set_ifindex(struct idiagnl_msg *, uint32_t);
extern uint32_t idiagnl_msg_get_expires(const struct idiagnl_msg *);
extern void idiagnl_msg_set_expires(struct idiagnl_msg *, uint32_t);
extern uint32_t idiagnl_msg_get_rqueue(const struct idiagnl_msg *);
extern void idiagnl_msg_set_rqueue(struct idiagnl_msg *, uint32_t);
extern uint32_t idiagnl_msg_get_wqueue(const struct idiagnl_msg *);
extern void idiagnl_msg_set_wqueue(struct idiagnl_msg *, uint32_t);
extern uint32_t idiagnl_msg_get_uid(const struct idiagnl_msg *);
extern void idiagnl_msg_set_uid(struct idiagnl_msg *, uint32_t);
extern uint32_t idiagnl_msg_get_inode(const struct idiagnl_msg *);
extern void idiagnl_msg_set_inode(struct idiagnl_msg *, uint32_t);
extern uint8_t idiagnl_msg_get_tos(const struct idiagnl_msg *);
extern void idiagnl_msg_set_tos(struct idiagnl_msg *, uint8_t);
extern uint8_t idiagnl_msg_get_tclass(const struct idiagnl_msg *);
extern void idiagnl_msg_set_tclass(struct idiagnl_msg *, uint8_t);
extern uint8_t idiagnl_msg_get_shutdown(const struct idiagnl_msg *);
extern void idiagnl_msg_set_shutdown(struct idiagnl_msg *, uint8_t);
extern char * idiagnl_msg_get_cong(const struct idiagnl_msg *);
extern void idiagnl_msg_set_cong(struct idiagnl_msg *, char *);
extern struct idiagnl_meminfo *idiagnl_msg_get_meminfo(const struct idiagnl_msg *);
extern void idiagnl_msg_set_meminfo(struct idiagnl_msg *,
struct idiagnl_meminfo *);
extern struct idiagnl_vegasinfo *idiagnl_msg_get_vegasinfo(const struct idiagnl_msg *);
extern void idiagnl_msg_set_vegasinfo(struct idiagnl_msg *,
struct idiagnl_vegasinfo *);
extern struct tcp_info idiagnl_msg_get_tcpinfo(const struct idiagnl_msg *);
extern void idiagnl_msg_set_tcpinfo(struct idiagnl_msg *,
struct tcp_info *);
extern int idiagnl_msg_parse(struct nlmsghdr *,
struct idiagnl_msg **);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* NETLINK_IDIAGNL_MSG_H_ */
idiag/idiagnl.h 0000644 00000011516 15051120407 0007400 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com>
*/
#ifndef NETLINK_IDIAGNL_H_
#define NETLINK_IDIAGNL_H_
#include <netlink/netlink.h>
#include <linux/sock_diag.h>
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************
* The following part contains DEPRECATED names and defines.
* Don't use them.
*************************************************************/
/**
* Inet Diag message types
*
* deprecated: use TCPDIAG_GETSOCK, DCCPDIAG_GETSOCK and
* INET_DIAG_GETSOCK_MAX from linux/inet_diag.h
*/
#define IDIAG_TCPDIAG_GETSOCK 18
#define IDIAG_DCCPDIAG_GETSOCK 19
#define IDIAG_GETSOCK_MAX 24
/**
* Socket state identifiers
* @ingroup idiag
* @deprecated: use instead the TCP_* defines from netinet/tcp.h.
*/
enum {
IDIAG_SS_UNKNOWN = 0,
IDIAG_SS_ESTABLISHED = 1, /* TCP_ESTABLISHED */
IDIAG_SS_SYN_SENT = 2, /* TCP_SYN_SENT */
IDIAG_SS_SYN_RECV = 3, /* TCP_SYN_RECV */
IDIAG_SS_FIN_WAIT1 = 4, /* TCP_FIN_WAIT1 */
IDIAG_SS_FIN_WAIT2 = 5, /* TCP_FIN_WAIT2 */
IDIAG_SS_TIME_WAIT = 6, /* TCP_TIME_WAIT */
IDIAG_SS_CLOSE = 7, /* TCP_CLOSE */
IDIAG_SS_CLOSE_WAIT = 8, /* TCP_CLOSE_WAIT */
IDIAG_SS_LAST_ACK = 9, /* TCP_LAST_ACK */
IDIAG_SS_LISTEN = 10, /* TCP_LISTEN */
IDIAG_SS_CLOSING = 11, /* TCP_CLOSING */
IDIAG_SS_MAX = 12,
};
/**
* Macro to represent all socket states.
* @ingroup idiag
* @deprecated
*/
#define IDIAG_SS_ALL IDIAGNL_SS_ALL
/**
* Inet Diag extended attributes
* @ingroup idiag
* @deprecated These attributes should not be used. They mirror the
* INET_DIAG_* extension flags from kernel headers. Use those instead. */
enum {
IDIAG_ATTR_NONE = 0, /* INET_DIAG_NONE */
IDIAG_ATTR_MEMINFO = 1, /* INET_DIAG_MEMINFO */
IDIAG_ATTR_INFO = 2, /* INET_DIAG_INFO */
IDIAG_ATTR_VEGASINFO = 3, /* INET_DIAG_VEGASINFO */
IDIAG_ATTR_CONG = 4, /* INET_DIAG_CONG */
IDIAG_ATTR_TOS = 5, /* INET_DIAG_TOS */
IDIAG_ATTR_TCLASS = 6, /* INET_DIAG_TCLASS */
IDIAG_ATTR_SKMEMINFO = 7, /* INET_DIAG_SKMEMINFO */
IDIAG_ATTR_SHUTDOWN = 8, /* INET_DIAG_SHUTDOWN */
/* IDIAG_ATTR_MAX was wrong, because it did not correspond to
* INET_DIAG_MAX. Anyway, freeze it to the previous value. */
IDIAG_ATTR_MAX = 9,
IDIAG_ATTR_ALL = (1<<IDIAG_ATTR_MAX) - 1,
};
/* deprectated keep these only for compatibility, DO NOT USE THEM */
#define IDIAG_SK_MEMINFO_RMEM_ALLOC 0 /* SK_MEMINFO_RMEM_ALLOC */
#define IDIAG_SK_MEMINFO_RCVBUF 1 /* SK_MEMINFO_RCVBUF */
#define IDIAG_SK_MEMINFO_WMEM_ALLOC 2 /* SK_MEMINFO_WMEM_ALLOC */
#define IDIAG_SK_MEMINFO_SNDBUF 3 /* SK_MEMINFO_SNDBUF */
#define IDIAG_SK_MEMINFO_FWD_ALLOC 4 /* SK_MEMINFO_FWD_ALLOC */
#define IDIAG_SK_MEMINFO_WMEM_QUEUED 5 /* SK_MEMINFO_WMEM_QUEUED */
#define IDIAG_SK_MEMINFO_OPTMEM 6 /* SK_MEMINFO_OPTMEM */
#define IDIAG_SK_MEMINFO_BACKLOG 7 /* SK_MEMINFO_BACKLOG */
#define IDIAG_SK_MEMINFO_VARS SK_MEMINFO_VARS
/* deprecated names. */
#define IDIAG_TIMER_OFF IDIAGNL_TIMER_OFF
#define IDIAG_TIMER_ON IDIAGNL_TIMER_ON
#define IDIAG_TIMER_KEEPALIVE IDIAGNL_TIMER_KEEPALIVE
#define IDIAG_TIMER_TIMEWAIT IDIAGNL_TIMER_TIMEWAIT
#define IDIAG_TIMER_PERSIST IDIAGNL_TIMER_PERSIST
#define IDIAG_TIMER_UNKNOWN IDIAGNL_TIMER_UNKNOWN
/*************************************************************/
/**
* Macro to represent all socket states.
* @ingroup idiag
*/
#define IDIAGNL_SS_ALL (((1<<12)-1))
/**
* Socket timer indentifiers
* @ingroupd idiag
*/
enum {
IDIAGNL_TIMER_OFF = 0,
IDIAGNL_TIMER_ON = 1,
IDIAGNL_TIMER_KEEPALIVE = 2,
IDIAGNL_TIMER_TIMEWAIT = 3,
IDIAGNL_TIMER_PERSIST = 4,
IDIAGNL_TIMER_UNKNOWN = 5,
};
extern char * idiagnl_state2str(int, char *, size_t);
extern int idiagnl_str2state(const char *);
extern int idiagnl_connect(struct nl_sock *);
extern int idiagnl_send_simple(struct nl_sock *, int, uint8_t, uint16_t,
uint16_t);
extern char * idiagnl_timer2str(int, char *, size_t);
extern int idiagnl_str2timer(const char *);
extern char * idiagnl_attrs2str(int, char *, size_t);
extern char * idiagnl_tcpstate2str(uint8_t, char *, size_t);
extern char * idiagnl_tcpopts2str(uint8_t, char *, size_t);
extern char * idiagnl_shutdown2str(uint8_t, char *, size_t);
extern char * idiagnl_exts2str(uint8_t, char *, size_t);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* NETLINK_IDIAGNL_H_ */
idiag/meminfo.h 0000644 00000002271 15051120407 0007421 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com>
*/
#ifndef NETLINK_IDIAGNL_MEMINFO_H_
#define NETLINK_IDIAGNL_MEMINFO_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
extern struct nl_object_ops idiagnl_meminfo_obj_ops;
extern struct idiagnl_meminfo *idiagnl_meminfo_alloc(void);
extern void idiagnl_meminfo_get(struct idiagnl_meminfo *);
extern void idiagnl_meminfo_put(struct idiagnl_meminfo *);
extern uint32_t idiagnl_meminfo_get_rmem(const struct idiagnl_meminfo *);
extern uint32_t idiagnl_meminfo_get_wmem(const struct idiagnl_meminfo *);
extern uint32_t idiagnl_meminfo_get_fmem(const struct idiagnl_meminfo *);
extern uint32_t idiagnl_meminfo_get_tmem(const struct idiagnl_meminfo *);
extern void idiagnl_meminfo_set_rmem(struct idiagnl_meminfo *, uint32_t);
extern void idiagnl_meminfo_set_wmem(struct idiagnl_meminfo *, uint32_t);
extern void idiagnl_meminfo_set_fmem(struct idiagnl_meminfo *, uint32_t);
extern void idiagnl_meminfo_set_tmem(struct idiagnl_meminfo *, uint32_t);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* NETLINK_IDIAGNL_MEMINFO_H_ */
idiag/req.h 0000644 00000003652 15051120407 0006562 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com>
*/
#ifndef NETLINK_IDIAGNL_REQ_H_
#define NETLINK_IDIAGNL_REQ_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
struct idiagnl_req;
extern struct nl_object_ops idiagnl_req_obj_ops;
extern struct idiagnl_req * idiagnl_req_alloc(void);
extern void idiagnl_req_get(struct idiagnl_req *);
extern void idiagnl_req_put(struct idiagnl_req *);
extern uint8_t idiagnl_req_get_family(const struct idiagnl_req *);
extern void idiagnl_req_set_family(struct idiagnl_req *,
uint8_t);
extern uint8_t idiagnl_req_get_ext(const struct idiagnl_req *);
extern void idiagnl_req_set_ext(struct idiagnl_req *, uint8_t);
extern uint32_t idiagnl_req_get_ifindex(const struct idiagnl_req *);
extern void idiagnl_req_set_ifindex(struct idiagnl_req *,
uint32_t);
extern uint32_t idiagnl_req_get_states(const struct idiagnl_req *);
extern void idiagnl_req_set_states(struct idiagnl_req *,
uint32_t);
extern uint32_t idiagnl_req_get_dbs(const struct idiagnl_req *);
extern void idiagnl_req_set_dbs(struct idiagnl_req *, uint32_t);
extern struct nl_addr * idiagnl_req_get_src(const struct idiagnl_req *);
extern int idiagnl_req_set_src(struct idiagnl_req *,
struct nl_addr *);
extern struct nl_addr * idiagnl_req_get_dst(const struct idiagnl_req *);
extern int idiagnl_req_set_dst(struct idiagnl_req *,
struct nl_addr *);
extern int idiagnl_req_parse(struct nlmsghdr *nlh,
struct idiagnl_req **result);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* NETLINK_IDIAGNL_REQ_H_ */
idiag/vegasinfo.h 0000644 00000002567 15051120407 0007760 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com>
*/
#ifndef NETLINK_IDIAGNL_VEGASINFO_H_
#define NETLINK_IDIAGNL_VEGASINFO_H_
#include <netlink/netlink.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
extern struct nl_object_ops idiagnl_vegasinfo_obj_ops;
extern struct idiagnl_vegasinfo * idiagnl_vegasinfo_alloc(void);
extern void idiagnl_vegasinfo_get(struct idiagnl_vegasinfo *);
extern void idiagnl_vegasinfo_put(struct idiagnl_vegasinfo *);
extern uint32_t idiagnl_vegasinfo_get_enabled(const struct idiagnl_vegasinfo *);
extern uint32_t idiagnl_vegasinfo_get_rttcnt(const struct idiagnl_vegasinfo *);
extern uint32_t idiagnl_vegasinfo_get_rtt(const struct idiagnl_vegasinfo *);
extern uint32_t idiagnl_vegasinfo_get_minrtt(const struct idiagnl_vegasinfo *);
extern void idiagnl_vegasinfo_set_enabled(struct idiagnl_vegasinfo *,
uint32_t);
extern void idiagnl_vegasinfo_set_rttcnt(struct idiagnl_vegasinfo *,
uint32_t);
extern void idiagnl_vegasinfo_set_rtt(struct idiagnl_vegasinfo *, uint32_t);
extern void idiagnl_vegasinfo_set_minrtt(struct idiagnl_vegasinfo *,
uint32_t);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* NETLINK_IDIAGNL_VEGASINFO_H_ */
cache.h 0000644 00000013575 15051120407 0005766 0 ustar 00 /* SPDX-License-Identifier: LGPL-2.1-only */
/*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_CACHE_H_
#define NETLINK_CACHE_H_
#include <netlink/netlink.h>
#include <netlink/msg.h>
#include <netlink/utils.h>
#include <netlink/object.h>
#ifdef __cplusplus
extern "C" {
#endif
enum {
NL_ACT_UNSPEC,
NL_ACT_NEW,
NL_ACT_DEL,
NL_ACT_GET,
NL_ACT_SET,
NL_ACT_CHANGE,
__NL_ACT_MAX,
};
#define NL_ACT_MAX (__NL_ACT_MAX - 1)
struct nl_cache;
typedef void (*change_func_t)(struct nl_cache *, struct nl_object *, int, void *);
typedef void (*change_func_v2_t)(struct nl_cache *, struct nl_object *old_obj,
struct nl_object *new_obj, uint64_t, int, void *);
/**
* @ingroup cache
* Explicitely iterate over all address families when updating the cache
*/
#define NL_CACHE_AF_ITER 0x0001
/* Access Functions */
extern int nl_cache_nitems(struct nl_cache *);
extern int nl_cache_nitems_filter(struct nl_cache *,
struct nl_object *);
extern struct nl_cache_ops * nl_cache_get_ops(struct nl_cache *);
extern struct nl_object * nl_cache_get_first(struct nl_cache *);
extern struct nl_object * nl_cache_get_last(struct nl_cache *);
extern struct nl_object * nl_cache_get_next(struct nl_object *);
extern struct nl_object * nl_cache_get_prev(struct nl_object *);
extern struct nl_cache * nl_cache_alloc(struct nl_cache_ops *);
extern int nl_cache_alloc_and_fill(struct nl_cache_ops *,
struct nl_sock *,
struct nl_cache **);
extern int nl_cache_alloc_name(const char *,
struct nl_cache **);
extern struct nl_cache * nl_cache_subset(struct nl_cache *,
struct nl_object *);
extern struct nl_cache * nl_cache_clone(struct nl_cache *);
extern void nl_cache_clear(struct nl_cache *);
extern void nl_cache_get(struct nl_cache *);
extern void nl_cache_free(struct nl_cache *);
extern void nl_cache_put(struct nl_cache *cache);
/* Cache modification */
extern int nl_cache_add(struct nl_cache *,
struct nl_object *);
extern int nl_cache_parse_and_add(struct nl_cache *,
struct nl_msg *);
extern int nl_cache_move(struct nl_cache *,
struct nl_object *);
extern void nl_cache_remove(struct nl_object *);
extern int nl_cache_refill(struct nl_sock *,
struct nl_cache *);
extern int nl_cache_pickup(struct nl_sock *,
struct nl_cache *);
extern int nl_cache_pickup_checkdup(struct nl_sock *,
struct nl_cache *);
extern int nl_cache_resync(struct nl_sock *,
struct nl_cache *,
change_func_t,
void *);
extern int nl_cache_include(struct nl_cache *,
struct nl_object *,
change_func_t,
void *);
extern int nl_cache_include_v2(struct nl_cache *,
struct nl_object *,
change_func_v2_t,
void *);
extern void nl_cache_set_arg1(struct nl_cache *, int);
extern void nl_cache_set_arg2(struct nl_cache *, int);
extern void nl_cache_set_flags(struct nl_cache *, unsigned int);
/* General */
extern int nl_cache_is_empty(struct nl_cache *);
extern struct nl_object * nl_cache_search(struct nl_cache *,
struct nl_object *);
extern struct nl_object *nl_cache_find(struct nl_cache *,
struct nl_object *);
extern void nl_cache_mark_all(struct nl_cache *);
/* Dumping */
extern void nl_cache_dump(struct nl_cache *,
struct nl_dump_params *);
extern void nl_cache_dump_filter(struct nl_cache *,
struct nl_dump_params *,
struct nl_object *);
/* Iterators */
extern void nl_cache_foreach(struct nl_cache *,
void (*cb)(struct nl_object *,
void *),
void *arg);
extern void nl_cache_foreach_filter(struct nl_cache *,
struct nl_object *,
void (*cb)(struct
nl_object *,
void *),
void *arg);
/* --- cache management --- */
/* Cache type management */
extern struct nl_cache_ops * nl_cache_ops_lookup(const char *);
extern struct nl_cache_ops * nl_cache_ops_lookup_safe(const char *);
extern struct nl_cache_ops * nl_cache_ops_associate(int, int);
extern struct nl_cache_ops * nl_cache_ops_associate_safe(int, int);
extern struct nl_msgtype * nl_msgtype_lookup(struct nl_cache_ops *, int);
extern void nl_cache_ops_foreach(void (*cb)(struct nl_cache_ops *, void *), void *);
extern int nl_cache_mngt_register(struct nl_cache_ops *);
extern int nl_cache_mngt_unregister(struct nl_cache_ops *);
/* Global cache provisioning/requiring */
extern void nl_cache_mngt_provide(struct nl_cache *);
extern void nl_cache_mngt_unprovide(struct nl_cache *);
extern struct nl_cache * nl_cache_mngt_require(const char *);
extern struct nl_cache * nl_cache_mngt_require_safe(const char *);
extern struct nl_cache * __nl_cache_mngt_require(const char *);
struct nl_cache_mngr;
#define NL_AUTO_PROVIDE 1
#define NL_ALLOCATED_SOCK 2 /* For internal use only, do not use */
extern int nl_cache_mngr_alloc(struct nl_sock *,
int, int,
struct nl_cache_mngr **);
extern int nl_cache_mngr_add(struct nl_cache_mngr *,
const char *,
change_func_t,
void *,
struct nl_cache **);
extern int nl_cache_mngr_add_cache(struct nl_cache_mngr *mngr,
struct nl_cache *cache,
change_func_t cb, void *data);
extern int nl_cache_mngr_add_cache_v2(struct nl_cache_mngr *mngr,
struct nl_cache *cache,
change_func_v2_t cb, void *data);
extern int nl_cache_mngr_get_fd(struct nl_cache_mngr *);
extern int nl_cache_mngr_poll(struct nl_cache_mngr *,
int);
extern int nl_cache_mngr_data_ready(struct nl_cache_mngr *);
extern void nl_cache_mngr_info(struct nl_cache_mngr *,
struct nl_dump_params *);
extern void nl_cache_mngr_free(struct nl_cache_mngr *);
extern void nl_cache_ops_get(struct nl_cache_ops *);
extern void nl_cache_ops_put(struct nl_cache_ops *);
extern void nl_cache_ops_set_flags(struct nl_cache_ops *,
unsigned int);
#ifdef __cplusplus
}
#endif
#endif