blob: 6558f3aec86625488c0a0da0863e780d6802dabf [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 Krejci5f9a3672021-03-05 21:35:22 +010021#include "common.h"
Radek Krejcif8d7f9a2021-03-10 14:32:36 +010022#include "printer_internal.h"
Radek Krejci5f9a3672021-03-05 21:35:22 +010023#include "schema_compile.h"
24
Jan Kundrátc6e39de2021-12-09 16:01:19 +010025LIBYANG_API_DEF struct ly_ctx *
Radek Krejci5f9a3672021-03-05 21:35:22 +010026lysc_ctx_get_ctx(const struct lysc_ctx *ctx)
27{
28 return ctx->ctx;
29}
30
Jan Kundrátc6e39de2021-12-09 16:01:19 +010031LIBYANG_API_DEF uint32_t *
Radek Krejci5f9a3672021-03-05 21:35:22 +010032lysc_ctx_get_options(const struct lysc_ctx *ctx)
33{
Michal Vasko7c565922021-06-10 14:58:27 +020034 return &((struct lysc_ctx *)ctx)->compile_opts;
Radek Krejci5f9a3672021-03-05 21:35:22 +010035}
36
Jan Kundrátc6e39de2021-12-09 16:01:19 +010037LIBYANG_API_DEF const char *
Radek Krejci5f9a3672021-03-05 21:35:22 +010038lysc_ctx_get_path(const struct lysc_ctx *ctx)
39{
40 return ctx->path;
41}
Radek Krejcif8d7f9a2021-03-10 14:32:36 +010042
Jan Kundrátc6e39de2021-12-09 16:01:19 +010043LIBYANG_API_DEF struct ly_out **
Radek Krejcif8d7f9a2021-03-10 14:32:36 +010044lys_ypr_ctx_get_out(const struct lyspr_ctx *ctx)
45{
46 return &((struct lyspr_ctx *)ctx)->out;
47}
48
Jan Kundrátc6e39de2021-12-09 16:01:19 +010049LIBYANG_API_DEF uint32_t *
Radek Krejcif8d7f9a2021-03-10 14:32:36 +010050lys_ypr_ctx_get_options(const struct lyspr_ctx *ctx)
51{
52 return &((struct lyspr_ctx *)ctx)->options;
53}
54
Jan Kundrátc6e39de2021-12-09 16:01:19 +010055LIBYANG_API_DEF uint16_t *
Radek Krejcif8d7f9a2021-03-10 14:32:36 +010056lys_ypr_ctx_get_level(const struct lyspr_ctx *ctx)
57{
58 return &((struct lyspr_ctx *)ctx)->level;
59}
tadeas-vintrlikbf8aa6e2021-11-03 13:07:34 +010060
61API const struct lys_module *
62lysc_ctx_get_cur_mod(const struct lysc_ctx *ctx)
63{
64 return ctx->cur_mod;
65}
66
67API struct lysp_module *
68lysc_ctx_get_pmod(const struct lysc_ctx *ctx)
69{
70 return ctx->pmod;
71}