libyang  0.16.105
YANG data modeling language library
Schemas

Schema is an internal libyang's representation of a YANG data model. Each schema is connected with its context and loaded using parser functions. It means, that the schema cannot be created (nor changed) programmatically. In libyang, schemas are used only to access data model definitions.

Schema tree nodes are able to hold private objects (via a pointer to a structure, function, variable, ...) used by a caller application. Such an object can be assigned to a specific node using lys_set_private() function. Note that the object is not freed by libyang when the context is being destroyed. So the caller is responsible for freeing the provided structure after the context is destroyed or the private pointer is set to NULL in appropriate schema nodes where the object was previously set. This can be automated via destructor function to free these private objects. The destructor is passed to the ly_ctx_destroy() function. On the other hand, freeing the object while the schema tree is still in use can lead to a segmentation fault.

Note
There are many functions to access information from the schema trees. Details are available in the Schema Tree module.

For information about difference between implemented and imported modules, see the context description.

Functions List (not assigned to above subsections)

  • lys_getnext()
  • lys_parent()
  • lys_module()
  • lys_node_module()
  • lys_set_private()
  • lys_set_implemented()
  • lys_set_disabled()
  • lys_set_enabled()