Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file tree_schema.h |
| 3 | * @author Radek Krejci <rkrejci@cesnet.cz> |
| 4 | * @brief libyang representation of YANG schema trees. |
| 5 | * |
| 6 | * Copyright (c) 2015 - 2018 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 | #ifndef LY_TREE_SCHEMA_H_ |
| 16 | #define LY_TREE_SCHEMA_H_ |
| 17 | |
| 18 | #include <stdint.h> |
| 19 | |
| 20 | /** |
| 21 | * @defgroup schematree Schema Tree |
| 22 | * @{ |
| 23 | * |
| 24 | * Data structures and functions to manipulate and access schema tree. |
| 25 | */ |
| 26 | |
Radek Krejci | 0af5f5d | 2018-09-07 15:00:30 +0200 | [diff] [blame] | 27 | /** |
| 28 | * @brief Schema input formats accepted by libyang [parser functions](@ref howtoschemasparsers). |
| 29 | */ |
| 30 | typedef enum { |
| 31 | LYS_IN_UNKNOWN = 0, /**< unknown format, used as return value in case of error */ |
| 32 | LYS_IN_YANG = 1, /**< YANG schema input format */ |
| 33 | LYS_IN_YIN = 2 /**< YIN schema input format */ |
| 34 | } LYS_INFORMAT; |
| 35 | |
| 36 | /** |
| 37 | * @brief Schema output formats accepted by libyang [printer functions](@ref howtoschemasprinters). |
| 38 | */ |
| 39 | typedef enum { |
| 40 | LYS_OUT_UNKNOWN = 0, /**< unknown format, used as return value in case of error */ |
| 41 | LYS_OUT_YANG = 1, /**< YANG schema output format */ |
| 42 | LYS_OUT_YIN = 2, /**< YIN schema output format */ |
| 43 | LYS_OUT_TREE, /**< Tree schema output format, for more information see the [printers](@ref howtoschemasprinters) page */ |
| 44 | LYS_OUT_INFO, /**< Info schema output format, for more information see the [printers](@ref howtoschemasprinters) page */ |
| 45 | LYS_OUT_JSON, /**< JSON schema output format, reflecting YIN format with conversion of attributes to object's members */ |
| 46 | } LYS_OUTFORMAT; |
| 47 | |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 48 | #define LY_REV_SIZE 11 /**< revision data string length (including terminating NULL byte) */ |
| 49 | |
| 50 | #define LYS_UNKNOWN 0x0000, /**< uninitalized unknown statement node */ |
| 51 | #define LYS_CONTAINER 0x0001, /**< container statement node */ |
| 52 | #define LYS_CHOICE 0x0002, /**< choice statement node */ |
| 53 | #define LYS_LEAF 0x0004, /**< leaf statement node */ |
| 54 | #define LYS_LEAFLIST 0x0008, /**< leaf-list statement node */ |
| 55 | #define LYS_LIST 0x0010, /**< list statement node */ |
| 56 | #define LYS_ANYXML 0x0020, /**< anyxml statement node */ |
| 57 | #define LYS_CASE 0x0040, /**< case statement node */ |
| 58 | #define LYS_USES 0x0080, /**< uses statement node */ |
| 59 | #define LYS_AUGMENT 0x0100, /**< augment statement node */ |
| 60 | #define LYS_ANYDATA 0x0220, /**< anydata statement node, in tests it can be used for both #LYS_ANYXML and #LYS_ANYDATA */ |
| 61 | |
| 62 | /** |
| 63 | * @brief YANG import-stmt |
| 64 | */ |
| 65 | struct lysp_import { |
Michal Vasko | d5927ca | 2018-09-07 15:05:32 +0200 | [diff] [blame^] | 66 | const char *name; /**< name of the module to import (mandatory) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 67 | const char *prefix; /**< prefix for the data from the imported schema (mandatory) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 68 | const char *dsc; /**< description */ |
| 69 | const char *ref; /**< reference */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 70 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 71 | char rev[LY_REV_SIZE]; /**< revision-date of the imported module */ |
| 72 | }; |
| 73 | |
| 74 | /** |
| 75 | * @brief YANG include-stmt |
| 76 | */ |
| 77 | struct lysp_include { |
Michal Vasko | d5927ca | 2018-09-07 15:05:32 +0200 | [diff] [blame^] | 78 | const char *name; /**< name of the submodule to include (mandatory) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 79 | const char *dsc; /**< description */ |
| 80 | const char *ref; /**< reference */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 81 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 82 | char rev[LY_REV_SIZE]; /**< revision-date of the included submodule */ |
| 83 | }; |
| 84 | |
| 85 | /** |
| 86 | * @brief YANG extension-stmt |
| 87 | */ |
| 88 | struct lysp_ext { |
| 89 | const char *name; /**< extension name */ |
| 90 | const char *argument; /**< argument name, NULL if not specified */ |
| 91 | const char *dsc; /**< description statement */ |
| 92 | const char *ref; /**< reference statement */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 93 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 94 | uint16_t flags; /**< LYS_STATUS_* and LYS_YINELEM values (@ref snodeflags) */ |
| 95 | }; |
| 96 | |
| 97 | /** |
| 98 | * @brief Helper structure for generic storage of the extension instances content. |
| 99 | */ |
| 100 | struct lysp_stmt { |
| 101 | const char *stmt; /**< identifier of the statement */ |
| 102 | const char *arg; /**< statement's argument */ |
| 103 | struct lysp_stmt *next; /**< link to the next statement */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 104 | struct lysp_stmt *child; /**< list of the statement's substatements (linked list) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | /** |
Michal Vasko | d92e42a | 2018-09-07 08:35:02 +0200 | [diff] [blame] | 108 | * @brief Enum of substatements in which extension instances can appear. |
| 109 | */ |
| 110 | typedef enum { |
| 111 | LYEXT_SUBSTMT_SELF = 0, /**< extension of the structure itself, not substatement's */ |
| 112 | LYEXT_SUBSTMT_ARGUMENT, /**< extension of the argument statement, can appear in lys_ext */ |
| 113 | LYEXT_SUBSTMT_BASE, /**< extension of the base statement, can appear (repeatedly) in lys_type and lys_ident */ |
| 114 | LYEXT_SUBSTMT_BELONGSTO, /**< extension of the belongs-to statement, can appear in lys_submodule */ |
| 115 | LYEXT_SUBSTMT_CONTACT, /**< extension of the contact statement, can appear in lys_module */ |
| 116 | LYEXT_SUBSTMT_DEFAULT, /**< extension of the default statement, can appear in lys_node_leaf, lys_node_leaflist, |
| 117 | lys_node_choice and lys_deviate */ |
| 118 | LYEXT_SUBSTMT_DESCRIPTION, /**< extension of the description statement, can appear in lys_module, lys_submodule, |
| 119 | lys_node, lys_import, lys_include, lys_ext, lys_feature, lys_tpdf, lys_restr, |
| 120 | lys_ident, lys_deviation, lys_type_enum, lys_type_bit, lys_when and lys_revision */ |
| 121 | LYEXT_SUBSTMT_ERRTAG, /**< extension of the error-app-tag statement, can appear in lys_restr */ |
| 122 | LYEXT_SUBSTMT_ERRMSG, /**< extension of the error-message statement, can appear in lys_restr */ |
| 123 | LYEXT_SUBSTMT_KEY, /**< extension of the key statement, can appear in lys_node_list */ |
| 124 | LYEXT_SUBSTMT_NAMESPACE, /**< extension of the namespace statement, can appear in lys_module */ |
| 125 | LYEXT_SUBSTMT_ORGANIZATION, /**< extension of the organization statement, can appear in lys_module and lys_submodule */ |
| 126 | LYEXT_SUBSTMT_PATH, /**< extension of the path statement, can appear in lys_type */ |
| 127 | LYEXT_SUBSTMT_PREFIX, /**< extension of the prefix statement, can appear in lys_module, lys_submodule (for |
| 128 | belongs-to's prefix) and lys_import */ |
| 129 | LYEXT_SUBSTMT_PRESENCE, /**< extension of the presence statement, can appear in lys_node_container */ |
| 130 | LYEXT_SUBSTMT_REFERENCE, /**< extension of the reference statement, can appear in lys_module, lys_submodule, |
| 131 | lys_node, lys_import, lys_include, lys_revision, lys_tpdf, lys_restr, lys_ident, |
| 132 | lys_ext, lys_feature, lys_deviation, lys_type_enum, lys_type_bit and lys_when */ |
| 133 | LYEXT_SUBSTMT_REVISIONDATE, /**< extension of the revision-date statement, can appear in lys_import and lys_include */ |
| 134 | LYEXT_SUBSTMT_UNITS, /**< extension of the units statement, can appear in lys_tpdf, lys_node_leaf, |
| 135 | lys_node_leaflist and lys_deviate */ |
| 136 | LYEXT_SUBSTMT_VALUE, /**< extension of the value statement, can appear in lys_type_enum */ |
| 137 | LYEXT_SUBSTMT_VERSION, /**< extension of the yang-version statement, can appear in lys_module and lys_submodule */ |
| 138 | LYEXT_SUBSTMT_MODIFIER, /**< extension of the modifier statement, can appear in lys_restr */ |
| 139 | LYEXT_SUBSTMT_REQINSTANCE, /**< extension of the require-instance statement, can appear in lys_type */ |
| 140 | LYEXT_SUBSTMT_YINELEM, /**< extension of the yin-element statement, can appear in lys_ext */ |
| 141 | LYEXT_SUBSTMT_CONFIG, /**< extension of the config statement, can appear in lys_node and lys_deviate */ |
| 142 | LYEXT_SUBSTMT_MANDATORY, /**< extension of the mandatory statement, can appear in lys_node_leaf, lys_node_choice, |
| 143 | lys_node_anydata and lys_deviate */ |
| 144 | LYEXT_SUBSTMT_ORDEREDBY, /**< extension of the ordered-by statement, can appear in lys_node_list and lys_node_leaflist */ |
| 145 | LYEXT_SUBSTMT_STATUS, /**< extension of the status statement, can appear in lys_tpdf, lys_node, lys_ident, |
| 146 | lys_ext, lys_feature, lys_type_enum and lys_type_bit */ |
| 147 | LYEXT_SUBSTMT_DIGITS, /**< extension of the fraction-digits statement, can appear in lys_type */ |
| 148 | LYEXT_SUBSTMT_MAX, /**< extension of the max-elements statement, can appear in lys_node_list, |
| 149 | lys_node_leaflist and lys_deviate */ |
| 150 | LYEXT_SUBSTMT_MIN, /**< extension of the min-elements statement, can appear in lys_node_list, |
| 151 | lys_node_leaflist and lys_deviate */ |
| 152 | LYEXT_SUBSTMT_POSITION, /**< extension of the position statement, can appear in lys_type_bit */ |
| 153 | LYEXT_SUBSTMT_UNIQUE, /**< extension of the unique statement, can appear in lys_node_list and lys_deviate */ |
| 154 | } LYEXT_SUBSTMT; |
| 155 | |
| 156 | /** |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 157 | * @brief YANG extension instance |
| 158 | */ |
| 159 | struct lysp_ext_instance { |
| 160 | const char *name; /**< extension identifier, including possible prefix */ |
| 161 | const char *argument; /**< optional value of the extension's argument */ |
Michal Vasko | d92e42a | 2018-09-07 08:35:02 +0200 | [diff] [blame] | 162 | LYEXT_SUBSTMT insubstmt; /**< value identifying placement of the extension instance */ |
| 163 | uint32_t insubstmt_index; /**< in case the instance is in a substatement, this identifies |
| 164 | the index of that substatement */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 165 | struct lysp_stmt *child; /**< list of the extension's substatements (linked list) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 166 | }; |
| 167 | |
| 168 | /** |
| 169 | * @brief YANG feature-stmt |
| 170 | */ |
| 171 | struct lysp_feature { |
| 172 | const char *name; /**< feature name (mandatory) */ |
| 173 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
| 174 | const char *dsc; /**< description statement */ |
| 175 | const char *ref; /**< reference statement */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 176 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 177 | uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values allowed */ |
| 178 | }; |
| 179 | |
| 180 | /** |
| 181 | * @brief YANG identity-stmt |
| 182 | */ |
| 183 | struct lysp_ident { |
| 184 | const char *name; /**< identity name (mandatory), including possible prefix */ |
| 185 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
| 186 | const char **bases; /**< list of base identifiers (NULL-terminated) */ |
| 187 | const char *dsc; /**< description statement */ |
| 188 | const char *ref; /**< reference statement */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 189 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 190 | uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_ values are allowed */ |
| 191 | }; |
| 192 | |
| 193 | /* |
| 194 | * @brief Covers restrictions: range, length, pattern, must |
| 195 | */ |
| 196 | struct lysp_restr { |
| 197 | const char *arg; /**< The restriction expression/value (mandatory); |
| 198 | in case of pattern restriction, the first byte has a special meaning: |
| 199 | 0x06 (ACK) for regular match and 0x15 (NACK) for invert-match */ |
| 200 | const char *emsg; /**< error-message */ |
| 201 | const char *eapptag; /**< error-app-tag value */ |
| 202 | const char *dsc; /**< description */ |
| 203 | const char *ref; /**< reference */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 204 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 205 | }; |
| 206 | |
| 207 | /** |
| 208 | * @brief Enumeration/Bit value definition |
| 209 | */ |
| 210 | struct lysp_type_enum { |
| 211 | const char *name; /**< name (mandatory) */ |
| 212 | const char *dsc; /**< description statement */ |
| 213 | const char *ref; /**< reference statement */ |
| 214 | const char *value; /**< enum's value or bit's position */ |
| 215 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 216 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 217 | uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_ values are allowed */ |
| 218 | }; |
| 219 | |
| 220 | /** |
| 221 | * @brief YANG type-stmt |
| 222 | * |
| 223 | * Some of the items in the structure may be mandatory, but it is necessary to resolve the type's base type first |
| 224 | */ |
| 225 | struct lysp_type { |
| 226 | const char *name; /**< name of the type (mandatory) */ |
| 227 | struct lysp_restr *range; /**< allowed values range - numerical, decimal64 */ |
| 228 | struct lysp_restr *length; /**< allowed length of the value - string, binary */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 229 | struct lysp_restr *patterns; /**< list of patterns (0-terminated) - string */ |
| 230 | struct lysp_type_enum *enums; /**< list of enum-stmts (0-terminated) - enum */ |
| 231 | struct lysp_type_enum *bits; /**< list of bit-stmts (0-terminated) - bits */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 232 | const char *path; /**< path - leafref */ |
| 233 | const char **bases; /**< list of base identifiers (NULL-terminated) - identityref */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 234 | struct lysp_type *types; /**< list of sub-types (0-terminated) - union */ |
| 235 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 236 | |
| 237 | uint8_t fraction_digits; /**< number of fraction digits - decimal64 */ |
| 238 | uint8_t require_instance; /**< require-instance flag - leafref, instance */ |
| 239 | }; |
| 240 | |
| 241 | /** |
| 242 | * @brief YANG typedef-stmt |
| 243 | */ |
| 244 | struct lysp_tpdf { |
| 245 | const char *name; /**< name of the newly defined type (mandatory) */ |
| 246 | const char *units; /**< units of the newly defined type */ |
| 247 | const char *dflt; /**< default value of the newly defined type */ |
| 248 | const char *dsc; /**< description statement */ |
| 249 | const char *ref; /**< reference statement */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 250 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 251 | struct lysp_type type; /**< base type from which the typedef is derived (mandatory) */ |
| 252 | uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values allowed */ |
| 253 | }; |
| 254 | |
| 255 | /** |
| 256 | * @brief YANG grouping-stmt |
| 257 | */ |
| 258 | struct lysp_grp { |
| 259 | const char *name; /**< grouping name (mandatory) */ |
| 260 | const char *dsc; /**< description statement */ |
| 261 | const char *ref; /**< reference statement */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 262 | struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */ |
| 263 | struct lysp_grp *groupings; /**< list of groupings (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 264 | struct lysp_node *data; /**< list of data nodes (linked list) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 265 | struct lysp_action *actions; /**< list of actions (0-terminated) */ |
| 266 | struct lysp_notif *notifs; /**< list of notifications (0-terminated) */ |
| 267 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 268 | uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values are allowed */ |
| 269 | }; |
| 270 | |
| 271 | /** |
| 272 | * @brief YANG when-stmt |
| 273 | */ |
| 274 | struct lysp_when { |
| 275 | const char *cond; /**< specified condition (mandatory) */ |
| 276 | const char *dsc; /**< description statement */ |
| 277 | const char *ref; /**< reference statement */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 278 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 279 | }; |
| 280 | |
| 281 | /** |
| 282 | * @brief YANG refine-stmt |
| 283 | */ |
| 284 | struct lysp_refine { |
| 285 | const char *nodeid; /**< target descendant schema nodeid (mandatory) */ |
| 286 | const char *dsc; /**< description statement */ |
| 287 | const char *ref; /**< reference statement */ |
| 288 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 289 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 290 | const char *presence; /**< presence description */ |
| 291 | const char **dflts; /**< list of default values (NULL-terminated) */ |
| 292 | uint32_t min; /**< min-elements constraint */ |
| 293 | uint32_t max; /**< max-elements constraint, 0 means unbounded */ |
| 294 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 295 | }; |
| 296 | |
| 297 | /** |
| 298 | * @brief YANG uses-augment-stmt and augment-stmt |
| 299 | */ |
| 300 | struct lysp_augment { |
| 301 | const char *nodeid; /**< target schema nodeid (mandatory) - absolute for global augments, descendant for uses's augments */ |
| 302 | const char *dsc; /**< description statement */ |
| 303 | const char *ref; /**< reference statement */ |
| 304 | struct lysp_when *when; /**< when statement */ |
| 305 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
| 306 | struct lysp_node *child; /**< list of data nodes (linked list) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 307 | struct lysp_action *actions; /**< list of actions (0-terminated) */ |
| 308 | struct lysp_notif *notifs; /**< list of notifications (0-terminated) */ |
| 309 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 310 | uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values are allowed */ |
| 311 | }; |
| 312 | |
| 313 | /** |
| 314 | * @defgroup deviatetypes Deviate types |
| 315 | * @{ |
| 316 | */ |
| 317 | #define LYS_DEV_NOT_SUPPORTED 1 /**< deviate type not-supported */ |
| 318 | #define LYS_DEV_ADD 2 /**< deviate type add */ |
| 319 | #define LYS_DEV_DELETE 3 /**< deviate type delete */ |
| 320 | #define LYS_DEV_REPLACE 4 /**< deviate type replace */ |
| 321 | /** @} */ |
| 322 | |
| 323 | /** |
| 324 | * @brief Generic deviate structure to get type and cast to lysp_deviate_* structure |
| 325 | */ |
| 326 | struct lysp_deviate { |
| 327 | uint8_t mod; /**< [type](@ref deviatetypes) of the deviate modification */ |
| 328 | struct lysp_deviate *next; /**< next deviate structure in the list */ |
| 329 | }; |
| 330 | |
| 331 | struct lysp_deviate_add { |
| 332 | uint8_t mod; /**< [type](@ref deviatetypes) of the deviate modification */ |
| 333 | struct lysp_deviate *next; /**< next deviate structure in the list */ |
| 334 | const char *units; /**< units of the leaf's type */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 335 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 336 | const char **uniques; /**< list of uniques specifications (NULL-terminated) */ |
| 337 | const char **dflts; /**< list of default values (NULL-terminated) */ |
| 338 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 339 | uint32_t min; /**< min-elements constraint */ |
| 340 | uint32_t max; /**< max-elements constraint, 0 means unbounded */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 341 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 342 | }; |
| 343 | |
| 344 | struct lysp_deviate_del { |
| 345 | uint8_t mod; /**< [type](@ref deviatetypes) of the deviate modification */ |
| 346 | struct lysp_deviate *next; /**< next deviate structure in the list */ |
| 347 | const char *units; /**< units of the leaf's type */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 348 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 349 | const char **uniques; /**< list of uniques specifications (NULL-terminated) */ |
| 350 | const char **dflts; /**< list of default values (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 351 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 352 | }; |
| 353 | |
| 354 | struct lysp_deviate_rpl { |
| 355 | uint8_t mod; /**< [type](@ref deviatetypes) of the deviate modification */ |
| 356 | struct lysp_deviate *next; /**< next deviate structure in the list */ |
| 357 | struct lysp_type *type; /**< type of the node (mandatory) */ |
| 358 | const char *units; /**< units of the values */ |
| 359 | const char *dflt; /**< default value */ |
| 360 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 361 | uint32_t min; /**< min-elements constraint */ |
| 362 | uint32_t max; /**< max-elements constraint, 0 means unbounded */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 363 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 364 | }; |
| 365 | |
| 366 | struct lysp_deviation { |
| 367 | uint8_t mod; /**< [type](@ref deviatetypes) of the deviate modification */ |
| 368 | const char *dsc; /**< description statement */ |
| 369 | const char *ref; /**< reference statement */ |
| 370 | struct lysp_deviate* deviates; /**< list of deviate specifications (linked list) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 371 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 372 | }; |
| 373 | |
| 374 | /** |
| 375 | * @brief Generic YANG data node |
| 376 | */ |
| 377 | struct lysp_node { |
| 378 | uint16_t nodetype; /**< type of the node (mandatory) */ |
| 379 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 380 | struct lysp_node *next; /**< pointer to the next sibling node (NULL if there is no one) */ |
| 381 | const char *name; /**< node name (mandatory) */ |
| 382 | const char *dsc; /**< description statement */ |
| 383 | const char *ref; /**< reference statement */ |
| 384 | struct lysp_when *when; /**< when statement */ |
| 385 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 386 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 387 | }; |
| 388 | |
| 389 | /** |
| 390 | * @brief Extension structure of the lysp_node for YANG container |
| 391 | */ |
| 392 | struct lysp_node_container { |
| 393 | uint16_t nodetype; /**< LYS_CONTAINER */ |
| 394 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 395 | struct lysp_node *next; /**< pointer to the next sibling node (NULL if there is no one) */ |
| 396 | const char *name; /**< node name (mandatory) */ |
| 397 | const char *dsc; /**< description statement */ |
| 398 | const char *ref; /**< reference statement */ |
| 399 | struct lysp_when *when; /**< when statement */ |
| 400 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 401 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 402 | |
| 403 | /* container */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 404 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 405 | const char *presence; /**< presence description */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 406 | struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */ |
| 407 | struct lysp_grp *groupings; /**< list of groupings (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 408 | struct lysp_node *child; /**< list of data nodes (linked list) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 409 | struct lysp_action *actions; /**< list of actions (0-terminated) */ |
| 410 | struct lysp_notif *notifs; /**< list of notifications (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 411 | }; |
| 412 | |
| 413 | struct lysp_node_leaf { |
| 414 | uint16_t nodetype; /**< LYS_LEAF */ |
| 415 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 416 | struct lysp_node *next; /**< pointer to the next sibling node (NULL if there is no one) */ |
| 417 | const char *name; /**< node name (mandatory) */ |
| 418 | const char *dsc; /**< description statement */ |
| 419 | const char *ref; /**< reference statement */ |
| 420 | struct lysp_when *when; /**< when statement */ |
| 421 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 422 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 423 | |
| 424 | /* leaf */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 425 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 426 | struct lysp_type type; /**< type of the leaf node (mandatory) */ |
| 427 | const char *units; /**< units of the leaf's type */ |
| 428 | const char *dflt; /**< default value */ |
| 429 | }; |
| 430 | |
| 431 | struct lysp_node_leaflist { |
| 432 | uint16_t nodetype; /**< LYS_LEAFLIST */ |
| 433 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 434 | struct lysp_node *next; /**< pointer to the next sibling node (NULL if there is no one) */ |
| 435 | const char *name; /**< node name (mandatory) */ |
| 436 | const char *dsc; /**< description statement */ |
| 437 | const char *ref; /**< reference statement */ |
| 438 | struct lysp_when *when; /**< when statement */ |
| 439 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 440 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 441 | |
| 442 | /* leaf-list */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 443 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 444 | struct lysp_type type; /**< type of the leaf node (mandatory) */ |
| 445 | const char *units; /**< units of the leaf's type */ |
| 446 | const char **dflts; /**< list of default values (NULL-terminated) */ |
| 447 | uint32_t min; /**< min-elements constraint */ |
| 448 | uint32_t max; /**< max-elements constraint, 0 means unbounded */ |
| 449 | }; |
| 450 | |
| 451 | struct lysp_node_list { |
| 452 | uint16_t nodetype; /**< LYS_LIST */ |
| 453 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 454 | struct lysp_node *next; /**< pointer to the next sibling node (NULL if there is no one) */ |
| 455 | const char *name; /**< node name (mandatory) */ |
| 456 | const char *dsc; /**< description statement */ |
| 457 | const char *ref; /**< reference statement */ |
| 458 | struct lysp_when *when; /**< when statement */ |
| 459 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 460 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 461 | |
| 462 | /* list */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 463 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 464 | const char *key; /**< keys specification */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 465 | struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */ |
| 466 | struct lysp_grp *groupings; /**< list of groupings (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 467 | struct lysp_node *child; /**< list of data nodes (linked list) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 468 | struct lysp_action *actions; /**< list of actions (0-terminated) */ |
| 469 | struct lysp_notif *notifications;/**< list of notifications (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 470 | const char **uniques; /**< list of uniques specifications (NULL-terminated) */ |
| 471 | uint32_t min; /**< min-elements constraint */ |
| 472 | uint32_t max; /**< max-elements constraint, 0 means unbounded */ |
| 473 | }; |
| 474 | |
| 475 | struct lysp_node_choice { |
| 476 | uint16_t nodetype; /**< LYS_CHOICE */ |
| 477 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 478 | struct lysp_node *next; /**< pointer to the next sibling node (NULL if there is no one) */ |
| 479 | const char *name; /**< node name (mandatory) */ |
| 480 | const char *dsc; /**< description statement */ |
| 481 | const char *ref; /**< reference statement */ |
| 482 | struct lysp_when *when; /**< when statement */ |
| 483 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 484 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 485 | |
| 486 | /* choice */ |
| 487 | struct lysp_node *child; /**< list of data nodes (linked list) */ |
| 488 | const char* dflt; /**< default case */ |
| 489 | }; |
| 490 | |
| 491 | struct lysp_node_case { |
| 492 | uint16_t nodetype; /**< LYS_CASE */ |
| 493 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 494 | struct lysp_node *next; /**< pointer to the next sibling node (NULL if there is no one) */ |
| 495 | const char *name; /**< node name (mandatory) */ |
| 496 | const char *dsc; /**< description statement */ |
| 497 | const char *ref; /**< reference statement */ |
| 498 | struct lysp_when *when; /**< when statement */ |
| 499 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 500 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 501 | |
| 502 | /* case */ |
| 503 | struct lysp_node *child; /**< list of data nodes (linked list) */ |
| 504 | }; |
| 505 | |
| 506 | struct lysp_node_anydata { |
| 507 | uint16_t nodetype; /**< LYS_ANYXML || LYS_ANYDATA */ |
| 508 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 509 | struct lysp_node *next; /**< pointer to the next sibling node (NULL if there is no one) */ |
| 510 | const char *name; /**< node name (mandatory) */ |
| 511 | const char *dsc; /**< description statement */ |
| 512 | const char *ref; /**< reference statement */ |
| 513 | struct lysp_when *when; /**< when statement */ |
| 514 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 515 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 516 | |
| 517 | /* anyxml/anydata */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 518 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 519 | }; |
| 520 | |
| 521 | struct lysp_node_uses { |
| 522 | uint16_t nodetype; /**< LYS_ANYXML || LYS_ANYDATA */ |
| 523 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 524 | struct lysp_node *next; /**< pointer to the next sibling node (NULL if there is no one) */ |
| 525 | const char *name; /**< grouping name reference (mandatory) */ |
| 526 | const char *dsc; /**< description statement */ |
| 527 | const char *ref; /**< reference statement */ |
| 528 | struct lysp_when *when; /**< when statement */ |
| 529 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 530 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 531 | |
| 532 | /* uses */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 533 | struct lysp_refine *refines; /**< list of uses's refines (0-terminated) */ |
| 534 | struct lysp_augment *augments; /**< list of uses's augment (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 535 | }; |
| 536 | |
| 537 | /** |
| 538 | * @brief YANG input-stmt and output-stmt |
| 539 | */ |
| 540 | struct lysp_action_inout { |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 541 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
| 542 | struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */ |
| 543 | struct lysp_grp *groupings; /**< list of groupings (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 544 | struct lysp_node *data; /**< list of data nodes (linked list) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 545 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 546 | }; |
| 547 | |
| 548 | /** |
| 549 | * @brief YANG rpc-stmt and action-stmt |
| 550 | */ |
| 551 | struct lysp_action { |
| 552 | const char *name; /**< grouping name reference (mandatory) */ |
| 553 | const char *dsc; /**< description statement */ |
| 554 | const char *ref; /**< reference statement */ |
| 555 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 556 | struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */ |
| 557 | struct lysp_grp *groupings; /**< list of groupings (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 558 | struct lysp_action_inout input; /**< RPC's/Action's input */ |
| 559 | struct lysp_action_inout output; /**< RPC's/Action's output */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 560 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 561 | uint16_t flags; /**< [schema node flags](@ref snodeflags) */ |
| 562 | }; |
| 563 | |
| 564 | /** |
| 565 | * @brief YANG notification-stmt |
| 566 | */ |
| 567 | struct lysp_notif { |
| 568 | const char *name; /**< grouping name reference (mandatory) */ |
| 569 | const char *dsc; /**< description statement */ |
| 570 | const char *ref; /**< reference statement */ |
| 571 | const char **iffeatures; /**< list of if-feature expressions (NULL-terminated) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 572 | struct lysp_restr *musts; /**< list of must restrictions (0-terminated) */ |
| 573 | struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */ |
| 574 | struct lysp_grp *groupings; /**< list of groupings (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 575 | struct lysp_node *data; /**< list of data nodes (linked list) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 576 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 577 | uint16_t flags; /**< [schema node flags](@ref snodeflags) - only LYS_STATUS_* values are allowed */ |
| 578 | }; |
| 579 | |
| 580 | /** |
Radek Krejci | f0fceb6 | 2018-09-05 14:58:45 +0200 | [diff] [blame] | 581 | * @brief supported YANG schema version values |
| 582 | */ |
| 583 | typedef enum LYS_VERSION { |
| 584 | LYS_VERSION_UNDEF = 0, /**< no specific version, YANG 1.0 as default */ |
| 585 | LYS_VERSION_1_0 = 1, /**< YANG 1.0 */ |
| 586 | LYS_VERSION_1_1 = 2 /**< YANG 1.1 */ |
| 587 | } LYS_VERSION; |
| 588 | |
| 589 | /** |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 590 | * @brief Printable YANG schema tree structure representing YANG module. |
| 591 | * |
| 592 | * Simple structure corresponding to the YANG format. The schema is only syntactically validated. |
| 593 | */ |
| 594 | struct lysp_module { |
| 595 | struct ly_ctx *ctx; /**< libyang context of the module (mandatory) */ |
| 596 | const char *name; /**< name of the module (mandatory) */ |
| 597 | const char *filepath; /**< path, if the schema was read from a file, NULL in case of reading from memory */ |
| 598 | union { |
| 599 | /* module */ |
Michal Vasko | d5927ca | 2018-09-07 15:05:32 +0200 | [diff] [blame^] | 600 | const char *ns; /**< namespace of the module (module - mandatory) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 601 | /* submodule */ |
Michal Vasko | d5927ca | 2018-09-07 15:05:32 +0200 | [diff] [blame^] | 602 | const char *belongsto; /**< belongs to parent module (submodule - mandatory) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 603 | }; |
Michal Vasko | d5927ca | 2018-09-07 15:05:32 +0200 | [diff] [blame^] | 604 | const char *prefix; /**< module prefix or submodule belongsto prefix of main module (mandatory) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 605 | struct lysp_import *imports; /**< list of imported modules (0-terminated) */ |
| 606 | struct lysp_include *includes; /**< list of included submodules (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 607 | const char *org; /**< party/company responsible for the module */ |
| 608 | const char *contact; /**< contact information for the module */ |
| 609 | const char *dsc; /**< description of the module */ |
| 610 | const char *ref; /**< cross-reference for the module */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 611 | struct lysp_revision *revs; /**< list of the module revisions (0-terminated), the first revision |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 612 | in the list is always the last (newest) revision of the module */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 613 | struct lysp_ext *extensions; /**< list of extension statements (0-terminated) */ |
| 614 | struct lysp_feature *features; /**< list of feature definitions (0-terminated) */ |
| 615 | struct lysp_ident *identities; /**< list of identities (0-terminated) */ |
| 616 | struct lysp_tpdf *typedefs; /**< list of typedefs (0-terminated) */ |
| 617 | struct lysp_grp *groupings; /**< list of groupings (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 618 | struct lysp_node *data; /**< list of module's top-level data nodes (linked list) */ |
Michal Vasko | bc2559f | 2018-09-07 10:17:50 +0200 | [diff] [blame] | 619 | struct lysp_augment *augments; /**< list of augments (0-terminated) */ |
| 620 | struct lysp_action *rpcs; /**< list of RPCs (0-terminated) */ |
| 621 | struct lysp_notif *notifs; /**< list of notifications (0-terminated) */ |
| 622 | struct lysp_deviation *deviations; /**< list of deviations (0-terminated) */ |
| 623 | struct lysp_ext_instance *exts; /**< list of the extension instances (0-terminated) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 624 | |
Radek Krejci | f0fceb6 | 2018-09-05 14:58:45 +0200 | [diff] [blame] | 625 | uint8_t submodule:1; /**< flag to distinguish main modules and submodules */ |
| 626 | uint8_t deviated:1; /**< flag if the module is deviated by another module */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 627 | uint8_t implemented:1; /**< flag if the module is implemented, not just imported */ |
| 628 | uint8_t latest_revision:1; /**< flag if the module was loaded without specific revision and is |
| 629 | the latest revision found */ |
Radek Krejci | f0fceb6 | 2018-09-05 14:58:45 +0200 | [diff] [blame] | 630 | uint8_t version:4; /**< yang-version (LYS_VERSION values) */ |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 631 | }; |
| 632 | |
| 633 | /** |
| 634 | * @brief Compiled YANG schema tree structure representing YANG module. |
| 635 | * |
| 636 | * Semantically validated YANG schema tree for data tree parsing. |
| 637 | * Contains only the necessary information for the data validation. |
| 638 | */ |
| 639 | struct lysc_module { |
| 640 | }; |
| 641 | |
| 642 | /** |
Radek Krejci | 0af5f5d | 2018-09-07 15:00:30 +0200 | [diff] [blame] | 643 | * @brief Compiled YANG data node |
| 644 | */ |
| 645 | struct lysc_node { |
| 646 | }; |
| 647 | |
| 648 | /** |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 649 | * @brief Available YANG schema tree structures representing YANG module. |
| 650 | */ |
| 651 | struct lys_module { |
| 652 | struct lysp_module *parsed; /**< Simply parsed (unresolved) YANG schema tree */ |
| 653 | struct lysc_module *compiled; /**< Compiled and fully validated YANG schema tree for data parsing */ |
| 654 | }; |
| 655 | |
| 656 | /** @} */ |
| 657 | |
| 658 | #endif /* LY_TREE_SCHEMA_H_ */ |