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