20 #include "Internal.hpp"
37 std::vector<S_Deviation>
Module::deviation() LY_NEW_LIST(module, deviation, deviation_size,
Deviation);
44 deleter(module->deleter)
46 if (module->type() != 1) {
47 throw std::invalid_argument(
"Attempted to cast a YANG module into a YANG submodule");
51 std::vector<S_Schema_Node> s_vector;
55 s_vector.push_back(std::make_shared<Schema_Node>(iter, deleter));
70 std::string s_strp = strp;
84 std::string s_strp = strp;
99 std::vector<S_Deviation>
Submodule::deviation() LY_NEW_LIST(submodule, deviation, deviation_size,
Deviation);
102 info_binary(info_binary),
117 info_bits(info_bits),
124 info_dec64(info_dec64),
131 info_enum(info_enum),
139 info_enums(info_enums),
146 info_ident(info_ident),
153 info_inst(info_inst),
166 info_lref(info_lref),
181 info_union(info_union),
202 return std::make_shared<Type_Info_Num>(&info->
num, deleter);
217 S_Tpdf
Type::der() {
return type->
der ? std::make_shared<Tpdf>(type->der, deleter) :
nullptr;};
222 iffeature(iffeature),
232 ext_instance(ext_instance),
252 S_Schema_Node Schema_Node::
child() LY_NEW(node,
child, Schema_Node);
253 S_Schema_Node Schema_Node::
next() LY_NEW(node,
next, Schema_Node);
254 S_Schema_Node Schema_Node::
prev() LY_NEW(node,
prev, Schema_Node);
255 std::
string Schema_Node::path(
int options) {
256 char *path =
nullptr;
263 std::string s_path = path;
268 std::vector<S_Schema_Node> s_vector;
272 s_vector.push_back(std::make_shared<Schema_Node>(iter, deleter));
284 S_Deleter new_deleter = std::make_shared<Deleter>(set, deleter);
285 return std::make_shared<Set>(set, new_deleter);
295 return std::make_shared<Set>(set, deleter);
304 return std::make_shared<Set>(set, deleter);
307 std::vector<S_Schema_Node> s_vector;
311 s_vector.push_back(std::make_shared<Schema_Node>(elem, deleter));
317 std::vector<S_Schema_Node> s_vector;
321 s_vector.push_back(std::make_shared<Schema_Node>(elem, deleter));
331 struct lys_node_container *node_container = (
struct lys_node_container *)node;
332 return node_container->
must ? std::make_shared<Restr>(node_container->
must, deleter) :
nullptr;
336 return node_container->
tpdf ? std::make_shared<Tpdf>(node_container->
tpdf, deleter) :
nullptr;
342 struct lys_node_choice *node_choice = (
struct lys_node_choice *)node;
343 return node_choice->
dflt ? std::make_shared<Schema_Node>(node_choice->
dflt, deleter) :
nullptr;
348 S_Type
Schema_Node_Leaf::type() {
return std::make_shared<Type>(&((
struct lys_node_leaf *)node)->type, deleter);}
353 return list ? std::make_shared<Schema_Node_List>((
struct lys_node *) list, deleter) :
nullptr;
359 struct lys_node_leaflist *node_leaflist = (
struct lys_node_leaflist *)node;
360 LY_NEW_STRING_LIST(node_leaflist, dflt,
dflt_size);
370 auto list = (
struct lys_node_list *) node;
372 std::vector<S_Schema_Node_Leaf> s_vector;
374 for (uint8_t i = 0; i < list->keys_size; i++) {
375 s_vector.push_back(std::make_shared<Schema_Node_Leaf>((
struct lys_node *) list->keys[i], deleter));
390 auto uses = (
struct lys_node_uses *) node;
392 std::vector<S_Schema_Node_Augment> s_vector;
394 for (uint8_t i = 0; i < uses->augment_size; i++) {
395 s_vector.push_back(std::make_shared<Schema_Node_Augment>((
struct lys_node *) &uses->augment[i], deleter));
402 return uses->grp ? std::make_shared<Schema_Node_Grp>(node, deleter) :
nullptr;
425 When::When(struct
lys_when *when, S_Deleter deleter):
454 target_type(target_type),
468 std::vector<S_Restr>
Refine::must() LY_NEW_LIST(refine, must, must_size,
Restr);
469 S_Refine_Mod
Refine::mod() {
return std::make_shared<Refine_Mod>(refine->mod, refine->target_type, deleter);};
477 S_Restr
Deviate::must() {
return deviate->
must ? std::make_shared<Restr>(deviate->must, deleter) :
nullptr;};
482 deviation(deviation),
487 std::vector<S_Deviate>
Deviation::deviate() LY_NEW_LIST(deviation, deviate, deviate_size,
Deviate);
Type_Enum(struct lys_type_enum *info_enum, S_Deleter deleter)
struct lys_module * module
Common structure representing single YANG data statement describing.
Schema leaf node structure.
S_Type_Info_Enums enums()
Ident(struct lys_ident *ident, S_Deleter deleter)
Tpdf(struct lys_tpdf *tpdf, S_Deleter deleter)
Schema grouping node structure.
std::vector< S_Type_Enum > enm()
int lys_iffeature_value(const struct lys_iffeature *iff)
Learn how the if-feature statement currently evaluates.
struct lys_type_info_bits bits
S_Schema_Node_Leaf target()
struct lys_type_info_inst inst
Submodule schema node structure that can be included into a YANG module.
Unique(struct lys_unique *unique, S_Deleter deleter)
Schema choice node structure.
std::vector< S_Ext_Instance > ext()
struct lys_type_info_num num
struct lys_unique * unique
Module(struct lys_module *module, S_Deleter deleter)
std::vector< S_Schema_Node > tree_for()
struct lys_restr * patterns
struct lys_refine_mod_list list
std::vector< S_Ext_Instance > ext()
Type_Bit(struct lys_type_bit *info_bit, S_Deleter deleter)
std::vector< S_Tpdf > tpdf()
YANG uses's refine substatement structure, see RFC 6020 sec. 7.12.2
std::vector< S_Schema_Node > tree_dfs()
YANG import structure used to reference other schemas (modules).
std::vector< S_Schema_Node > data_instantiables(int options)
Container for list modifications in lys_refine_mod.
Container for information about string types (LY_TYPE_STRING), used in lys_type_info.
S_Schema_Node_List is_key()
libyang representation of data model trees.
Deviate(struct lys_deviate *deviate, S_Deleter deleter)
classes for wrapping lys_submodule.
std::vector< S_Ext_Instance > ext_instance()
struct ly_set * lys_find_path(const struct lys_module *cur_module, const struct lys_node *cur_node, const char *path)
Search for schema nodes matching the provided path.
YANG typedef structure providing information from the schema.
struct lys_restr * length
std::vector< S_Tpdf > tpdf()
lyxp_node_type
Types of context nodes, LYXP_NODE_ROOT_CONFIG used only in when or must conditions.
Single enumeration value specification for lys_type_info_enums.
Union for holding type-specific information in lys_type.
int lys_features_disable(const struct lys_module *module, const char *feature)
Disable specified feature in the module. If it causes some dependant features to be disabled...
Container for information about leafref types (LY_TYPE_LEAFREF), used in lys_type_info.
Compiled if-feature expression structure.
Schema leaf-list node structure.
YANG augment structure (covering both possibilities - uses's substatement as well as (sub)module's su...
LYS_OUTFORMAT
Schema output formats accepted by libyang printer functions.
Type_Info_Num(struct lys_type_info_num *info_num, S_Deleter deleter)
Container for information about enumeration types (LY_TYPE_ENUM), used in lys_type_info.
Container for information about integer types, used in lys_type_info.
Ext_Instance(lys_ext_instance *ext_instance, S_Deleter deleter)
std::vector< S_Tpdf > tpdf()
Restr(struct lys_restr *restr, S_Deleter deleter)
Class implementation for libyang C header tree_schema.h.
S_Type_Info_Dec64 dec64()
Union to hold target modification in lys_refine.
Schema anydata (and anyxml) node structure.
Container for information about decimal64 types (LY_TYPE_DEC64), used in lys_type_info.
struct lys_node * lys_getnext(const struct lys_node *last, const struct lys_node *parent, const struct lys_module *module, int options)
Get next schema tree (sibling) node element that can be instantiated in a data tree. Returned node can be from an augment.
int lys_features_enable(const struct lys_module *module, const char *feature)
Enable specified feature in the module. In case its if-feature evaluates to false, return an error.
std::vector< S_Restr > must()
std::vector< S_Ext_Instance > ext()
struct lys_type_info_lref lref
Type_Info_Union(struct lys_type_info_union *info_union, S_Deleter deleter)
Ext(struct lys_ext *ext, S_Deleter deleter)
std::vector< S_Ext_Instance > ext()
Deviation(struct lys_deviation *deviation, S_Deleter deleter)
int feature_enable(const char *feature)
struct lys_iffeature * iffeature
virtual S_Schema_Node next()
Container for information about identity types (LY_TYPE_IDENT), used in lys_type_info.
YANG when restriction, see RFC 6020 sec. 7.19.5
#define LY_TREE_DFS_BEGIN(START, NEXT, ELEM)
Macro to iterate via all elements in a tree. This is the opening part to the LY_TREE_DFS_END - they a...
Type_Info_Lref(struct lys_type_info_lref *info_lref, S_Deleter deleter)
Container for information about bits types (LY_TYPE_BINARY), used in lys_type_info.
Submodule(struct lys_submodule *submodule, S_Deleter deleter)
S_Type_Info_Binary binary()
Schema case node structure.
int lys_features_state(const struct lys_module *module, const char *feature)
Get the current status of the specified feature in the module. Even if the feature is enabled but som...
#define LY_TREE_DFS_END(START, NEXT, ELEM)
Schema list node structure.
std::vector< S_Ext_Instance > ext()
Type(struct lys_type *type, S_Deleter deleter)
std::vector< S_Ident > base()
S_Set find_path(const char *path)
Iffeature(struct lys_iffeature *iffeature, S_Deleter deleter)
Refine_Mod(union lys_refine_mod mod, uint16_t target_type, S_Deleter deleter)
Container for information about instance-identifier types (LY_TYPE_INST), used in lys_type_info...
Main schema node structure representing YANG module.
#define LY_TREE_FOR(START, ELEM)
Macro to iterate via all sibling elements without affecting the list itself.
std::vector< S_Type > types()
int lys_print_mem(char **strp, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node, int line_length, int options)
Print schema tree in the specified format into a memory block. It is up to caller to free the returne...
S_Set xpath_atomize(enum lyxp_node_type ctx_node_type, const char *expr, int options)
std::vector< S_Ident > ref()
S_Type_Info_Ident ident()
Class implementation for libyang C header libyang.h.
Refine(struct lys_refine *refine, S_Deleter deleter)
RPC input and output node structure.
LY_DATA_TYPE _PACKED base
LY_DATA_TYPE
YANG built-in types.
S_Schema_Node orig_node()
struct lys_node_leaf * target
struct lys_type_info_dec64 dec64
struct lys_type_info_binary binary
struct ly_set * lys_node_xpath_atomize(const struct lys_node *node, int options)
Call lys_xpath_atomize() on all the when and must expressions of the node. This node must be a descen...
std::string print_mem(LYS_OUTFORMAT format, int options)
YANG type structure providing information from the schema.
char * lys_path(const struct lys_node *node, int options)
Build schema path (usable as path, see howtoxpath) of the schema node.
std::vector< S_Ext_Instance > ext()
YANG list's unique statement structure, see RFC 6020 sec. 7.8.3
struct lys_refine * refine
Structure to hold information about identity, see RFC 6020 sec. 7.16
Schema_Node(lys_node *node, S_Deleter deleter)
std::vector< S_Schema_Node > child_instantiables(int options)
Description of the extension instance substatement.
YANG deviate statement structure, see RFC 6020 sec. 7.18.3.2
std::vector< S_Ext_Instance > ext()
struct lys_type_info_enums enums
Schema uses node structure.
int feature_state(const char *feature)
struct lys_type_info_union uni
Schema notification node structure.
std::vector< S_Ext_Instance > ext()
std::vector< S_Unique > unique()
YANG validity restriction (must, length, etc.) structure providing information from the schema...
std::vector< S_Ext_Instance > ext()
Schema rpc/action node structure.
Generic extension instance structure.
Container for information about union types (LY_TYPE_UNION), used in lys_type_info.
YANG extension definition.
YANG revision statement for (sub)modules.
struct lys_type_info_str str
YANG include structure used to reference submodules.
struct lys_node_list * lys_is_key(const struct lys_node_leaf *node, uint8_t *index)
Check if the schema leaf node is used as a key for a list.
YANG feature definition structure.
Feature(struct lys_feature *feature, S_Deleter)
Type_Info_Str(struct lys_type_info_str *info_str, S_Deleter deleter)
std::vector< S_Tpdf > tpdf()
Include(struct lys_include *include, S_Deleter deleter)
int feature_disable(const char *feature)
std::vector< S_Type_Bit > bit()
Single bit value specification for lys_type_info_bits.
classes for wrapping lys_module.
struct lys_type_info_ident ident
struct lys_ext_instance ** ext
Schema container node structure.
YANG deviation statement structure, see RFC 6020 sec. 7.18.3
struct ly_set * lys_xpath_atomize(const struct lys_node *ctx_node, enum lyxp_node_type ctx_node_type, const char *expr, int options)
Get all the partial XPath nodes (atoms) that are required for expr to be evaluated.