6 #ifndef NETLINK_UTILS_H_
7 #define NETLINK_UTILS_H_
9 #include <netlink/netlink.h>
10 #include <netlink/list.h>
25 #define NL_PROB_MIN 0x0
31 #define NL_PROB_MAX 0xffffffff
43 extern int nl_rate2str(
unsigned long long,
int,
char *,
size_t);
48 extern char *
nl_size2str(
const size_t,
char *,
const size_t);
56 extern int nl_str2msec(
const char *, uint64_t *);
57 extern char *
nl_msec2str(uint64_t,
char *,
size_t);
60 extern char * nl_llproto2str(
int,
char *,
size_t);
61 extern int nl_str2llproto(
const char *);
64 extern char * nl_ether_proto2str(
int,
char *,
size_t);
65 extern int nl_str2ether_proto(
const char *);
68 extern char * nl_ip_proto2str(
int,
char *,
size_t);
69 extern int nl_str2ip_proto(
const char *);
74 extern void nl_dump_line(
struct nl_dump_params *,
const char *, ...);
85 #define NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE
91 NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE = 2,
92 #define NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE NL_CAPABILITY_ROUTE_LINK_VETH_GET_PEER_OWN_REFERENCE
98 NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE = 3,
99 #define NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE NL_CAPABILITY_ROUTE_LINK_CLS_ADD_ACT_OWN_REFERENCE
107 NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE = 4,
108 #define NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE
115 NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP = 5,
116 #define NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP
123 NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO = 6,
124 #define NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO
129 NL_CAPABILITY_VERSION_3_2_26 = 7,
130 #define NL_CAPABILITY_VERSION_3_2_26 NL_CAPABILITY_VERSION_3_2_26
137 NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK = 8,
138 #define NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK
145 NL_CAPABILITY_LINK_BUILD_CHANGE_REQUEST_SET_CHANGE = 9,
146 #define NL_CAPABILITY_LINK_BUILD_CHANGE_REQUEST_SET_CHANGE NL_CAPABILITY_LINK_BUILD_CHANGE_REQUEST_SET_CHANGE
153 NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX = 10,
154 #define NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX
159 NL_CAPABILITY_VERSION_3_2_27 = 11,
160 #define NL_CAPABILITY_VERSION_3_2_27 NL_CAPABILITY_VERSION_3_2_27
165 NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE = 12,
166 #define NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE
171 NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE = 13,
172 #define NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE
179 NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR = 14,
180 #define NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR
185 NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE = 15,
186 #define NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE
191 NL_CAPABILITY_NL_OBJECT_DIFF64 = 16,
192 #define NL_CAPABILITY_NL_OBJECT_DIFF64 NL_CAPABILITY_NL_OBJECT_DIFF64
198 NL_CAPABILITY_XFRM_SA_KEY_SIZE = 17,
199 #define NL_CAPABILITY_XFRM_SA_KEY_SIZE NL_CAPABILITY_XFRM_SA_KEY_SIZE
205 NL_CAPABILITY_RTNL_ADDR_PEER_FIX = 18,
206 #define NL_CAPABILITY_RTNL_ADDR_PEER_FIX NL_CAPABILITY_RTNL_ADDR_PEER_FIX
211 NL_CAPABILITY_VERSION_3_2_28 = 19,
212 #define NL_CAPABILITY_VERSION_3_2_28 NL_CAPABILITY_VERSION_3_2_28
218 NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX = 20,
219 #define NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX
225 NL_CAPABILITY_NL_ADDR_FILL_SOCKADDR = 21,
226 #define NL_CAPABILITY_NL_ADDR_FILL_SOCKADDR NL_CAPABILITY_NL_ADDR_FILL_SOCKADDR
232 NL_CAPABILITY_XFRM_SEC_CTX_LEN = 22,
233 #define NL_CAPABILITY_XFRM_SEC_CTX_LEN NL_CAPABILITY_XFRM_SEC_CTX_LEN
240 NL_CAPABILITY_LINK_BUILD_ADD_REQUEST_SET_CHANGE = 23,
241 #define NL_CAPABILITY_LINK_BUILD_ADD_REQUEST_SET_CHANGE NL_CAPABILITY_LINK_BUILD_ADD_REQUEST_SET_CHANGE
255 NL_CAPABILITY_NL_RECVMSGS_PEEK_BY_DEFAULT = 24,
256 #define NL_CAPABILITY_NL_RECVMSGS_PEEK_BY_DEFAULT NL_CAPABILITY_NL_RECVMSGS_PEEK_BY_DEFAULT
261 NL_CAPABILITY_VERSION_3_2_29 = 25,
262 #define NL_CAPABILITY_VERSION_3_2_29 NL_CAPABILITY_VERSION_3_2_29
268 NL_CAPABILITY_XFRM_SP_SEC_CTX_LEN = 26,
269 #define NL_CAPABILITY_XFRM_SP_SEC_CTX_LEN NL_CAPABILITY_XFRM_SP_SEC_CTX_LEN
274 NL_CAPABILITY_VERSION_3_3_0 = 27,
275 #define NL_CAPABILITY_VERSION_3_3_0 NL_CAPABILITY_VERSION_3_3_0
280 NL_CAPABILITY_VERSION_3_4_0 = 28,
281 #define NL_CAPABILITY_VERSION_3_4_0 NL_CAPABILITY_VERSION_3_4_0
288 NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP = 29,
289 #define NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP
294 NL_CAPABILITY_VERSION_3_5_0 = 30,
295 #define NL_CAPABILITY_VERSION_3_5_0 NL_CAPABILITY_VERSION_3_5_0
301 NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL = 31,
302 #define NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL
307 NL_CAPABILITY_VERSION_3_6_0 = 32,
308 #define NL_CAPABILITY_VERSION_3_6_0 NL_CAPABILITY_VERSION_3_6_0
311 NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
312 #define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
318 #define NL_CAPABILITY_IS_USER_RESERVED(cap) ( ((cap) & ~0x0FFF) == 0x7000 )
320 int 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 *, const char *,...)
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.
@ NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE
rtnl_route_build_msg() no longer guesses the route scope if explicitly set to RT_SCOPE_NOWHERE.
void nl_new_line(struct nl_dump_params *)
Handle a new line while dumping.
char * nl_msec2str(uint64_t, char *, size_t)
Convert milliseconds to a character string.
uint32_t nl_ticks2us(uint32_t)
Convert ticks to micro seconds.
uint32_t nl_us2ticks(uint32_t)
Convert micro seconds to ticks.