1 /** 2 * @file tree_internal.h 3 * @author Radek Krejci <rkrejci@cesnet.cz> 4 * @brief libyang internal functions for manipulating with the data model and 5 * data trees. 6 * 7 * Copyright (c) 2015 CESNET, z.s.p.o. 8 * 9 * This source code is licensed under BSD 3-Clause License (the "License"). 10 * You may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * https://opensource.org/licenses/BSD-3-Clause 14 */ 15 16 #ifndef LY_TREE_INTERNAL_H_ 17 #define LY_TREE_INTERNAL_H_ 18 19 #include <stdint.h> 20 21 #include "libyang.h" 22 #include "tree_schema.h" 23 #include "tree_data.h" 24 #include "resolve.h" 25 26 /* this is used to distinguish lyxml_elem * from a YANG temporary parsing structure, the first byte is compared */ 27 #define LY_YANG_STRUCTURE_FLAG 0x80 28 29 /** 30 * @brief YANG namespace 31 */ 32 #define LY_NSYANG "urn:ietf:params:xml:ns:yang:1" 33 34 /** 35 * @brief YIN namespace 36 */ 37 #define LY_NSYIN "urn:ietf:params:xml:ns:yang:yin:1" 38 39 /** 40 * @brief NETCONF namespace 41 */ 42 #define LY_NSNC "urn:ietf:params:xml:ns:netconf:base:1.0" 43 44 /** 45 * @brief NACM namespace 46 */ 47 #define LY_NSNACM "urn:ietf:params:xml:ns:yang:ietf-netconf-acm" 48 49 /** 50 * @brief internal parser flag for actions and inline notifications 51 */ 52 #define LYD_OPT_ACT_NOTIF 0x100 53 54 /** 55 * @brief Internal list of built-in types 56 */ 57 extern struct lys_tpdf *ly_types[LY_DATA_TYPE_COUNT]; 58 59 /** 60 * @brief Internal structure for data node sorting. 61 */ 62 struct lyd_node_pos { 63 struct lyd_node *node; 64 uint32_t pos; 65 }; 66 67 /** 68 * @brief Internal structure for LYB parser/printer. 69 */ 70 struct lyb_state { 71 size_t *written; 72 size_t *position; 73 uint8_t *inner_chunks; 74 int used; 75 int size; 76 const struct lys_module **models; 77 int mod_count; 78 struct ly_ctx *ctx; 79 80 /* LYB printer only */ 81 struct { 82 struct lys_node *first_sibling; 83 struct hash_table *ht; 84 } *sib_ht; 85 int sib_ht_count; 86 }; 87 88 /* struct lyb_state allocation step */ 89 #define LYB_STATE_STEP 4 90 91 /** 92 * LYB schema hash constants 93 * 94 * Hash is divided to collision ID and hash itself. 95 * 96 * First bits are collision ID until 1 is found. The rest is truncated 32b hash. 97 * 1xxx xxxx - collision ID 0 (no collisions) 98 * 01xx xxxx - collision ID 1 (collision ID 0 hash collided) 99 * 001x xxxx - collision ID 2 ... 100 */ 101 102 /* Number of bits the whole hash will take (including hash collision ID) */ 103 #define LYB_HASH_BITS 8 104 105 /* Masking 32b hash (collision ID 0) */ 106 #define LYB_HASH_MASK 0x7f 107 108 /* Type for storing the whole hash (used only internally, publicly defined directly) */ 109 #define LYB_HASH uint8_t 110 111 /* Need to move this first >> collision number (from 0) to get collision ID hash part */ 112 #define LYB_HASH_COLLISION_ID 0x80 113 114 /* How many bytes are reserved for one data chunk SIZE (8B is maximum) */ 115 #define LYB_SIZE_BYTES 1 116 117 /* Maximum size that will be written into LYB_SIZE_BYTES (must be large enough) */ 118 #define LYB_SIZE_MAX UINT8_MAX 119 120 /* How many bytes are reserved for one data chunk inner chunk count */ 121 #define LYB_INCHUNK_BYTES 1 122 123 /* Maximum size that will be written into LYB_INCHUNK_BYTES (must be large enough) */ 124 #define LYB_INCHUNK_MAX UINT8_MAX 125 126 /* Just a helper macro */ 127 #define LYB_META_BYTES (LYB_INCHUNK_BYTES + LYB_SIZE_BYTES) 128 129 /* Type large enough for all meta data */ 130 #define LYB_META uint16_t 131 132 LYB_HASH lyb_hash(struct lys_node *sibling, uint8_t collision_id); 133 134 int lyb_has_schema_model(struct lys_node *sibling, const struct lys_module **models, int mod_count); 135 136 /** 137 * Macros to work with ::lyd_node#when_status 138 * +--- bit 1 - some when-stmt connected with the node (resolve_applies_when() is true) 139 * |+-- bit 2 - when-stmt's condition is resolved and it is true 140 * ||+- bit 3 - when-stmt's condition is resolved and it is false 141 * XXX 142 * 143 * bit 1 is set when the node is created 144 * if none of bits 2 and 3 is set, the when condition is not yet resolved 145 */ 146 #define LYD_WHEN 0x04 147 #define LYD_WHEN_TRUE 0x02 148 #define LYD_WHEN_FALSE 0x01 149 #define LYD_WHEN_DONE(status) (!((status) & LYD_WHEN) || ((status) & (LYD_WHEN_TRUE | LYD_WHEN_FALSE))) 150 151 /** 152 * @brief Type flag for an unresolved type in a grouping. 153 */ 154 #define LY_VALUE_UNRESGRP 0x80 155 156 #ifdef LY_ENABLED_CACHE 157 158 /** 159 * @brief Minimum number of children for the parent to create a hash table for them. 160 */ 161 # define LY_CACHE_HT_MIN_CHILDREN 4 162 163 int lyd_hash(struct lyd_node *node); 164 165 void lyd_insert_hash(struct lyd_node *node); 166 167 void lyd_unlink_hash(struct lyd_node *node, struct lyd_node *orig_parent); 168 #endif 169 170 /** 171 * @brief Create submodule structure by reading data from memory. 172 * 173 * @param[in] module Schema tree where to connect the submodule, belongs-to value must match. 174 * @param[in] data String containing the submodule specification in the given \p format. 175 * @param[in] format Format of the data to read. 176 * @param[in] unres list of unresolved items 177 * @return Created submodule structure or NULL in case of error. 178 */ 179 struct lys_submodule *lys_sub_parse_mem(struct lys_module *module, const char *data, LYS_INFORMAT format, 180 struct unres_schema *unres); 181 182 /** 183 * @brief Create submodule structure by reading data from file descriptor. 184 * 185 * \note Current implementation supports only reading data from standard (disk) file, not from sockets, pipes, etc. 186 * 187 * @param[in] module Schema tree where to connect the submodule, belongs-to value must match. 188 * @param[in] fd File descriptor of a regular file (e.g. sockets are not supported) containing the submodule 189 * specification in the given \p format. 190 * @param[in] format Format of the data to read. 191 * @param[in] unres list of unresolved items 192 * @return Created submodule structure or NULL in case of error. 193 */ 194 struct lys_submodule *lys_sub_parse_fd(struct lys_module *module, int fd, LYS_INFORMAT format, struct unres_schema *unres); 195 196 /** 197 * @brief Free the submodule structure 198 * 199 * @param[in] submodule The structure to free. Do not use the pointer after calling this function. 200 * @param[in] private_destructor Optional destructor function for private objects assigned 201 * to the nodes via lys_set_private(). If NULL, the private objects are not freed by libyang. 202 */ 203 void lys_submodule_free(struct lys_submodule *submodule, void (*private_destructor)(const struct lys_node *node, void *priv)); 204 205 /** 206 * @brief Add child schema tree node at the end of the parent's child list. 207 * 208 * If the child is connected somewhere (has a parent), it is completely 209 * unlinked and none of the following conditions applies. 210 * If the child has prev sibling(s), they are ignored (child is added at the 211 * end of the child list). 212 * If the child has next sibling(s), all of them are connected with the parent. 213 * 214 * @param[in] parent Parent node where the \p child will be added. 215 * @param[in] module Module where the \p child will be added if the \p parent 216 * parameter is NULL (case of top-level elements). The parameter does not change 217 * the module of the \p child element. If the \p parent parameter is present, 218 * the \p module parameter is ignored. 219 * @param[in] child The schema tree node to be added. 220 * @param[in] options Parsing options. Only relevant when creating a shorthand case. 221 * @return 0 on success, nonzero else 222 */ 223 int lys_node_addchild(struct lys_node *parent, struct lys_module *module, struct lys_node *child, int options); 224 225 /** 226 * @brief Find a valid grouping definition relative to a node. 227 * 228 * Valid definition means a sibling of \p start or a sibling of any of \p start 's parents. 229 * 230 * @param[in] name Name of the searched grouping. 231 * @param[in] start Definition must be valid (visible) for this node. 232 * @return Matching valid grouping or NULL. 233 */ 234 struct lys_node_grp *lys_find_grouping_up(const char *name, struct lys_node *start); 235 236 /** 237 * @brief Check that the \p node being connected into the \p parent has a unique name (identifier). 238 * 239 * Function is performed also as part of lys_node_addchild(). 240 * 241 * @param[in] node The schema tree node to be checked. 242 * @param[in] parent Parent node where the \p child is supposed to be added. 243 * @param[in] module Module where the \p child is supposed to be added if the \p parent 244 * parameter is NULL (case of top-level elements). The parameter does not change 245 * the module of the \p child element. If the \p parent parameter is present, 246 * the \p module parameter is ignored. 247 * @return 0 on success, nonzero else 248 */ 249 int lys_check_id(struct lys_node *node, struct lys_node *parent, struct lys_module *module); 250 251 /** 252 * @brief Get know if the node contains must or when with XPath expression 253 * 254 * @param[in] node Node to examine. 255 * @return 1 if contains, 0 otherwise 256 */ 257 int lys_has_xpath(const struct lys_node *node); 258 259 /** 260 * @brief Learn if \p type is defined in the local module or from an import. 261 * 262 * @param[in] type Type to examine. 263 * @return non-zero if local, 0 if from an import. 264 */ 265 int lys_type_is_local(const struct lys_type *type); 266 267 /** 268 * @brief Create a copy of the specified schema tree \p node 269 * 270 * @param[in] module Target module for the duplicated node. 271 * @param[in] parent Schema tree node where the node is being connected, NULL in case of top level \p node. 272 * @param[in] node Schema tree node to be duplicated. 273 * @param[in] unres list of unresolved items 274 * @param[in] shallow Whether to copy children and connect to parent/module too. 275 * @return Created copy of the provided schema \p node. 276 */ 277 struct lys_node *lys_node_dup(struct lys_module *module, struct lys_node *parent, const struct lys_node *node, 278 struct unres_schema *unres, int shallow); 279 280 /** 281 * @brief duplicate the list of extension instances. 282 * 283 * @param[in] ctx Context to store errors in. 284 * @param[in] mod Module where we are 285 * @param[in] orig list of the extension instances to duplicate, the size of the array must correspond with \p size 286 * @param[in] size number of items in \p old array to duplicate 287 * @param[in] parent Parent structure of the new extension instances list 288 * @param[in] parent_type Type of the provide \p parent * 289 * @param[in,out] new Address where to store the created list of duplicated extension instances 290 * @param[in] shallow Whether to copy children and connect to parent/module too. 291 * @param[in] unres list of unresolved items 292 * 293 */ 294 int lys_ext_dup(struct ly_ctx *ctx, struct lys_module *mod, struct lys_ext_instance **orig, uint8_t size, void *parent, 295 LYEXT_PAR parent_type, struct lys_ext_instance ***new, int shallow, struct unres_schema *unres); 296 297 /** 298 * @brief Iterate over the specified type of the extension instances 299 * 300 * @param[in] ext Array of extensions to explore 301 * @param[in] ext_size Size of the provided \p ext array 302 * @param[in] start Index in the \p ext array where to start searching (first call with 0, the consequent calls with 303 * the returned index increased by 1, unless the returned index is -1) 304 * @param[in] substmt Type of the extension (its belongins to the specific substatement) to iterate, use 305 * #LYEXT_SUBSTMT_ALL to go through all the extensions in the array 306 * @result index in the ext, -1 if not present 307 */ 308 int lys_ext_iter(struct lys_ext_instance **ext, uint8_t ext_size, uint8_t start, LYEXT_SUBSTMT substmt); 309 310 /** 311 * @brief free the array of the extension instances 312 */ 313 void lys_extension_instances_free(struct ly_ctx *ctx, struct lys_ext_instance **e, unsigned int size, 314 void (*private_destructor)(const struct lys_node *node, void *priv)); 315 316 /** 317 * @brief Check that leafref and its target have allowed config combination and there are no cyclic references. 318 * 319 * @param[in] leafref_target Leaf that is \p leafref's target. 320 * @param[in] leafref Leaf or leaflist of type #LY_TYPE_LEAFREF referring \p leafref_target. 321 * @return 0 on success, -1 on error. 322 */ 323 int lys_leaf_check_leafref(struct lys_node_leaf *leafref_target, struct lys_node *leafref); 324 325 /** 326 * @brief Free a schema when condition 327 * 328 * @param[in] libyang context where the schema of the ondition is used. 329 * @param[in] w When structure to free. 330 * @param[in] private_destructor Destructor for priv member in extension instances 331 */ 332 void lys_when_free(struct ly_ctx *ctx, struct lys_when *w, 333 void (*private_destructor)(const struct lys_node *node, void *priv)); 334 335 /** 336 * @brief Free the schema tree restriction (must, ...) structure content 337 * 338 * @param[in] ctx libyang context where the schema of the restriction is used. 339 * @param[in] restr The restriction structure to free. The function actually frees only 340 * the content of the structure, so after using this function, caller is supposed to 341 * use free(restr). It is done to free the content of structures being allocated as 342 * part of array, in that case the free() is used on the whole array. 343 * @param[in] private_destructor Destructor for priv member in extension instances 344 */ 345 void lys_restr_free(struct ly_ctx *ctx, struct lys_restr *restr, 346 void (*private_destructor)(const struct lys_node *node, void *priv)); 347 348 /** 349 * @brief Free the schema tree type structure content 350 * 351 * @param[in] ctx libyang context where the schema of the type is used. 352 * @param[in] restr The type structure to free. The function actually frees only 353 * the content of the structure, so after using this function, caller is supposed to 354 * use free(type). It is done to free the content of structures being allocated as 355 * part of array, in that case the free() is used on the whole array. 356 * @param[in] private_destructor Destructor for priv member in extension instances 357 */ 358 void lys_type_free(struct ly_ctx *ctx, struct lys_type *type, 359 void (*private_destructor)(const struct lys_node *node, void *priv)); 360 361 /** 362 * @brief Unlink the schema node from the tree. 363 * 364 * @param[in] node Schema tree node to unlink. 365 */ 366 void lys_node_unlink(struct lys_node *node); 367 368 /** 369 * @brief Free the schema node structure, includes unlinking it from the tree 370 * 371 * @param[in] ctx libang context to use, @p node may not have it filled (in groupings, for example). 372 * @param[in] node Schema tree node to free. Do not use the pointer after calling this function. 373 * @param[in] private_destructor Optional destructor function for private objects assigned 374 * to the nodes via lys_set_private(). If NULL, the private objects are not freed by libyang. 375 * @param[in] shallow Whether to do a shallow free only (on a shallow copy of a node). 376 */ 377 void lys_node_free(struct ly_ctx *ctx, struct lys_node *node, 378 void (*private_destructor)(const struct lys_node *node, void *priv), int shallow); 379 380 /** 381 * @brief Free (and unlink it from the context) the specified schema. 382 * 383 * It is dangerous to call this function on schemas already placed into the context's 384 * list of modules - there can be many references from other modules and data instances. 385 * 386 * @param[in] module Data model to free. 387 * @param[in] private_destructor Optional destructor function for private objects assigned 388 * to the nodes via lys_set_private(). If NULL, the private objects are not freed by libyang. 389 * @param[in] free_subs Whether to free included submodules. 390 * @param[in] remove_from_ctx Whether to remove this model from context. Always use 1 except 391 * when removing all the models (in ly_ctx_destroy()). 392 */ 393 void lys_free(struct lys_module *module, void (*private_destructor)(const struct lys_node *node, void *priv), 394 int free_subs, int remove_from_ctx); 395 396 /** 397 * @brief Create a data container knowing it's schema node. 398 * 399 * @param[in] parent Data parent of the new node. 400 * @param[in] schema Schema node of the new node. 401 * @param[in] dflt Set dflt flag in the created data nodes 402 * @return New node, NULL on error. 403 */ 404 struct lyd_node *_lyd_new(struct lyd_node *parent, const struct lys_node *schema, int dflt); 405 406 /** 407 * @brief Find the parent node of an attribute. 408 * 409 * @param[in] root Root element of the data tree with the attribute. 410 * @param[in] attr Attribute to find. 411 * 412 * @return Parent of \p attr, NULL if not found. 413 */ 414 const struct lyd_node *lyd_attr_parent(const struct lyd_node *root, struct lyd_attr *attr); 415 416 /** 417 * @brief Internal version of lyd_value_type(). 418 * 419 * @param[in] node Schema node of the value. 420 * @param[in] value String value to get the type of. 421 * @param[in] local_mod Local module for the value prefix resolution in case it is a default value (defined in schema). 422 * Otherwise set to NULL. 423 * @param[out] type Optionally the resolved type of the value. 424 * @return EXIT_SUCCESS on success, EXIT_FAILURE on error. 425 */ 426 int lyd_value_type_internal(struct lys_node *node, const char *value, const struct lys_module *local_mod, 427 struct lys_type **type); 428 429 /** 430 * @brief Internal version of lyd_unlink(). 431 * 432 * @param[in] node Node to unlink. 433 * @param[in] permanent 0 - the node will be linked back, 434 * 1 - the node is premanently unlinked, 435 * 2 - the node is being freed. 436 * 437 * @return EXIT_SUCCESS on success, EXIT_FAILURE on error. 438 */ 439 int lyd_unlink_internal(struct lyd_node *node, int permanent); 440 441 /** 442 * @brief Get the canonical value. 443 * 444 * @param[in] schema Leaf or leaf-list schema node of the value. 445 * @param[in] val_str String value to transform. 446 * @param[in] val_str_len String value length. 447 * @return Canonical value (must be freed), NULL on error. 448 */ 449 char *lyd_make_canonical(const struct lys_node *schema, const char *val_str, int val_str_len); 450 451 /** 452 * @brief Internal version of lyd_insert() and lyd_insert_sibling(). 453 * 454 * @param[in] invalidate Whether to invalidate any nodes. Set 0 only if linking back some temporarily internally unlinked nodes. 455 */ 456 int lyd_insert_common(struct lyd_node *parent, struct lyd_node **sibling, struct lyd_node *node, int invalidate); 457 458 /** 459 * @brief Internal version of lyd_insert_before() and lyd_insert_after(). 460 * 461 * @param[in] invalidate Whether to invalidate any nodes. Set 0 only if linking back some temporarily internally unlinked nodes. 462 */ 463 int lyd_insert_nextto(struct lyd_node *sibling, struct lyd_node *node, int before, int invalidate); 464 465 /** 466 * @brief Find a specific sibling. Does not log. 467 * 468 * Since \p mod_name is mandatory, augments are handled. 469 * 470 * @param[in] siblings Siblings to consider. They are first adjusted to 471 * point to the first sibling. 472 * @param[in] mod_name Module name, mandatory. 473 * @param[in] mod_name_len Module name length. 474 * @param[in] name Node name, mandatory. 475 * @param[in] nam_len Node name length. 476 * @param[in] type ORed desired type of the node. 0 means any type. 477 * Does not return groupings, uses, and augments (but can return augment nodes). 478 * @param[out] ret Pointer to the node of the desired type. Can be NULL. 479 * 480 * @return EXIT_SUCCESS on success, EXIT_FAILURE on forward reference. 481 */ 482 int lys_get_sibling(const struct lys_node *siblings, const char *mod_name, int mod_name_len, const char *name, 483 int nam_len, LYS_NODE type, const struct lys_node **ret); 484 485 /** 486 * @brief Find a specific node that can only appear in the data. Does not log. 487 * 488 * @param[in] mod Main module with the node. Must be set if \p parent == NULL (top-level node). 489 * @param[in] parent Parent of the node. Must be set if \p mod == NULL (nested node). 490 * @param[in] name Node name. 491 * @param[in] nam_len Node \p name length. 492 * @param[in] type ORed desired type of the node. 0 means any (data node) type. 493 * @param[in] getnext_opts lys_getnext() options to use. 494 * @param[out] ret Pointer to the node of the desired type. Can be NULL. 495 * 496 * @return EXIT_SUCCESS on success, EXIT_FAILURE on fail. 497 */ 498 int lys_getnext_data(const struct lys_module *mod, const struct lys_node *parent, const char *name, int nam_len, 499 LYS_NODE type, int getnext_opts, const struct lys_node **ret); 500 501 int lyd_get_unique_default(const char* unique_expr, struct lyd_node *list, const char **dflt); 502 503 int lyd_build_relative_data_path(const struct lys_module *module, const struct lyd_node *node, const char *schema_id, 504 char *buf); 505 506 void lyd_free_value(lyd_val value, LY_DATA_TYPE value_type, uint8_t value_flags, struct lys_type *type, 507 const char *value_str, lyd_val *old_val, LY_DATA_TYPE *old_val_type, uint8_t *old_val_flags); 508 509 int lyd_list_equal(struct lyd_node *node1, struct lyd_node *node2, int with_defaults); 510 511 int lys_make_implemented_r(struct lys_module *module, struct unres_schema *unres); 512 513 /** 514 * @brief Check for (validate) mandatory nodes of a data tree. Checks recursively whole data tree. Requires all when 515 * statement to be solved. 516 * 517 * @param[in] root Data tree to validate. 518 * @param[in] ctx libyang context (for the case when the data tree is empty - i.e. root == NULL). 519 * @param[in] modules Only check mandatory nodes from these modules. If not set, check for all modules in the context. 520 * @param[in] mod_count Number of modules in \p modules. 521 * @param[in] options Standard @ref parseroptions. 522 * @return EXIT_SUCCESS or EXIT_FAILURE. 523 */ 524 int lyd_check_mandatory_tree(struct lyd_node *root, struct ly_ctx *ctx, const struct lys_module **modules, int mod_count, 525 int options); 526 527 /** 528 * @brief Check if the provided node is inside a grouping. 529 * 530 * @param[in] node Schema node to check. 531 * @return 0 as false, 1 as true 532 */ 533 int lys_ingrouping(const struct lys_node *node); 534 535 int unres_data_diff_new(struct unres_data *unres, struct lyd_node *subtree, struct lyd_node *parent, int created); 536 537 void unres_data_diff_rem(struct unres_data *unres, unsigned int idx); 538 539 /** 540 * @brief Process (add/clean) default nodes in the data tree and resolve the unresolved items 541 * 542 * @param[in,out] root Pointer to the root node of the complete data tree, the root node can be NULL if the data tree 543 * is empty 544 * @param[in] options Parser options to know the data tree type, see @ref parseroptions. 545 * @param[in] ctx Context for the case the \p root is empty (in that case \p ctx must not be NULL) 546 * @param[in] modules Only modules that will be traversed when adding default values. 547 * @param[in] mod_count Number of module names in \p modules. 548 * @param[in] data_tree Additional data tree for validating RPC/action/notification. The tree is used to satisfy 549 * possible references to the datastore content. 550 * @param[in] act_notif In case of nested action/notification, the subtree of the action/notification. Note 551 * that in this case the \p root points to the top level data tree node which provides the context 552 * for the nested action/notification 553 * @param[in] unres Unresolved data list, the newly added default nodes may need to add some unresolved items 554 * @param[in] wd Whether to add default values. 555 * @return EXIT_SUCCESS or EXIT_FAILURE 556 */ 557 int lyd_defaults_add_unres(struct lyd_node **root, int options, struct ly_ctx *ctx, const struct lys_module **modules, 558 int mod_count, const struct lyd_node *data_tree, struct lyd_node *act_notif, 559 struct unres_data *unres, int wd); 560 561 void lys_enable_deviations(struct lys_module *module); 562 563 void lys_disable_deviations(struct lys_module *module); 564 565 void lys_sub_module_remove_devs_augs(struct lys_module *module); 566 567 void lys_sub_module_apply_devs_augs(struct lys_module *module); 568 569 int apply_aug(struct lys_node_augment *augment, struct unres_schema *unres); 570 571 void lys_submodule_module_data_free(struct lys_submodule *submodule); 572 573 int lys_copy_union_leafrefs(struct lys_module *mod, struct lys_node *parent, struct lys_type *type, 574 struct lys_type *prev_new, struct unres_schema *unres); 575 576 const struct lys_module *lys_parse_fd_(struct ly_ctx *ctx, int fd, LYS_INFORMAT format, const char *revision, int implement); 577 578 const struct lys_module *lys_parse_mem_(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format, const char *revision, 579 int internal, int implement); 580 581 /** 582 * @brief Get next augment from \p mod augmenting \p aug_target 583 */ 584 struct lys_node_augment *lys_getnext_target_aug(struct lys_node_augment *last, const struct lys_module *mod, 585 const struct lys_node *aug_target); 586 587 LY_STMT lys_snode2stmt(LYS_NODE nodetype); 588 struct lys_node ** lys_child(const struct lys_node *node, LYS_NODE nodetype); 589 590 #endif /* LY_TREE_INTERNAL_H_ */ 591