6#ifndef NETLINK_UTILS_H_
7#define NETLINK_UTILS_H_
9#include <netlink/netlink.h>
10#include <netlink/list.h>
16#if defined(__GNUC__) && __GNUC__ > 5
17#define _nl_attribute_printf(a, b) __attribute__((__format__(printf, a, b)))
19#define _nl_attribute_printf(a, b)
31#define NL_PROB_MIN 0x0
37#define NL_PROB_MAX 0xffffffff
49extern int nl_rate2str(
unsigned long long,
int,
char *,
size_t);
54extern char *
nl_size2str(
const size_t,
char *,
const size_t);
62extern int nl_str2msec(
const char *, uint64_t *);
66extern char * nl_llproto2str(
int,
char *,
size_t);
67extern int nl_str2llproto(
const char *);
70extern char * nl_ether_proto2str(
int,
char *,
size_t);
71extern int nl_str2ether_proto(
const char *);
74extern char * nl_ip_proto2str(
int,
char *,
size_t);
75extern int nl_str2ip_proto(
const char *);
80extern
void nl_dump_line(struct
nl_dump_params *, const
char *, ...) _nl_attribute_printf(2, 3);
90 NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE = 1,
91#define NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE
97 NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE = 2,
98#define NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE
104 NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE = 3,
105#define NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE
113 NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE = 4,
114#define NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE
121 NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP = 5,
122#define NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP
129 NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO = 6,
130#define NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO
135 NL_CAPABILITY_VERSION_3_2_26 = 7,
136#define NL_CAPABILITY_VERSION_3_2_26 NL_CAPABILITY_VERSION_3_2_26
143 NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK = 8,
144#define NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK
151 NL_CAPABILITY_LINK_BUILD_CHANGE_REQUEST_SET_CHANGE = 9,
152#define NL_CAPABILITY_LINK_BUILD_CHANGE_REQUEST_SET_CHANGE NL_CAPABILITY_LINK_BUILD_CHANGE_REQUEST_SET_CHANGE
159 NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX = 10,
160#define NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX
165 NL_CAPABILITY_VERSION_3_2_27 = 11,
166#define NL_CAPABILITY_VERSION_3_2_27 NL_CAPABILITY_VERSION_3_2_27
171 NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE = 12,
172#define NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE
177 NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE = 13,
178#define NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE
185 NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR = 14,
186#define NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR
191 NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE = 15,
192#define NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE
197 NL_CAPABILITY_NL_OBJECT_DIFF64 = 16,
198#define NL_CAPABILITY_NL_OBJECT_DIFF64 NL_CAPABILITY_NL_OBJECT_DIFF64
204 NL_CAPABILITY_XFRM_SA_KEY_SIZE = 17,
205#define NL_CAPABILITY_XFRM_SA_KEY_SIZE NL_CAPABILITY_XFRM_SA_KEY_SIZE
211 NL_CAPABILITY_RTNL_ADDR_PEER_FIX = 18,
212#define NL_CAPABILITY_RTNL_ADDR_PEER_FIX NL_CAPABILITY_RTNL_ADDR_PEER_FIX
217 NL_CAPABILITY_VERSION_3_2_28 = 19,
218#define NL_CAPABILITY_VERSION_3_2_28 NL_CAPABILITY_VERSION_3_2_28
224 NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX = 20,
225#define NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX
231 NL_CAPABILITY_NL_ADDR_FILL_SOCKADDR = 21,
232#define NL_CAPABILITY_NL_ADDR_FILL_SOCKADDR NL_CAPABILITY_NL_ADDR_FILL_SOCKADDR
238 NL_CAPABILITY_XFRM_SEC_CTX_LEN = 22,
239#define NL_CAPABILITY_XFRM_SEC_CTX_LEN NL_CAPABILITY_XFRM_SEC_CTX_LEN
246 NL_CAPABILITY_LINK_BUILD_ADD_REQUEST_SET_CHANGE = 23,
247#define NL_CAPABILITY_LINK_BUILD_ADD_REQUEST_SET_CHANGE NL_CAPABILITY_LINK_BUILD_ADD_REQUEST_SET_CHANGE
261 NL_CAPABILITY_NL_RECVMSGS_PEEK_BY_DEFAULT = 24,
262#define NL_CAPABILITY_NL_RECVMSGS_PEEK_BY_DEFAULT NL_CAPABILITY_NL_RECVMSGS_PEEK_BY_DEFAULT
267 NL_CAPABILITY_VERSION_3_2_29 = 25,
268#define NL_CAPABILITY_VERSION_3_2_29 NL_CAPABILITY_VERSION_3_2_29
274 NL_CAPABILITY_XFRM_SP_SEC_CTX_LEN = 26,
275#define NL_CAPABILITY_XFRM_SP_SEC_CTX_LEN NL_CAPABILITY_XFRM_SP_SEC_CTX_LEN
280 NL_CAPABILITY_VERSION_3_3_0 = 27,
281#define NL_CAPABILITY_VERSION_3_3_0 NL_CAPABILITY_VERSION_3_3_0
286 NL_CAPABILITY_VERSION_3_4_0 = 28,
287#define NL_CAPABILITY_VERSION_3_4_0 NL_CAPABILITY_VERSION_3_4_0
294 NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP = 29,
295#define NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP
300 NL_CAPABILITY_VERSION_3_5_0 = 30,
301#define NL_CAPABILITY_VERSION_3_5_0 NL_CAPABILITY_VERSION_3_5_0
307 NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL = 31,
308#define NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL
313 NL_CAPABILITY_VERSION_3_6_0 = 32,
314#define NL_CAPABILITY_VERSION_3_6_0 NL_CAPABILITY_VERSION_3_6_0
319 NL_CAPABILITY_VERSION_3_7_0 = 33,
320#define NL_CAPABILITY_VERSION_3_7_0 NL_CAPABILITY_VERSION_3_7_0
323 NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
324#define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
330#define NL_CAPABILITY_IS_USER_RESERVED(cap) ( ((cap) & ~0x0FFF) == 0x7000 )
332int nl_has_capability (
int capability);
int nl_get_psched_hz(void)
Return the value of packet scheduler HZ.
char * nl_size2str(const size_t, char *, const size_t)
Convert a size toa character string.
double nl_cancel_down_us(uint32_t, char **)
Cancel down a micro second value.
double nl_cancel_down_bits(unsigned long long, char **)
Cancel down a bit counter.
int nl_get_user_hz(void)
Return the value of HZ.
long nl_size2int(const char *)
Convert a character string to a size.
void nl_dump(struct nl_dump_params *params, const char *fmt,...)
Dump a formatted character string.
double nl_cancel_down_bytes(unsigned long long, char **)
Cancel down a byte counter.
long nl_prob2int(const char *)
Convert a character string to a probability.
void nl_new_line(struct nl_dump_params *)
Handle a new line while dumping.
uint32_t nl_ticks2us(uint32_t)
Convert ticks to micro seconds.
uint32_t nl_us2ticks(uint32_t)
Convert micro seconds to ticks.
char * nl_msec2str(uint64_t, char *, size_t)
Convert milliseconds to a character string.