Radek Krejci | 0935f41 | 2019-08-20 16:15:18 +0200 | [diff] [blame] | 1 | /** |
| 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 Krejci | 0935f41 | 2019-08-20 16:15:18 +0200 | [diff] [blame] | 14 | |
| 15 | #include "plugins_exts.h" |
Radek Krejci | 7711410 | 2021-03-10 15:21:57 +0100 | [diff] [blame] | 16 | #include "plugins_exts_compile.h" |
| 17 | #include "plugins_exts_print.h" |
Radek Krejci | 0935f41 | 2019-08-20 16:15:18 +0200 | [diff] [blame] | 18 | |
Radek Krejci | 47fab89 | 2020-11-05 17:02:41 +0100 | [diff] [blame] | 19 | #include <stdint.h> |
Radek Krejci | 535ea9f | 2020-05-29 16:01:05 +0200 | [diff] [blame] | 20 | |
Radek Krejci | cc9e30f | 2021-03-29 12:45:08 +0200 | [diff] [blame] | 21 | extern struct lyplg_ext metadata_plugin; /* plugins_exts_metadata.c */ |
| 22 | extern struct lyplg_ext nacm_plugin; /* plugins_exts_nacm.c */ |
| 23 | extern struct lyplg_ext yangdata_plugin; /* plugins_exts_yangdata.c */ |
Radek Krejci | 0935f41 | 2019-08-20 16:15:18 +0200 | [diff] [blame] | 24 | |
Radek Krejci | 5f9a367 | 2021-03-05 21:35:22 +0100 | [diff] [blame] | 25 | /* internal libyang headers - do not make them accessible to the extension plugins in plugins_exts_*.c */ |
| 26 | #include "common.h" |
Radek Krejci | f8d7f9a | 2021-03-10 14:32:36 +0100 | [diff] [blame] | 27 | #include "printer_internal.h" |
Radek Krejci | 5f9a367 | 2021-03-05 21:35:22 +0100 | [diff] [blame] | 28 | #include "schema_compile.h" |
| 29 | |
Jan Kundrát | c6e39de | 2021-12-09 16:01:19 +0100 | [diff] [blame] | 30 | LIBYANG_API_DEF struct ly_ctx * |
Radek Krejci | 5f9a367 | 2021-03-05 21:35:22 +0100 | [diff] [blame] | 31 | lysc_ctx_get_ctx(const struct lysc_ctx *ctx) |
| 32 | { |
| 33 | return ctx->ctx; |
| 34 | } |
| 35 | |
Jan Kundrát | c6e39de | 2021-12-09 16:01:19 +0100 | [diff] [blame] | 36 | LIBYANG_API_DEF uint32_t * |
Radek Krejci | 5f9a367 | 2021-03-05 21:35:22 +0100 | [diff] [blame] | 37 | lysc_ctx_get_options(const struct lysc_ctx *ctx) |
| 38 | { |
Michal Vasko | 7c56592 | 2021-06-10 14:58:27 +0200 | [diff] [blame] | 39 | return &((struct lysc_ctx *)ctx)->compile_opts; |
Radek Krejci | 5f9a367 | 2021-03-05 21:35:22 +0100 | [diff] [blame] | 40 | } |
| 41 | |
Jan Kundrát | c6e39de | 2021-12-09 16:01:19 +0100 | [diff] [blame] | 42 | LIBYANG_API_DEF const char * |
Radek Krejci | 5f9a367 | 2021-03-05 21:35:22 +0100 | [diff] [blame] | 43 | lysc_ctx_get_path(const struct lysc_ctx *ctx) |
| 44 | { |
| 45 | return ctx->path; |
| 46 | } |
Radek Krejci | f8d7f9a | 2021-03-10 14:32:36 +0100 | [diff] [blame] | 47 | |
Jan Kundrát | c6e39de | 2021-12-09 16:01:19 +0100 | [diff] [blame] | 48 | LIBYANG_API_DEF struct ly_out ** |
Radek Krejci | f8d7f9a | 2021-03-10 14:32:36 +0100 | [diff] [blame] | 49 | lys_ypr_ctx_get_out(const struct lyspr_ctx *ctx) |
| 50 | { |
| 51 | return &((struct lyspr_ctx *)ctx)->out; |
| 52 | } |
| 53 | |
Jan Kundrát | c6e39de | 2021-12-09 16:01:19 +0100 | [diff] [blame] | 54 | LIBYANG_API_DEF uint32_t * |
Radek Krejci | f8d7f9a | 2021-03-10 14:32:36 +0100 | [diff] [blame] | 55 | lys_ypr_ctx_get_options(const struct lyspr_ctx *ctx) |
| 56 | { |
| 57 | return &((struct lyspr_ctx *)ctx)->options; |
| 58 | } |
| 59 | |
Jan Kundrát | c6e39de | 2021-12-09 16:01:19 +0100 | [diff] [blame] | 60 | LIBYANG_API_DEF uint16_t * |
Radek Krejci | f8d7f9a | 2021-03-10 14:32:36 +0100 | [diff] [blame] | 61 | lys_ypr_ctx_get_level(const struct lyspr_ctx *ctx) |
| 62 | { |
| 63 | return &((struct lyspr_ctx *)ctx)->level; |
| 64 | } |