libyang  1.0.253
YANG data modeling language library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
tree_schema.h
Go to the documentation of this file.
1 
15 #ifndef LY_TREE_SCHEMA_H_
16 #define LY_TREE_SCHEMA_H_
17 
18 #include <limits.h>
19 #include <stddef.h>
20 #include <stdint.h>
21 #include <stdio.h>
22 #include <sys/types.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
40 #define LY_TREE_FOR(START, ELEM) \
41  for ((ELEM) = (START); \
42  (ELEM); \
43  (ELEM) = (ELEM)->next)
44 
58 #define LY_TREE_FOR_SAFE(START, NEXT, ELEM) \
59  for ((ELEM) = (START); \
60  (ELEM) ? (NEXT = (ELEM)->next, 1) : 0; \
61  (ELEM) = (NEXT))
62 
90 #define LY_TREE_DFS_BEGIN(START, NEXT, ELEM) \
91  for ((ELEM) = (NEXT) = (START); \
92  (ELEM); \
93  (ELEM) = (NEXT))
94 
114 #ifdef __cplusplus
115 #define TYPES_COMPATIBLE(type1, type2) typeid(*(type1)) == typeid(type2)
116 #elif defined(__GNUC__) || defined(__clang__)
117 #define TYPES_COMPATIBLE(type1, type2) __builtin_types_compatible_p(__typeof__(*(type1)), type2)
118 #else
119 #define TYPES_COMPATIBLE(type1, type2) _Generic(*(type1), type2: 1, default: 0)
120 #endif
121 
122 #define LY_TREE_DFS_END(START, NEXT, ELEM) \
123  /* select element for the next run - children first */ \
124  if (TYPES_COMPATIBLE(ELEM, struct lyd_node)) { \
125  /* child exception for leafs, leaflists and anyxml without children */\
126  if (((struct lyd_node *)(ELEM))->schema->nodetype & (LYS_LEAF | LYS_LEAFLIST | LYS_ANYDATA)) { \
127  (NEXT) = NULL; \
128  } else { \
129  (NEXT) = (ELEM)->child; \
130  } \
131  } else if (TYPES_COMPATIBLE(ELEM, struct lys_node)) { \
132  /* child exception for leafs, leaflists and anyxml without children */\
133  if (((struct lys_node *)(ELEM))->nodetype & (LYS_LEAF | LYS_LEAFLIST | LYS_ANYDATA)) { \
134  (NEXT) = NULL; \
135  } else { \
136  (NEXT) = (ELEM)->child; \
137  } \
138  } else { \
139  (NEXT) = (ELEM)->child; \
140  } \
141  \
142  if (!(NEXT)) { \
143  /* no children */ \
144  if ((ELEM) == (START)) { \
145  /* we are done, (START) has no children */ \
146  break; \
147  } \
148  /* try siblings */ \
149  (NEXT) = (ELEM)->next; \
150  } \
151  while (!(NEXT)) { \
152  /* parent is already processed, go to its sibling */ \
153  if (TYPES_COMPATIBLE(ELEM, struct lys_node) \
154  && (((struct lys_node *)(ELEM)->parent)->nodetype == LYS_AUGMENT)) { \
155  (ELEM) = (ELEM)->parent->prev; \
156  } else { \
157  (ELEM) = (ELEM)->parent; \
158  } \
159  /* no siblings, go back through parents */ \
160  if (TYPES_COMPATIBLE(ELEM, struct lys_node)) { \
161  /* due to possible augments */ \
162  if (lys_parent((struct lys_node *)(ELEM)) == lys_parent((struct lys_node *)(START))) { \
163  /* we are done, no next element to process */ \
164  break; \
165  } \
166  } else if ((ELEM)->parent == (START)->parent) { \
167  /* we are done, no next element to process */ \
168  break; \
169  } \
170  (NEXT) = (ELEM)->next; \
171  }
172 
180 #define LY_ARRAY_MAX(var) (sizeof(var) == 8 ? ULLONG_MAX : ((1ULL << (sizeof(var) * 8)) - 1))
182 #define LY_REV_SIZE 11
187 typedef enum {
191 } LYS_INFORMAT;
192 
196 typedef enum {
203 } LYS_OUTFORMAT;
204 
211 #define LYS_OUTOPT_TREE_RFC 0x01
212 #define LYS_OUTOPT_TREE_GROUPING 0x02
213 #define LYS_OUTOPT_TREE_USES 0x04
214 #define LYS_OUTOPT_TREE_NO_LEAFREF 0x08
220 /* shortcuts for common in and out formats */
221 #define LYS_YANG 1
222 #define LYS_YIN 2
229 typedef enum lys_nodetype {
230  LYS_UNKNOWN = 0x0000,
231  LYS_CONTAINER = 0x0001,
232  LYS_CHOICE = 0x0002,
233  LYS_LEAF = 0x0004,
234  LYS_LEAFLIST = 0x0008,
235  LYS_LIST = 0x0010,
236  LYS_ANYXML = 0x0020,
237  LYS_CASE = 0x0040,
238  LYS_NOTIF = 0x0080,
239  LYS_RPC = 0x0100,
240  LYS_INPUT = 0x0200,
241  LYS_OUTPUT = 0x0400,
242  LYS_GROUPING = 0x0800,
243  LYS_USES = 0x1000,
244  LYS_AUGMENT = 0x2000,
245  LYS_ACTION = 0x4000,
246  LYS_ANYDATA = 0x8020,
247  LYS_EXT = 0x10000
248 } LYS_NODE;
249 
250 /* all nodes sharing the node namespace except RPCs and notifications */
251 #define LYS_NO_RPC_NOTIF_NODE 0x807F
252 
253 #define LYS_ANY 0xFFFF
254 
282 typedef enum {
367 } LY_STMT;
368 
374 typedef enum {
375  LY_STMT_CARD_OPT, /* 0..1 */
377  LY_STMT_CARD_SOME, /* 1..n */
378  LY_STMT_CARD_ANY /* 0..n */
379 } LY_STMT_CARD;
380 
384 typedef enum {
385  LYEXT_ERR = -1,
394 } LYEXT_TYPE;
395 
404 #define LYEXT_OPT_INHERIT 0x01
410 #define LYEXT_OPT_YANG 0x02
411 #define LYEXT_OPT_CONTENT 0x04
413 #define LYEXT_OPT_VALID 0x08
414 #define LYEXT_OPT_VALID_SUBTREE 0x10
418 #define LYEXT_OPT_PLUGIN1 0x0100
419 #define LYEXT_OPT_PLUGIN2 0x0200
420 #define LYEXT_OPT_PLUGIN3 0x0400
421 #define LYEXT_OPT_PLUGIN4 0x0800
422 #define LYEXT_OPT_PLUGIN5 0x1000
423 #define LYEXT_OPT_PLUGIN6 0x2000
424 #define LYEXT_OPT_PLUGIN7 0x4000
425 #define LYEXT_OPT_PLUGIN8 0x8000
435 struct lyext_substmt {
436  LY_STMT stmt;
437  size_t offset;
438  LY_STMT_CARD cardinality;
439 };
440 
444 struct lys_ext {
445  const char *name;
446  const char *dsc;
447  const char *ref;
448  uint16_t flags;
449  uint8_t ext_size;
450  uint8_t padding[5];
452  const char *argument;
453  struct lys_module *module;
455 };
464 struct lys_ext_instance {
465  struct lys_ext *def;
468  void *parent;
470  const char *arg_value;
471  uint16_t flags;
472  uint8_t ext_size;
473  uint8_t insubstmt_index;
480  uint8_t insubstmt;
483  uint8_t parent_type;
484  uint8_t ext_type;
485  uint8_t padding;
486  struct lys_ext_instance **ext;
487  void *priv;
488  struct lys_module *module;
490 };
499  struct lys_ext *def;
500  void *parent;
502  const char *arg_value;
503  uint16_t flags;
504  uint8_t ext_size;
505  uint8_t insubstmt_index;
512  uint8_t insubstmt;
515  uint8_t parent_type;
516  uint8_t ext_type;
517  uint8_t padding;
518  struct lys_ext_instance **ext;
519  void *priv;
520  struct lys_module *module;
523  /* to this point the structure is compatible with the generic ::lys_ext_instance structure */
525  char content[1];
526 };
574 const void *lys_ext_instance_substmt(const struct lys_ext_instance *ext);
575 
584 int lys_ext_instance_presence(struct lys_ext *def, struct lys_ext_instance **ext, uint8_t ext_size);
585 
597 
603 const char * const *ly_get_loaded_plugins(void);
604 
612 void ly_load_plugins(void);
613 
614 /* don't need the contents of these types, just forward-declare them for the next 2 functions. */
615 struct lyext_plugin_list;
616 struct lytype_plugin_list;
617 
626 int ly_register_exts(struct lyext_plugin_list *plugin, const char *log_name);
627 
633 int ly_register_types(struct lytype_plugin_list *plugin, const char *log_name);
634 
644 int ly_clean_plugins(void);
645 
653 typedef enum LYS_VERSION {
654  LYS_VERSION_UNDEF = 0,
655  LYS_VERSION_1 = 1,
656  LYS_VERSION_1_1 = 2
657 } LYS_VERSION;
658 
666 struct lys_module {
667  struct ly_ctx *ctx;
668  const char *name;
669  const char *prefix;
670  const char *dsc;
671  const char *ref;
672  const char *org;
673  const char *contact;
674  const char *filepath;
675  uint8_t type:1;
676  uint8_t version:3;
680  uint8_t deviated:2;
684  uint8_t disabled:1;
685  uint8_t implemented:1;
686  uint8_t latest_revision:1;
688  uint8_t padding1:7;
689  uint8_t padding2[2];
690 
691  /* array sizes */
692  uint8_t rev_size;
693  uint8_t imp_size;
694  uint8_t inc_size;
696  uint16_t ident_size;
697  uint16_t tpdf_size;
699  uint8_t features_size;
700  uint8_t augment_size;
701  uint8_t deviation_size;
702  uint8_t extensions_size;
703  uint8_t ext_size;
705  struct lys_revision *rev;
707  struct lys_import *imp;
708  struct lys_include *inc;
709  struct lys_tpdf *tpdf;
710  struct lys_ident *ident;
711  struct lys_feature *features;
713  struct lys_deviation *deviation;
714  struct lys_ext *extensions;
717  /* specific module's items in comparison to submodules */
718  struct lys_node *data;
719  const char *ns;
720 };
729 struct lys_submodule {
730  struct ly_ctx *ctx;
731  const char *name;
732  const char *prefix;
733  const char *dsc;
734  const char *ref;
735  const char *org;
736  const char *contact;
737  const char *filepath;
738  uint8_t type:1;
739  uint8_t version:3;
743  uint8_t deviated:2;
747  uint8_t disabled:1;
748  uint8_t implemented:1;
749  uint8_t padding[3];
751  /* array sizes */
752  uint8_t rev_size;
753  uint8_t imp_size;
754  uint8_t inc_size;
756  uint16_t ident_size;
757  uint16_t tpdf_size;
759  uint8_t features_size;
760  uint8_t augment_size;
761  uint8_t deviation_size;
762  uint8_t extensions_size;
763  uint8_t ext_size;
765  struct lys_revision *rev;
767  struct lys_import *imp;
768  struct lys_include *inc;
769  struct lys_tpdf *tpdf;
770  struct lys_ident *ident;
771  struct lys_feature *features;
773  struct lys_deviation *deviation;
774  struct lys_ext *extensions;
777  /* specific submodule's items in comparison to modules */
779 };
784 typedef enum {
787  LY_TYPE_BITS,
788  LY_TYPE_BOOL,
789  LY_TYPE_DEC64,
790  LY_TYPE_EMPTY,
807 #define LY_DATA_TYPE_COUNT 20
812 struct lys_type_info_binary {
813  struct lys_restr *length;
815 };
816 
820 struct lys_type_bit {
821  const char *name;
822  const char *dsc;
823  const char *ref;
824  uint16_t flags;
826  uint8_t ext_size;
827  uint8_t iffeature_size;
829  /* 32b padding for compatibility with ::lys_node */
830  uint32_t pos;
832  struct lys_ext_instance **ext;
834 };
835 
840  struct lys_type_bit *bit;
841  unsigned int count;
842 };
843 
848  struct lys_restr *range;
850  uint8_t dig;
854  uint64_t div;
855 };
856 
860 struct lys_type_enum {
861  const char *name;
862  const char *dsc;
863  const char *ref;
864  uint16_t flags;
866  uint8_t ext_size;
867  uint8_t iffeature_size;
869  /* 32b padding for compatibility with ::lys_node */
870  int32_t value;
872  struct lys_ext_instance **ext;
874 };
875 
881  unsigned int count;
882 };
883 
888  struct lys_ident **ref;
889  unsigned int count;
890 };
891 
896  int8_t req;
901 };
906 struct lys_type_info_num {
907  struct lys_restr *range;
909 };
910 
915  const char *path;
917  struct lys_node_leaf* target;
918  int8_t req;
922 };
923 
927 struct lys_type_info_str {
928  struct lys_restr *length;
930  struct lys_restr *patterns;
936  unsigned int pat_count;
937 #ifdef LY_ENABLED_CACHE
938  void **patterns_pcre;
941 #endif
942 };
947 struct lys_type_info_union {
948  struct lys_type *types;
949  unsigned int count;
950  int has_ptr_type;
952 };
953 
958  struct lys_type_info_binary binary;
959  struct lys_type_info_bits bits;
960  struct lys_type_info_dec64 dec64;
961  struct lys_type_info_enums enums;
962  struct lys_type_info_ident ident;
963  struct lys_type_info_inst inst;
968 };
973 struct lys_type {
974  LY_DATA_TYPE _PACKED base;
975  uint8_t value_flags;
976  uint8_t ext_size;
977  struct lys_ext_instance **ext;
978  struct lys_tpdf *der;
980  struct lys_tpdf *parent;
983  /*
984  * here is an overview of the info union:
985  * LY_TYPE_BINARY (binary)
986  * struct lys_restr *binary.length; length restriction (optional), see
987  * [RFC 6020 sec. 9.4.4](http://tools.ietf.org/html/rfc6020#section-9.4.4)
988  * -----------------------------------------------------------------------------------------------------------------
989  * LY_TYPE_BITS (bits)
990  * struct lys_type_bit *bits.bit; array of bit definitions
991  * const char *bits.bit[i].name; bit's name (mandatory)
992  * const char *bits.bit[i].dsc; bit's description (optional)
993  * const char *bits.bit[i].ref; bit's reference (optional)
994  * uint8_t bits.bit[i].flags; bit's flags, whether the position was auto-assigned
995  * and the status(one of LYS_NODE_STATUS_* values or 0 for default)
996  * uint8_t bits.bit[i].iffeature_size; number of elements in the bit's #iffeature array
997  * uint8_t bits.bit[i].ext_size; number of elements in the bit's #ext array
998  * uint32_t bits.bit[i].pos; bit's position (mandatory)
999  * struct lys_iffeature *bits.bit[i].iffeature; array of bit's if-feature expressions
1000  * struct lys_ext_instance **bits.bit[i].ext; array of pointers to the bit's extension instances (optional)
1001  * unsigned int bits.count; number of bit definitions in the bit array
1002  * -----------------------------------------------------------------------------------------------------------------
1003  * LY_TYPE_DEC64 (dec64)
1004  * struct lys_restr *dec64.range; range restriction (optional), see
1005  * [RFC 6020 sec. 9.2.4](http://tools.ietf.org/html/rfc6020#section-9.2.4)
1006  * struct lys_ext_instance **dec64.ext; array of pointers to the bit's extension instances (optional)
1007  * uint8_t dec64.ext_size; number of elements in the bit's #ext array
1008  * uint8_t dec64.dig; fraction-digits restriction (mandatory)
1009  * uint64_t dec64.div; auxiliary value for moving decimal point (dividing the stored value to get
1010  * the real value) (mandatory, corresponds to the fraction-digits)
1011  * -----------------------------------------------------------------------------------------------------------------
1012  * LY_TYPE_ENUM (enums)
1013  * struct lys_type_enum *enums.enm; array of enum definitions
1014  * const char *enums.enm[i].name; enum's name (mandatory)
1015  * const char *enums.enm[i].dsc; enum's description (optional)
1016  * const char *enums.enm[i].ref; enum's reference (optional)
1017  * uint8_t enums.enm[i].flags; enum's flags, whether the value was auto-assigned
1018  * and the status(one of LYS_NODE_STATUS_* values or 0 for default)
1019  * uint8_t enums.enum[i].iffeature_size; number of elements in the bit's #iffeature array
1020  * uint8_t enums.enum[i].ext_size; number of elements in the bit's #ext array
1021  * int32_t enums.enm[i].value; enum's value (mandatory)
1022  * struct lys_iffeature *enums.enum[i].iffeature; array of bit's if-feature expressions
1023  * struct lys_ext_instance **enums.enum[i].ext; array of pointers to the bit's extension instances (optional)
1024  * unsigned int enums.count; number of enum definitions in the enm array
1025  * -----------------------------------------------------------------------------------------------------------------
1026  * LY_TYPE_IDENT (ident)
1027  * struct lys_ident **ident.ref; array of pointers (reference) to the identity definition (mandatory)
1028  * unsigned int ident.count; number of base identity references
1029  * -----------------------------------------------------------------------------------------------------------------
1030  * LY_TYPE_INST (inst)
1031  * int8_t inst.req; require-identifier restriction, see
1032  * [RFC 6020 sec. 9.13.2](http://tools.ietf.org/html/rfc6020#section-9.13.2):
1033  * - -1 = false,
1034  * - 0 not defined,
1035  * - 1 = true
1036  * -----------------------------------------------------------------------------------------------------------------
1037  * LY_TYPE_*INT* (num)
1038  * struct lys_restr *num.range; range restriction (optional), see
1039  * [RFC 6020 sec. 9.2.4](http://tools.ietf.org/html/rfc6020#section-9.2.4)
1040  * -----------------------------------------------------------------------------------------------------------------
1041  * LY_TYPE_LEAFREF (lref)
1042  * const char *lref.path; path to the referred leaf or leaf-list node (mandatory), see
1043  * [RFC 6020 sec. 9.9.2](http://tools.ietf.org/html/rfc6020#section-9.9.2)
1044  * struct lys_node_leaf *lref.target; target schema node according to path
1045  * int8_t lref.req; require-instance restriction: -1 = false; 0 not defined (true); 1 = true
1046  * -----------------------------------------------------------------------------------------------------------------
1047  * LY_TYPE_STRING (str)
1048  * struct lys_restr *str.length; length restriction (optional), see
1049  * [RFC 6020 sec. 9.4.4](http://tools.ietf.org/html/rfc6020#section-9.4.4)
1050  * struct lys_restr *str.patterns; array of pattern restrictions (optional), see
1051  * [RFC 6020 sec. 9.4.6](http://tools.ietf.org/html/rfc6020#section-9.4.6)
1052  * unsigned int str.pat_count; number of pattern definitions in the patterns array
1053  * -----------------------------------------------------------------------------------------------------------------
1054  * LY_TYPE_UNION (uni)
1055  * struct lys_type *uni.types; array of union's subtypes
1056  * unsigned int uni.count; number of subtype definitions in types array
1057  * int uni.has_ptr_type; types recursively include an instance-identifier or leafref (union must always
1058  * be resolved after it is parsed)
1059  */
1060 };
1061 
1062 #define LYS_IFF_NOT 0x00
1063 #define LYS_IFF_AND 0x01
1064 #define LYS_IFF_OR 0x02
1065 #define LYS_IFF_F 0x03
1066 
1071  uint8_t *expr;
1072  uint8_t ext_size;
1073  struct lys_feature **features;
1074  struct lys_ext_instance **ext;
1075 };
1076 
1135 #define LYS_CONFIG_W 0x01
1136 #define LYS_CONFIG_R 0x02
1137 #define LYS_CONFIG_SET 0x04
1138 #define LYS_CONFIG_MASK 0x03
1139 #define LYS_STATUS_CURR 0x08
1140 #define LYS_STATUS_DEPRC 0x10
1141 #define LYS_STATUS_OBSLT 0x20
1142 #define LYS_STATUS_MASK 0x38
1143 #define LYS_RFN_MAXSET 0x08
1144 #define LYS_RFN_MINSET 0x10
1145 #define LYS_MAND_TRUE 0x40
1147 #define LYS_MAND_FALSE 0x80
1149 #define LYS_INCL_STATUS 0x80
1151 #define LYS_MAND_MASK 0xc0
1152 #define LYS_USERORDERED 0x100
1154 #define LYS_FENABLED 0x100
1155 #define LYS_UNIQUE 0x100
1156 #define LYS_AUTOASSIGNED 0x01
1158 #define LYS_USESGRP 0x01
1159 #define LYS_IMPLICIT 0x40
1160 #define LYS_XPCONF_DEP 0x200
1163 #define LYS_XPSTATE_DEP 0x400
1166 #define LYS_LEAFREF_DEP 0x800
1169 #define LYS_DFLTJSON 0x1000
1173 #define LYS_NOTAPPLIED 0x01
1174 #define LYS_YINELEM 0x01
1175 #define LYS_VALID_EXT 0x2000
1176 #define LYS_VALID_EXT_SUBTREE 0x4000
1183 #ifdef LY_ENABLED_CACHE
1184 
1188 #define LYS_NODE_HASH_COUNT 4
1189 
1190 #endif
1191 
1209 struct lys_node {
1210  const char *name;
1211  const char *dsc;
1212  const char *ref;
1213  uint16_t flags;
1214  uint8_t ext_size;
1215  uint8_t iffeature_size;
1217  uint8_t padding[4];
1223  struct lys_ext_instance **ext;
1224  struct lys_iffeature *iffeature;
1225  struct lys_module *module;
1227  LYS_NODE nodetype;
1228  struct lys_node *parent;
1229  struct lys_node *child;
1233  struct lys_node *next;
1234  struct lys_node *prev;
1239  void *priv;
1241 #ifdef LY_ENABLED_CACHE
1242  uint8_t hash[LYS_NODE_HASH_COUNT];
1243 #endif
1244 };
1256  const char *name;
1257  const char *dsc;
1258  const char *ref;
1259  uint16_t flags;
1260  uint8_t ext_size;
1261  uint8_t iffeature_size;
1263  /* non compatible 32b with ::lys_node */
1264  uint8_t padding[1];
1265  uint8_t must_size;
1266  uint16_t tpdf_size;
1268  struct lys_ext_instance **ext;
1269  struct lys_iffeature *iffeature;
1270  struct lys_module *module;
1272  LYS_NODE nodetype;
1273  struct lys_node *parent;
1274  struct lys_node *child;
1275  struct lys_node *next;
1276  struct lys_node *prev;
1281  void *priv;
1283 #ifdef LY_ENABLED_CACHE
1284  uint8_t hash[LYS_NODE_HASH_COUNT];
1285 #endif
1287  /* specific container's data */
1288  struct lys_when *when;
1289  struct lys_restr *must;
1290  struct lys_tpdf *tpdf;
1291  const char *presence;
1292 };
1293 
1304  const char *name;
1305  const char *dsc;
1306  const char *ref;
1307  uint16_t flags;
1308  uint8_t ext_size;
1309  uint8_t iffeature_size;
1311  /* non compatible 32b with ::lys_node */
1312  uint8_t padding[4];
1314  struct lys_ext_instance **ext;
1315  struct lys_iffeature *iffeature;
1316  struct lys_module *module;
1318  LYS_NODE nodetype;
1319  struct lys_node *parent;
1320  struct lys_node *child;
1321  struct lys_node *next;
1322  struct lys_node *prev;
1327  void *priv;
1329  /* specific choice's data */
1330  struct lys_when *when;
1331  struct lys_node *dflt;
1332 };
1333 
1345 struct lys_node_leaf {
1346  const char *name;
1347  const char *dsc;
1348  const char *ref;
1349  uint16_t flags;
1350  uint8_t ext_size;
1351  uint8_t iffeature_size;
1353  /* non compatible 32b with ::lys_node */
1354  uint8_t padding[3];
1355  uint8_t must_size;
1357  struct lys_ext_instance **ext;
1358  struct lys_iffeature *iffeature;
1359  struct lys_module *module;
1361  LYS_NODE nodetype;
1362  struct lys_node *parent;
1363  void *child;
1364  struct lys_node *next;
1365  struct lys_node *prev;
1370  void *priv;
1372 #ifdef LY_ENABLED_CACHE
1373  uint8_t hash[LYS_NODE_HASH_COUNT];
1374 #endif
1375 
1376  /* specific leaf's data */
1377  struct lys_when *when;
1378  struct lys_restr *must;
1379  struct lys_type type;
1380  const char *units;
1382  /* to this point, struct lys_node_leaf is compatible with struct lys_node_leaflist */
1383  const char *dflt;
1384 };
1396 struct lys_node_leaflist {
1397  const char *name;
1398  const char *dsc;
1399  const char *ref;
1400  uint16_t flags;
1401  uint8_t ext_size;
1402  uint8_t iffeature_size;
1404  /* non compatible 32b with ::lys_node */
1405  uint8_t padding[2];
1406  uint8_t dflt_size;
1407  uint8_t must_size;
1409  struct lys_ext_instance **ext;
1410  struct lys_iffeature *iffeature;
1411  struct lys_module *module;
1413  LYS_NODE nodetype;
1414  struct lys_node *parent;
1415  struct ly_set *backlinks;
1418  struct lys_node *next;
1419  struct lys_node *prev;
1424  void *priv;
1426 #ifdef LY_ENABLED_CACHE
1427  uint8_t hash[LYS_NODE_HASH_COUNT];
1428 #endif
1430  /* specific leaf-list's data */
1431  struct lys_when *when;
1432  struct lys_restr *must;
1433  struct lys_type type;
1434  const char *units;
1436  /* to this point, struct lys_node_leaflist is compatible with struct lys_node_leaf
1437  * on the other hand, the min and max are compatible with struct lys_node_list */
1438  const char **dflt;
1439  uint32_t min;
1440  uint32_t max;
1441 };
1442 
1452 struct lys_node_list {
1453  const char *name;
1454  const char *dsc;
1455  const char *ref;
1456  uint16_t flags;
1457  uint8_t ext_size;
1458  uint8_t iffeature_size;
1460  /* non compatible 32b with ::lys_node */
1461  uint8_t must_size;
1462  uint8_t tpdf_size;
1463  uint8_t keys_size;
1464  uint8_t unique_size;
1466  struct lys_ext_instance **ext;
1467  struct lys_iffeature *iffeature;
1468  struct lys_module *module;
1470  LYS_NODE nodetype;
1471  struct lys_node *parent;
1472  struct lys_node *child;
1473  struct lys_node *next;
1474  struct lys_node *prev;
1479  void *priv;
1481 #ifdef LY_ENABLED_CACHE
1482  uint8_t hash[LYS_NODE_HASH_COUNT];
1483 #endif
1485  /* specific list's data */
1486  struct lys_when *when;
1487  struct lys_restr *must;
1488  struct lys_tpdf *tpdf;
1489  struct lys_node_leaf **keys;
1490  struct lys_unique *unique;
1492  uint32_t min;
1493  uint32_t max;
1495  const char *keys_str;
1498 };
1499 
1512  const char *name;
1513  const char *dsc;
1514  const char *ref;
1515  uint16_t flags;
1516  uint8_t ext_size;
1517  uint8_t iffeature_size;
1519  /* non compatible 32b with ::lys_node */
1520  uint8_t padding[3];
1521  uint8_t must_size;
1523  struct lys_ext_instance **ext;
1524  struct lys_iffeature *iffeature;
1525  struct lys_module *module;
1527  LYS_NODE nodetype;
1528  struct lys_node *parent;
1529  struct lys_node *child;
1530  struct lys_node *next;
1531  struct lys_node *prev;
1536  void *priv;
1538 #ifdef LY_ENABLED_CACHE
1539  uint8_t hash[LYS_NODE_HASH_COUNT];
1540 #endif
1541 
1542  /* specific anyxml's data */
1543  struct lys_when *when;
1544  struct lys_restr *must;
1545 };
1559 struct lys_node_uses {
1560  const char *name;
1561  const char *dsc;
1562  const char *ref;
1563  uint16_t flags;
1565  uint8_t ext_size;
1566  uint8_t iffeature_size;
1568  /* non compatible 32b with ::lys_node */
1569  uint8_t padding[2];
1570  uint8_t refine_size;
1571  uint8_t augment_size;
1573  struct lys_ext_instance **ext;
1574  struct lys_iffeature *iffeature;
1575  struct lys_module *module;
1577  LYS_NODE nodetype;
1578  struct lys_node *parent;
1579  struct lys_node *child;
1580  struct lys_node *next;
1581  struct lys_node *prev;
1586  void *priv;
1588  /* specific uses's data */
1589  struct lys_when *when;
1590  struct lys_refine *refine;
1592  struct lys_node_grp *grp;
1593 };
1594 
1606 struct lys_node_grp {
1607  const char *name;
1608  const char *dsc;
1609  const char *ref;
1610  uint16_t flags;
1611  uint8_t ext_size;
1614  /* non compatible 32b with ::lys_node */
1615  uint16_t unres_count;
1616  uint16_t tpdf_size;
1618  struct lys_ext_instance **ext;
1619  void *padding_iff;
1620  struct lys_module *module;
1622  LYS_NODE nodetype;
1623  struct lys_node *parent;
1624  struct lys_node *child;
1625  struct lys_node *next;
1626  struct lys_node *prev;
1631  void *priv;
1633  /* specific grouping's data */
1634  struct lys_tpdf *tpdf;
1635 };
1636 
1646  const char *name;
1647  const char *dsc;
1648  const char *ref;
1649  uint16_t flags;
1650  uint8_t ext_size;
1651  uint8_t iffeature_size;
1653  /* non compatible 32b with ::lys_node */
1654  uint8_t padding[4];
1657  struct lys_iffeature *iffeature;
1658  struct lys_module *module;
1660  LYS_NODE nodetype;
1661  struct lys_node *parent;
1662  struct lys_node *child;
1663  struct lys_node *next;
1664  struct lys_node *prev;
1669  void *priv;
1671  /* specific case's data */
1672  struct lys_when *when;
1673 };
1674 
1690 struct lys_node_inout {
1691  const char *name;
1692  void *fill1[2];
1693  uint16_t flags;
1694  uint8_t ext_size;
1695  uint8_t padding_iffsize;
1697  /* non compatible 32b with ::lys_node */
1698  uint8_t padding[1];
1699  uint8_t must_size;
1700  uint16_t tpdf_size;
1702  struct lys_ext_instance **ext;
1703  void *padding_iff;
1704  struct lys_module *module;
1706  LYS_NODE nodetype;
1707  struct lys_node *parent;
1708  struct lys_node *child;
1709  struct lys_node *next;
1710  struct lys_node *prev;
1715  void *priv;
1717  /* specific inout's data */
1718  struct lys_tpdf *tpdf;
1719  struct lys_restr *must;
1720 };
1729  const char *name;
1730  const char *dsc;
1731  const char *ref;
1732  uint16_t flags;
1733  uint8_t ext_size;
1734  uint8_t iffeature_size;
1736  /* non compatible 32b with ::lys_node */
1737  uint8_t padding[1];
1738  uint8_t must_size;
1739  uint16_t tpdf_size;
1742  struct lys_iffeature *iffeature;
1743  struct lys_module *module;
1745  LYS_NODE nodetype;
1746  struct lys_node *parent;
1747  struct lys_node *child;
1748  struct lys_node *next;
1749  struct lys_node *prev;
1754  void *priv;
1756 #ifdef LY_ENABLED_CACHE
1757  uint8_t hash[LYS_NODE_HASH_COUNT];
1758 #endif
1760  /* specific rpc's data */
1761  struct lys_tpdf *tpdf;
1762  struct lys_restr *must;
1763 };
1775 struct lys_node_rpc_action {
1776  const char *name;
1777  const char *dsc;
1778  const char *ref;
1779  uint16_t flags;
1780  uint8_t ext_size;
1781  uint8_t iffeature_size;
1783  /* non compatible 32b with ::lys_node */
1784  uint8_t padding[2];
1785  uint16_t tpdf_size;
1787  struct lys_ext_instance **ext;
1788  struct lys_iffeature *iffeature;
1789  struct lys_module *module;
1791  LYS_NODE nodetype;
1792  struct lys_node *parent;
1793  struct lys_node *child;
1794  struct lys_node *next;
1795  struct lys_node *prev;
1800  void *priv;
1802 #ifdef LY_ENABLED_CACHE
1803  uint8_t hash[LYS_NODE_HASH_COUNT];
1804 #endif
1805 
1806  /* specific rpc's data */
1807  struct lys_tpdf *tpdf;
1808 };
1823 struct lys_node_augment {
1824  const char *target_name;
1826  const char *dsc;
1827  const char *ref;
1828  uint16_t flags;
1829  uint8_t ext_size;
1830  uint8_t iffeature_size;
1832  /* non compatible 32b with ::lys_node */
1833  uint8_t padding[4];
1835  struct lys_ext_instance **ext;
1836  struct lys_iffeature *iffeature;
1837  struct lys_module *module;
1839  LYS_NODE nodetype;
1840  struct lys_node *parent;
1841  struct lys_node *child;
1847  /* replaces #next and #prev members of ::lys_node */
1848  struct lys_when *when;
1849  struct lys_node *target;
1851  /* again compatible members with ::lys_node */
1852  void *priv;
1853 };
1854 
1859  uint32_t min;
1860  uint32_t max;
1861 };
1866 union lys_refine_mod {
1867  const char *presence;
1868  struct lys_refine_mod_list list;
1870 };
1875 struct lys_refine {
1876  const char *target_name;
1877  const char *dsc;
1878  const char *ref;
1879  uint16_t flags;
1880  uint8_t ext_size;
1881  uint8_t iffeature_size;
1883  /* 32b padding for compatibility with ::lys_node */
1884  uint16_t target_type;
1887  uint8_t must_size;
1888  uint8_t dflt_size;
1891  struct lys_iffeature *iffeature;
1892  struct lys_module *module;
1894  struct lys_restr *must;
1895  const char **dflt;
1900 };
1906 typedef enum lys_deviate_type {
1907  LY_DEVIATE_NO,
1908  LY_DEVIATE_ADD,
1916 struct lys_deviate {
1919  uint8_t flags;
1920  uint8_t dflt_size;
1921  uint8_t ext_size;
1923  uint8_t min_set;
1924  uint8_t max_set;
1925  uint8_t must_size;
1926  uint8_t unique_size;
1928  uint32_t min;
1929  uint32_t max;
1931  struct lys_restr *must;
1932  struct lys_unique *unique;
1933  struct lys_type *type;
1934  const char *units;
1935  const char **dflt;
1937  struct lys_ext_instance **ext;
1938 };
1944  const char *target_name;
1946  const char *dsc;
1947  const char *ref;
1950  uint8_t deviate_size;
1951  uint8_t ext_size;
1952  struct lys_deviate *deviate;
1954 };
1959 struct lys_import {
1960  struct lys_module *module;
1961  const char *prefix;
1962  char rev[LY_REV_SIZE];
1963  uint8_t ext_size;
1964  struct lys_ext_instance **ext;
1965  const char *dsc;
1966  const char *ref;
1967 };
1972 struct lys_include {
1975  uint8_t ext_size;
1976  struct lys_ext_instance **ext;
1977  const char *dsc;
1978  const char *ref;
1979 };
1980 
1986  uint8_t ext_size;
1988  const char *dsc;
1989  const char *ref;
1990 };
1991 
1995 struct lys_tpdf {
1996  const char *name;
1997  const char *dsc;
1998  const char *ref;
1999  uint16_t flags;
2000  uint8_t ext_size;
2001  uint8_t padding_iffsize;
2002  uint8_t has_union_leafref;
2004  /* 24b padding for compatibility with ::lys_node */
2005  uint8_t padding[3];
2008  const char *units;
2009  struct lys_module *module;
2012  struct lys_type type;
2014  const char *dflt;
2015 };
2016 
2020 struct lys_unique {
2021  const char **expr;
2022  uint8_t expr_size;
2023  uint8_t trg_type;
2024 };
2025 
2029 struct lys_feature {
2030  const char *name;
2031  const char *dsc;
2032  const char *ref;
2033  uint16_t flags;
2035  uint8_t ext_size;
2036  uint8_t iffeature_size;
2038  /* 32b padding for compatibility with ::lys_node */
2039  uint8_t padding[4];
2041  struct lys_ext_instance **ext;
2043  struct lys_module *module;
2044  struct ly_set *depfeatures;
2045 };
2046 
2050 struct lys_restr {
2051  const char *expr;
2054  const char *dsc;
2055  const char *ref;
2056  const char *eapptag;
2057  const char *emsg;
2059  uint8_t ext_size;
2060  uint16_t flags;
2061 };
2062 
2066 struct lys_when {
2067  const char *cond;
2068  const char *dsc;
2069  const char *ref;
2070  struct lys_ext_instance **ext;
2071  uint8_t ext_size;
2072  uint16_t flags;
2073 };
2074 
2080 struct lys_ident {
2081  const char *name;
2082  const char *dsc;
2083  const char *ref;
2084  uint16_t flags;
2085  uint8_t ext_size;
2086  uint8_t iffeature_size;
2088  /* 32b padding for compatibility with ::lys_node */
2089  uint8_t padding[3];
2090  uint8_t base_size;
2094  struct lys_module *module;
2096  struct lys_ident **base;
2097  struct ly_set *der;
2098 };
2099 
2109 const struct lys_module *lys_parse_mem(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format);
2110 
2122 const struct lys_module *lys_parse_fd(struct ly_ctx *ctx, int fd, LYS_INFORMAT format);
2123 
2132 const struct lys_module *lys_parse_path(struct ly_ctx *ctx, const char *path, LYS_INFORMAT format);
2133 
2149 int lys_search_localfile(const char * const *searchpaths, int cwd, const char *name, const char *revision, char **localfile, LYS_INFORMAT *format);
2150 
2164 const char **lys_features_list(const struct lys_module *module, uint8_t **states);
2165 
2176 int lys_features_enable(const struct lys_module *module, const char *feature);
2177 
2188 int lys_features_disable(const struct lys_module *module, const char *feature);
2189 
2197 int lys_features_enable_force(const struct lys_module *module, const char *feature);
2198 
2208 int lys_features_disable_force(const struct lys_module *module, const char *feature);
2209 
2222 int lys_features_state(const struct lys_module *module, const char *feature);
2223 
2235 const struct lys_node *lys_is_disabled(const struct lys_node *node, int recursive);
2236 
2243 int lys_iffeature_value(const struct lys_iffeature *iff);
2244 
2252 const struct lys_node_list *lys_is_key(const struct lys_node_leaf *node, uint8_t *index);
2253 
2275 const struct lys_node *lys_getnext(const struct lys_node *last, const struct lys_node *parent,
2276  const struct lys_module *module, int options);
2277 
2278 #define LYS_GETNEXT_WITHCHOICE 0x01
2279 #define LYS_GETNEXT_WITHCASE 0x02
2280 #define LYS_GETNEXT_WITHGROUPING 0x04
2281 #define LYS_GETNEXT_WITHINOUT 0x08
2283 #define LYS_GETNEXT_WITHUSES 0x10
2284 #define LYS_GETNEXT_INTOUSES 0x20
2286 #define LYS_GETNEXT_INTONPCONT 0x40
2287 #define LYS_GETNEXT_PARENTUSES 0x80
2289 #define LYS_GETNEXT_NOSTATECHECK 0x100
2299 const struct lys_type *lys_getnext_union_type(const struct lys_type *last, const struct lys_type *type);
2312 struct ly_set *lys_find_path(const struct lys_module *cur_module, const struct lys_node *cur_node, const char *path);
2313 
2317 enum lyxp_node_type {
2318  /* XML document roots */
2319  LYXP_NODE_ROOT, /* access to all the data (node value first top-level node) */
2320  LYXP_NODE_ROOT_CONFIG, /* <running> data context, no state data (node value first top-level node) */
2321 
2322  /* XML elements */
2323  LYXP_NODE_ELEM, /* XML element (most common) */
2324  LYXP_NODE_TEXT, /* XML text element (extremely specific use, unlikely to be ever needed) */
2325  LYXP_NODE_ATTR, /* XML attribute (in YANG cannot happen, do not use for the context node) */
2326 
2327  LYXP_NODE_NONE /* invalid node type, do not use */
2328 };
2329 
2343 struct ly_set *lys_xpath_atomize(const struct lys_node *ctx_node, enum lyxp_node_type ctx_node_type,
2344  const char *expr, int options);
2346 #define LYXP_MUST 0x01
2347 #define LYXP_WHEN 0x02
2356 struct ly_set *lys_node_xpath_atomize(const struct lys_node *node, int options);
2357 
2358 #define LYXP_RECURSIVE 0x01
2359 #define LYXP_NO_LOCAL 0x02
2372 char *lys_path(const struct lys_node *node, int options);
2374 #define LYS_PATH_FIRST_PREFIX 0x01
2384 char *lys_data_path(const struct lys_node *node);
2399 char *lys_data_path_pattern(const struct lys_node *node, const char *placeholder);
2411 struct lys_node *lys_parent(const struct lys_node *node);
2412 
2422 struct lys_module *lys_node_module(const struct lys_node *node);
2423 
2433 struct lys_module *lys_main_module(const struct lys_module *module);
2434 
2450 struct lys_module *lys_implemented_module(const struct lys_module *mod);
2451 
2471 int lys_set_implemented(const struct lys_module *module);
2472 
2489 int lys_set_disabled(const struct lys_module *module);
2490 
2505 int lys_set_enabled(const struct lys_module *module);
2506 
2516 void *lys_set_private(const struct lys_node *node, void *priv);
2517 
2531 int lys_print_mem(char **strp, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node,
2532  int line_length, int options);
2533 
2546 int lys_print_fd(int fd, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node,
2547  int line_length, int options);
2548 
2561 int lys_print_file(FILE *f, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node,
2562  int line_length, int options);
2563 
2576 int lys_print_path(const char *path, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node,
2577  int line_length, int options);
2578 
2592 int lys_print_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg,
2593  const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node, int line_length, int options);
2594 
2597 #ifdef __cplusplus
2598 }
2599 #endif
2600 
2601 #endif /* LY_TREE_SCHEMA_H_ */
uint8_t augment_size
Definition: tree_schema.h:707
struct lys_deviation * deviation
Definition: tree_schema.h:720
int ly_register_types(struct lytype_plugin_list *plugin, const char *log_name)
Directly register a YANG type by pointer.
struct lys_module * module
Definition: tree_schema.h:1247
const char * ref
Definition: tree_schema.h:454
uint8_t ext_size
Definition: tree_schema.h:456
Common structure representing single YANG data statement describing.
Definition: tree_schema.h:1231
const char * emsg
Definition: tree_schema.h:2079
struct lys_node * lys_is_disabled(const struct lys_node *node, int recursive)
Check if the schema node is disabled in the schema tree, i.e. there is any disabled if-feature statem...
struct ly_set * backlinks
Definition: tree_schema.h:1437
int lys_print_file(FILE *f, 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 file stream.
LY_STMT_CARD
Possible cardinalities of the YANG statements.
Definition: tree_schema.h:374
Schema leaf node structure.
Definition: tree_schema.h:1367
Schema grouping node structure.
Definition: tree_schema.h:1628
struct lys_type * types
Definition: tree_schema.h:955
LYS_NODE nodetype
Definition: tree_schema.h:496
struct lys_type_bit * bit
Definition: tree_schema.h:847
int lys_iffeature_value(const struct lys_iffeature *iff)
Learn how the if-feature statement currently evaluates.
uint8_t implemented
Definition: tree_schema.h:692
unsigned int count
Definition: tree_schema.h:848
struct lys_ident * ident
Definition: tree_schema.h:717
struct lys_node * target
Definition: tree_schema.h:1871
Submodule schema node structure that can be included into a YANG module.
Definition: tree_schema.h:736
Schema choice node structure.
Definition: tree_schema.h:1325
struct lys_type_info_num num
Definition: tree_schema.h:971
struct lys_unique * unique
Definition: tree_schema.h:1512
uint8_t type
Definition: tree_schema.h:682
struct lys_node * dflt
Definition: tree_schema.h:1353
const char * target_name
Definition: tree_schema.h:1846
const char * arg_value
Definition: tree_schema.h:477
struct lys_restr * patterns
Definition: tree_schema.h:937
uint8_t padding[4]
Definition: tree_schema.h:1239
struct lys_module * lys_main_module(const struct lys_module *module)
Return main module of the module.
LYS_NODE nodetype
Definition: tree_schema.h:1249
struct lys_ext * extensions
Definition: tree_schema.h:721
uint8_t trg_type
Definition: tree_schema.h:2045
uint8_t deviated
Definition: tree_schema.h:687
uint8_t iffeature_size
Definition: tree_schema.h:834
struct lys_ident ** ref
Definition: tree_schema.h:895
const char * cond
Definition: tree_schema.h:2089
YANG uses&#39;s refine substatement structure, see RFC 6020 sec. 7.12.2
Definition: tree_schema.h:1897
YANG import structure used to reference other schemas (modules).
Definition: tree_schema.h:1981
Container for list modifications in lys_refine_mod.
Definition: tree_schema.h:1880
Container for information about string types (LY_TYPE_STRING), used in lys_type_info.
Definition: tree_schema.h:934
void * fill1[2]
Definition: tree_schema.h:1714
struct lys_node * data
Definition: tree_schema.h:725
const char ** dflt
Definition: tree_schema.h:1460
struct lys_import * imp
Definition: tree_schema.h:714
int lys_print_clb(ssize_t(*writeclb)(void *arg, const void *buf, size_t count), void *arg, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node, int line_length, int options)
Print schema tree in the specified format using a provided callback.
unsigned int pat_count
Definition: tree_schema.h:943
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.
Definition: tree_schema.h:2017
struct lys_restr * length
Definition: tree_schema.h:935
uint8_t min_set
Definition: tree_schema.h:1945
lyxp_node_type
Types of context nodes, LYXP_NODE_ROOT_CONFIG used only in when or must conditions.
Definition: tree_schema.h:2343
uint8_t padding[5]
Definition: tree_schema.h:457
struct lys_type * type
Definition: tree_schema.h:1955
int lys_search_localfile(const char *const *searchpaths, int cwd, const char *name, const char *revision, char **localfile, LYS_INFORMAT *format)
Search for the schema file in the specified searchpaths.
Single enumeration value specification for lys_type_info_enums.
Definition: tree_schema.h:867
const char * prefix
Definition: tree_schema.h:676
Union for holding type-specific information in lys_type.
Definition: tree_schema.h:964
#define LY_REV_SIZE
Definition: tree_schema.h:182
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...
void * priv
Definition: tree_schema.h:1261
uint8_t padding[3]
Definition: tree_schema.h:756
struct lys_node * child
Definition: tree_schema.h:1251
Container for information about leafref types (LY_TYPE_LEAFREF), used in lys_type_info.
Definition: tree_schema.h:921
struct lys_tpdf * tpdf
Definition: tree_schema.h:716
uint8_t padding1
Definition: tree_schema.h:695
Compiled if-feature expression structure.
Definition: tree_schema.h:1077
struct lys_node_leaf ** keys
Definition: tree_schema.h:1511
union lys_type_info info
Definition: tree_schema.h:989
Schema leaf-list node structure.
Definition: tree_schema.h:1418
const char * contact
Definition: tree_schema.h:680
YANG augment structure (covering both possibilities - uses&#39;s substatement as well as (sub)module&#39;s su...
Definition: tree_schema.h:1845
uint8_t inc_size
Definition: tree_schema.h:701
LYS_OUTFORMAT
Schema output formats accepted by libyang printer functions.
Definition: tree_schema.h:196
void ly_load_plugins(void)
Load the available YANG extension and type plugins from the plugin directory (LIBDIR/libyang/).
struct lys_node * orig_node
Definition: tree_schema.h:1970
uint8_t max_set
Definition: tree_schema.h:1946
LYS_DEVIATE_TYPE mod
Definition: tree_schema.h:1939
struct lys_type_enum * enm
Definition: tree_schema.h:887
Container for information about enumeration types (LY_TYPE_ENUM), used in lys_type_info.
Definition: tree_schema.h:886
uint16_t ident_size
Definition: tree_schema.h:703
struct ly_set * der
Definition: tree_schema.h:2119
Container for information about integer types, used in lys_type_info.
Definition: tree_schema.h:913
uint8_t flags
Definition: tree_schema.h:1941
int ly_register_exts(struct lyext_plugin_list *plugin, const char *log_name)
Directly register a YANG extension by pointer.
LY_STMT stmt
Definition: tree_schema.h:443
const char * argument
Definition: tree_schema.h:459
struct lys_ext * def
Definition: tree_schema.h:472
const char * dsc
Definition: tree_schema.h:453
Union to hold target modification in lys_refine.
Definition: tree_schema.h:1888
uint16_t unres_count
Definition: tree_schema.h:1637
Schema anydata (and anyxml) node structure.
Definition: tree_schema.h:1533
Container for information about decimal64 types (LY_TYPE_DEC64), used in lys_type_info.
Definition: tree_schema.h:854
uint8_t insubstmt_index
Definition: tree_schema.h:480
int lys_set_implemented(const struct lys_module *module)
Mark imported module as &quot;implemented&quot;.
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.
struct lys_ext_instance ** ext
Definition: tree_schema.h:458
uint8_t has_union_leafref
Definition: tree_schema.h:2024
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.
const char * ref
Definition: tree_schema.h:678
struct lys_type_info_lref lref
Definition: tree_schema.h:972
char rev[11]
Definition: tree_schema.h:1984
struct lys_module * belongsto
Definition: tree_schema.h:785
const char * keys_str
Definition: tree_schema.h:1517
struct lys_module * module
Definition: tree_schema.h:460
uint8_t keys_size
Definition: tree_schema.h:1485
const char * dflt
Definition: tree_schema.h:1405
uint8_t latest_revision
Definition: tree_schema.h:693
const char * filepath
Definition: tree_schema.h:681
struct lyext_plugin * plugin
Definition: tree_schema.h:461
struct lys_iffeature * iffeature
Definition: tree_schema.h:840
Container for information about identity types (LY_TYPE_IDENT), used in lys_type_info.
Definition: tree_schema.h:894
YANG when restriction, see RFC 6020 sec. 7.19.5
Definition: tree_schema.h:2088
const void * lys_ext_instance_substmt(const struct lys_ext_instance *ext)
Get address of the substatement structure to which the extension instance refers. ...
int lys_print_fd(int fd, 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 file descriptor.
Container for information about bits types (LY_TYPE_BINARY), used in lys_type_info.
Definition: tree_schema.h:846
struct lyext_substmt * substmt
Definition: tree_schema.h:531
uint8_t * expr
Definition: tree_schema.h:1078
lys_deviate_type
Possible deviation modifications, see RFC 6020 sec. 7.18.3.2
Definition: tree_schema.h:1928
LYS_INFORMAT
Schema input formats accepted by libyang parser functions.
Definition: tree_schema.h:187
Schema case node structure.
Definition: tree_schema.h:1667
struct lys_submodule * submodule
Definition: tree_schema.h:1995
struct lys_include * inc
Definition: tree_schema.h:715
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...
struct lys_node_augment * augment
Definition: tree_schema.h:719
uint8_t tpdf_size
Definition: tree_schema.h:1484
int lys_set_enabled(const struct lys_module *module)
Enable previously disabled module.
Schema list node structure.
Definition: tree_schema.h:1474
uint8_t features_size
Definition: tree_schema.h:706
const char * ns
Definition: tree_schema.h:726
struct lys_revision * rev
Definition: tree_schema.h:712
int lys_features_disable_force(const struct lys_module *module, const char *feature)
Disable specified feature in the module disregarding dependant features.
Container for information about instance-identifier types (LY_TYPE_INST), used in lys_type_info...
Definition: tree_schema.h:902
struct lys_feature * features
Definition: tree_schema.h:718
Main schema node structure representing YANG module.
Definition: tree_schema.h:673
struct lys_module * lys_node_module(const struct lys_node *node)
Return main module of the schema tree node.
Complex extension instance structure.
Definition: tree_schema.h:505
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...
struct lys_module * lys_parse_mem(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format)
Load a schema into the specified context.
uint32_t pos
Definition: tree_schema.h:837
struct lys_deviate * deviate
Definition: tree_schema.h:1974
int ly_clean_plugins(void)
Unload all the YANG extension and type plugins.
uint8_t unique_size
Definition: tree_schema.h:1486
RPC input and output node structure.
Definition: tree_schema.h:1712
uint8_t version
Definition: tree_schema.h:683
LY_DATA_TYPE _PACKED base
Definition: tree_schema.h:981
LY_DATA_TYPE
YANG built-in types.
Definition: tree_schema.h:791
uint8_t ext_size
Definition: tree_schema.h:710
struct lys_node * next
Definition: tree_schema.h:1255
struct lys_node_leaf * target
Definition: tree_schema.h:924
struct lys_node_grp * grp
Definition: tree_schema.h:1614
struct lys_type type
Definition: tree_schema.h:1401
struct lys_module * lys_implemented_module(const struct lys_module *mod)
Find the implemented revision of the given module in the context.
uint16_t flags
Definition: tree_schema.h:831
YANG type structure providing information from the schema.
Definition: tree_schema.h:980
uint16_t flags
Definition: tree_schema.h:455
char date[11]
Definition: tree_schema.h:2007
void * padding_iff
Definition: tree_schema.h:1641
struct lys_when * when
Definition: tree_schema.h:1310
LYS_VERSION
supported YANG schema version values
Definition: tree_schema.h:660
YANG list&#39;s unique statement structure, see RFC 6020 sec. 7.8.3
Definition: tree_schema.h:2042
uint8_t imp_size
Definition: tree_schema.h:700
struct lys_refine * refine
Definition: tree_schema.h:1612
void * lys_ext_complex_get_substmt(LY_STMT stmt, struct lys_ext_instance_complex *ext, struct lyext_substmt **info)
get pointer to the place where the specified extension&#39;s substatement is supposed to be stored in the...
Structure to hold information about identity, see RFC 6020 sec. 7.16
Definition: tree_schema.h:2102
uint8_t padding[1]
Definition: tree_schema.h:1286
struct ly_set * depfeatures
Definition: tree_schema.h:2066
uint8_t refine_size
Definition: tree_schema.h:1592
struct lys_node * prev
Definition: tree_schema.h:1256
struct lys_tpdf * der
Definition: tree_schema.h:985
struct lys_ident ** base
Definition: tree_schema.h:2118
const char * org
Definition: tree_schema.h:679
Description of the extension instance substatement.
Definition: tree_schema.h:442
uint8_t rev_size
Definition: tree_schema.h:699
char * lys_data_path_pattern(const struct lys_node *node, const char *placeholder)
Build the data path pattern of a schema node.
YANG deviate statement structure, see RFC 6020 sec. 7.18.3.2
Definition: tree_schema.h:1938
struct lys_restr * range
Definition: tree_schema.h:855
uint8_t base_size
Definition: tree_schema.h:2112
const char * name
Definition: tree_schema.h:452
const char *const * ly_get_loaded_plugins(void)
Get list of all the loaded plugins, both extension and user type ones.
uint8_t extensions_size
Definition: tree_schema.h:709
const char ** lys_features_list(const struct lys_module *module, uint8_t **states)
Get list of all the defined features in the module and its submodules.
const char * presence
Definition: tree_schema.h:1313
Schema uses node structure.
Definition: tree_schema.h:1581
const char * units
Definition: tree_schema.h:1402
int lys_set_disabled(const struct lys_module *module)
Disable module in its context to avoid its further usage (it will be hidden for module getters)...
struct lys_type_info_union uni
Definition: tree_schema.h:974
Schema notification node structure.
Definition: tree_schema.h:1750
void * lys_set_private(const struct lys_node *node, void *priv)
Set a schema private pointer to a user pointer.
int lys_print_path(const char *path, 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 file.
const char * name
Definition: tree_schema.h:675
LY_STMT
List of YANG statements.
Definition: tree_schema.h:282
union lys_refine_mod mod
Definition: tree_schema.h:1921
const char ** expr
Definition: tree_schema.h:2043
YANG validity restriction (must, length, etc.) structure providing information from the schema...
Definition: tree_schema.h:2072
int32_t value
Definition: tree_schema.h:877
struct lys_module * lys_parse_path(struct ly_ctx *ctx, const char *path, LYS_INFORMAT format)
Load a schema into the specified context from a file.
uint8_t expr_size
Definition: tree_schema.h:2044
enum lys_deviate_type LYS_DEVIATE_TYPE
Possible deviation modifications, see RFC 6020 sec. 7.18.3.2
LYEXT_TYPE
Extension types.
Definition: tree_schema.h:384
Schema rpc/action node structure.
Definition: tree_schema.h:1797
uint8_t padding_iffsize
Definition: tree_schema.h:1634
struct lys_restr * must
Definition: tree_schema.h:1311
Generic extension instance structure.
Definition: tree_schema.h:471
Container for information about union types (LY_TYPE_UNION), used in lys_type_info.
Definition: tree_schema.h:954
struct lys_tpdf * parent
Definition: tree_schema.h:987
uint8_t parent_type
Definition: tree_schema.h:490
YANG extension definition.
Definition: tree_schema.h:451
struct ly_ctx * ctx
Definition: tree_schema.h:674
uint8_t value_flags
Definition: tree_schema.h:982
uint8_t disabled
Definition: tree_schema.h:691
YANG revision statement for (sub)modules.
Definition: tree_schema.h:2006
struct lys_type_info_str str
Definition: tree_schema.h:973
YANG include structure used to reference submodules.
Definition: tree_schema.h:1994
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.
uint8_t deviate_size
Definition: tree_schema.h:1972
YANG feature definition structure.
Definition: tree_schema.h:2051
uint8_t padding2[2]
Definition: tree_schema.h:696
struct lys_feature ** features
Definition: tree_schema.h:1080
uint16_t tpdf_size
Definition: tree_schema.h:704
const char * eapptag
Definition: tree_schema.h:2078
const char * path
Definition: tree_schema.h:922
enum lys_nodetype LYS_NODE
YANG schema node types.
Single bit value specification for lys_type_info_bits.
Definition: tree_schema.h:827
uint16_t target_type
Definition: tree_schema.h:1906
uint8_t padding[2]
Definition: tree_schema.h:1427
uint8_t deviation_size
Definition: tree_schema.h:708
int lys_ext_instance_presence(struct lys_ext *def, struct lys_ext_instance **ext, uint8_t ext_size)
Get the position of the extension instance in the extensions list.
struct lys_module * lys_parse_fd(struct ly_ctx *ctx, int fd, LYS_INFORMAT format)
Read a schema from file descriptor into the specified context.
const char * dsc
Definition: tree_schema.h:677
struct lys_ext_instance ** ext
Definition: tree_schema.h:722
Schema container node structure.
Definition: tree_schema.h:1277
struct lys_node * parent
Definition: tree_schema.h:1250
YANG deviation statement structure, see RFC 6020 sec. 7.18.3
Definition: tree_schema.h:1965
struct lys_node * lys_parent(const struct lys_node *node)
Return parent node in the schema tree.
const char * expr
Definition: tree_schema.h:2073
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.
int lys_features_enable_force(const struct lys_module *module, const char *feature)
Enable specified feature in the module disregarding its if-features.