libyang  1.0.225
YANG data modeling language library
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 {
190  LYS_IN_YIN = 2
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
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 {
285  LY_STMT_ARGUMENT = 1,
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 */
380 
384 typedef enum {
385  LYEXT_ERR = -1,
386  LYEXT_FLAG = 0,
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
437  size_t offset;
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 };
456 
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;
487  void *priv;
488  struct lys_module *module;
490 };
491 
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;
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 };
527 
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 
645 
653 typedef enum LYS_VERSION {
656  LYS_VERSION_1_1 = 2
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;
714  struct lys_ext *extensions;
717  /* specific module's items in comparison to submodules */
718  struct lys_node *data;
719  const char *ns;
720 };
721 
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;
774  struct lys_ext *extensions;
777  /* specific submodule's items in comparison to modules */
779 };
780 
784 typedef enum {
806 } LY_DATA_TYPE;
807 #define LY_DATA_TYPE_COUNT 20
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;
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 
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;
874 };
875 
881  unsigned int count;
882 };
883 
888  struct lys_ident **ref;
889  unsigned int count;
890 };
891 
896  int8_t req;
901 };
902 
907  struct lys_restr *range;
909 };
910 
915  const char *path;
918  int8_t req;
922 };
923 
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 };
943 
948  struct lys_type *types;
949  unsigned int count;
952 };
953 
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;
964  struct lys_type_info_num num;
965  struct lys_type_info_lref lref;
966  struct lys_type_info_str str;
967  struct lys_type_info_union uni;
968 };
969 
973 struct lys_type {
974  LY_DATA_TYPE _PACKED base;
975  uint8_t value_flags;
976  uint8_t ext_size;
978  struct lys_tpdf *der;
980  struct lys_tpdf *parent;
982  union lys_type_info info;
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;
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];
1225  struct lys_module *module;
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 };
1245 
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;
1270  struct lys_module *module;
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
1286 
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];
1316  struct lys_module *module;
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 
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;
1359  struct lys_module *module;
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 };
1385 
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;
1411  struct lys_module *module;
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
1429 
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 
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;
1468  struct lys_module *module;
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
1484 
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;
1525  struct lys_module *module;
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 };
1546 
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;
1575  struct lys_module *module;
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 
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;
1619  void *padding_iff;
1620  struct lys_module *module;
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];
1658  struct lys_module *module;
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 
1691  const char *name;
1692  void *fill1[2];
1693  uint16_t flags;
1694  uint8_t ext_size;
1697  /* non compatible 32b with ::lys_node */
1698  uint8_t padding[1];
1699  uint8_t must_size;
1700  uint16_t tpdf_size;
1703  void *padding_iff;
1704  struct lys_module *module;
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 };
1721 
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;
1743  struct lys_module *module;
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
1759 
1760  /* specific rpc's data */
1761  struct lys_tpdf *tpdf;
1762  struct lys_restr *must;
1763 };
1764 
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;
1789  struct lys_module *module;
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 };
1809 
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];
1837  struct lys_module *module;
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 };
1862 
1867  const char *presence;
1868  struct lys_refine_mod_list list;
1870 };
1871 
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;
1892  struct lys_module *module;
1894  struct lys_restr *must;
1895  const char **dflt;
1899  union lys_refine_mod mod;
1900 };
1901 
1902 
1906 typedef enum lys_deviate_type {
1912 
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;
1938 };
1939 
1944  const char *target_name;
1946  const char *dsc;
1947  const char *ref;
1950  uint8_t deviate_size;
1951  uint8_t ext_size;
1954 };
1955 
1959 struct lys_import {
1960  struct lys_module *module;
1961  const char *prefix;
1963  uint8_t ext_size;
1965  const char *dsc;
1966  const char *ref;
1967 };
1968 
1972 struct lys_include {
1975  uint8_t ext_size;
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;
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];
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;
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);
2300 
2312 struct ly_set *lys_find_path(const struct lys_module *cur_module, const struct lys_node *cur_node, const char *path);
2313 
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);
2345 
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);
2373 
2374 #define LYS_PATH_FIRST_PREFIX 0x01
2384 char *lys_data_path(const struct lys_node *node);
2385 
2399 char *lys_data_path_pattern(const struct lys_node *node, const char *placeholder);
2400 
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_ */
struct lys_module * module
Definition: tree_schema.h:453
struct lys_ext * def
Definition: tree_schema.h:465
const char * arg_value
Definition: tree_schema.h:470
uint16_t flags
Definition: tree_schema.h:448
LY_STMT stmt
Definition: tree_schema.h:436
uint8_t insubstmt_index
Definition: tree_schema.h:473
struct lyext_plugin * plugin
Definition: tree_schema.h:454
uint8_t ext_size
Definition: tree_schema.h:449
const char * dsc
Definition: tree_schema.h:446
uint8_t padding[5]
Definition: tree_schema.h:450
uint8_t parent_type
Definition: tree_schema.h:483
struct lys_ext_instance ** ext
Definition: tree_schema.h:451
LY_STMT_CARD cardinality
Definition: tree_schema.h:438
LYS_NODE nodetype
Definition: tree_schema.h:489
const char * argument
Definition: tree_schema.h:452
const char * name
Definition: tree_schema.h:445
struct lyext_substmt * substmt
Definition: tree_schema.h:524
const char * ref
Definition: tree_schema.h:447
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's substatement is supposed to be stored in the...
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.
int ly_register_types(struct lytype_plugin_list *plugin, const char *log_name)
Directly register a YANG type by pointer.
void ly_load_plugins(void)
Load the available YANG extension and type plugins from the plugin directory (LIBDIR/libyang/).
int ly_register_exts(struct lyext_plugin_list *plugin, const char *log_name)
Directly register a YANG extension by pointer.
LY_STMT_CARD
Possible cardinalities of the YANG statements.
Definition: tree_schema.h:374
LY_STMT
List of YANG statements.
Definition: tree_schema.h:282
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 ly_clean_plugins(void)
Unload all the YANG extension and type plugins.
LYEXT_TYPE
Extension types.
Definition: tree_schema.h:384
const char *const * ly_get_loaded_plugins(void)
Get list of all the loaded plugins, both extension and user type ones.
@ LY_STMT_CARD_MAND
Definition: tree_schema.h:376
@ LY_STMT_CARD_ANY
Definition: tree_schema.h:378
@ LY_STMT_CARD_OPT
Definition: tree_schema.h:375
@ LY_STMT_CARD_SOME
Definition: tree_schema.h:377
@ LY_STMT_REVISION
Definition: tree_schema.h:352
@ LY_STMT_MUST
Definition: tree_schema.h:348
@ LY_STMT_ARGUMENT
Definition: tree_schema.h:285
@ LY_STMT_ENUM
Definition: tree_schema.h:357
@ LY_STMT_LEAF
Definition: tree_schema.h:338
@ LY_STMT_VERSION
Definition: tree_schema.h:308
@ LY_STMT_REVISIONDATE
Definition: tree_schema.h:305
@ LY_STMT_ERRTAG
Definition: tree_schema.h:296
@ LY_STMT_REFERENCE
Definition: tree_schema.h:304
@ LY_STMT_UNIQUE
Definition: tree_schema.h:328
@ LY_STMT_DEVIATION
Definition: tree_schema.h:361
@ LY_STMT_IMPORT
Definition: tree_schema.h:365
@ LY_STMT_CONTACT
Definition: tree_schema.h:293
@ LY_STMT_LENGTH
Definition: tree_schema.h:347
@ LY_STMT_NODE
Definition: tree_schema.h:283
@ LY_STMT_DIGITS
Definition: tree_schema.h:324
@ LY_STMT_ANYDATA
Definition: tree_schema.h:331
@ LY_STMT_ORDEREDBY
Definition: tree_schema.h:319
@ LY_STMT_CONTAINER
Definition: tree_schema.h:335
@ LY_STMT_PATTERN
Definition: tree_schema.h:349
@ LY_STMT_POSITION
Definition: tree_schema.h:327
@ LY_STMT_PREFIX
Definition: tree_schema.h:302
@ LY_STMT_WHEN
Definition: tree_schema.h:351
@ LY_STMT_ORGANIZATION
Definition: tree_schema.h:300
@ LY_STMT_AUGMENT
Definition: tree_schema.h:359
@ LY_STMT_SUBMODULE
Definition: tree_schema.h:353
@ LY_STMT_ANYXML
Definition: tree_schema.h:332
@ LY_STMT_ERRMSG
Definition: tree_schema.h:297
@ LY_STMT_NAMESPACE
Definition: tree_schema.h:299
@ LY_STMT_LEAFLIST
Definition: tree_schema.h:339
@ LY_STMT_MANDATORY
Definition: tree_schema.h:317
@ LY_STMT_PATH
Definition: tree_schema.h:301
@ LY_STMT_UNKNOWN
Definition: tree_schema.h:284
@ LY_STMT_MIN
Definition: tree_schema.h:326
@ LY_STMT_EXTENSION
Definition: tree_schema.h:362
@ LY_STMT_CASE
Definition: tree_schema.h:333
@ LY_STMT_MODULE
Definition: tree_schema.h:329
@ LY_STMT_REQINSTANCE
Definition: tree_schema.h:311
@ LY_STMT_OUTPUT
Definition: tree_schema.h:342
@ LY_STMT_REFINE
Definition: tree_schema.h:358
@ LY_STMT_IDENTITY
Definition: tree_schema.h:364
@ LY_STMT_TYPEDEF
Definition: tree_schema.h:344
@ LY_STMT_BELONGSTO
Definition: tree_schema.h:290
@ LY_STMT_DESCRIPTION
Definition: tree_schema.h:295
@ LY_STMT_CONFIG
Definition: tree_schema.h:314
@ LY_STMT_RANGE
Definition: tree_schema.h:350
@ LY_STMT_INCLUDE
Definition: tree_schema.h:366
@ LY_STMT_IFFEATURE
Definition: tree_schema.h:346
@ LY_STMT_BIT
Definition: tree_schema.h:356
@ LY_STMT_ACTION
Definition: tree_schema.h:330
@ LY_STMT_MODIFIER
Definition: tree_schema.h:309
@ LY_STMT_TYPE
Definition: tree_schema.h:345
@ LY_STMT_BASE
Definition: tree_schema.h:289
@ LY_STMT_FEATURE
Definition: tree_schema.h:363
@ LY_STMT_RPC
Definition: tree_schema.h:355
@ LY_STMT_DEVIATE
Definition: tree_schema.h:360
@ LY_STMT_UNITS
Definition: tree_schema.h:306
@ LY_STMT_GROUPING
Definition: tree_schema.h:336
@ LY_STMT_KEY
Definition: tree_schema.h:298
@ LY_STMT_NOTIFICATION
Definition: tree_schema.h:341
@ LY_STMT_CHOICE
Definition: tree_schema.h:334
@ LY_STMT_VALUE
Definition: tree_schema.h:307
@ LY_STMT_USES
Definition: tree_schema.h:343
@ LY_STMT_MAX
Definition: tree_schema.h:325
@ LY_STMT_PRESENCE
Definition: tree_schema.h:303
@ LY_STMT_STATUS
Definition: tree_schema.h:321
@ LY_STMT_INPUT
Definition: tree_schema.h:337
@ LY_STMT_YINELEM
Definition: tree_schema.h:313
@ LY_STMT_LIST
Definition: tree_schema.h:340
@ LY_STMT_DEFAULT
Definition: tree_schema.h:294
@ LYEXT_ERR
Definition: tree_schema.h:385
@ LYEXT_COMPLEX
Definition: tree_schema.h:389
@ LYEXT_FLAG
Definition: tree_schema.h:386
Description of the extension instance substatement.
Definition: tree_schema.h:435
YANG extension definition.
Definition: tree_schema.h:444
Generic extension instance structure.
Definition: tree_schema.h:464
Complex extension instance structure.
Definition: tree_schema.h:498
int32_t value
Definition: tree_schema.h:870
struct lys_module * module
Definition: tree_schema.h:1225
struct lys_node * target
Definition: tree_schema.h:1849
uint8_t tpdf_size
Definition: tree_schema.h:1462
const char * eapptag
Definition: tree_schema.h:2056
struct ly_set * depfeatures
Definition: tree_schema.h:2044
struct lys_node_leaf ** keys
Definition: tree_schema.h:1489
uint8_t unique_size
Definition: tree_schema.h:1464
unsigned int count
Definition: tree_schema.h:841
const char * units
Definition: tree_schema.h:1380
uint8_t type
Definition: tree_schema.h:675
uint16_t flags
Definition: tree_schema.h:824
uint8_t deviate_size
Definition: tree_schema.h:1950
const char * presence
Definition: tree_schema.h:1291
struct lys_feature * features
Definition: tree_schema.h:711
uint8_t padding_iffsize
Definition: tree_schema.h:1612
struct lys_ident * ident
Definition: tree_schema.h:710
uint8_t deviated
Definition: tree_schema.h:680
uint8_t latest_revision
Definition: tree_schema.h:686
uint8_t deviation_size
Definition: tree_schema.h:701
uint8_t padding[1]
Definition: tree_schema.h:1264
const char ** dflt
Definition: tree_schema.h:1438
uint8_t value_flags
Definition: tree_schema.h:975
struct lys_type_info_lref lref
Definition: tree_schema.h:965
struct lys_node * parent
Definition: tree_schema.h:1228
struct lys_type_info_union uni
Definition: tree_schema.h:967
const char * ns
Definition: tree_schema.h:719
struct lys_node * prev
Definition: tree_schema.h:1234
struct lys_type_info_num num
Definition: tree_schema.h:964
const char * path
Definition: tree_schema.h:915
uint8_t expr_size
Definition: tree_schema.h:2022
uint8_t * expr
Definition: tree_schema.h:1071
uint8_t padding1
Definition: tree_schema.h:688
struct lys_type_info_ident ident
Definition: tree_schema.h:962
struct lys_refine_mod_list list
Definition: tree_schema.h:1868
void * padding_iff
Definition: tree_schema.h:1619
struct lys_include * inc
Definition: tree_schema.h:708
struct lys_submodule * submodule
Definition: tree_schema.h:1973
struct lys_ext * extensions
Definition: tree_schema.h:714
const char ** expr
Definition: tree_schema.h:2021
uint8_t augment_size
Definition: tree_schema.h:700
struct lys_ident ** base
Definition: tree_schema.h:2096
struct lys_node_augment * augment
Definition: tree_schema.h:712
struct lys_type_info_dec64 dec64
Definition: tree_schema.h:960
uint16_t unres_count
Definition: tree_schema.h:1615
struct lys_revision * rev
Definition: tree_schema.h:705
const char * prefix
Definition: tree_schema.h:669
struct lys_tpdf * tpdf
Definition: tree_schema.h:709
struct lys_type * types
Definition: tree_schema.h:948
struct lys_when * when
Definition: tree_schema.h:1288
struct lys_type_bit * bit
Definition: tree_schema.h:840
uint8_t ext_size
Definition: tree_schema.h:703
const char * emsg
Definition: tree_schema.h:2057
struct lys_type * type
Definition: tree_schema.h:1933
const char * dsc
Definition: tree_schema.h:670
struct lys_ext_instance ** ext
Definition: tree_schema.h:715
uint8_t base_size
Definition: tree_schema.h:2090
const char * target_name
Definition: tree_schema.h:1824
uint8_t padding[3]
Definition: tree_schema.h:749
struct lys_node_leaf * target
Definition: tree_schema.h:917
struct lys_refine * refine
Definition: tree_schema.h:1590
uint16_t target_type
Definition: tree_schema.h:1884
struct lys_node * data
Definition: tree_schema.h:718
struct lys_ident ** ref
Definition: tree_schema.h:888
struct lys_node * child
Definition: tree_schema.h:1229
struct lys_type_info_str str
Definition: tree_schema.h:966
struct lys_restr * patterns
Definition: tree_schema.h:930
const char * contact
Definition: tree_schema.h:673
struct lys_restr * length
Definition: tree_schema.h:813
uint8_t iffeature_size
Definition: tree_schema.h:827
uint8_t keys_size
Definition: tree_schema.h:1463
union lys_type_info info
Definition: tree_schema.h:982
struct lys_node_grp * grp
Definition: tree_schema.h:1592
uint16_t ident_size
Definition: tree_schema.h:696
const char * cond
Definition: tree_schema.h:2067
LYS_NODE nodetype
Definition: tree_schema.h:1227
void * priv
Definition: tree_schema.h:1239
const char * name
Definition: tree_schema.h:668
void * fill1[2]
Definition: tree_schema.h:1692
uint8_t trg_type
Definition: tree_schema.h:2023
const char * org
Definition: tree_schema.h:672
uint8_t features_size
Definition: tree_schema.h:699
const char * keys_str
Definition: tree_schema.h:1495
struct lys_tpdf * der
Definition: tree_schema.h:978
struct lys_unique * unique
Definition: tree_schema.h:1490
uint8_t has_union_leafref
Definition: tree_schema.h:2002
struct lys_tpdf * parent
Definition: tree_schema.h:980
uint8_t flags
Definition: tree_schema.h:1919
struct ly_set * der
Definition: tree_schema.h:2097
struct lys_type_info_enums enums
Definition: tree_schema.h:961
struct lys_deviate * deviate
Definition: tree_schema.h:1952
unsigned int pat_count
Definition: tree_schema.h:936
struct lys_node * orig_node
Definition: tree_schema.h:1948
uint8_t version
Definition: tree_schema.h:676
struct lys_iffeature * iffeature
Definition: tree_schema.h:833
uint16_t tpdf_size
Definition: tree_schema.h:697
struct lys_feature ** features
Definition: tree_schema.h:1073
uint8_t padding2[2]
Definition: tree_schema.h:689
uint8_t max_set
Definition: tree_schema.h:1924
uint8_t min_set
Definition: tree_schema.h:1923
struct lys_node * next
Definition: tree_schema.h:1233
uint8_t implemented
Definition: tree_schema.h:685
uint8_t refine_size
Definition: tree_schema.h:1570
struct lys_type_info_inst inst
Definition: tree_schema.h:963
uint8_t imp_size
Definition: tree_schema.h:693
uint8_t extensions_size
Definition: tree_schema.h:702
uint8_t disabled
Definition: tree_schema.h:684
LY_DATA_TYPE _PACKED base
Definition: tree_schema.h:974
union lys_refine_mod mod
Definition: tree_schema.h:1899
uint8_t padding[4]
Definition: tree_schema.h:1217
struct ly_set * backlinks
Definition: tree_schema.h:1415
struct lys_type type
Definition: tree_schema.h:1379
const char * filepath
Definition: tree_schema.h:674
uint8_t padding[2]
Definition: tree_schema.h:1405
const char * ref
Definition: tree_schema.h:671
struct lys_deviation * deviation
Definition: tree_schema.h:713
struct lys_restr * range
Definition: tree_schema.h:848
const char * expr
Definition: tree_schema.h:2051
struct lys_type_info_binary binary
Definition: tree_schema.h:958
struct lys_type_enum * enm
Definition: tree_schema.h:880
struct lys_node * dflt
Definition: tree_schema.h:1331
const char * dflt
Definition: tree_schema.h:1383
struct lys_module * belongsto
Definition: tree_schema.h:778
struct lys_import * imp
Definition: tree_schema.h:707
uint32_t pos
Definition: tree_schema.h:830
LYS_DEVIATE_TYPE mod
Definition: tree_schema.h:1917
uint8_t inc_size
Definition: tree_schema.h:694
char date[11]
Definition: tree_schema.h:1985
char rev[11]
Definition: tree_schema.h:1962
struct lys_type_info_bits bits
Definition: tree_schema.h:959
struct ly_ctx * ctx
Definition: tree_schema.h:667
uint8_t rev_size
Definition: tree_schema.h:692
struct lys_restr * must
Definition: tree_schema.h:1289
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.
const 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 ** lys_features_list(const struct lys_module *module, uint8_t **states)
Get list of all the defined features in the module and its submodules.
LY_DATA_TYPE
YANG built-in types.
Definition: tree_schema.h:784
lyxp_node_type
Types of context nodes, LYXP_NODE_ROOT_CONFIG used only in when or must conditions.
Definition: tree_schema.h:2317
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.
int lys_features_disable_force(const struct lys_module *module, const char *feature)
Disable specified feature in the module disregarding dependant features.
struct lys_module * lys_implemented_module(const struct lys_module *mod)
Find the implemented revision of the given module in the context.
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).
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,...
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.
const 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....
struct lys_module * lys_main_module(const struct lys_module *module)
Return main module of the module.
char * lys_data_path_pattern(const struct lys_node *node, const char *placeholder)
Build the data path pattern of a schema node.
int lys_set_enabled(const struct lys_module *module)
Enable previously disabled module.
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,...
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.
struct lys_node * lys_parent(const struct lys_node *node)
Return parent node in the schema tree.
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 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...
char * lys_path(const struct lys_node *node, int options)
Build schema path (usable as path, see howtoxpath) of the schema node.
const 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...
const 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.
char * lys_data_path(const struct lys_node *node)
Build data path (usable as path, see howtoxpath) of the schema node.
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.
LYS_OUTFORMAT
Schema output formats accepted by libyang printer functions.
Definition: tree_schema.h:196
enum lys_deviate_type LYS_DEVIATE_TYPE
Possible deviation modifications, see RFC 6020 sec. 7.18.3.2
void * lys_set_private(const struct lys_node *node, void *priv)
Set a schema private pointer to a user pointer.
LYS_INFORMAT
Schema input formats accepted by libyang parser functions.
Definition: tree_schema.h:187
lys_nodetype
YANG schema node types.
Definition: tree_schema.h:229
lys_deviate_type
Possible deviation modifications, see RFC 6020 sec. 7.18.3.2
Definition: tree_schema.h:1906
const 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.
int lys_iffeature_value(const struct lys_iffeature *iff)
Learn how the if-feature statement currently evaluates.
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.
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.
int lys_set_implemented(const struct lys_module *module)
Mark imported module as "implemented".
int lys_features_enable_force(const struct lys_module *module, const char *feature)
Enable specified feature in the module disregarding its if-features.
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...
LYS_VERSION
supported YANG schema version values
Definition: tree_schema.h:653
struct lys_module * lys_node_module(const struct lys_node *node)
Return main module of the schema tree node.
const struct lys_type * lys_getnext_union_type(const struct lys_type *last, const struct lys_type *type)
Get next type of a union.
#define LY_REV_SIZE
Definition: tree_schema.h:182
const struct lys_module * lys_parse_mem(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format)
Load a schema into the specified context.
enum lys_nodetype LYS_NODE
YANG schema node types.
@ LY_TYPE_STRING
Definition: tree_schema.h:795
@ LY_TYPE_BITS
Definition: tree_schema.h:787
@ LY_TYPE_UNKNOWN
Definition: tree_schema.h:805
@ LY_TYPE_IDENT
Definition: tree_schema.h:792
@ LY_TYPE_UINT16
Definition: tree_schema.h:800
@ LY_TYPE_LEAFREF
Definition: tree_schema.h:794
@ LY_TYPE_INT16
Definition: tree_schema.h:799
@ LY_TYPE_UNION
Definition: tree_schema.h:796
@ LY_TYPE_BOOL
Definition: tree_schema.h:788
@ LY_TYPE_DER
Definition: tree_schema.h:785
@ LY_TYPE_INT32
Definition: tree_schema.h:801
@ LY_TYPE_ENUM
Definition: tree_schema.h:791
@ LY_TYPE_INST
Definition: tree_schema.h:793
@ LY_TYPE_UINT8
Definition: tree_schema.h:798
@ LY_TYPE_BINARY
Definition: tree_schema.h:786
@ LY_TYPE_INT64
Definition: tree_schema.h:803
@ LY_TYPE_INT8
Definition: tree_schema.h:797
@ LY_TYPE_UINT64
Definition: tree_schema.h:804
@ LY_TYPE_DEC64
Definition: tree_schema.h:789
@ LY_TYPE_UINT32
Definition: tree_schema.h:802
@ LY_TYPE_EMPTY
Definition: tree_schema.h:790
@ LYXP_NODE_ATTR
Definition: tree_schema.h:2325
@ LYXP_NODE_ELEM
Definition: tree_schema.h:2323
@ LYXP_NODE_ROOT
Definition: tree_schema.h:2319
@ LYXP_NODE_ROOT_CONFIG
Definition: tree_schema.h:2320
@ LYXP_NODE_NONE
Definition: tree_schema.h:2327
@ LYXP_NODE_TEXT
Definition: tree_schema.h:2324
@ LYS_OUT_YANG
Definition: tree_schema.h:198
@ LYS_OUT_JSON
Definition: tree_schema.h:202
@ LYS_OUT_TREE
Definition: tree_schema.h:200
@ LYS_OUT_UNKNOWN
Definition: tree_schema.h:197
@ LYS_OUT_INFO
Definition: tree_schema.h:201
@ LYS_OUT_YIN
Definition: tree_schema.h:199
@ LYS_IN_UNKNOWN
Definition: tree_schema.h:188
@ LYS_IN_YIN
Definition: tree_schema.h:190
@ LYS_IN_YANG
Definition: tree_schema.h:189
@ LYS_USES
Definition: tree_schema.h:243
@ LYS_AUGMENT
Definition: tree_schema.h:244
@ LYS_CASE
Definition: tree_schema.h:237
@ LYS_RPC
Definition: tree_schema.h:239
@ LYS_LEAF
Definition: tree_schema.h:233
@ LYS_OUTPUT
Definition: tree_schema.h:241
@ LYS_ANYDATA
Definition: tree_schema.h:246
@ LYS_LIST
Definition: tree_schema.h:235
@ LYS_ANYXML
Definition: tree_schema.h:236
@ LYS_UNKNOWN
Definition: tree_schema.h:230
@ LYS_EXT
Definition: tree_schema.h:247
@ LYS_CONTAINER
Definition: tree_schema.h:231
@ LYS_NOTIF
Definition: tree_schema.h:238
@ LYS_ACTION
Definition: tree_schema.h:245
@ LYS_INPUT
Definition: tree_schema.h:240
@ LYS_CHOICE
Definition: tree_schema.h:232
@ LYS_GROUPING
Definition: tree_schema.h:242
@ LYS_LEAFLIST
Definition: tree_schema.h:234
@ LY_DEVIATE_ADD
Definition: tree_schema.h:1908
@ LY_DEVIATE_DEL
Definition: tree_schema.h:1910
@ LY_DEVIATE_RPL
Definition: tree_schema.h:1909
@ LY_DEVIATE_NO
Definition: tree_schema.h:1907
@ LYS_VERSION_UNDEF
Definition: tree_schema.h:654
@ LYS_VERSION_1_1
Definition: tree_schema.h:656
@ LYS_VERSION_1
Definition: tree_schema.h:655
YANG deviate statement structure, see RFC 6020 sec. 7.18.3.2
Definition: tree_schema.h:1916
YANG deviation statement structure, see RFC 6020 sec. 7.18.3
Definition: tree_schema.h:1943
YANG feature definition structure.
Definition: tree_schema.h:2029
Structure to hold information about identity, see RFC 6020 sec. 7.16
Definition: tree_schema.h:2080
Compiled if-feature expression structure.
Definition: tree_schema.h:1070
YANG import structure used to reference other schemas (modules).
Definition: tree_schema.h:1959
YANG include structure used to reference submodules.
Definition: tree_schema.h:1972
Main schema node structure representing YANG module.
Definition: tree_schema.h:666
Common structure representing single YANG data statement describing.
Definition: tree_schema.h:1209
Schema anydata (and anyxml) node structure.
Definition: tree_schema.h:1511
YANG augment structure (covering both possibilities - uses's substatement as well as (sub)module's su...
Definition: tree_schema.h:1823
Schema case node structure.
Definition: tree_schema.h:1645
Schema choice node structure.
Definition: tree_schema.h:1303
Schema container node structure.
Definition: tree_schema.h:1255
Schema grouping node structure.
Definition: tree_schema.h:1606
RPC input and output node structure.
Definition: tree_schema.h:1690
Schema leaf node structure.
Definition: tree_schema.h:1345
Schema leaf-list node structure.
Definition: tree_schema.h:1396
Schema list node structure.
Definition: tree_schema.h:1452
Schema notification node structure.
Definition: tree_schema.h:1728
Schema rpc/action node structure.
Definition: tree_schema.h:1775
Schema uses node structure.
Definition: tree_schema.h:1559
YANG uses's refine substatement structure, see RFC 6020 sec. 7.12.2
Definition: tree_schema.h:1875
Container for list modifications in lys_refine_mod.
Definition: tree_schema.h:1858
YANG validity restriction (must, length, etc.) structure providing information from the schema.
Definition: tree_schema.h:2050
YANG revision statement for (sub)modules.
Definition: tree_schema.h:1984
Submodule schema node structure that can be included into a YANG module.
Definition: tree_schema.h:729
YANG typedef structure providing information from the schema.
Definition: tree_schema.h:1995
YANG type structure providing information from the schema.
Definition: tree_schema.h:973
Single bit value specification for lys_type_info_bits.
Definition: tree_schema.h:820
Single enumeration value specification for lys_type_info_enums.
Definition: tree_schema.h:860
Container for information about bits types (LY_TYPE_BINARY), used in lys_type_info.
Definition: tree_schema.h:839
Container for information about decimal64 types (LY_TYPE_DEC64), used in lys_type_info.
Definition: tree_schema.h:847
Container for information about enumeration types (LY_TYPE_ENUM), used in lys_type_info.
Definition: tree_schema.h:879
Container for information about identity types (LY_TYPE_IDENT), used in lys_type_info.
Definition: tree_schema.h:887
Container for information about instance-identifier types (LY_TYPE_INST), used in lys_type_info.
Definition: tree_schema.h:895
Container for information about leafref types (LY_TYPE_LEAFREF), used in lys_type_info.
Definition: tree_schema.h:914
Container for information about integer types, used in lys_type_info.
Definition: tree_schema.h:906
Container for information about string types (LY_TYPE_STRING), used in lys_type_info.
Definition: tree_schema.h:927
Container for information about union types (LY_TYPE_UNION), used in lys_type_info.
Definition: tree_schema.h:947
YANG list's unique statement structure, see RFC 6020 sec. 7.8.3
Definition: tree_schema.h:2020
YANG when restriction, see RFC 6020 sec. 7.19.5
Definition: tree_schema.h:2066
Union to hold target modification in lys_refine.
Definition: tree_schema.h:1866
Union for holding type-specific information in lys_type.
Definition: tree_schema.h:957