File: yang_types.c

package info (click to toggle)
libyang 0.16.105-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 14,544 kB
  • sloc: ansic: 96,743; xml: 9,300; cpp: 5,023; python: 1,637; java: 1,448; lex: 281; sh: 158; makefile: 72
file content (212 lines) | stat: -rw-r--r-- 5,230 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/**
 * @file yang_types.c
 * @author Radek Krejci <rkrejci@cesnet.cz>
 * @brief Static YANG built-in-types
 *
 * Copyright (c) 2015 CESNET, z.s.p.o.
 *
 * This source code is licensed under BSD 3-Clause License (the "License").
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://opensource.org/licenses/BSD-3-Clause
 */

#include <stdlib.h>

#include "tree_internal.h"

struct lys_tpdf ly_type_binary = {
    .name = "binary",
    .module = NULL,
    .dsc = "Any binary data",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_BINARY}
};

struct lys_tpdf ly_type_bits = {
    .name = "bits",
    .module = NULL,
    .dsc = "A set of bits or flags",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_BITS}
};

struct lys_tpdf ly_type_bool = {
    .name = "boolean",
    .module = NULL,
    .dsc = "true or false",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_BOOL}
};

struct lys_tpdf ly_type_dec64 = {
    .name = "decimal64",
    .module = NULL,
    .dsc = "64-bit signed decimal number",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_DEC64}
};

struct lys_tpdf ly_type_empty = {
    .name = "empty",
    .module = NULL,
    .dsc = "A leaf that does not have any value",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_EMPTY}
};

struct lys_tpdf ly_type_enum = {
    .name = "enumeration",
    .module = NULL,
    .dsc = "Enumerated strings",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_ENUM}
};

struct lys_tpdf ly_type_ident = {
    .name = "identityref",
    .module = NULL,
    .dsc = "A reference to an abstract identity",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_IDENT}
};

struct lys_tpdf ly_type_inst = {
    .name = "instance-identifier",
    .module = NULL,
    .dsc = "References a data tree node",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_INST}
};

struct lys_tpdf ly_type_int8 = {
    .name = "int8",
    .module = NULL,
    .dsc = "8-bit signed integer",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_INT8}
};

struct lys_tpdf ly_type_int16 = {
    .name = "int16",
    .module = NULL,
    .dsc = "16-bit signed integer",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_INT16}
};

struct lys_tpdf ly_type_int32 = {
    .name = "int32",
    .module = NULL,
    .dsc = "32-bit signed integer",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_INT32}
};

struct lys_tpdf ly_type_int64 = {
    .name = "int64",
    .module = NULL,
    .dsc = "64-bit signed integer",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_INT64}
};

struct lys_tpdf ly_type_leafref = {
    .name = "leafref",
    .module = NULL,
    .dsc = "A reference to a leaf instance",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_LEAFREF}
};

struct lys_tpdf ly_type_string = {
    .name = "string",
    .module = NULL,
    .dsc = "Human-readable string",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_STRING}
};

struct lys_tpdf ly_type_uint8 = {
    .name = "uint8",
    .module = NULL,
    .dsc = "8-bit unsigned integer",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_UINT8}
};

struct lys_tpdf ly_type_uint16 = {
    .name = "uint16",
    .module = NULL,
    .dsc = "16-bit unsigned integer",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_UINT16}
};

struct lys_tpdf ly_type_uint32 = {
    .name = "uint32",
    .module = NULL,
    .dsc = "32-bit unsigned integer",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_UINT32}
};

struct lys_tpdf ly_type_uint64 = {
    .name = "uint64",
    .module = NULL,
    .dsc = "64-bit unsigned integer",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_UINT64}
};

struct lys_tpdf ly_type_union = {
    .name = "union",
    .module = NULL,
    .dsc = "Choice of member types",
    .ref = "RFC 6020, section 4.2.4",
    .flags = 0,
    .type = {.base = LY_TYPE_UNION}
};

struct lys_tpdf *ly_types[LY_DATA_TYPE_COUNT] = {
    [LY_TYPE_DER] = NULL,
    [LY_TYPE_BINARY] = &ly_type_binary,
    [LY_TYPE_BITS] = &ly_type_bits,
    [LY_TYPE_BOOL] = &ly_type_bool,
    [LY_TYPE_DEC64] = &ly_type_dec64,
    [LY_TYPE_EMPTY] = &ly_type_empty,
    [LY_TYPE_ENUM] = &ly_type_enum,
    [LY_TYPE_IDENT] = &ly_type_ident,
    [LY_TYPE_INST] = &ly_type_inst,
    [LY_TYPE_INT8] = &ly_type_int8,
    [LY_TYPE_INT16] = &ly_type_int16,
    [LY_TYPE_INT32] = &ly_type_int32,
    [LY_TYPE_INT64] = &ly_type_int64,
    [LY_TYPE_LEAFREF] = &ly_type_leafref,
    [LY_TYPE_STRING] = &ly_type_string,
    [LY_TYPE_UINT8] = &ly_type_uint8,
    [LY_TYPE_UINT16] = &ly_type_uint16,
    [LY_TYPE_UINT32] = &ly_type_uint32,
    [LY_TYPE_UINT64] = &ly_type_uint64,
    [LY_TYPE_UNION] = &ly_type_union
};