]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd/sd-netlink/netlink-types.h
networkd: add support to configure virtual CAN device (#4139)
[thirdparty/systemd.git] / src / libsystemd / sd-netlink / netlink-types.h
CommitLineData
d8e538ec
TG
1#pragma once
2
3/***
4 This file is part of systemd.
5
6 Copyright 2014 Tom Gundersen <teg@jklm.no>
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
ab5dfda7
TA
22#include "macro.h"
23
d8e538ec 24enum {
cafbc790 25 NETLINK_TYPE_UNSPEC,
cafbc790
DH
26 NETLINK_TYPE_U8, /* NLA_U8 */
27 NETLINK_TYPE_U16, /* NLA_U16 */
28 NETLINK_TYPE_U32, /* NLA_U32 */
29 NETLINK_TYPE_U64, /* NLA_U64 */
30 NETLINK_TYPE_STRING, /* NLA_STRING */
de566208 31 NETLINK_TYPE_FLAG, /* NLA_FLAG */
cafbc790
DH
32 NETLINK_TYPE_IN_ADDR,
33 NETLINK_TYPE_ETHER_ADDR,
34 NETLINK_TYPE_CACHE_INFO,
35 NETLINK_TYPE_NESTED, /* NLA_NESTED */
36 NETLINK_TYPE_UNION,
d8e538ec
TG
37};
38
4af7b60d
TG
39typedef enum NLMatchType {
40 NL_MATCH_SIBLING,
41 NL_MATCH_PROTOCOL,
42} NLMatchType;
43
d8e538ec
TG
44typedef struct NLTypeSystemUnion NLTypeSystemUnion;
45typedef struct NLTypeSystem NLTypeSystem;
46typedef struct NLType NLType;
47
48struct NLTypeSystemUnion {
49 int num;
4af7b60d 50 NLMatchType match_type;
d8e538ec
TG
51 uint16_t match;
52 int (*lookup)(const char *);
53 const NLTypeSystem *type_systems;
54};
55
846a6b3d
DH
56extern const NLTypeSystem type_system_root;
57
817d1cd8
DH
58uint16_t type_get_type(const NLType *type);
59size_t type_get_size(const NLType *type);
c658008f
DH
60void type_get_type_system(const NLType *type, const NLTypeSystem **ret);
61void type_get_type_system_union(const NLType *type, const NLTypeSystemUnion **ret);
435bbb02 62
c1df8dee 63uint16_t type_system_get_count(const NLTypeSystem *type_system);
d8e538ec
TG
64int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, uint16_t type);
65int type_system_get_type_system(const NLTypeSystem *type_system, const NLTypeSystem **ret, uint16_t type);
66int type_system_get_type_system_union(const NLTypeSystem *type_system, const NLTypeSystemUnion **ret, uint16_t type);
67int type_system_union_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, const char *key);
4af7b60d 68int type_system_union_protocol_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, uint16_t protocol);
86bbe5bf
ZJS
69
70typedef enum NLUnionLinkInfoData {
71 NL_UNION_LINK_INFO_DATA_BOND,
72 NL_UNION_LINK_INFO_DATA_BRIDGE,
73 NL_UNION_LINK_INFO_DATA_VLAN,
74 NL_UNION_LINK_INFO_DATA_VETH,
75 NL_UNION_LINK_INFO_DATA_DUMMY,
76 NL_UNION_LINK_INFO_DATA_MACVLAN,
d1312575 77 NL_UNION_LINK_INFO_DATA_MACVTAP,
c4a5ddc9 78 NL_UNION_LINK_INFO_DATA_IPVLAN,
86bbe5bf
ZJS
79 NL_UNION_LINK_INFO_DATA_VXLAN,
80 NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL,
81 NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL,
1af2536a 82 NL_UNION_LINK_INFO_DATA_IPGRETAP_TUNNEL,
b16492f8
SS
83 NL_UNION_LINK_INFO_DATA_IP6GRE_TUNNEL,
84 NL_UNION_LINK_INFO_DATA_IP6GRETAP_TUNNEL,
86bbe5bf
ZJS
85 NL_UNION_LINK_INFO_DATA_SIT_TUNNEL,
86 NL_UNION_LINK_INFO_DATA_VTI_TUNNEL,
9011ce77 87 NL_UNION_LINK_INFO_DATA_VTI6_TUNNEL,
855ee1a1 88 NL_UNION_LINK_INFO_DATA_IP6TNL_TUNNEL,
20897a0d 89 NL_UNION_LINK_INFO_DATA_VRF,
92c918b0 90 NL_UNION_LINK_INFO_DATA_VCAN,
86bbe5bf
ZJS
91 _NL_UNION_LINK_INFO_DATA_MAX,
92 _NL_UNION_LINK_INFO_DATA_INVALID = -1
93} NLUnionLinkInfoData;
94
95const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_;
96NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_;