1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include "sd-netlink.h" 5 6 enum { 7 NETLINK_TYPE_UNSPEC, 8 NETLINK_TYPE_U8, /* NLA_U8 */ 9 NETLINK_TYPE_U16, /* NLA_U16 */ 10 NETLINK_TYPE_U32, /* NLA_U32 */ 11 NETLINK_TYPE_U64, /* NLA_U64 */ 12 NETLINK_TYPE_S8, /* NLA_S8 */ 13 NETLINK_TYPE_S16, /* NLA_S16 */ 14 NETLINK_TYPE_S32, /* NLA_S32 */ 15 NETLINK_TYPE_S64, /* NLA_S64 */ 16 NETLINK_TYPE_STRING, /* NLA_STRING */ 17 NETLINK_TYPE_FLAG, /* NLA_FLAG */ 18 NETLINK_TYPE_IN_ADDR, 19 NETLINK_TYPE_ETHER_ADDR, 20 NETLINK_TYPE_CACHE_INFO, 21 NETLINK_TYPE_NESTED, /* NLA_NESTED */ 22 NETLINK_TYPE_UNION, 23 NETLINK_TYPE_SOCKADDR, 24 NETLINK_TYPE_BINARY, 25 NETLINK_TYPE_BITFIELD32, /* NLA_BITFIELD32 */ 26 NETLINK_TYPE_REJECT, /* NLA_REJECT */ 27 }; 28 29 typedef enum NLMatchType { 30 NL_MATCH_SIBLING, 31 NL_MATCH_PROTOCOL, 32 } NLMatchType; 33 34 typedef struct NLTypeSystemUnion NLTypeSystemUnion; 35 typedef struct NLTypeSystem NLTypeSystem; 36 typedef struct NLType NLType; 37 38 const NLType *rtnl_get_type(uint16_t nlmsg_type); 39 const NLType *nfnl_get_type(uint16_t nlmsg_type); 40 const NLTypeSystem *genl_get_type_system_by_name(const char *name); 41 int genl_get_type_system_and_header_size( 42 sd_netlink *nl, 43 uint16_t id, 44 const NLTypeSystem **ret_type_system, 45 size_t *ret_header_size); 46 47 uint16_t type_get_type(const NLType *type); 48 size_t type_get_size(const NLType *type); 49 const NLTypeSystem *type_get_type_system(const NLType *type); 50 const NLTypeSystemUnion *type_get_type_system_union(const NLType *type); 51 52 int type_system_root_get_type_system_and_header_size( 53 sd_netlink *nl, 54 uint16_t type, 55 const NLTypeSystem **ret_type_system, 56 size_t *ret_header_size); 57 58 const NLType *type_system_get_type(const NLTypeSystem *type_system, uint16_t type); 59 const NLTypeSystem *type_system_get_type_system(const NLTypeSystem *type_system, uint16_t type); 60 const NLTypeSystemUnion *type_system_get_type_system_union(const NLTypeSystem *type_system, uint16_t type); 61 NLMatchType type_system_union_get_match_type(const NLTypeSystemUnion *type_system_union); 62 uint16_t type_system_union_get_match_attribute(const NLTypeSystemUnion *type_system_union); 63 const NLTypeSystem *type_system_union_get_type_system_by_string(const NLTypeSystemUnion *type_system_union, const char *key); 64 const NLTypeSystem *type_system_union_get_type_system_by_protocol(const NLTypeSystemUnion *type_system_union, uint16_t protocol); 65