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
169 NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
170 #define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
176 #define NL_CAPABILITY_IS_USER_RESERVED(cap) ( ((cap) & ~0x0FFF) == 0x7000 )
178 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.
rtnl_route_build_msg() no longer guesses the route scope if explicitly set to RT_SCOPE_NOWHERE.
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.
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.