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