]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd/sd-netlink/netlink-types.h
networkd-link: link_up_can(): move function upwards
[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>
d8e538ec
TG
8***/
9
ab5dfda7
TA
10#include "macro.h"
11
d8e538ec 12enum {
cafbc790 13 NETLINK_TYPE_UNSPEC,
cafbc790
DH
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 */
de566208 19 NETLINK_TYPE_FLAG, /* NLA_FLAG */
cafbc790
DH
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,
d8e538ec
TG
25};
26
4af7b60d
TG
27typedef enum NLMatchType {
28 NL_MATCH_SIBLING,
29 NL_MATCH_PROTOCOL,
30} NLMatchType;
31
d8e538ec
TG
32typedef struct NLTypeSystemUnion NLTypeSystemUnion;
33typedef struct NLTypeSystem NLTypeSystem;
34typedef struct NLType NLType;
35
36struct NLTypeSystemUnion {
37 int num;
4af7b60d 38 NLMatchType match_type;
d8e538ec
TG
39 uint16_t match;
40 int (*lookup)(const char *);
41 const NLTypeSystem *type_systems;
42};
43
05d0c2e3
JT
44extern const NLTypeSystem rtnl_type_system_root;
45extern const NLTypeSystem genl_type_system_root;
46extern const NLTypeSystem genl_family_type_system_root;
846a6b3d 47
817d1cd8
DH
48uint16_t type_get_type(const NLType *type);
49size_t type_get_size(const NLType *type);
c658008f
DH
50void type_get_type_system(const NLType *type, const NLTypeSystem **ret);
51void type_get_type_system_union(const NLType *type, const NLTypeSystemUnion **ret);
435bbb02 52
05d0c2e3 53const NLTypeSystem* type_system_get_root(int protocol);
c1df8dee 54uint16_t type_system_get_count(const NLTypeSystem *type_system);
d8e538ec
TG
55int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, uint16_t type);
56int type_system_get_type_system(const NLTypeSystem *type_system, const NLTypeSystem **ret, uint16_t type);
57int type_system_get_type_system_union(const NLTypeSystem *type_system, const NLTypeSystemUnion **ret, uint16_t type);
58int type_system_union_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, const char *key);
4af7b60d 59int type_system_union_protocol_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, uint16_t protocol);
86bbe5bf
ZJS
60
61typedef 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,
d1312575 68 NL_UNION_LINK_INFO_DATA_MACVTAP,
c4a5ddc9 69 NL_UNION_LINK_INFO_DATA_IPVLAN,
86bbe5bf
ZJS
70 NL_UNION_LINK_INFO_DATA_VXLAN,
71 NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL,
72 NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL,
1af2536a 73 NL_UNION_LINK_INFO_DATA_IPGRETAP_TUNNEL,
b16492f8
SS
74 NL_UNION_LINK_INFO_DATA_IP6GRE_TUNNEL,
75 NL_UNION_LINK_INFO_DATA_IP6GRETAP_TUNNEL,
86bbe5bf
ZJS
76 NL_UNION_LINK_INFO_DATA_SIT_TUNNEL,
77 NL_UNION_LINK_INFO_DATA_VTI_TUNNEL,
9011ce77 78 NL_UNION_LINK_INFO_DATA_VTI6_TUNNEL,
855ee1a1 79 NL_UNION_LINK_INFO_DATA_IP6TNL_TUNNEL,
20897a0d 80 NL_UNION_LINK_INFO_DATA_VRF,
92c918b0 81 NL_UNION_LINK_INFO_DATA_VCAN,
ca5e8071 82 NL_UNION_LINK_INFO_DATA_GENEVE,
d6df583c 83 NL_UNION_LINK_INFO_DATA_VXCAN,
e5719363 84 NL_UNION_LINK_INFO_DATA_WIREGUARD,
56e7fb50 85 NL_UNION_LINK_INFO_DATA_NETDEVSIM,
86bbe5bf
ZJS
86 _NL_UNION_LINK_INFO_DATA_MAX,
87 _NL_UNION_LINK_INFO_DATA_INVALID = -1
88} NLUnionLinkInfoData;
89
90const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_;
91NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_;