]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/libsystemd/sd-netlink/netlink-types.h
f1ce3b25b3d2934bc8e90f448e2222119660b649
[thirdparty/systemd.git] / src / libsystemd / sd-netlink / netlink-types.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 Copyright 2014 Tom Gundersen <teg@jklm.no>
6 ***/
7
8 #include "macro.h"
9
10 enum {
11 NETLINK_TYPE_UNSPEC,
12 NETLINK_TYPE_U8, /* NLA_U8 */
13 NETLINK_TYPE_U16, /* NLA_U16 */
14 NETLINK_TYPE_U32, /* NLA_U32 */
15 NETLINK_TYPE_U64, /* NLA_U64 */
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 };
24
25 typedef enum NLMatchType {
26 NL_MATCH_SIBLING,
27 NL_MATCH_PROTOCOL,
28 } NLMatchType;
29
30 typedef struct NLTypeSystemUnion NLTypeSystemUnion;
31 typedef struct NLTypeSystem NLTypeSystem;
32 typedef struct NLType NLType;
33
34 struct NLTypeSystemUnion {
35 int num;
36 NLMatchType match_type;
37 uint16_t match;
38 int (*lookup)(const char *);
39 const NLTypeSystem *type_systems;
40 };
41
42 extern const NLTypeSystem rtnl_type_system_root;
43 extern const NLTypeSystem genl_type_system_root;
44 extern const NLTypeSystem genl_family_type_system_root;
45
46 uint16_t type_get_type(const NLType *type);
47 size_t type_get_size(const NLType *type);
48 void type_get_type_system(const NLType *type, const NLTypeSystem **ret);
49 void type_get_type_system_union(const NLType *type, const NLTypeSystemUnion **ret);
50
51 const NLTypeSystem* type_system_get_root(int protocol);
52 uint16_t type_system_get_count(const NLTypeSystem *type_system);
53 int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, uint16_t type);
54 int type_system_get_type_system(const NLTypeSystem *type_system, const NLTypeSystem **ret, uint16_t type);
55 int type_system_get_type_system_union(const NLTypeSystem *type_system, const NLTypeSystemUnion **ret, uint16_t type);
56 int type_system_union_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, const char *key);
57 int type_system_union_protocol_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, uint16_t protocol);
58
59 typedef enum NLUnionLinkInfoData {
60 NL_UNION_LINK_INFO_DATA_BOND,
61 NL_UNION_LINK_INFO_DATA_BRIDGE,
62 NL_UNION_LINK_INFO_DATA_VLAN,
63 NL_UNION_LINK_INFO_DATA_VETH,
64 NL_UNION_LINK_INFO_DATA_DUMMY,
65 NL_UNION_LINK_INFO_DATA_MACVLAN,
66 NL_UNION_LINK_INFO_DATA_MACVTAP,
67 NL_UNION_LINK_INFO_DATA_IPVLAN,
68 NL_UNION_LINK_INFO_DATA_VXLAN,
69 NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL,
70 NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL,
71 NL_UNION_LINK_INFO_DATA_IPGRETAP_TUNNEL,
72 NL_UNION_LINK_INFO_DATA_IP6GRE_TUNNEL,
73 NL_UNION_LINK_INFO_DATA_IP6GRETAP_TUNNEL,
74 NL_UNION_LINK_INFO_DATA_SIT_TUNNEL,
75 NL_UNION_LINK_INFO_DATA_VTI_TUNNEL,
76 NL_UNION_LINK_INFO_DATA_VTI6_TUNNEL,
77 NL_UNION_LINK_INFO_DATA_IP6TNL_TUNNEL,
78 NL_UNION_LINK_INFO_DATA_VRF,
79 NL_UNION_LINK_INFO_DATA_VCAN,
80 NL_UNION_LINK_INFO_DATA_GENEVE,
81 NL_UNION_LINK_INFO_DATA_VXCAN,
82 NL_UNION_LINK_INFO_DATA_WIREGUARD,
83 NL_UNION_LINK_INFO_DATA_NETDEVSIM,
84 NL_UNION_LINK_INFO_DATA_CAN,
85 _NL_UNION_LINK_INFO_DATA_MAX,
86 _NL_UNION_LINK_INFO_DATA_INVALID = -1
87 } NLUnionLinkInfoData;
88
89 const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_;
90 NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_;