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