libyang  0.16.105
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 #ifdef __APPLE__
19  #include <machine/endian.h>
20 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
21  #include <sys/endian.h>
22 #else
23  #include <endian.h>
24 #endif
25 
26 #include <limits.h>
27 #include <stddef.h>
28 #include <stdint.h>
29 #include <stdio.h>
30 #include <sys/types.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
48 #define LY_TREE_FOR(START, ELEM) \
49  for ((ELEM) = (START); \
50  (ELEM); \
51  (ELEM) = (ELEM)->next)
52 
66 #define LY_TREE_FOR_SAFE(START, NEXT, ELEM) \
67  for ((ELEM) = (START); \
68  (ELEM) ? (NEXT = (ELEM)->next, 1) : 0; \
69  (ELEM) = (NEXT))
70 
98 #define LY_TREE_DFS_BEGIN(START, NEXT, ELEM) \
99  for ((ELEM) = (NEXT) = (START); \
100  (ELEM); \
101  (ELEM) = (NEXT))
102 
122 #ifdef __cplusplus
123 #define TYPES_COMPATIBLE(type1, type2) typeid(*(type1)) == typeid(type2)
124 #elif defined(__GNUC__) || defined(__clang__)
125 #define TYPES_COMPATIBLE(type1, type2) __builtin_types_compatible_p(__typeof__(*(type1)), type2)
126 #else
127 #define TYPES_COMPATIBLE(type1, type2) _Generic(*(type1), type2: 1, default: 0)
128 #endif
129 
130 #define LY_TREE_DFS_END(START, NEXT, ELEM) \
131  /* select element for the next run - children first */ \
132  if (TYPES_COMPATIBLE(ELEM, struct lyd_node)) { \
133  /* child exception for leafs, leaflists and anyxml without children */\
134  if (((struct lyd_node *)(ELEM))->schema->nodetype & (LYS_LEAF | LYS_LEAFLIST | LYS_ANYDATA)) { \
135  (NEXT) = NULL; \
136  } else { \
137  (NEXT) = (ELEM)->child; \
138  } \
139  } else if (TYPES_COMPATIBLE(ELEM, struct lys_node)) { \
140  /* child exception for leafs, leaflists and anyxml without children */\
141  if (((struct lys_node *)(ELEM))->nodetype & (LYS_LEAF | LYS_LEAFLIST | LYS_ANYDATA)) { \
142  (NEXT) = NULL; \
143  } else { \
144  (NEXT) = (ELEM)->child; \
145  } \
146  } else { \
147  (NEXT) = (ELEM)->child; \
148  } \
149  \
150  if (!(NEXT)) { \
151  /* no children */ \
152  if ((ELEM) == (START)) { \
153  /* we are done, (START) has no children */ \
154  break; \
155  } \
156  /* try siblings */ \
157  (NEXT) = (ELEM)->next; \
158  } \
159  while (!(NEXT)) { \
160  /* parent is already processed, go to its sibling */ \
161  if (TYPES_COMPATIBLE(ELEM, struct lys_node) \
162  && (((struct lys_node *)(ELEM)->parent)->nodetype == LYS_AUGMENT)) { \
163  (ELEM) = (ELEM)->parent->prev; \
164  } else { \
165  (ELEM) = (ELEM)->parent; \
166  } \
167  /* no siblings, go back through parents */ \
168  if (TYPES_COMPATIBLE(ELEM, struct lys_node)) { \
169  /* due to possible augments */ \
170  if (lys_parent((struct lys_node *)(ELEM)) == lys_parent((struct lys_node *)(START))) { \
171  /* we are done, no next element to process */ \
172  break; \
173  } \
174  } else if ((ELEM)->parent == (START)->parent) { \
175  /* we are done, no next element to process */ \
176  break; \
177  } \
178  (NEXT) = (ELEM)->next; \
179  }
180 
188 #define LY_ARRAY_MAX(var) (sizeof(var) == 8 ? ULLONG_MAX : ((1ULL << (sizeof(var) * 8)) - 1))
190 #define LY_REV_SIZE 11
195 typedef enum {
199 } LYS_INFORMAT;
200 
204 typedef enum {
211 } LYS_OUTFORMAT;
212 
219 #define LYS_OUTOPT_TREE_RFC 0x01
220 #define LYS_OUTOPT_TREE_GROUPING 0x02
221 #define LYS_OUTOPT_TREE_USES 0x04
222 #define LYS_OUTOPT_TREE_NO_LEAFREF 0x08
228 /* shortcuts for common in and out formats */
229 #define LYS_YANG 1
230 #define LYS_YIN 2
237 typedef enum lys_nodetype {
238  LYS_UNKNOWN = 0x0000,
239  LYS_CONTAINER = 0x0001,
240  LYS_CHOICE = 0x0002,
241  LYS_LEAF = 0x0004,
242  LYS_LEAFLIST = 0x0008,
243  LYS_LIST = 0x0010,
244  LYS_ANYXML = 0x0020,
245  LYS_CASE = 0x0040,
246  LYS_NOTIF = 0x0080,
247  LYS_RPC = 0x0100,
248  LYS_INPUT = 0x0200,
249  LYS_OUTPUT = 0x0400,
250  LYS_GROUPING = 0x0800,
251  LYS_USES = 0x1000,
252  LYS_AUGMENT = 0x2000,
253  LYS_ACTION = 0x4000,
254  LYS_ANYDATA = 0x8020,
255  LYS_EXT = 0x10000
256 } LYS_NODE;
257 
258 /* all nodes sharing the node namespace except RPCs and notifications */
259 #define LYS_NO_RPC_NOTIF_NODE 0x807F
260 
261 #define LYS_ANY 0xFFFF
262 
290 typedef enum {
375 } LY_STMT;
376 
382 typedef enum {
383  LY_STMT_CARD_OPT, /* 0..1 */
385  LY_STMT_CARD_SOME, /* 1..n */
386  LY_STMT_CARD_ANY /* 0..n */
387 } LY_STMT_CARD;
388 
392 typedef enum {
393  LYEXT_ERR = -1,
402 } LYEXT_TYPE;
403 
412 #define LYEXT_OPT_INHERIT 0x01
418 #define LYEXT_OPT_YANG 0x02
419 #define LYEXT_OPT_CONTENT 0x04
421 #define LYEXT_OPT_VALID 0x08
422 #define LYEXT_OPT_PLUGIN1 0x0100
423 #define LYEXT_OPT_PLUGIN2 0x0200
424 #define LYEXT_OPT_PLUGIN3 0x0400
425 #define LYEXT_OPT_PLUGIN4 0x0800
426 #define LYEXT_OPT_PLUGIN5 0x1000
427 #define LYEXT_OPT_PLUGIN6 0x2000
428 #define LYEXT_OPT_PLUGIN7 0x4000
429 #define LYEXT_OPT_PLUGIN8 0x8000
439 struct lyext_substmt {
440  LY_STMT stmt;
441  size_t offset;
442  LY_STMT_CARD cardinality;
443 };
448 struct lys_ext {
449  const char *name;
450  const char *dsc;
451  const char *ref;
452  uint16_t flags;
453  uint8_t ext_size;
454  uint8_t padding[5];
456  const char *argument;
457  struct lys_module *module;
459 };
468 struct lys_ext_instance {
469  struct lys_ext *def;
472  void *parent;
474  const char *arg_value;
475  uint16_t flags;
476  uint8_t ext_size;
477  uint8_t insubstmt_index;
484  uint8_t insubstmt;
487  uint8_t parent_type;
488  uint8_t ext_type;
489  uint8_t padding;
490  struct lys_ext_instance **ext;
491  void *priv;
492  struct lys_module *module;
494 };
503  struct lys_ext *def;
504  void *parent;
506  const char *arg_value;
507  uint16_t flags;
508  uint8_t ext_size;
509  uint8_t insubstmt_index;
516  uint8_t insubstmt;
519  uint8_t parent_type;
520  uint8_t ext_type;
521  uint8_t padding;
522  struct lys_ext_instance **ext;
523  void *priv;
524  struct lys_module *module;
527  /* to this point the structure is compatible with the generic ::lys_ext_instance structure */
529  char content[1];
530 };
531 
578 const void *lys_ext_instance_substmt(const struct lys_ext_instance *ext);
579 
588 int lys_ext_instance_presence(struct lys_ext *def, struct lys_ext_instance **ext, uint8_t ext_size);
589 
601 
607 const char * const *ly_get_loaded_plugins(void);
608 
616 void ly_load_plugins(void);
617 
618 /* don't need the contents of these types, just forward-declare them for the next 2 functions. */
619 struct lyext_plugin_list;
620 struct lytype_plugin_list;
621 
630 int ly_register_exts(struct lyext_plugin_list *plugin, const char *log_name);
631 
637 int ly_register_types(struct lytype_plugin_list *plugin, const char *log_name);
638 
648 int ly_clean_plugins(void);
649 
657 typedef enum LYS_VERSION {
658  LYS_VERSION_UNDEF = 0,
659  LYS_VERSION_1 = 1,
660  LYS_VERSION_1_1 = 2
670 struct lys_module {
671  struct ly_ctx *ctx;
672  const char *name;
673  const char *prefix;
674  const char *dsc;
675  const char *ref;
676  const char *org;
677  const char *contact;
678  const char *filepath;
679  uint8_t type:1;
680  uint8_t version:3;
684  uint8_t deviated:2;
688  uint8_t disabled:1;
689  uint8_t implemented:1;
690  uint8_t latest_revision:1;
692  uint8_t padding1:7;
693  uint8_t padding2[2];
695  /* array sizes */
696  uint8_t rev_size;
697  uint8_t imp_size;
698  uint8_t inc_size;
700  uint16_t ident_size;
701  uint16_t tpdf_size;
703  uint8_t features_size;
704  uint8_t augment_size;
705  uint8_t deviation_size;
706  uint8_t extensions_size;
707  uint8_t ext_size;
709  struct lys_revision *rev;
711  struct lys_import *imp;
712  struct lys_include *inc;
713  struct lys_tpdf *tpdf;
714  struct lys_ident *ident;
718  struct lys_ext *extensions;
721  /* specific module's items in comparison to submodules */
722  struct lys_node *data;
723  const char *ns;
724 };
725 
733 struct lys_submodule {
734  struct ly_ctx *ctx;
735  const char *name;
736  const char *prefix;
737  const char *dsc;
738  const char *ref;
739  const char *org;
740  const char *contact;
741  const char *filepath;
742  uint8_t type:1;
743  uint8_t version:3;
747  uint8_t deviated:2;
751  uint8_t disabled:1;
752  uint8_t implemented:1;
753  uint8_t padding[3];
755  /* array sizes */
756  uint8_t rev_size;
757  uint8_t imp_size;
758  uint8_t inc_size;
760  uint16_t ident_size;
761  uint16_t tpdf_size;
763  uint8_t features_size;
764  uint8_t augment_size;
765  uint8_t deviation_size;
766  uint8_t extensions_size;
767  uint8_t ext_size;
769  struct lys_revision *rev;
771  struct lys_import *imp;
772  struct lys_include *inc;
773  struct lys_tpdf *tpdf;
774  struct lys_ident *ident;
778  struct lys_ext *extensions;
781  /* specific submodule's items in comparison to modules */
783 };
784 
788 typedef enum {
789  LY_TYPE_DER = 0,
791  LY_TYPE_BITS,
811 #define LY_DATA_TYPE_COUNT 20
816 struct lys_type_info_binary {
817  struct lys_restr *length;
819 };
824 struct lys_type_bit {
825  const char *name;
826  const char *dsc;
827  const char *ref;
828  uint16_t flags;
830  uint8_t ext_size;
831  uint8_t iffeature_size;
833  /* 32b padding for compatibility with ::lys_node */
834  uint32_t pos;
836  struct lys_ext_instance **ext;
837  struct lys_iffeature *iffeature;
838 };
839 
843 struct lys_type_info_bits {
844  struct lys_type_bit *bit;
845  unsigned int count;
846 };
851 struct lys_type_info_dec64 {
852  struct lys_restr *range;
854  uint8_t dig;
858  uint64_t div;
859 };
860 
864 struct lys_type_enum {
865  const char *name;
866  const char *dsc;
867  const char *ref;
868  uint16_t flags;
870  uint8_t ext_size;
871  uint8_t iffeature_size;
873  /* 32b padding for compatibility with ::lys_node */
874  int32_t value;
876  struct lys_ext_instance **ext;
877  struct lys_iffeature *iffeature;
878 };
879 
883 struct lys_type_info_enums {
884  struct lys_type_enum *enm;
885  unsigned int count;
886 };
891 struct lys_type_info_ident {
892  struct lys_ident **ref;
893  unsigned int count;
894 };
899 struct lys_type_info_inst {
900  int8_t req;
905 };
906 
910 struct lys_type_info_num {
911  struct lys_restr *range;
913 };
918 struct lys_type_info_lref {
919  const char *path;
921  struct lys_node_leaf* target;
922  int8_t req;
926 };
927 
931 struct lys_type_info_str {
932  struct lys_restr *length;
934  struct lys_restr *patterns;
940  unsigned int pat_count;
941 #ifdef LY_ENABLED_CACHE
942  void **patterns_pcre;
945 #endif
946 };
947 
951 struct lys_type_info_union {
952  struct lys_type *types;
953  unsigned int count;
954  int has_ptr_type;
956 };
961 union lys_type_info {
963  struct lys_type_info_bits bits;
964  struct lys_type_info_dec64 dec64;
972 };
977 struct lys_type {
979  uint8_t value_flags;
980  uint8_t ext_size;
982  struct lys_tpdf *der;
984  struct lys_tpdf *parent;
987  /*
988  * here is an overview of the info union:
989  * LY_TYPE_BINARY (binary)
990  * struct lys_restr *binary.length; length restriction (optional), see
991  * [RFC 6020 sec. 9.4.4](http://tools.ietf.org/html/rfc6020#section-9.4.4)
992  * -----------------------------------------------------------------------------------------------------------------
993  * LY_TYPE_BITS (bits)
994  * struct lys_type_bit *bits.bit; array of bit definitions
995  * const char *bits.bit[i].name; bit's name (mandatory)
996  * const char *bits.bit[i].dsc; bit's description (optional)
997  * const char *bits.bit[i].ref; bit's reference (optional)
998  * uint8_t bits.bit[i].flags; bit's flags, whether the position was auto-assigned
999  * and the status(one of LYS_NODE_STATUS_* values or 0 for default)
1000  * uint8_t bits.bit[i].iffeature_size; number of elements in the bit's #iffeature array
1001  * uint8_t bits.bit[i].ext_size; number of elements in the bit's #ext array
1002  * uint32_t bits.bit[i].pos; bit's position (mandatory)
1003  * struct lys_iffeature *bits.bit[i].iffeature; array of bit's if-feature expressions
1004  * struct lys_ext_instance **bits.bit[i].ext; array of pointers to the bit's extension instances (optional)
1005  * unsigned int bits.count; number of bit definitions in the bit array
1006  * -----------------------------------------------------------------------------------------------------------------
1007  * LY_TYPE_DEC64 (dec64)
1008  * struct lys_restr *dec64.range; range restriction (optional), see
1009  * [RFC 6020 sec. 9.2.4](http://tools.ietf.org/html/rfc6020#section-9.2.4)
1010  * struct lys_ext_instance **dec64.ext; array of pointers to the bit's extension instances (optional)
1011  * uint8_t dec64.ext_size; number of elements in the bit's #ext array
1012  * uint8_t dec64.dig; fraction-digits restriction (mandatory)
1013  * uint64_t dec64.div; auxiliary value for moving decimal point (dividing the stored value to get
1014  * the real value) (mandatory, corresponds to the fraction-digits)
1015  * -----------------------------------------------------------------------------------------------------------------
1016  * LY_TYPE_ENUM (enums)
1017  * struct lys_type_enum *enums.enm; array of enum definitions
1018  * const char *enums.enm[i].name; enum's name (mandatory)
1019  * const char *enums.enm[i].dsc; enum's description (optional)
1020  * const char *enums.enm[i].ref; enum's reference (optional)
1021  * uint8_t enums.enm[i].flags; enum's flags, whether the value was auto-assigned
1022  * and the status(one of LYS_NODE_STATUS_* values or 0 for default)
1023  * uint8_t enums.enum[i].iffeature_size; number of elements in the bit's #iffeature array
1024  * uint8_t enums.enum[i].ext_size; number of elements in the bit's #ext array
1025  * int32_t enums.enm[i].value; enum's value (mandatory)
1026  * struct lys_iffeature *enums.enum[i].iffeature; array of bit's if-feature expressions
1027  * struct lys_ext_instance **enums.enum[i].ext; array of pointers to the bit's extension instances (optional)
1028  * unsigned int enums.count; number of enum definitions in the enm array
1029  * -----------------------------------------------------------------------------------------------------------------
1030  * LY_TYPE_IDENT (ident)
1031  * struct lys_ident **ident.ref; array of pointers (reference) to the identity definition (mandatory)
1032  * unsigned int ident.count; number of base identity references
1033  * -----------------------------------------------------------------------------------------------------------------
1034  * LY_TYPE_INST (inst)
1035  * int8_t inst.req; require-identifier restriction, see
1036  * [RFC 6020 sec. 9.13.2](http://tools.ietf.org/html/rfc6020#section-9.13.2):
1037  * - -1 = false,
1038  * - 0 not defined,
1039  * - 1 = true
1040  * -----------------------------------------------------------------------------------------------------------------
1041  * LY_TYPE_*INT* (num)
1042  * struct lys_restr *num.range; range restriction (optional), see
1043  * [RFC 6020 sec. 9.2.4](http://tools.ietf.org/html/rfc6020#section-9.2.4)
1044  * -----------------------------------------------------------------------------------------------------------------
1045  * LY_TYPE_LEAFREF (lref)
1046  * const char *lref.path; path to the referred leaf or leaf-list node (mandatory), see
1047  * [RFC 6020 sec. 9.9.2](http://tools.ietf.org/html/rfc6020#section-9.9.2)
1048  * struct lys_node_leaf *lref.target; target schema node according to path
1049  * int8_t lref.req; require-instance restriction: -1 = false; 0 not defined (true); 1 = true
1050  * -----------------------------------------------------------------------------------------------------------------
1051  * LY_TYPE_STRING (str)
1052  * struct lys_restr *str.length; length restriction (optional), see
1053  * [RFC 6020 sec. 9.4.4](http://tools.ietf.org/html/rfc6020#section-9.4.4)
1054  * struct lys_restr *str.patterns; array of pattern restrictions (optional), see
1055  * [RFC 6020 sec. 9.4.6](http://tools.ietf.org/html/rfc6020#section-9.4.6)
1056  * unsigned int str.pat_count; number of pattern definitions in the patterns array
1057  * -----------------------------------------------------------------------------------------------------------------
1058  * LY_TYPE_UNION (uni)
1059  * struct lys_type *uni.types; array of union's subtypes
1060  * unsigned int uni.count; number of subtype definitions in types array
1061  * int uni.has_ptr_type; types recursively include an instance-identifier or leafref (union must always
1062  * be resolved after it is parsed)
1063  */
1064 };
1065 
1066 #define LYS_IFF_NOT 0x00
1067 #define LYS_IFF_AND 0x01
1068 #define LYS_IFF_OR 0x02
1069 #define LYS_IFF_F 0x03
1074 struct lys_iffeature {
1075  uint8_t *expr;
1076  uint8_t ext_size;
1077  struct lys_feature **features;
1079 };
1139 #define LYS_CONFIG_W 0x01
1140 #define LYS_CONFIG_R 0x02
1141 #define LYS_CONFIG_SET 0x04
1142 #define LYS_CONFIG_MASK 0x03
1143 #define LYS_STATUS_CURR 0x08
1144 #define LYS_STATUS_DEPRC 0x10
1145 #define LYS_STATUS_OBSLT 0x20
1146 #define LYS_STATUS_MASK 0x38
1147 #define LYS_RFN_MAXSET 0x08
1148 #define LYS_RFN_MINSET 0x10
1149 #define LYS_MAND_TRUE 0x40
1151 #define LYS_MAND_FALSE 0x80
1153 #define LYS_INCL_STATUS 0x80
1155 #define LYS_MAND_MASK 0xc0
1156 #define LYS_USERORDERED 0x100
1158 #define LYS_FENABLED 0x100
1159 #define LYS_UNIQUE 0x100
1160 #define LYS_AUTOASSIGNED 0x01
1162 #define LYS_USESGRP 0x01
1163 #define LYS_IMPLICIT 0x40
1164 #define LYS_XPCONF_DEP 0x200
1167 #define LYS_XPSTATE_DEP 0x400
1170 #define LYS_LEAFREF_DEP 0x800
1173 #define LYS_DFLTJSON 0x1000
1177 #define LYS_NOTAPPLIED 0x01
1178 #define LYS_YINELEM 0x01
1179 #define LYS_VALID_EXT 0x2000
1185 #ifdef LY_ENABLED_CACHE
1186 
1190 #define LYS_NODE_HASH_COUNT 4
1191 
1192 #endif
1193 
1211 struct lys_node {
1212  const char *name;
1213  const char *dsc;
1214  const char *ref;
1215  uint16_t flags;
1216  uint8_t ext_size;
1217  uint8_t iffeature_size;
1219  uint8_t padding[4];
1225  struct lys_ext_instance **ext;
1226  struct lys_iffeature *iffeature;
1227  struct lys_module *module;
1230  struct lys_node *parent;
1231  struct lys_node *child;
1235  struct lys_node *next;
1236  struct lys_node *prev;
1241  void *priv;
1243 #ifdef LY_ENABLED_CACHE
1244  uint8_t hash[LYS_NODE_HASH_COUNT];
1245 #endif
1246 };
1257 struct lys_node_container {
1258  const char *name;
1259  const char *dsc;
1260  const char *ref;
1261  uint16_t flags;
1262  uint8_t ext_size;
1263  uint8_t iffeature_size;
1265  /* non compatible 32b with ::lys_node */
1266  uint8_t padding[1];
1267  uint8_t must_size;
1268  uint16_t tpdf_size;
1270  struct lys_ext_instance **ext;
1271  struct lys_iffeature *iffeature;
1272  struct lys_module *module;
1274  LYS_NODE nodetype;
1275  struct lys_node *parent;
1276  struct lys_node *child;
1277  struct lys_node *next;
1278  struct lys_node *prev;
1283  void *priv;
1285 #ifdef LY_ENABLED_CACHE
1286  uint8_t hash[LYS_NODE_HASH_COUNT];
1287 #endif
1289  /* specific container's data */
1290  struct lys_when *when;
1291  struct lys_restr *must;
1292  struct lys_tpdf *tpdf;
1293  const char *presence;
1294 };
1305 struct lys_node_choice {
1306  const char *name;
1307  const char *dsc;
1308  const char *ref;
1309  uint16_t flags;
1310  uint8_t ext_size;
1311  uint8_t iffeature_size;
1313  /* non compatible 32b with ::lys_node */
1314  uint8_t padding[4];
1316  struct lys_ext_instance **ext;
1317  struct lys_iffeature *iffeature;
1318  struct lys_module *module;
1320  LYS_NODE nodetype;
1321  struct lys_node *parent;
1322  struct lys_node *child;
1323  struct lys_node *next;
1324  struct lys_node *prev;
1329  void *priv;
1331  /* specific choice's data */
1332  struct lys_when *when;
1333  struct lys_node *dflt;
1334 };
1348  const char *name;
1349  const char *dsc;
1350  const char *ref;
1351  uint16_t flags;
1352  uint8_t ext_size;
1353  uint8_t iffeature_size;
1355  /* non compatible 32b with ::lys_node */
1356  uint8_t padding[3];
1357  uint8_t must_size;
1359  struct lys_ext_instance **ext;
1360  struct lys_iffeature *iffeature;
1361  struct lys_module *module;
1363  LYS_NODE nodetype;
1364  struct lys_node *parent;
1365  struct ly_set *backlinks;
1368  struct lys_node *next;
1369  struct lys_node *prev;
1374  void *priv;
1376 #ifdef LY_ENABLED_CACHE
1377  uint8_t hash[LYS_NODE_HASH_COUNT];
1378 #endif
1380  /* specific leaf's data */
1381  struct lys_when *when;
1382  struct lys_restr *must;
1383  struct lys_type type;
1384  const char *units;
1386  /* to this point, struct lys_node_leaf is compatible with struct lys_node_leaflist */
1387  const char *dflt;
1388 };
1389 
1401  const char *name;
1402  const char *dsc;
1403  const char *ref;
1404  uint16_t flags;
1405  uint8_t ext_size;
1406  uint8_t iffeature_size;
1408  /* non compatible 32b with ::lys_node */
1409  uint8_t padding[2];
1410  uint8_t dflt_size;
1411  uint8_t must_size;
1413  struct lys_ext_instance **ext;
1414  struct lys_iffeature *iffeature;
1415  struct lys_module *module;
1417  LYS_NODE nodetype;
1418  struct lys_node *parent;
1419  struct ly_set *backlinks;
1422  struct lys_node *next;
1423  struct lys_node *prev;
1428  void *priv;
1430 #ifdef LY_ENABLED_CACHE
1431  uint8_t hash[LYS_NODE_HASH_COUNT];
1432 #endif
1434  /* specific leaf-list's data */
1435  struct lys_when *when;
1436  struct lys_restr *must;
1437  struct lys_type type;
1438  const char *units;
1440  /* to this point, struct lys_node_leaflist is compatible with struct lys_node_leaf
1441  * on the other hand, the min and max are compatible with struct lys_node_list */
1442  const char **dflt;
1443  uint32_t min;
1444  uint32_t max;
1445 };
1457  const char *name;
1458  const char *dsc;
1459  const char *ref;
1460  uint16_t flags;
1461  uint8_t ext_size;
1462  uint8_t iffeature_size;
1464  /* non compatible 32b with ::lys_node */
1465  uint8_t must_size;
1466  uint8_t tpdf_size;
1467  uint8_t keys_size;
1468  uint8_t unique_size;
1470  struct lys_ext_instance **ext;
1471  struct lys_iffeature *iffeature;
1472  struct lys_module *module;
1475  struct lys_node *parent;
1476  struct lys_node *child;
1477  struct lys_node *next;
1478  struct lys_node *prev;
1483  void *priv;
1485 #ifdef LY_ENABLED_CACHE
1486  uint8_t hash[LYS_NODE_HASH_COUNT];
1487 #endif
1489  /* specific list's data */
1490  struct lys_when *when;
1491  struct lys_restr *must;
1492  struct lys_tpdf *tpdf;
1493  struct lys_node_leaf **keys;
1494  struct lys_unique *unique;
1496  uint32_t min;
1497  uint32_t max;
1499  const char *keys_str;
1502 };
1503 
1516  const char *name;
1517  const char *dsc;
1518  const char *ref;
1519  uint16_t flags;
1520  uint8_t ext_size;
1521  uint8_t iffeature_size;
1523  /* non compatible 32b with ::lys_node */
1524  uint8_t padding[3];
1525  uint8_t must_size;
1527  struct lys_ext_instance **ext;
1528  struct lys_iffeature *iffeature;
1529  struct lys_module *module;
1531  LYS_NODE nodetype;
1532  struct lys_node *parent;
1533  struct lys_node *child;
1534  struct lys_node *next;
1535  struct lys_node *prev;
1540  void *priv;
1542 #ifdef LY_ENABLED_CACHE
1543  uint8_t hash[LYS_NODE_HASH_COUNT];
1544 #endif
1546  /* specific anyxml's data */
1547  struct lys_when *when;
1548  struct lys_restr *must;
1549 };
1563 struct lys_node_uses {
1564  const char *name;
1565  const char *dsc;
1566  const char *ref;
1567  uint16_t flags;
1569  uint8_t ext_size;
1570  uint8_t iffeature_size;
1572  /* non compatible 32b with ::lys_node */
1573  uint8_t padding[2];
1574  uint8_t refine_size;
1575  uint8_t augment_size;
1577  struct lys_ext_instance **ext;
1578  struct lys_iffeature *iffeature;
1579  struct lys_module *module;
1582  struct lys_node *parent;
1583  struct lys_node *child;
1584  struct lys_node *next;
1585  struct lys_node *prev;
1590  void *priv;
1592  /* specific uses's data */
1593  struct lys_when *when;
1594  struct lys_refine *refine;
1596  struct lys_node_grp *grp;
1597 };
1598 
1610 struct lys_node_grp {
1611  const char *name;
1612  const char *dsc;
1613  const char *ref;
1614  uint16_t flags;
1615  uint8_t ext_size;
1616  uint8_t padding_iffsize;
1618  /* non compatible 32b with ::lys_node */
1619  uint16_t unres_count;
1620  uint16_t tpdf_size;
1622  struct lys_ext_instance **ext;
1623  void *padding_iff;
1624  struct lys_module *module;
1626  LYS_NODE nodetype;
1627  struct lys_node *parent;
1628  struct lys_node *child;
1629  struct lys_node *next;
1630  struct lys_node *prev;
1635  void *priv;
1637  /* specific grouping's data */
1638  struct lys_tpdf *tpdf;
1639 };
1649 struct lys_node_case {
1650  const char *name;
1651  const char *dsc;
1652  const char *ref;
1653  uint16_t flags;
1654  uint8_t ext_size;
1655  uint8_t iffeature_size;
1657  /* non compatible 32b with ::lys_node */
1658  uint8_t padding[4];
1660  struct lys_ext_instance **ext;
1661  struct lys_iffeature *iffeature;
1662  struct lys_module *module;
1664  LYS_NODE nodetype;
1665  struct lys_node *parent;
1666  struct lys_node *child;
1667  struct lys_node *next;
1668  struct lys_node *prev;
1673  void *priv;
1675  /* specific case's data */
1676  struct lys_when *when;
1677 };
1695  const char *name;
1696  void *fill1[2];
1697  uint16_t flags;
1698  uint8_t ext_size;
1699  uint8_t padding_iffsize;
1701  /* non compatible 32b with ::lys_node */
1702  uint8_t padding[1];
1703  uint8_t must_size;
1704  uint16_t tpdf_size;
1706  struct lys_ext_instance **ext;
1707  void *padding_iff;
1708  struct lys_module *module;
1710  LYS_NODE nodetype;
1711  struct lys_node *parent;
1712  struct lys_node *child;
1713  struct lys_node *next;
1714  struct lys_node *prev;
1719  void *priv;
1721  /* specific inout's data */
1722  struct lys_tpdf *tpdf;
1723  struct lys_restr *must;
1724 };
1733  const char *name;
1734  const char *dsc;
1735  const char *ref;
1736  uint16_t flags;
1737  uint8_t ext_size;
1738  uint8_t iffeature_size;
1740  /* non compatible 32b with ::lys_node */
1741  uint8_t padding[1];
1742  uint8_t must_size;
1743  uint16_t tpdf_size;
1745  struct lys_ext_instance **ext;
1746  struct lys_iffeature *iffeature;
1747  struct lys_module *module;
1749  LYS_NODE nodetype;
1750  struct lys_node *parent;
1751  struct lys_node *child;
1752  struct lys_node *next;
1753  struct lys_node *prev;
1758  void *priv;
1760 #ifdef LY_ENABLED_CACHE
1761  uint8_t hash[LYS_NODE_HASH_COUNT];
1762 #endif
1764  /* specific rpc's data */
1765  struct lys_tpdf *tpdf;
1766  struct lys_restr *must;
1767 };
1779 struct lys_node_rpc_action {
1780  const char *name;
1781  const char *dsc;
1782  const char *ref;
1783  uint16_t flags;
1784  uint8_t ext_size;
1785  uint8_t iffeature_size;
1787  /* non compatible 32b with ::lys_node */
1788  uint8_t padding[2];
1789  uint16_t tpdf_size;
1791  struct lys_ext_instance **ext;
1792  struct lys_iffeature *iffeature;
1793  struct lys_module *module;
1795  LYS_NODE nodetype;
1796  struct lys_node *parent;
1797  struct lys_node *child;
1798  struct lys_node *next;
1799  struct lys_node *prev;
1804  void *priv;
1806 #ifdef LY_ENABLED_CACHE
1807  uint8_t hash[LYS_NODE_HASH_COUNT];
1808 #endif
1810  /* specific rpc's data */
1811  struct lys_tpdf *tpdf;
1812 };
1827 struct lys_node_augment {
1828  const char *target_name;
1830  const char *dsc;
1831  const char *ref;
1832  uint16_t flags;
1833  uint8_t ext_size;
1834  uint8_t iffeature_size;
1836  /* non compatible 32b with ::lys_node */
1837  uint8_t padding[4];
1839  struct lys_ext_instance **ext;
1840  struct lys_iffeature *iffeature;
1841  struct lys_module *module;
1843  LYS_NODE nodetype;
1844  struct lys_node *parent;
1845  struct lys_node *child;
1851  /* replaces #next and #prev members of ::lys_node */
1852  struct lys_when *when;
1853  struct lys_node *target;
1855  /* again compatible members with ::lys_node */
1856  void *priv;
1857 };
1863  uint32_t min;
1864  uint32_t max;
1865 };
1866 
1871  const char *presence;
1872  struct lys_refine_mod_list list;
1874 };
1875 
1879 struct lys_refine {
1880  const char *target_name;
1881  const char *dsc;
1882  const char *ref;
1883  uint16_t flags;
1884  uint8_t ext_size;
1885  uint8_t iffeature_size;
1887  /* 32b padding for compatibility with ::lys_node */
1888  uint16_t target_type;
1891  uint8_t must_size;
1892  uint8_t dflt_size;
1894  struct lys_ext_instance **ext;
1895  struct lys_iffeature *iffeature;
1896  struct lys_module *module;
1898  struct lys_restr *must;
1899  const char **dflt;
1904 };
1905 
1910 typedef enum lys_deviate_type {
1911  LY_DEVIATE_NO,
1920 struct lys_deviate {
1923  uint8_t flags;
1924  uint8_t dflt_size;
1925  uint8_t ext_size;
1927  uint8_t min_set;
1928  uint8_t max_set;
1929  uint8_t must_size;
1930  uint8_t unique_size;
1932  uint32_t min;
1933  uint32_t max;
1935  struct lys_restr *must;
1936  struct lys_unique *unique;
1937  struct lys_type *type;
1938  const char *units;
1939  const char **dflt;
1942 };
1948  const char *target_name;
1950  const char *dsc;
1951  const char *ref;
1952  struct lys_node *orig_node;
1954  uint8_t deviate_size;
1955  uint8_t ext_size;
1958 };
1963 struct lys_import {
1964  struct lys_module *module;
1965  const char *prefix;
1967  uint8_t ext_size;
1969  const char *dsc;
1970  const char *ref;
1971 };
1976 struct lys_include {
1977  struct lys_submodule *submodule;
1978  char rev[LY_REV_SIZE];
1979  uint8_t ext_size;
1980  struct lys_ext_instance **ext;
1981  const char *dsc;
1982  const char *ref;
1983 };
1989  char date[LY_REV_SIZE];
1990  uint8_t ext_size;
1991  struct lys_ext_instance **ext;
1992  const char *dsc;
1993  const char *ref;
1994 };
1999 struct lys_tpdf {
2000  const char *name;
2001  const char *dsc;
2002  const char *ref;
2003  uint16_t flags;
2004  uint8_t ext_size;
2005  uint8_t padding_iffsize;
2008  /* 24b padding for compatibility with ::lys_node */
2009  uint8_t padding[3];
2012  const char *units;
2013  struct lys_module *module;
2016  struct lys_type type;
2018  const char *dflt;
2019 };
2024 struct lys_unique {
2025  const char **expr;
2026  uint8_t expr_size;
2027  uint8_t trg_type;
2028 };
2033 struct lys_feature {
2034  const char *name;
2035  const char *dsc;
2036  const char *ref;
2037  uint16_t flags;
2039  uint8_t ext_size;
2040  uint8_t iffeature_size;
2042  /* 32b padding for compatibility with ::lys_node */
2043  uint8_t padding[4];
2046  struct lys_iffeature *iffeature;
2047  struct lys_module *module;
2048  struct ly_set *depfeatures;
2049 };
2050 
2054 struct lys_restr {
2055  const char *expr;
2058  const char *dsc;
2059  const char *ref;
2060  const char *eapptag;
2061  const char *emsg;
2062  struct lys_ext_instance **ext;
2063  uint8_t ext_size;
2064  uint16_t flags;
2065 };
2070 struct lys_when {
2071  const char *cond;
2072  const char *dsc;
2073  const char *ref;
2074  struct lys_ext_instance **ext;
2075  uint8_t ext_size;
2076  uint16_t flags;
2077 };
2084 struct lys_ident {
2085  const char *name;
2086  const char *dsc;
2087  const char *ref;
2088  uint16_t flags;
2089  uint8_t ext_size;
2090  uint8_t iffeature_size;
2092  /* 32b padding for compatibility with ::lys_node */
2093  uint8_t padding[3];
2094  uint8_t base_size;
2096  struct lys_ext_instance **ext;
2097  struct lys_iffeature *iffeature;
2098  struct lys_module *module;
2100  struct lys_ident **base;
2101  struct ly_set *der;
2102 };
2113 const struct lys_module *lys_parse_mem(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format);
2126 const struct lys_module *lys_parse_fd(struct ly_ctx *ctx, int fd, LYS_INFORMAT format);
2127 
2136 const struct lys_module *lys_parse_path(struct ly_ctx *ctx, const char *path, LYS_INFORMAT format);
2137 
2153 int lys_search_localfile(const char * const *searchpaths, int cwd, const char *name, const char *revision, char **localfile, LYS_INFORMAT *format);
2154 
2168 const char **lys_features_list(const struct lys_module *module, uint8_t **states);
2169 
2179 int lys_features_enable(const struct lys_module *module, const char *feature);
2180 
2190 int lys_features_disable(const struct lys_module *module, const char *feature);
2191 
2202 int lys_features_state(const struct lys_module *module, const char *feature);
2203 
2215 const struct lys_node *lys_is_disabled(const struct lys_node *node, int recursive);
2216 
2224 const struct lys_node_list *lys_is_key(const struct lys_node_leaf *node, uint8_t *index);
2225 
2247 const struct lys_node *lys_getnext(const struct lys_node *last, const struct lys_node *parent,
2248  const struct lys_module *module, int options);
2249 
2250 #define LYS_GETNEXT_WITHCHOICE 0x01
2251 #define LYS_GETNEXT_WITHCASE 0x02
2252 #define LYS_GETNEXT_WITHGROUPING 0x04
2253 #define LYS_GETNEXT_WITHINOUT 0x08
2255 #define LYS_GETNEXT_WITHUSES 0x10
2256 #define LYS_GETNEXT_INTOUSES 0x20
2258 #define LYS_GETNEXT_INTONPCONT 0x40
2259 #define LYS_GETNEXT_PARENTUSES 0x80
2261 #define LYS_GETNEXT_NOSTATECHECK 0x100
2271 const struct lys_type *lys_getnext_union_type(const struct lys_type *last, const struct lys_type *type);
2272 
2284 struct ly_set *lys_find_path(const struct lys_module *cur_module, const struct lys_node *cur_node, const char *path);
2285 
2289 enum lyxp_node_type {
2290  /* XML document roots */
2291  LYXP_NODE_ROOT, /* access to all the data (node value first top-level node) */
2292  LYXP_NODE_ROOT_CONFIG, /* <running> data context, no state data (node value first top-level node) */
2293 
2294  /* XML elements */
2295  LYXP_NODE_ELEM, /* XML element (most common) */
2296  LYXP_NODE_TEXT, /* XML text element (extremely specific use, unlikely to be ever needed) */
2297  LYXP_NODE_ATTR /* XML attribute (in YANG cannot happen, do not use for the context node) */
2298 };
2299 
2313 struct ly_set *lys_xpath_atomize(const struct lys_node *ctx_node, enum lyxp_node_type ctx_node_type,
2314  const char *expr, int options);
2315 
2316 #define LYXP_MUST 0x01
2317 #define LYXP_WHEN 0x02
2326 struct ly_set *lys_node_xpath_atomize(const struct lys_node *node, int options);
2327 
2328 #define LYXP_RECURSIVE 0x01
2329 #define LYXP_NO_LOCAL 0x02
2342 char *lys_path(const struct lys_node *node, int options);
2343 
2344 #define LYS_PATH_FIRST_PREFIX 0x01
2354 char *lys_data_path(const struct lys_node *node);
2355 
2366 struct lys_node *lys_parent(const struct lys_node *node);
2367 
2377 struct lys_module *lys_node_module(const struct lys_node *node);
2378 
2388 struct lys_module *lys_main_module(const struct lys_module *module);
2389 
2405 struct lys_module *lys_implemented_module(const struct lys_module *mod);
2406 
2426 int lys_set_implemented(const struct lys_module *module);
2427 
2444 int lys_set_disabled(const struct lys_module *module);
2445 
2460 int lys_set_enabled(const struct lys_module *module);
2461 
2471 void *lys_set_private(const struct lys_node *node, void *priv);
2472 
2486 int lys_print_mem(char **strp, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node,
2487  int line_length, int options);
2488 
2501 int lys_print_fd(int fd, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node,
2502  int line_length, int options);
2503 
2516 int lys_print_file(FILE *f, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node,
2517  int line_length, int options);
2518 
2531 int lys_print_path(const char *path, const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node,
2532  int line_length, int options);
2533 
2547 int lys_print_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg,
2548  const struct lys_module *module, LYS_OUTFORMAT format, const char *target_node, int line_length, int options);
2549 
2552 #ifdef __cplusplus
2553 }
2554 #endif
2555 
2556 #endif /* LY_TREE_SCHEMA_H_ */
uint8_t augment_size
Definition: tree_schema.h:708
struct lys_deviation * deviation
Definition: tree_schema.h:721
int ly_register_types(struct lytype_plugin_list *plugin, const char *log_name)
Directly register a YANG type by pointer.
const struct lys_module * lys_parse_mem(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format)
Load a schema into the specified context.
struct lys_module * module
Definition: tree_schema.h:1245
const char * ref
Definition: tree_schema.h:455
uint8_t ext_size
Definition: tree_schema.h:457
Common structure representing single YANG data statement describing.
Definition: tree_schema.h:1229
const char * emsg
Definition: tree_schema.h:2079
struct ly_set * backlinks
Definition: tree_schema.h:1383
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:382
Schema leaf node structure.
Definition: tree_schema.h:1365
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. Returned node can be from an augment.
Schema grouping node structure.
Definition: tree_schema.h:1628
struct lys_type * types
Definition: tree_schema.h:956
LYS_NODE nodetype
Definition: tree_schema.h:497
struct lys_type_bit * bit
Definition: tree_schema.h:848
uint8_t implemented
Definition: tree_schema.h:693
struct lys_type_info_bits bits
Definition: tree_schema.h:967
unsigned int count
Definition: tree_schema.h:849
struct lys_ident * ident
Definition: tree_schema.h:718
struct lys_type_info_inst inst
Definition: tree_schema.h:971
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:737
Schema choice node structure.
Definition: tree_schema.h:1323
struct lys_type_info_num num
Definition: tree_schema.h:972
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...
struct lys_unique * unique
Definition: tree_schema.h:1512
uint8_t type
Definition: tree_schema.h:683
struct lys_node * dflt
Definition: tree_schema.h:1351
const char * target_name
Definition: tree_schema.h:1846
const char * arg_value
Definition: tree_schema.h:478
struct lys_restr * patterns
Definition: tree_schema.h:938
uint8_t padding[4]
Definition: tree_schema.h:1237
struct lys_refine_mod_list list
Definition: tree_schema.h:1890
struct lys_module * lys_main_module(const struct lys_module *module)
Return main module of the module.
LYS_NODE nodetype
Definition: tree_schema.h:1247
struct lys_ext * extensions
Definition: tree_schema.h:722
uint8_t trg_type
Definition: tree_schema.h:2045
uint8_t deviated
Definition: tree_schema.h:688
uint8_t iffeature_size
Definition: tree_schema.h:835
struct lys_ident ** ref
Definition: tree_schema.h:896
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:935
void * fill1[2]
Definition: tree_schema.h:1714
struct lys_node * data
Definition: tree_schema.h:726
const char ** dflt
Definition: tree_schema.h:1460
struct lys_import * imp
Definition: tree_schema.h:715
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:944
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:936
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:2311
uint8_t padding[5]
Definition: tree_schema.h:458
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:868
const char * prefix
Definition: tree_schema.h:677
Union for holding type-specific information in lys_type.
Definition: tree_schema.h:965
#define LY_REV_SIZE
Definition: tree_schema.h:190
int lys_features_disable(const struct lys_module *module, const char *feature)
Disable specified feature in the module.
void * priv
Definition: tree_schema.h:1259
uint8_t padding[3]
Definition: tree_schema.h:757
struct lys_node * child
Definition: tree_schema.h:1249
Container for information about leafref types (LY_TYPE_LEAFREF), used in lys_type_info.
Definition: tree_schema.h:922
struct lys_tpdf * tpdf
Definition: tree_schema.h:717
uint8_t padding1
Definition: tree_schema.h:696
Compiled if-feature expression structure.
Definition: tree_schema.h:1078
struct lys_node_leaf ** keys
Definition: tree_schema.h:1511
union lys_type_info info
Definition: tree_schema.h:990
Schema leaf-list node structure.
Definition: tree_schema.h:1418
const char * contact
Definition: tree_schema.h:681
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:702
LYS_OUTFORMAT
Schema output formats accepted by libyang printer functions.
Definition: tree_schema.h:204
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:888
Container for information about enumeration types (LY_TYPE_ENUM), used in lys_type_info.
Definition: tree_schema.h:887
uint16_t ident_size
Definition: tree_schema.h:704
struct ly_set * der
Definition: tree_schema.h:2119
Container for information about integer types, used in lys_type_info.
Definition: tree_schema.h:914
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:444
const char * argument
Definition: tree_schema.h:460
struct lys_ext * def
Definition: tree_schema.h:473
const char * dsc
Definition: tree_schema.h:454
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:855
uint8_t insubstmt_index
Definition: tree_schema.h:481
int lys_set_implemented(const struct lys_module *module)
Mark imported module as "implemented".
struct lys_ext_instance ** ext
Definition: tree_schema.h:459
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.
Structure to hold a set of (not necessary somehow connected) lyd_node or lys_node objects...
Definition: libyang.h:1716
const char * ref
Definition: tree_schema.h:679
struct lys_type_info_lref lref
Definition: tree_schema.h:973
char rev[11]
Definition: tree_schema.h:1984
struct lys_module * belongsto
Definition: tree_schema.h:786
const char * keys_str
Definition: tree_schema.h:1517
struct lys_module * module
Definition: tree_schema.h:461
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:694
const char * filepath
Definition: tree_schema.h:682
struct lyext_plugin * plugin
Definition: tree_schema.h:462
struct lys_iffeature * iffeature
Definition: tree_schema.h:841
Container for information about identity types (LY_TYPE_IDENT), used in lys_type_info.
Definition: tree_schema.h:895
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:847
struct lyext_substmt * substmt
Definition: tree_schema.h:532
uint8_t * expr
Definition: tree_schema.h:1079
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:195
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.
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:716
int lys_features_state(const struct lys_module *module, const char *feature)
Get the current status of the specified feature in the module.
struct lys_node_augment * augment
Definition: tree_schema.h:720
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:707
const char * ns
Definition: tree_schema.h:727
struct lys_revision * rev
Definition: tree_schema.h:713
Container for information about instance-identifier types (LY_TYPE_INST), used in lys_type_info...
Definition: tree_schema.h:903
struct lys_feature * features
Definition: tree_schema.h:719
Main schema node structure representing YANG module.
Definition: tree_schema.h:674
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:506
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_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...
uint32_t pos
Definition: tree_schema.h:838
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:684
LY_DATA_TYPE _PACKED base
Definition: tree_schema.h:982
LY_DATA_TYPE
YANG built-in types.
Definition: tree_schema.h:792
uint8_t ext_size
Definition: tree_schema.h:711
struct lys_node * next
Definition: tree_schema.h:1253
struct lys_node_leaf * target
Definition: tree_schema.h:925
struct lys_node_grp * grp
Definition: tree_schema.h:1614
struct lys_type_info_dec64 dec64
Definition: tree_schema.h:968
struct lys_type_info_binary binary
Definition: tree_schema.h:966
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:832
YANG type structure providing information from the schema.
Definition: tree_schema.h:981
uint16_t flags
Definition: tree_schema.h:456
char date[11]
Definition: tree_schema.h:2007
void * padding_iff
Definition: tree_schema.h:1641
struct lys_when * when
Definition: tree_schema.h:1308
LYS_VERSION
supported YANG schema version values
Definition: tree_schema.h:661
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:701
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:1284
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:1254
struct lys_tpdf * der
Definition: tree_schema.h:986
struct lys_ident ** base
Definition: tree_schema.h:2118
const char * org
Definition: tree_schema.h:680
Description of the extension instance substatement.
Definition: tree_schema.h:443
uint8_t rev_size
Definition: tree_schema.h:700
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:856
uint8_t base_size
Definition: tree_schema.h:2112
const char * name
Definition: tree_schema.h:453
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:710
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.
struct lys_type_info_enums enums
Definition: tree_schema.h:969
const char * presence
Definition: tree_schema.h:1311
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:975
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:676
LY_STMT
List of YANG statements.
Definition: tree_schema.h:290
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
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.
int32_t value
Definition: tree_schema.h:878
uint8_t expr_size
Definition: tree_schema.h:2044
#define _PACKED
Compiler flag for packed data types.
Definition: libyang.h:38
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:392
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:1309
Generic extension instance structure.
Definition: tree_schema.h:472
Container for information about union types (LY_TYPE_UNION), used in lys_type_info.
Definition: tree_schema.h:955
struct lys_tpdf * parent
Definition: tree_schema.h:988
uint8_t parent_type
Definition: tree_schema.h:491
YANG extension definition.
Definition: tree_schema.h:452
struct ly_ctx * ctx
Definition: tree_schema.h:675
uint8_t value_flags
Definition: tree_schema.h:983
uint8_t disabled
Definition: tree_schema.h:692
YANG revision statement for (sub)modules.
Definition: tree_schema.h:2006
struct lys_type_info_str str
Definition: tree_schema.h:974
YANG include structure used to reference submodules.
Definition: tree_schema.h:1994
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:697
struct lys_feature ** features
Definition: tree_schema.h:1081
uint16_t tpdf_size
Definition: tree_schema.h:705
const char * eapptag
Definition: tree_schema.h:2078
const char * path
Definition: tree_schema.h:923
enum lys_nodetype LYS_NODE
YANG schema node types.
Single bit value specification for lys_type_info_bits.
Definition: tree_schema.h:828
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:709
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.
libyang context handler.
const char * dsc
Definition: tree_schema.h:678
struct lys_type_info_ident ident
Definition: tree_schema.h:970
struct lys_ext_instance ** ext
Definition: tree_schema.h:723
Schema container node structure.
Definition: tree_schema.h:1275
struct lys_node * parent
Definition: tree_schema.h:1248
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.