12 #ifndef NETLINK_UTILS_H_ 13 #define NETLINK_UTILS_H_ 15 #include <netlink/netlink.h> 16 #include <netlink/list.h> 31 #define NL_PROB_MIN 0x0 37 #define NL_PROB_MAX 0xffffffff 49 extern int nl_rate2str(
unsigned long long,
int,
char *,
size_t);
54 extern char *
nl_size2str(
const size_t,
char *,
const size_t);
62 extern int nl_str2msec(
const char *, uint64_t *);
63 extern char *
nl_msec2str(uint64_t,
char *,
size_t);
66 extern char * nl_llproto2str(
int,
char *,
size_t);
67 extern int nl_str2llproto(
const char *);
70 extern char * nl_ether_proto2str(
int,
char *,
size_t);
71 extern int nl_str2ether_proto(
const char *);
74 extern char * nl_ip_proto2str(
int,
char *,
size_t);
75 extern int nl_str2ip_proto(
const char *);
80 extern void nl_dump_line(
struct nl_dump_params *,
const char *, ...);
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 290 NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
291 #define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
297 #define NL_CAPABILITY_IS_USER_RESERVED(cap) ( ((cap) & ~0x0FFF) == 0x7000 )
299 int nl_has_capability (
int capability);
int nl_get_user_hz(void)
Return the value of HZ.
void nl_new_line(struct nl_dump_params *)
Handle a new line while dumping.
long nl_size2int(const char *)
Convert a character string to a size.
double nl_cancel_down_bits(unsigned long long, char **)
Cancel down a bit counter.
char * nl_msec2str(uint64_t, char *, size_t)
Convert milliseconds to a character string.
char * nl_size2str(const size_t, char *, const size_t)
Convert a size toa character string.
rtnl_route_build_msg() no longer guesses the route scope if explicitly set to RT_SCOPE_NOWHERE.
double nl_cancel_down_bytes(unsigned long long, char **)
Cancel down a byte counter.
double nl_cancel_down_us(uint32_t, char **)
Cancel down a micro second value.
int nl_get_psched_hz(void)
Return the value of packet scheduler HZ.
uint32_t nl_ticks2us(uint32_t)
Convert ticks to micro seconds.
long nl_prob2int(const char *)
Convert a character string to a probability.
uint32_t nl_us2ticks(uint32_t)
Convert micro seconds to ticks.
void nl_dump(struct nl_dump_params *, const char *,...)
Dump a formatted character string.