Coverage Report

Created: 2024-02-29 06:11

/src/libyang/src/plugins_exts/structure.c
Line
Count
Source (jump to first uncovered line)
1
/**
2
 * @file structure.c
3
 * @author Michal Vasko <mvasko@cesnet.cz>
4
 * @brief libyang extension plugin - structure (RFC 8791)
5
 *
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 <assert.h>
16
#include <stdint.h>
17
#include <stdlib.h>
18
#include <string.h>
19
20
#include "compat.h"
21
#include "libyang.h"
22
#include "plugins_exts.h"
23
24
struct lysp_ext_instance_structure {
25
    struct lysp_restr *musts;
26
    uint16_t flags;
27
    const char *dsc;
28
    const char *ref;
29
    struct lysp_tpdf *typedefs;
30
    struct lysp_node_grp *groupings;
31
    struct lysp_node *child;
32
};
33
34
struct lysc_ext_instance_structure {
35
    struct lysc_must *musts;
36
    uint16_t flags;
37
    const char *dsc;
38
    const char *ref;
39
    struct lysc_node *child;
40
};
41
42
struct lysp_ext_instance_augment_structure {
43
    uint16_t flags;
44
    const char *dsc;
45
    const char *ref;
46
    struct lysp_node *child;
47
    struct lysp_node_augment *aug;
48
};
49
50
/**
51
 * @brief Parse structure extension instances.
52
 *
53
 * Implementation of ::lyplg_ext_parse_clb callback set as lyext_plugin::parse.
54
 */
55
static LY_ERR
56
structure_parse(struct lysp_ctx *pctx, struct lysp_ext_instance *ext)
57
0
{
58
0
    LY_ERR rc;
59
0
    LY_ARRAY_COUNT_TYPE u;
60
0
    struct lysp_module *pmod;
61
0
    struct lysp_ext_instance_structure *struct_pdata;
62
63
    /* structure can appear only at the top level of a YANG module or submodule */
64
0
    if ((ext->parent_stmt != LY_STMT_MODULE) && (ext->parent_stmt != LY_STMT_SUBMODULE)) {
65
0
        lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EVALID,
66
0
                "Extension %s must not be used as a non top-level statement in \"%s\" statement.", ext->name,
67
0
                lyplg_ext_stmt2str(ext->parent_stmt));
68
0
        return LY_EVALID;
69
0
    }
70
71
0
    pmod = ext->parent;
72
73
    /* check for duplication */
74
0
    LY_ARRAY_FOR(pmod->exts, u) {
75
0
        if ((&pmod->exts[u] != ext) && (pmod->exts[u].name == ext->name) && !strcmp(pmod->exts[u].argument, ext->argument)) {
76
            /* duplication of the same structure extension in a single module */
77
0
            lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EVALID, "Extension %s is instantiated multiple times.", ext->name);
78
0
            return LY_EVALID;
79
0
        }
80
0
    }
81
82
    /* allocate the storage */
83
0
    struct_pdata = calloc(1, sizeof *struct_pdata);
84
0
    if (!struct_pdata) {
85
0
        goto emem;
86
0
    }
87
0
    ext->parsed = struct_pdata;
88
0
    LY_ARRAY_CREATE_GOTO(lyplg_ext_parse_get_cur_pmod(pctx)->mod->ctx, ext->substmts, 14, rc, emem);
89
90
    /* parse substatements */
91
0
    LY_ARRAY_INCREMENT(ext->substmts);
92
0
    ext->substmts[0].stmt = LY_STMT_MUST;
93
0
    ext->substmts[0].storage = &struct_pdata->musts;
94
95
0
    LY_ARRAY_INCREMENT(ext->substmts);
96
0
    ext->substmts[1].stmt = LY_STMT_STATUS;
97
0
    ext->substmts[1].storage = &struct_pdata->flags;
98
99
0
    LY_ARRAY_INCREMENT(ext->substmts);
100
0
    ext->substmts[2].stmt = LY_STMT_DESCRIPTION;
101
0
    ext->substmts[2].storage = &struct_pdata->dsc;
102
103
0
    LY_ARRAY_INCREMENT(ext->substmts);
104
0
    ext->substmts[3].stmt = LY_STMT_REFERENCE;
105
0
    ext->substmts[3].storage = &struct_pdata->ref;
106
107
0
    LY_ARRAY_INCREMENT(ext->substmts);
108
0
    ext->substmts[4].stmt = LY_STMT_TYPEDEF;
109
0
    ext->substmts[4].storage = &struct_pdata->typedefs;
110
111
0
    LY_ARRAY_INCREMENT(ext->substmts);
112
0
    ext->substmts[5].stmt = LY_STMT_GROUPING;
113
0
    ext->substmts[5].storage = &struct_pdata->groupings;
114
115
    /* data-def-stmt */
116
0
    LY_ARRAY_INCREMENT(ext->substmts);
117
0
    ext->substmts[6].stmt = LY_STMT_CONTAINER;
118
0
    ext->substmts[6].storage = &struct_pdata->child;
119
120
0
    LY_ARRAY_INCREMENT(ext->substmts);
121
0
    ext->substmts[7].stmt = LY_STMT_LEAF;
122
0
    ext->substmts[7].storage = &struct_pdata->child;
123
124
0
    LY_ARRAY_INCREMENT(ext->substmts);
125
0
    ext->substmts[8].stmt = LY_STMT_LEAF_LIST;
126
0
    ext->substmts[8].storage = &struct_pdata->child;
127
128
0
    LY_ARRAY_INCREMENT(ext->substmts);
129
0
    ext->substmts[9].stmt = LY_STMT_LIST;
130
0
    ext->substmts[9].storage = &struct_pdata->child;
131
132
0
    LY_ARRAY_INCREMENT(ext->substmts);
133
0
    ext->substmts[10].stmt = LY_STMT_CHOICE;
134
0
    ext->substmts[10].storage = &struct_pdata->child;
135
136
0
    LY_ARRAY_INCREMENT(ext->substmts);
137
0
    ext->substmts[11].stmt = LY_STMT_ANYDATA;
138
0
    ext->substmts[11].storage = &struct_pdata->child;
139
140
0
    LY_ARRAY_INCREMENT(ext->substmts);
141
0
    ext->substmts[12].stmt = LY_STMT_ANYXML;
142
0
    ext->substmts[12].storage = &struct_pdata->child;
143
144
0
    LY_ARRAY_INCREMENT(ext->substmts);
145
0
    ext->substmts[13].stmt = LY_STMT_USES;
146
0
    ext->substmts[13].storage = &struct_pdata->child;
147
148
0
    rc = lyplg_ext_parse_extension_instance(pctx, ext);
149
0
    return rc;
150
151
0
emem:
152
0
    lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EMEM, "Memory allocation failed (%s()).", __func__);
153
0
    return LY_EMEM;
154
0
}
155
156
/**
157
 * @brief Compile structure extension instances.
158
 *
159
 * Implementation of ::lyplg_ext_compile_clb callback set as lyext_plugin::compile.
160
 */
161
static LY_ERR
162
structure_compile(struct lysc_ctx *cctx, const struct lysp_ext_instance *extp, struct lysc_ext_instance *ext)
163
0
{
164
0
    LY_ERR rc;
165
0
    struct lysc_module *mod_c;
166
0
    const struct lysc_node *child;
167
0
    struct lysc_ext_instance_structure *struct_cdata;
168
0
    uint32_t prev_options = *lyplg_ext_compile_get_options(cctx);
169
170
0
    mod_c = ext->parent;
171
172
    /* check identifier namespace with the compiled nodes */
173
0
    LY_LIST_FOR(mod_c->data, child) {
174
0
        if (!strcmp(child->name, ext->argument)) {
175
            /* identifier collision */
176
0
            lyplg_ext_compile_log(cctx, ext, LY_LLERR, LY_EVALID,  "Extension %s collides with a %s with the same identifier.",
177
0
                    extp->name, lys_nodetype2str(child->nodetype));
178
0
            return LY_EVALID;
179
0
        }
180
0
    }
181
182
    /* allocate the storage */
183
0
    struct_cdata = calloc(1, sizeof *struct_cdata);
184
0
    if (!struct_cdata) {
185
0
        goto emem;
186
0
    }
187
0
    ext->compiled = struct_cdata;
188
189
    /* compile substatements */
190
0
    LY_ARRAY_CREATE_GOTO(cctx->ctx, ext->substmts, 14, rc, emem);
191
0
    LY_ARRAY_INCREMENT(ext->substmts);
192
0
    ext->substmts[0].stmt = LY_STMT_MUST;
193
0
    ext->substmts[0].storage = &struct_cdata->musts;
194
195
0
    LY_ARRAY_INCREMENT(ext->substmts);
196
0
    ext->substmts[1].stmt = LY_STMT_STATUS;
197
0
    ext->substmts[1].storage = &struct_cdata->flags;
198
199
0
    LY_ARRAY_INCREMENT(ext->substmts);
200
0
    ext->substmts[2].stmt = LY_STMT_DESCRIPTION;
201
0
    ext->substmts[2].storage = &struct_cdata->dsc;
202
203
0
    LY_ARRAY_INCREMENT(ext->substmts);
204
0
    ext->substmts[3].stmt = LY_STMT_REFERENCE;
205
0
    ext->substmts[3].storage = &struct_cdata->ref;
206
207
0
    LY_ARRAY_INCREMENT(ext->substmts);
208
0
    ext->substmts[4].stmt = LY_STMT_TYPEDEF;
209
0
    ext->substmts[4].storage = NULL;
210
211
0
    LY_ARRAY_INCREMENT(ext->substmts);
212
0
    ext->substmts[5].stmt = LY_STMT_GROUPING;
213
0
    ext->substmts[5].storage = NULL;
214
215
    /* data-def-stmt */
216
0
    LY_ARRAY_INCREMENT(ext->substmts);
217
0
    ext->substmts[6].stmt = LY_STMT_CONTAINER;
218
0
    ext->substmts[6].storage = &struct_cdata->child;
219
220
0
    LY_ARRAY_INCREMENT(ext->substmts);
221
0
    ext->substmts[7].stmt = LY_STMT_LEAF;
222
0
    ext->substmts[7].storage = &struct_cdata->child;
223
224
0
    LY_ARRAY_INCREMENT(ext->substmts);
225
0
    ext->substmts[8].stmt = LY_STMT_LEAF_LIST;
226
0
    ext->substmts[8].storage = &struct_cdata->child;
227
228
0
    LY_ARRAY_INCREMENT(ext->substmts);
229
0
    ext->substmts[9].stmt = LY_STMT_LIST;
230
0
    ext->substmts[9].storage = &struct_cdata->child;
231
232
0
    LY_ARRAY_INCREMENT(ext->substmts);
233
0
    ext->substmts[10].stmt = LY_STMT_CHOICE;
234
0
    ext->substmts[10].storage = &struct_cdata->child;
235
236
0
    LY_ARRAY_INCREMENT(ext->substmts);
237
0
    ext->substmts[11].stmt = LY_STMT_ANYDATA;
238
0
    ext->substmts[11].storage = &struct_cdata->child;
239
240
0
    LY_ARRAY_INCREMENT(ext->substmts);
241
0
    ext->substmts[12].stmt = LY_STMT_ANYXML;
242
0
    ext->substmts[12].storage = &struct_cdata->child;
243
244
0
    LY_ARRAY_INCREMENT(ext->substmts);
245
0
    ext->substmts[13].stmt = LY_STMT_USES;
246
0
    ext->substmts[13].storage = &struct_cdata->child;
247
248
0
    *lyplg_ext_compile_get_options(cctx) |= LYS_COMPILE_NO_CONFIG | LYS_COMPILE_NO_DISABLED;
249
0
    rc = lyplg_ext_compile_extension_instance(cctx, extp, ext);
250
0
    *lyplg_ext_compile_get_options(cctx) = prev_options;
251
0
    if (rc) {
252
0
        return rc;
253
0
    }
254
255
0
    return LY_SUCCESS;
256
257
0
emem:
258
0
    lyplg_ext_compile_log(cctx, ext, LY_LLERR, LY_EMEM, "Memory allocation failed (%s()).", __func__);
259
0
    return LY_EMEM;
260
0
}
261
262
/**
263
 * @brief Structure schema info printer.
264
 *
265
 * Implementation of ::lyplg_ext_sprinter_info_clb set as ::lyext_plugin::printer_info
266
 */
267
static LY_ERR
268
structure_printer_info(struct lyspr_ctx *ctx, struct lysc_ext_instance *ext, ly_bool *flag)
269
0
{
270
0
    lyplg_ext_print_info_extension_instance(ctx, ext, flag);
271
0
    return LY_SUCCESS;
272
0
}
273
274
/**
275
 * @brief Free parsed structure extension instance data.
276
 *
277
 * Implementation of ::lyplg_clb_parse_free_clb callback set as lyext_plugin::pfree.
278
 */
279
static void
280
structure_pfree(const struct ly_ctx *ctx, struct lysp_ext_instance *ext)
281
0
{
282
0
    lyplg_ext_pfree_instance_substatements(ctx, ext->substmts);
283
0
    free(ext->parsed);
284
0
}
285
286
/**
287
 * @brief Free compiled structure extension instance data.
288
 *
289
 * Implementation of ::lyplg_clb_compile_free_clb callback set as lyext_plugin::cfree.
290
 */
291
static void
292
structure_cfree(const struct ly_ctx *ctx, struct lysc_ext_instance *ext)
293
0
{
294
0
    lyplg_ext_cfree_instance_substatements(ctx, ext->substmts);
295
0
    free(ext->compiled);
296
0
}
297
298
/**
299
 * @brief Parse augment-structure extension instances.
300
 *
301
 * Implementation of ::lyplg_ext_parse_clb callback set as lyext_plugin::parse.
302
 */
303
static LY_ERR
304
structure_aug_parse(struct lysp_ctx *pctx, struct lysp_ext_instance *ext)
305
0
{
306
0
    LY_ERR rc;
307
0
    struct lysp_stmt *stmt;
308
0
    struct lysp_ext_instance_augment_structure *aug_pdata;
309
0
    const struct ly_ctx *ctx = lyplg_ext_parse_get_cur_pmod(pctx)->mod->ctx;
310
311
    /* augment-structure can appear only at the top level of a YANG module or submodule */
312
0
    if ((ext->parent_stmt != LY_STMT_MODULE) && (ext->parent_stmt != LY_STMT_SUBMODULE)) {
313
0
        lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EVALID,
314
0
                "Extension %s must not be used as a non top-level statement in \"%s\" statement.", ext->name,
315
0
                lyplg_ext_stmt2str(ext->parent_stmt));
316
0
        return LY_EVALID;
317
0
    }
318
319
    /* augment-structure must define some data-def-stmt */
320
0
    LY_LIST_FOR(ext->child, stmt) {
321
0
        if (stmt->kw & LY_STMT_DATA_NODE_MASK) {
322
0
            break;
323
0
        }
324
0
    }
325
0
    if (!stmt) {
326
0
        lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EVALID, "Extension %s does not define any data-def-stmt statements.",
327
0
                ext->name);
328
0
        return LY_EVALID;
329
0
    }
330
331
    /* allocate the storage */
332
0
    aug_pdata = calloc(1, sizeof *aug_pdata);
333
0
    if (!aug_pdata) {
334
0
        goto emem;
335
0
    }
336
0
    ext->parsed = aug_pdata;
337
0
    LY_ARRAY_CREATE_GOTO(ctx, ext->substmts, 13, rc, emem);
338
339
    /* parse substatements */
340
0
    LY_ARRAY_INCREMENT(ext->substmts);
341
0
    ext->substmts[0].stmt = LY_STMT_STATUS;
342
0
    ext->substmts[0].storage = &aug_pdata->flags;
343
344
0
    LY_ARRAY_INCREMENT(ext->substmts);
345
0
    ext->substmts[1].stmt = LY_STMT_DESCRIPTION;
346
0
    ext->substmts[1].storage = &aug_pdata->dsc;
347
348
0
    LY_ARRAY_INCREMENT(ext->substmts);
349
0
    ext->substmts[2].stmt = LY_STMT_REFERENCE;
350
0
    ext->substmts[2].storage = &aug_pdata->ref;
351
352
    /* data-def-stmt */
353
0
    LY_ARRAY_INCREMENT(ext->substmts);
354
0
    ext->substmts[3].stmt = LY_STMT_CONTAINER;
355
0
    ext->substmts[3].storage = &aug_pdata->child;
356
357
0
    LY_ARRAY_INCREMENT(ext->substmts);
358
0
    ext->substmts[4].stmt = LY_STMT_LEAF;
359
0
    ext->substmts[4].storage = &aug_pdata->child;
360
361
0
    LY_ARRAY_INCREMENT(ext->substmts);
362
0
    ext->substmts[5].stmt = LY_STMT_LEAF_LIST;
363
0
    ext->substmts[5].storage = &aug_pdata->child;
364
365
0
    LY_ARRAY_INCREMENT(ext->substmts);
366
0
    ext->substmts[6].stmt = LY_STMT_LIST;
367
0
    ext->substmts[6].storage = &aug_pdata->child;
368
369
0
    LY_ARRAY_INCREMENT(ext->substmts);
370
0
    ext->substmts[7].stmt = LY_STMT_CHOICE;
371
0
    ext->substmts[7].storage = &aug_pdata->child;
372
373
0
    LY_ARRAY_INCREMENT(ext->substmts);
374
0
    ext->substmts[8].stmt = LY_STMT_ANYDATA;
375
0
    ext->substmts[8].storage = &aug_pdata->child;
376
377
0
    LY_ARRAY_INCREMENT(ext->substmts);
378
0
    ext->substmts[9].stmt = LY_STMT_ANYXML;
379
0
    ext->substmts[9].storage = &aug_pdata->child;
380
381
0
    LY_ARRAY_INCREMENT(ext->substmts);
382
0
    ext->substmts[10].stmt = LY_STMT_USES;
383
0
    ext->substmts[10].storage = &aug_pdata->child;
384
385
    /* case */
386
0
    LY_ARRAY_INCREMENT(ext->substmts);
387
0
    ext->substmts[11].stmt = LY_STMT_CASE;
388
0
    ext->substmts[11].storage = &aug_pdata->child;
389
390
0
    if ((rc = lyplg_ext_parse_extension_instance(pctx, ext))) {
391
0
        return rc;
392
0
    }
393
394
    /* add fake parsed augment node */
395
0
    LY_ARRAY_INCREMENT(ext->substmts);
396
0
    ext->substmts[12].stmt = LY_STMT_AUGMENT;
397
0
    ext->substmts[12].storage = &aug_pdata->aug;
398
399
0
    aug_pdata->aug = calloc(1, sizeof *aug_pdata->aug);
400
0
    if (!aug_pdata->aug) {
401
0
        goto emem;
402
0
    }
403
0
    aug_pdata->aug->nodetype = LYS_AUGMENT;
404
0
    aug_pdata->aug->flags = aug_pdata->flags;
405
0
    if (lydict_insert(ctx, ext->argument, 0, &aug_pdata->aug->nodeid)) {
406
0
        goto emem;
407
0
    }
408
0
    aug_pdata->aug->child = aug_pdata->child;
409
    /* avoid double free */
410
0
    aug_pdata->child = NULL;
411
412
0
    return LY_SUCCESS;
413
414
0
emem:
415
0
    lyplg_ext_parse_log(pctx, ext, LY_LLERR, LY_EMEM, "Memory allocation failed (%s()).", __func__);
416
0
    return LY_EMEM;
417
0
}
418
419
static LY_ERR
420
structure_sprinter_pnode(const struct lysp_node *UNUSED(node), const void *UNUSED(plugin_priv),
421
        ly_bool *UNUSED(skip), const char **flags, const char **UNUSED(add_opts))
422
0
{
423
0
    *flags = "";
424
0
    return LY_SUCCESS;
425
0
}
426
427
static LY_ERR
428
structure_sprinter_cnode(const struct lysc_node *UNUSED(node), const void *UNUSED(plugin_priv),
429
        ly_bool *UNUSED(skip), const char **flags, const char **UNUSED(add_opts))
430
0
{
431
0
    *flags = "";
432
0
    return LY_SUCCESS;
433
0
}
434
435
/**
436
 * @brief Structure schema compiled tree printer.
437
 *
438
 * Implementation of ::lyplg_ext_sprinter_ctree_clb callback set as lyext_plugin::printer_ctree.
439
 */
440
static LY_ERR
441
structure_sprinter_ctree(struct lysc_ext_instance *ext, const struct lyspr_tree_ctx *ctx,
442
        const char **UNUSED(flags), const char **UNUSED(add_opts))
443
0
{
444
0
    LY_ERR rc;
445
446
0
    rc = lyplg_ext_sprinter_ctree_add_ext_nodes(ctx, ext, structure_sprinter_cnode);
447
0
    return rc;
448
0
}
449
450
/**
451
 * @brief Structure schema parsed tree printer.
452
 *
453
 * Implementation of ::lyplg_ext_sprinter_ptree_clb callback set as lyext_plugin::printer_ptree.
454
 */
455
static LY_ERR
456
structure_sprinter_ptree(struct lysp_ext_instance *ext, const struct lyspr_tree_ctx *ctx,
457
        const char **UNUSED(flags), const char **UNUSED(add_opts))
458
0
{
459
0
    LY_ERR rc;
460
461
0
    rc = lyplg_ext_sprinter_ptree_add_ext_nodes(ctx, ext, structure_sprinter_pnode);
462
0
    return rc;
463
0
}
464
465
/**
466
 * @brief Augment structure schema parsed tree printer.
467
 *
468
 * Implementation of ::lyplg_ext_sprinter_ptree_clb callback set as lyext_plugin::printer_ptree.
469
 */
470
static LY_ERR
471
structure_aug_sprinter_ptree(struct lysp_ext_instance *ext, const struct lyspr_tree_ctx *ctx,
472
        const char **UNUSED(flags), const char **UNUSED(add_opts))
473
0
{
474
0
    LY_ERR rc = LY_SUCCESS;
475
0
    struct lysp_node_augment **aug;
476
477
0
    assert(ctx);
478
479
0
    aug = ext->substmts[12].storage;
480
0
    rc = lyplg_ext_sprinter_ptree_add_nodes(ctx, (*aug)->child, structure_sprinter_pnode);
481
482
0
    return rc;
483
0
}
484
485
/**
486
 * @brief Augment structure schema compiled tree printer.
487
 *
488
 * Implementation of ::lyplg_ext_sprinter_ctree_clb callback set as lyext_plugin::printer_ctree.
489
 */
490
static LY_ERR
491
structure_aug_sprinter_ctree(struct lysc_ext_instance *ext, const struct lyspr_tree_ctx *ctx, const char **flags,
492
        const char **add_opts)
493
0
{
494
0
    LY_ERR rc = LY_SUCCESS;
495
496
0
    LY_ARRAY_COUNT_TYPE i;
497
0
    struct lysp_ext_instance *parsed_ext;
498
499
0
    assert(ctx);
500
501
    /* find the parsed ext structure */
502
0
    parsed_ext = ext->module->parsed->exts;
503
0
    LY_ARRAY_FOR(parsed_ext, i) {
504
0
        if (!strcmp(parsed_ext[i].name, "sx:augment-structure") && !strcmp(parsed_ext[i].argument, ext->argument)) {
505
0
            break;
506
0
        }
507
0
    }
508
0
    assert(i < LY_ARRAY_COUNT(parsed_ext));
509
510
    /* for augments print the parsed tree */
511
0
    rc = structure_aug_sprinter_ptree(parsed_ext, ctx, flags, add_opts);
512
0
    return rc;
513
0
}
514
515
/**
516
 * @brief Plugin descriptions for the structure extension
517
 *
518
 * Note that external plugins are supposed to use:
519
 *
520
 *   LYPLG_EXTENSIONS = {
521
 */
522
const struct lyplg_ext_record plugins_structure[] = {
523
    {
524
        .module = "ietf-yang-structure-ext",
525
        .revision = "2020-06-17",
526
        .name = "structure",
527
528
        .plugin.id = "ly2 structure v1",
529
        .plugin.parse = structure_parse,
530
        .plugin.compile = structure_compile,
531
        .plugin.printer_info = structure_printer_info,
532
        .plugin.printer_ctree = structure_sprinter_ctree,
533
        .plugin.printer_ptree = structure_sprinter_ptree,
534
        .plugin.node = NULL,
535
        .plugin.snode = NULL,
536
        .plugin.validate = NULL,
537
        .plugin.pfree = structure_pfree,
538
        .plugin.cfree = structure_cfree
539
    },
540
    {
541
        .module = "ietf-yang-structure-ext",
542
        .revision = "2020-06-17",
543
        .name = "augment-structure",
544
545
        .plugin.id = "ly2 structure v1",
546
        .plugin.parse = structure_aug_parse,
547
        .plugin.compile = NULL,
548
        .plugin.printer_info = NULL,
549
        .plugin.printer_ctree = structure_aug_sprinter_ctree,
550
        .plugin.printer_ptree = structure_aug_sprinter_ptree,
551
        .plugin.node = NULL,
552
        .plugin.snode = NULL,
553
        .plugin.validate = NULL,
554
        .plugin.pfree = structure_pfree,
555
        .plugin.cfree = NULL
556
    },
557
    {0}     /* terminating zeroed record */
558
};