blob: 741a5dca4f2f999267856717db6a180b5de3b4a0 [file] [log] [blame]
Michal Vaskoedb0fa52022-10-04 10:36:00 +02001/**
2 * @file structure.c
3 * @author Michal Vasko <mvasko@cesnet.cz>
Michal Vasko193dacd2022-10-13 08:43:05 +02004 * @brief libyang extension plugin - structure (RFC 8791)
Michal Vaskoedb0fa52022-10-04 10:36:00 +02005 *
6 * Copyright (c) 2022 CESNET, z.s.p.o.
7 *
8 * This source code is licensed under BSD 3-Clause License (the "License").
9 * You may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * https://opensource.org/licenses/BSD-3-Clause
13 */
14
15#include <stdint.h>
16#include <stdlib.h>
17#include <string.h>
18
Michal Vasko0b50f6b2022-10-05 15:07:55 +020019#include "compat.h"
Michal Vaskoedb0fa52022-10-04 10:36:00 +020020#include "libyang.h"
21#include "plugins_exts.h"
22
Michal Vasko193dacd2022-10-13 08:43:05 +020023struct lysp_ext_instance_structure {
24 struct lysp_restr *musts;
Michal Vaskoedb0fa52022-10-04 10:36:00 +020025 uint16_t flags;
26 const char *dsc;
27 const char *ref;
28 struct lysp_tpdf *typedefs;
29 struct lysp_node_grp *groupings;
Michal Vasko193dacd2022-10-13 08:43:05 +020030 struct lysp_node *child;
31};
32
33struct lysc_ext_instance_structure {
34 struct lysc_must *musts;
35 uint16_t flags;
36 const char *dsc;
37 const char *ref;
Michal Vaskoedb0fa52022-10-04 10:36:00 +020038 struct lysc_node *child;
39};
40
Michal Vasko193dacd2022-10-13 08:43:05 +020041struct lysp_ext_instance_augment_structure {
42 uint16_t flags;
43 const char *dsc;
44 const char *ref;
45 struct lysp_node *child;
Michal Vaskoa0ba01e2022-10-19 13:26:57 +020046 struct lysp_node_augment *aug;
Michal Vasko0b50f6b2022-10-05 15:07:55 +020047};
48
Michal Vaskoedb0fa52022-10-04 10:36:00 +020049/**
Michal Vasko193dacd2022-10-13 08:43:05 +020050 * @brief Parse structure extension instances.
51 *
52 * Implementation of ::lyplg_ext_parse_clb callback set as lyext_plugin::parse.
53 */
54static LY_ERR
55structure_parse(struct lysp_ctx *pctx, struct lysp_ext_instance *ext)
56{
57 LY_ERR rc;
58 LY_ARRAY_COUNT_TYPE u;
59 struct lysp_module *pmod;
60 struct lysp_ext_instance_structure *struct_pdata;
61
62 /* structure can appear only at the top level of a YANG module or submodule */
63 if ((ext->parent_stmt != LY_STMT_MODULE) && (ext->parent_stmt != LY_STMT_SUBMODULE)) {
64 lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EVALID,
65 "Extension %s must not be used as a non top-level statement in \"%s\" statement.", ext->name,
66 lyplg_ext_stmt2str(ext->parent_stmt));
67 return LY_EVALID;
68 }
69
70 pmod = ext->parent;
71
72 /* check for duplication */
73 LY_ARRAY_FOR(pmod->exts, u) {
74 if ((&pmod->exts[u] != ext) && (pmod->exts[u].name == ext->name) && !strcmp(pmod->exts[u].argument, ext->argument)) {
75 /* duplication of the same structure extension in a single module */
76 lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EVALID, "Extension %s is instantiated multiple times.", ext->name);
77 return LY_EVALID;
78 }
79 }
80
81 /* allocate the storage */
82 struct_pdata = calloc(1, sizeof *struct_pdata);
83 if (!struct_pdata) {
84 goto emem;
85 }
86 ext->parsed = struct_pdata;
Michal Vaskoa0ba01e2022-10-19 13:26:57 +020087 LY_ARRAY_CREATE_GOTO(lyplg_ext_parse_get_cur_pmod(pctx)->mod->ctx, ext->substmts, 14, rc, emem);
Michal Vasko193dacd2022-10-13 08:43:05 +020088
89 /* parse substatements */
90 LY_ARRAY_INCREMENT(ext->substmts);
91 ext->substmts[0].stmt = LY_STMT_MUST;
92 ext->substmts[0].storage = &struct_pdata->musts;
93
94 LY_ARRAY_INCREMENT(ext->substmts);
95 ext->substmts[1].stmt = LY_STMT_STATUS;
96 ext->substmts[1].storage = &struct_pdata->flags;
97
98 LY_ARRAY_INCREMENT(ext->substmts);
99 ext->substmts[2].stmt = LY_STMT_DESCRIPTION;
100 ext->substmts[2].storage = &struct_pdata->dsc;
101
102 LY_ARRAY_INCREMENT(ext->substmts);
103 ext->substmts[3].stmt = LY_STMT_REFERENCE;
104 ext->substmts[3].storage = &struct_pdata->ref;
105
106 LY_ARRAY_INCREMENT(ext->substmts);
107 ext->substmts[4].stmt = LY_STMT_TYPEDEF;
108 ext->substmts[4].storage = &struct_pdata->typedefs;
109
110 LY_ARRAY_INCREMENT(ext->substmts);
111 ext->substmts[5].stmt = LY_STMT_GROUPING;
112 ext->substmts[5].storage = &struct_pdata->groupings;
113
114 /* data-def-stmt */
115 LY_ARRAY_INCREMENT(ext->substmts);
116 ext->substmts[6].stmt = LY_STMT_CONTAINER;
117 ext->substmts[6].storage = &struct_pdata->child;
118
119 LY_ARRAY_INCREMENT(ext->substmts);
120 ext->substmts[7].stmt = LY_STMT_LEAF;
121 ext->substmts[7].storage = &struct_pdata->child;
122
123 LY_ARRAY_INCREMENT(ext->substmts);
124 ext->substmts[8].stmt = LY_STMT_LEAF_LIST;
125 ext->substmts[8].storage = &struct_pdata->child;
126
127 LY_ARRAY_INCREMENT(ext->substmts);
128 ext->substmts[9].stmt = LY_STMT_LIST;
129 ext->substmts[9].storage = &struct_pdata->child;
130
131 LY_ARRAY_INCREMENT(ext->substmts);
132 ext->substmts[10].stmt = LY_STMT_CHOICE;
133 ext->substmts[10].storage = &struct_pdata->child;
134
135 LY_ARRAY_INCREMENT(ext->substmts);
136 ext->substmts[11].stmt = LY_STMT_ANYDATA;
137 ext->substmts[11].storage = &struct_pdata->child;
138
139 LY_ARRAY_INCREMENT(ext->substmts);
140 ext->substmts[12].stmt = LY_STMT_ANYXML;
141 ext->substmts[12].storage = &struct_pdata->child;
142
143 LY_ARRAY_INCREMENT(ext->substmts);
144 ext->substmts[13].stmt = LY_STMT_USES;
145 ext->substmts[13].storage = &struct_pdata->child;
146
147 rc = lyplg_ext_parse_extension_instance(pctx, ext);
148 return rc;
149
150emem:
151 lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EMEM, "Memory allocation failed (%s()).", __func__);
152 return LY_EMEM;
153}
154
155/**
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200156 * @brief Compile structure extension instances.
157 *
158 * Implementation of ::lyplg_ext_compile_clb callback set as lyext_plugin::compile.
159 */
160static LY_ERR
Michal Vasko193dacd2022-10-13 08:43:05 +0200161structure_compile(struct lysc_ctx *cctx, const struct lysp_ext_instance *extp, struct lysc_ext_instance *ext)
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200162{
Michal Vasko0b50f6b2022-10-05 15:07:55 +0200163 LY_ERR rc;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200164 struct lysc_module *mod_c;
165 const struct lysc_node *child;
Michal Vasko193dacd2022-10-13 08:43:05 +0200166 struct lysc_ext_instance_structure *struct_cdata;
167 uint32_t prev_options = *lyplg_ext_compile_get_options(cctx);
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200168
Michal Vasko193dacd2022-10-13 08:43:05 +0200169 mod_c = ext->parent;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200170
Michal Vasko193dacd2022-10-13 08:43:05 +0200171 /* check identifier namespace with the compiled nodes */
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200172 LY_LIST_FOR(mod_c->data, child) {
Michal Vasko193dacd2022-10-13 08:43:05 +0200173 if (!strcmp(child->name, ext->argument)) {
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200174 /* identifier collision */
Michal Vasko193dacd2022-10-13 08:43:05 +0200175 lyplg_ext_compile_log(cctx, ext, LY_LLERR, LY_EVALID, "Extension %s collides with a %s with the same identifier.",
176 extp->name, lys_nodetype2str(child->nodetype));
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200177 return LY_EVALID;
178 }
179 }
180
181 /* allocate the storage */
Michal Vasko193dacd2022-10-13 08:43:05 +0200182 struct_cdata = calloc(1, sizeof *struct_cdata);
183 if (!struct_cdata) {
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200184 goto emem;
185 }
Michal Vasko193dacd2022-10-13 08:43:05 +0200186 ext->compiled = struct_cdata;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200187
188 /* compile substatements */
Michal Vasko193dacd2022-10-13 08:43:05 +0200189 LY_ARRAY_CREATE_GOTO(cctx->ctx, ext->substmts, 14, rc, emem);
190 LY_ARRAY_INCREMENT(ext->substmts);
191 ext->substmts[0].stmt = LY_STMT_MUST;
192 ext->substmts[0].storage = &struct_cdata->musts;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200193
Michal Vasko193dacd2022-10-13 08:43:05 +0200194 LY_ARRAY_INCREMENT(ext->substmts);
195 ext->substmts[1].stmt = LY_STMT_STATUS;
196 ext->substmts[1].storage = &struct_cdata->flags;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200197
Michal Vasko193dacd2022-10-13 08:43:05 +0200198 LY_ARRAY_INCREMENT(ext->substmts);
199 ext->substmts[2].stmt = LY_STMT_DESCRIPTION;
200 ext->substmts[2].storage = &struct_cdata->dsc;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200201
Michal Vasko193dacd2022-10-13 08:43:05 +0200202 LY_ARRAY_INCREMENT(ext->substmts);
203 ext->substmts[3].stmt = LY_STMT_REFERENCE;
204 ext->substmts[3].storage = &struct_cdata->ref;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200205
Michal Vasko193dacd2022-10-13 08:43:05 +0200206 LY_ARRAY_INCREMENT(ext->substmts);
207 ext->substmts[4].stmt = LY_STMT_TYPEDEF;
208 ext->substmts[4].storage = NULL;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200209
Michal Vasko193dacd2022-10-13 08:43:05 +0200210 LY_ARRAY_INCREMENT(ext->substmts);
211 ext->substmts[5].stmt = LY_STMT_GROUPING;
212 ext->substmts[5].storage = NULL;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200213
214 /* data-def-stmt */
Michal Vasko193dacd2022-10-13 08:43:05 +0200215 LY_ARRAY_INCREMENT(ext->substmts);
216 ext->substmts[6].stmt = LY_STMT_CONTAINER;
217 ext->substmts[6].storage = &struct_cdata->child;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200218
Michal Vasko193dacd2022-10-13 08:43:05 +0200219 LY_ARRAY_INCREMENT(ext->substmts);
220 ext->substmts[7].stmt = LY_STMT_LEAF;
221 ext->substmts[7].storage = &struct_cdata->child;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200222
Michal Vasko193dacd2022-10-13 08:43:05 +0200223 LY_ARRAY_INCREMENT(ext->substmts);
224 ext->substmts[8].stmt = LY_STMT_LEAF_LIST;
225 ext->substmts[8].storage = &struct_cdata->child;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200226
Michal Vasko193dacd2022-10-13 08:43:05 +0200227 LY_ARRAY_INCREMENT(ext->substmts);
228 ext->substmts[9].stmt = LY_STMT_LIST;
229 ext->substmts[9].storage = &struct_cdata->child;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200230
Michal Vasko193dacd2022-10-13 08:43:05 +0200231 LY_ARRAY_INCREMENT(ext->substmts);
232 ext->substmts[10].stmt = LY_STMT_CHOICE;
233 ext->substmts[10].storage = &struct_cdata->child;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200234
Michal Vasko193dacd2022-10-13 08:43:05 +0200235 LY_ARRAY_INCREMENT(ext->substmts);
236 ext->substmts[11].stmt = LY_STMT_ANYDATA;
237 ext->substmts[11].storage = &struct_cdata->child;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200238
Michal Vasko193dacd2022-10-13 08:43:05 +0200239 LY_ARRAY_INCREMENT(ext->substmts);
240 ext->substmts[12].stmt = LY_STMT_ANYXML;
241 ext->substmts[12].storage = &struct_cdata->child;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200242
Michal Vasko193dacd2022-10-13 08:43:05 +0200243 LY_ARRAY_INCREMENT(ext->substmts);
244 ext->substmts[13].stmt = LY_STMT_USES;
245 ext->substmts[13].storage = &struct_cdata->child;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200246
Michal Vasko193dacd2022-10-13 08:43:05 +0200247 *lyplg_ext_compile_get_options(cctx) |= LYS_COMPILE_NO_CONFIG | LYS_COMPILE_NO_DISABLED;
248 rc = lyplg_ext_compile_extension_instance(cctx, extp, ext);
249 *lyplg_ext_compile_get_options(cctx) = prev_options;
Michal Vasko0b50f6b2022-10-05 15:07:55 +0200250 if (rc) {
251 return rc;
252 }
253
254 return LY_SUCCESS;
255
256emem:
Michal Vasko193dacd2022-10-13 08:43:05 +0200257 lyplg_ext_compile_log(cctx, ext, LY_LLERR, LY_EMEM, "Memory allocation failed (%s()).", __func__);
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200258 return LY_EMEM;
259}
260
261/**
262 * @brief INFO printer
263 *
Michal Vasko941e0562022-10-18 10:35:00 +0200264 * Implementation of ::lyplg_ext_sprinter_info_clb set as ::lyext_plugin::printer_info
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200265 */
266static LY_ERR
Michal Vasko941e0562022-10-18 10:35:00 +0200267structure_printer_info(struct lyspr_ctx *ctx, struct lysc_ext_instance *ext, ly_bool *flag)
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200268{
Michal Vasko941e0562022-10-18 10:35:00 +0200269 lyplg_ext_print_info_extension_instance(ctx, ext, flag);
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200270 return LY_SUCCESS;
271}
272
273/**
Michal Vasko193dacd2022-10-13 08:43:05 +0200274 * @brief Free parsed structure extension instance data.
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200275 *
Michal Vasko193dacd2022-10-13 08:43:05 +0200276 * Implementation of ::lyplg_clb_parse_free_clb callback set as lyext_plugin::pfree.
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200277 */
278static void
Michal Vasko193dacd2022-10-13 08:43:05 +0200279structure_pfree(const struct ly_ctx *ctx, struct lysp_ext_instance *ext)
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200280{
Michal Vasko193dacd2022-10-13 08:43:05 +0200281 lyplg_ext_pfree_instance_substatements(ctx, ext->substmts);
282 free(ext->parsed);
283}
284
285/**
286 * @brief Free compiled structure extension instance data.
287 *
288 * Implementation of ::lyplg_clb_compile_free_clb callback set as lyext_plugin::cfree.
289 */
290static void
291structure_cfree(const struct ly_ctx *ctx, struct lysc_ext_instance *ext)
292{
293 lyplg_ext_cfree_instance_substatements(ctx, ext->substmts);
294 free(ext->compiled);
295}
296
297/**
298 * @brief Parse augment-structure extension instances.
299 *
300 * Implementation of ::lyplg_ext_parse_clb callback set as lyext_plugin::parse.
301 */
302static LY_ERR
303structure_aug_parse(struct lysp_ctx *pctx, struct lysp_ext_instance *ext)
304{
305 LY_ERR rc;
306 struct lysp_stmt *stmt;
307 struct lysp_ext_instance_augment_structure *aug_pdata;
Michal Vaskoa0ba01e2022-10-19 13:26:57 +0200308 const struct ly_ctx *ctx = lyplg_ext_parse_get_cur_pmod(pctx)->mod->ctx;
Michal Vasko193dacd2022-10-13 08:43:05 +0200309
310 /* augment-structure can appear only at the top level of a YANG module or submodule */
311 if ((ext->parent_stmt != LY_STMT_MODULE) && (ext->parent_stmt != LY_STMT_SUBMODULE)) {
312 lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EVALID,
313 "Extension %s must not be used as a non top-level statement in \"%s\" statement.", ext->name,
314 lyplg_ext_stmt2str(ext->parent_stmt));
315 return LY_EVALID;
316 }
317
318 /* augment-structure must define some data-def-stmt */
319 LY_LIST_FOR(ext->child, stmt) {
320 if (stmt->kw & LY_STMT_DATA_NODE_MASK) {
321 break;
322 }
323 }
324 if (!stmt) {
325 lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EVALID, "Extension %s does not define any data-def-stmt statements.",
326 ext->name);
327 return LY_EVALID;
328 }
329
330 /* allocate the storage */
331 aug_pdata = calloc(1, sizeof *aug_pdata);
332 if (!aug_pdata) {
333 goto emem;
334 }
335 ext->parsed = aug_pdata;
Michal Vaskoa0ba01e2022-10-19 13:26:57 +0200336 LY_ARRAY_CREATE_GOTO(ctx, ext->substmts, 13, rc, emem);
Michal Vasko193dacd2022-10-13 08:43:05 +0200337
338 /* parse substatements */
339 LY_ARRAY_INCREMENT(ext->substmts);
340 ext->substmts[0].stmt = LY_STMT_STATUS;
341 ext->substmts[0].storage = &aug_pdata->flags;
342
343 LY_ARRAY_INCREMENT(ext->substmts);
344 ext->substmts[1].stmt = LY_STMT_DESCRIPTION;
345 ext->substmts[1].storage = &aug_pdata->dsc;
346
347 LY_ARRAY_INCREMENT(ext->substmts);
348 ext->substmts[2].stmt = LY_STMT_REFERENCE;
349 ext->substmts[2].storage = &aug_pdata->ref;
350
351 /* data-def-stmt */
352 LY_ARRAY_INCREMENT(ext->substmts);
353 ext->substmts[3].stmt = LY_STMT_CONTAINER;
354 ext->substmts[3].storage = &aug_pdata->child;
355
356 LY_ARRAY_INCREMENT(ext->substmts);
357 ext->substmts[4].stmt = LY_STMT_LEAF;
358 ext->substmts[4].storage = &aug_pdata->child;
359
360 LY_ARRAY_INCREMENT(ext->substmts);
361 ext->substmts[5].stmt = LY_STMT_LEAF_LIST;
362 ext->substmts[5].storage = &aug_pdata->child;
363
364 LY_ARRAY_INCREMENT(ext->substmts);
365 ext->substmts[6].stmt = LY_STMT_LIST;
366 ext->substmts[6].storage = &aug_pdata->child;
367
368 LY_ARRAY_INCREMENT(ext->substmts);
369 ext->substmts[7].stmt = LY_STMT_CHOICE;
370 ext->substmts[7].storage = &aug_pdata->child;
371
372 LY_ARRAY_INCREMENT(ext->substmts);
373 ext->substmts[8].stmt = LY_STMT_ANYDATA;
374 ext->substmts[8].storage = &aug_pdata->child;
375
376 LY_ARRAY_INCREMENT(ext->substmts);
377 ext->substmts[9].stmt = LY_STMT_ANYXML;
378 ext->substmts[9].storage = &aug_pdata->child;
379
380 LY_ARRAY_INCREMENT(ext->substmts);
381 ext->substmts[10].stmt = LY_STMT_USES;
382 ext->substmts[10].storage = &aug_pdata->child;
383
384 /* case */
385 LY_ARRAY_INCREMENT(ext->substmts);
386 ext->substmts[11].stmt = LY_STMT_CASE;
387 ext->substmts[11].storage = &aug_pdata->child;
388
Michal Vaskoa0ba01e2022-10-19 13:26:57 +0200389 if ((rc = lyplg_ext_parse_extension_instance(pctx, ext))) {
Michal Vasko193dacd2022-10-13 08:43:05 +0200390 return rc;
391 }
392
Michal Vaskoa0ba01e2022-10-19 13:26:57 +0200393 /* add fake parsed augment node */
394 LY_ARRAY_INCREMENT(ext->substmts);
395 ext->substmts[12].stmt = LY_STMT_AUGMENT;
396 ext->substmts[12].storage = &aug_pdata->aug;
Michal Vasko193dacd2022-10-13 08:43:05 +0200397
Michal Vaskoa0ba01e2022-10-19 13:26:57 +0200398 aug_pdata->aug = calloc(1, sizeof *aug_pdata->aug);
399 if (!aug_pdata->aug) {
Michal Vasko193dacd2022-10-13 08:43:05 +0200400 goto emem;
401 }
Michal Vaskoa0ba01e2022-10-19 13:26:57 +0200402 aug_pdata->aug->nodetype = LYS_AUGMENT;
403 aug_pdata->aug->flags = aug_pdata->flags;
404 lydict_insert(ctx, ext->argument, 0, &aug_pdata->aug->nodeid);
405 aug_pdata->aug->child = aug_pdata->child;
406 /* avoid double free */
407 aug_pdata->child = NULL;
Michal Vasko193dacd2022-10-13 08:43:05 +0200408
409 return LY_SUCCESS;
410
411emem:
Michal Vaskoa0ba01e2022-10-19 13:26:57 +0200412 lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EMEM, "Memory allocation failed (%s()).", __func__);
Michal Vasko193dacd2022-10-13 08:43:05 +0200413 return LY_EMEM;
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200414}
415
416/**
417 * @brief Plugin descriptions for the structure extension
418 *
419 * Note that external plugins are supposed to use:
420 *
421 * LYPLG_EXTENSIONS = {
422 */
423const struct lyplg_ext_record plugins_structure[] = {
424 {
425 .module = "ietf-yang-structure-ext",
426 .revision = "2020-06-17",
427 .name = "structure",
428
Michal Vasko193dacd2022-10-13 08:43:05 +0200429 .plugin.id = "ly2 structure v1",
430 .plugin.parse = structure_parse,
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200431 .plugin.compile = structure_compile,
Michal Vasko941e0562022-10-18 10:35:00 +0200432 .plugin.printer_info = structure_printer_info,
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200433 .plugin.node = NULL,
434 .plugin.snode = NULL,
Michal Vasko193dacd2022-10-13 08:43:05 +0200435 .plugin.validate = NULL,
436 .plugin.pfree = structure_pfree,
437 .plugin.cfree = structure_cfree
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200438 },
Michal Vasko0b50f6b2022-10-05 15:07:55 +0200439 {
440 .module = "ietf-yang-structure-ext",
441 .revision = "2020-06-17",
442 .name = "augment-structure",
443
Michal Vasko193dacd2022-10-13 08:43:05 +0200444 .plugin.id = "ly2 structure v1",
445 .plugin.parse = structure_aug_parse,
Michal Vaskoa0ba01e2022-10-19 13:26:57 +0200446 .plugin.compile = NULL,
447 .plugin.printer_info = NULL,
Michal Vasko0b50f6b2022-10-05 15:07:55 +0200448 .plugin.node = NULL,
449 .plugin.snode = NULL,
Michal Vasko193dacd2022-10-13 08:43:05 +0200450 .plugin.validate = NULL,
Michal Vaskoa0ba01e2022-10-19 13:26:57 +0200451 .plugin.pfree = structure_pfree,
452 .plugin.cfree = NULL
Michal Vasko0b50f6b2022-10-05 15:07:55 +0200453 },
Michal Vaskoedb0fa52022-10-04 10:36:00 +0200454 {0} /* terminating zeroed record */
455};