chiark / gitweb /
sysusers: fix uninitialized warning
[elogind.git] / src / libsystemd / 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 struct NLTypeSystemUnion NLTypeSystemUnion;
40 typedef struct NLTypeSystem NLTypeSystem;
41 typedef struct NLType NLType;
42
43 struct NLTypeSystemUnion {
44         int num;
45         uint16_t match;
46         int (*lookup)(const char *);
47         const NLTypeSystem *type_systems;
48 };
49
50 struct NLTypeSystem {
51         uint16_t max;
52         const NLType *types;
53 };
54
55 struct NLType {
56         uint16_t type;
57         size_t size;
58         const NLTypeSystem *type_system;
59         const NLTypeSystemUnion *type_system_union;
60 };
61
62 int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, uint16_t type);
63 int type_system_get_type_system(const NLTypeSystem *type_system, const NLTypeSystem **ret, uint16_t type);
64 int type_system_get_type_system_union(const NLTypeSystem *type_system, const NLTypeSystemUnion **ret, uint16_t type);
65 int type_system_union_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, const char *key);