blob: e084c98f3a55e5773b1d6ffe57b4426f4496bb4f [file] [log] [blame]
Radek Krejci0935f412019-08-20 16:15:18 +02001/**
2 * @file plugins_exts.c
3 * @author Radek Krejci <rkrejci@cesnet.cz>
4 * @brief Internally implemented YANG extensions.
5 *
6 * Copyright (c) 2019 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 */
Radek Krejci0935f412019-08-20 16:15:18 +020014
15#include "plugins_exts.h"
Radek Krejci77114102021-03-10 15:21:57 +010016#include "plugins_exts_compile.h"
17#include "plugins_exts_print.h"
Radek Krejci0935f412019-08-20 16:15:18 +020018
Radek Krejci47fab892020-11-05 17:02:41 +010019#include <stdint.h>
Radek Krejci535ea9f2020-05-29 16:01:05 +020020
Radek Krejcicc9e30f2021-03-29 12:45:08 +020021extern struct lyplg_ext metadata_plugin; /* plugins_exts_metadata.c */
22extern struct lyplg_ext nacm_plugin; /* plugins_exts_nacm.c */
23extern struct lyplg_ext yangdata_plugin; /* plugins_exts_yangdata.c */
Radek Krejci0935f412019-08-20 16:15:18 +020024
Radek Krejci5f9a3672021-03-05 21:35:22 +010025/* internal libyang headers - do not make them accessible to the extension plugins in plugins_exts_*.c */
26#include "common.h"
Radek Krejcif8d7f9a2021-03-10 14:32:36 +010027#include "printer_internal.h"
Radek Krejci5f9a3672021-03-05 21:35:22 +010028#include "schema_compile.h"
29
Radek Krejci5f9a3672021-03-05 21:35:22 +010030API struct ly_ctx *
31lysc_ctx_get_ctx(const struct lysc_ctx *ctx)
32{
33 return ctx->ctx;
34}
35
36API uint32_t *
37lysc_ctx_get_options(const struct lysc_ctx *ctx)
38{
39 return &((struct lysc_ctx *)ctx)->options;
40}
41
42API const char *
43lysc_ctx_get_path(const struct lysc_ctx *ctx)
44{
45 return ctx->path;
46}
Radek Krejcif8d7f9a2021-03-10 14:32:36 +010047
48API struct ly_out **
49lys_ypr_ctx_get_out(const struct lyspr_ctx *ctx)
50{
51 return &((struct lyspr_ctx *)ctx)->out;
52}
53
54API uint32_t *
55lys_ypr_ctx_get_options(const struct lyspr_ctx *ctx)
56{
57 return &((struct lyspr_ctx *)ctx)->options;
58}
59
60API uint16_t *
61lys_ypr_ctx_get_level(const struct lyspr_ctx *ctx)
62{
63 return &((struct lyspr_ctx *)ctx)->level;
64}