chiark / gitweb /
Prep v220: Apply "Fixes to user and session saving"
[elogind.git] / src / libelogind / sd-rtnl / rtnl-types.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6   This file is part of systemd.
7
8   Copyright 2014 Tom Gundersen <teg@jklm.no>
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 enum {
25         NLA_UNSPEC,
26         NLA_META,
27         NLA_U8,
28         NLA_U16,
29         NLA_U32,
30         NLA_U64,
31         NLA_STRING,
32         NLA_IN_ADDR,
33         NLA_ETHER_ADDR,
34         NLA_CACHE_INFO,
35         NLA_NESTED,
36         NLA_UNION,
37 };
38
39 typedef enum NLMatchType {
40         NL_MATCH_SIBLING,
41         NL_MATCH_PROTOCOL,
42 } NLMatchType;
43
44 typedef struct NLTypeSystemUnion NLTypeSystemUnion;
45 typedef struct NLTypeSystem NLTypeSystem;
46 typedef struct NLType NLType;
47
48 struct NLTypeSystemUnion {
49         int num;
50         NLMatchType match_type;
51         uint16_t match;
52         int (*lookup)(const char *);
53         const NLTypeSystem *type_systems;
54 };
55
56 struct NLTypeSystem {
57         uint16_t max;
58         const NLType *types;
59 };
60
61 struct NLType {
62         uint16_t type;
63         size_t size;
64         const NLTypeSystem *type_system;
65         const NLTypeSystemUnion *type_system_union;
66 };
67
68 int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, uint16_t type);
69 int type_system_get_type_system(const NLTypeSystem *type_system, const NLTypeSystem **ret, uint16_t type);
70 int type_system_get_type_system_union(const NLTypeSystem *type_system, const NLTypeSystemUnion **ret, uint16_t type);
71 int type_system_union_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, const char *key);
72 int type_system_union_protocol_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, uint16_t protocol);
73
74 typedef enum NLUnionLinkInfoData {
75         NL_UNION_LINK_INFO_DATA_BOND,
76         NL_UNION_LINK_INFO_DATA_BRIDGE,
77         NL_UNION_LINK_INFO_DATA_VLAN,
78         NL_UNION_LINK_INFO_DATA_VETH,
79         NL_UNION_LINK_INFO_DATA_DUMMY,
80         NL_UNION_LINK_INFO_DATA_MACVLAN,
81         NL_UNION_LINK_INFO_DATA_IPVLAN,
82         NL_UNION_LINK_INFO_DATA_VXLAN,
83         NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL,
84         NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL,
85         NL_UNION_LINK_INFO_DATA_IPGRETAP_TUNNEL,
86         NL_UNION_LINK_INFO_DATA_IP6GRE_TUNNEL,
87         NL_UNION_LINK_INFO_DATA_IP6GRETAP_TUNNEL,
88         NL_UNION_LINK_INFO_DATA_SIT_TUNNEL,
89         NL_UNION_LINK_INFO_DATA_VTI_TUNNEL,
90         NL_UNION_LINK_INFO_DATA_VTI6_TUNNEL,
91         NL_UNION_LINK_INFO_DATA_IP6TNL_TUNNEL,
92         _NL_UNION_LINK_INFO_DATA_MAX,
93         _NL_UNION_LINK_INFO_DATA_INVALID = -1
94 } NLUnionLinkInfoData;
95
96 const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_;
97 NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_;
98
99 /* Maximum ARP IP target defined in kernel */
100 #define BOND_MAX_ARP_TARGETS    16
101
102 typedef enum BondArpTargets {
103         BOND_ARP_TARGETS_0,
104         BOND_ARP_TARGETS_1,
105         BOND_ARP_TARGETS_2,
106         BOND_ARP_TARGETS_3,
107         BOND_ARP_TARGETS_4,
108         BOND_ARP_TARGETS_5,
109         BOND_ARP_TARGETS_6,
110         BOND_ARP_TARGETS_7,
111         BOND_ARP_TARGETS_8,
112         BOND_ARP_TARGETS_9,
113         BOND_ARP_TARGETS_10,
114         BOND_ARP_TARGETS_11,
115         BOND_ARP_TARGETS_12,
116         BOND_ARP_TARGETS_13,
117         BOND_ARP_TARGETS_14,
118         BOND_ARP_TARGETS_MAX = BOND_MAX_ARP_TARGETS,
119 } BondArpTargets;