123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- #ifndef NETLINK_UTILS_H_
- #define NETLINK_UTILS_H_
- #include <netlink/netlink.h>
- #include <netlink/list.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define NL_PROB_MIN 0x0
- #define NL_PROB_MAX 0xffffffff
- enum {
- NL_BYTE_RATE,
- NL_BIT_RATE,
- };
- 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 **);
- extern long nl_size2int(const char *);
- extern char * nl_size2str(const size_t, char *, const size_t);
- extern long nl_prob2int(const char *);
- 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);
- extern char * nl_llproto2str(int, char *, size_t);
- extern int nl_str2llproto(const char *);
- extern char * nl_ether_proto2str(int, char *, size_t);
- extern int nl_str2ether_proto(const char *);
- extern char * nl_ip_proto2str(int, char *, size_t);
- extern int nl_str2ip_proto(const char *);
- extern void nl_new_line(struct nl_dump_params *);
- extern void nl_dump(struct nl_dump_params *, const char *, ...);
- extern void nl_dump_line(struct nl_dump_params *, const char *, ...);
- enum {
- NL_CAPABILITY_NONE,
-
- NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE = 1,
- #define NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE
-
- 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
-
- 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
-
- 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
-
- 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
-
- NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO = 6,
- #define NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO
-
- NL_CAPABILITY_VERSION_3_2_26 = 7,
- #define NL_CAPABILITY_VERSION_3_2_26 NL_CAPABILITY_VERSION_3_2_26
-
- 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
-
- 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
-
- 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
-
- NL_CAPABILITY_VERSION_3_2_27 = 11,
- #define NL_CAPABILITY_VERSION_3_2_27 NL_CAPABILITY_VERSION_3_2_27
-
- NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE = 12,
- #define NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE
-
- NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE = 13,
- #define NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE NL_CAPABILITY_RTNL_LINK_PARSE_GRE_REMOTE
-
- 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
-
- NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE = 15,
- #define NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE NL_CAPABILITY_RTNL_LINK_VXLAN_IO_COMPARE
-
- NL_CAPABILITY_NL_OBJECT_DIFF64 = 16,
- #define NL_CAPABILITY_NL_OBJECT_DIFF64 NL_CAPABILITY_NL_OBJECT_DIFF64
-
- NL_CAPABILITY_XFRM_SA_KEY_SIZE = 17,
- #define NL_CAPABILITY_XFRM_SA_KEY_SIZE NL_CAPABILITY_XFRM_SA_KEY_SIZE
-
- NL_CAPABILITY_RTNL_ADDR_PEER_FIX = 18,
- #define NL_CAPABILITY_RTNL_ADDR_PEER_FIX NL_CAPABILITY_RTNL_ADDR_PEER_FIX
-
- NL_CAPABILITY_VERSION_3_2_28 = 19,
- #define NL_CAPABILITY_VERSION_3_2_28 NL_CAPABILITY_VERSION_3_2_28
- __NL_CAPABILITY_MAX,
- NL_CAPABILITY_MAX = (__NL_CAPABILITY_MAX - 1),
- #define NL_CAPABILITY_MAX NL_CAPABILITY_MAX
-
- #define NL_CAPABILITY_IS_USER_RESERVED(cap) ( ((cap) & ~0x0FFF) == 0x7000 )
- };
- int nl_has_capability (int capability);
- #ifdef __cplusplus
- }
- #endif
- #endif
|