libyang  3.4.2
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tree_schema.h
Go to the documentation of this file.
1 
16 #ifndef LY_TREE_SCHEMA_H_
17 #define LY_TREE_SCHEMA_H_
18 
19 #define PCRE2_CODE_UNIT_WIDTH 8
20 
21 #include <pcre2.h>
22 
23 #include <stdint.h>
24 #include <stdio.h>
25 
26 #include "log.h"
27 #include "ly_config.h"
28 #include "tree.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 struct ly_ctx;
35 struct ly_path;
36 struct ly_set;
37 struct lys_module;
38 struct lysc_node;
39 struct lyxp_expr;
40 
154 /* *INDENT-OFF* */
155 
184 #define LYSC_TREE_DFS_BEGIN(START, ELEM) \
185  { ly_bool LYSC_TREE_DFS_continue = 0; struct lysc_node *LYSC_TREE_DFS_next; \
186  for ((ELEM) = (LYSC_TREE_DFS_next) = (struct lysc_node *)(START); \
187  (ELEM); \
188  (ELEM) = (LYSC_TREE_DFS_next), LYSC_TREE_DFS_continue = 0)
189 
203 #define LYSC_TREE_DFS_END(START, ELEM) \
204  /* select element for the next run - children first */ \
205  if (LYSC_TREE_DFS_continue) { \
206  (LYSC_TREE_DFS_next) = NULL; \
207  } else { \
208  (LYSC_TREE_DFS_next) = (struct lysc_node *)lysc_node_child(ELEM); \
209  } \
210  if (!(LYSC_TREE_DFS_next)) { \
211  /* no children, try siblings */ \
212  _LYSC_TREE_DFS_NEXT(START, ELEM, LYSC_TREE_DFS_next); \
213  } \
214  while (!(LYSC_TREE_DFS_next)) { \
215  /* parent is already processed, go to its sibling */ \
216  (ELEM) = (ELEM)->parent; \
217  _LYSC_TREE_DFS_NEXT(START, ELEM, LYSC_TREE_DFS_next); \
218  } }
219 
223 #define _LYSC_TREE_DFS_NEXT(START, ELEM, NEXT) \
224  if ((ELEM) == (struct lysc_node *)(START)) { \
225  /* we are done, no next element to process */ \
226  break; \
227  } \
228  (NEXT) = (ELEM)->next;
229 
230 /* *INDENT-ON* */
231 
232 #define LY_REV_SIZE 11
239 #define LYS_UNKNOWN 0x0000
240 #define LYS_CONTAINER 0x0001
241 #define LYS_CHOICE 0x0002
242 #define LYS_LEAF 0x0004
243 #define LYS_LEAFLIST 0x0008
244 #define LYS_LIST 0x0010
245 #define LYS_ANYXML 0x0020
246 #define LYS_ANYDATA 0x0060
247 #define LYS_CASE 0x0080
249 #define LYS_RPC 0x0100
250 #define LYS_ACTION 0x0200
251 #define LYS_NOTIF 0x0400
253 #define LYS_USES 0x0800
254 #define LYS_INPUT 0x1000
255 #define LYS_OUTPUT 0x2000
256 #define LYS_GROUPING 0x4000
257 #define LYS_AUGMENT 0x8000
258 
259 #define LYS_NODETYPE_MASK 0xffff
265 struct lysp_import {
266  struct lys_module *module;
268  const char *name;
269  const char *prefix;
270  const char *dsc;
271  const char *ref;
273  uint16_t flags;
274  char rev[LY_REV_SIZE];
275 };
276 
280 struct lysp_include {
283  const char *name;
284  const char *dsc;
285  const char *ref;
287  char rev[LY_REV_SIZE];
291 };
292 
296 struct lysp_ext {
297  const char *name;
298  const char *argname;
299  const char *dsc;
300  const char *ref;
302  uint16_t flags;
304  struct lysc_ext *compiled;
308 };
309 
313 struct lysp_feature {
314  const char *name;
319  const char *dsc;
320  const char *ref;
322  uint16_t flags;
324 };
325 
330  uint8_t *expr;
332 };
333 
337 struct lysp_qname {
338  const char *str;
339  const struct lysp_module *mod;
341  uint16_t flags;
343 };
344 
348 struct lysp_ident {
349  const char *name;
351  const char **bases;
352  const char *dsc;
353  const char *ref;
355  uint16_t flags;
356 };
357 
361 struct lysp_restr {
362 #define LYSP_RESTR_PATTERN_ACK 0x06
363 #define LYSP_RESTR_PATTERN_NACK 0x15
364  struct lysp_qname arg;
367  const char *emsg;
368  const char *eapptag;
369  const char *dsc;
370  const char *ref;
372 };
373 
379  const char *dsc;
380  const char *ref;
382 };
383 
388  const char *name;
389  const char *dsc;
390  const char *ref;
391  int64_t value;
394  uint16_t flags;
396 };
397 
403 struct lysp_type {
404  const char *name;
405  struct lysp_restr *range;
406  struct lysp_restr *length;
410  struct lyxp_expr *path;
411  const char **bases;
412  struct lysp_type *types;
415  const struct lysp_module *pmod;
416  struct lysc_type *compiled;
418  uint8_t fraction_digits;
420  uint16_t flags;
421 };
422 
426 struct lysp_tpdf {
427  const char *name;
428  const char *units;
429  struct lysp_qname dflt;
430  const char *dsc;
431  const char *ref;
433  struct lysp_type type;
434  uint16_t flags;
435 };
436 
440 struct lysp_when {
441  const char *cond;
442  const char *dsc;
443  const char *ref;
445 };
446 
450 struct lysp_refine {
451  const char *nodeid;
452  const char *dsc;
453  const char *ref;
455  struct lysp_restr *musts;
456  const char *presence;
457  struct lysp_qname *dflts;
458  uint32_t min;
459  uint32_t max;
461  uint16_t flags;
462 };
463 
472 #define LYS_DEV_NOT_SUPPORTED 1
473 #define LYS_DEV_ADD 2
474 #define LYS_DEV_DELETE 3
475 #define LYS_DEV_REPLACE 4
481 struct lysp_deviate {
482  uint8_t mod;
483  struct lysp_deviate *next;
485 };
486 
488  uint8_t mod;
489  struct lysp_deviate *next;
491  const char *units;
492  struct lysp_restr *musts;
493  struct lysp_qname *uniques;
494  struct lysp_qname *dflts;
495  uint16_t flags;
496  uint32_t min;
497  uint32_t max;
498 };
499 
501  uint8_t mod;
502  struct lysp_deviate *next;
504  const char *units;
505  struct lysp_restr *musts;
506  struct lysp_qname *uniques;
507  struct lysp_qname *dflts;
508 };
509 
511  uint8_t mod;
512  struct lysp_deviate *next;
514  struct lysp_type *type;
515  const char *units;
516  struct lysp_qname dflt;
517  uint16_t flags;
518  uint32_t min;
519  uint32_t max;
520 };
521 
523  const char *nodeid;
524  const char *dsc;
525  const char *ref;
528 };
529 
653 #define LYS_CONFIG_W 0x01
654 #define LYS_CONFIG_R 0x02
655 #define LYS_CONFIG_MASK 0x03
656 #define LYS_STATUS_CURR 0x04
657 #define LYS_STATUS_DEPRC 0x08
658 #define LYS_STATUS_OBSLT 0x10
659 #define LYS_STATUS_MASK 0x1C
660 #define LYS_MAND_TRUE 0x20
665 #define LYS_MAND_FALSE 0x40
668 #define LYS_MAND_MASK 0x60
669 #define LYS_PRESENCE 0x80
672 #define LYS_UNIQUE 0x80
673 #define LYS_KEY 0x0100
674 #define LYS_KEYLESS 0x0200
675 #define LYS_DISABLED 0x0100
676 #define LYS_FENABLED 0x20
677 #define LYS_ORDBY_SYSTEM 0x80
679 #define LYS_ORDBY_USER 0x40
682 #define LYS_ORDBY_MASK 0xC0
683 #define LYS_YINELEM_TRUE 0x80
684 #define LYS_YINELEM_FALSE 0x0100
685 #define LYS_YINELEM_MASK 0x0180
686 #define LYS_USED_GRP 0x0400
688 #define LYS_SET_VALUE 0x0200
689 #define LYS_SET_MIN 0x0200
690 #define LYS_SET_MAX 0x0400
692 #define LYS_SET_BASE 0x0001
693 #define LYS_SET_BIT 0x0002
694 #define LYS_SET_ENUM 0x0004
695 #define LYS_SET_FRDIGITS 0x0008
696 #define LYS_SET_LENGTH 0x0010
697 #define LYS_SET_PATH 0x0020
698 #define LYS_SET_PATTERN 0x0040
699 #define LYS_SET_RANGE 0x0080
700 #define LYS_SET_TYPE 0x0100
701 #define LYS_SET_REQINST 0x0200
702 #define LYS_SET_DFLT 0x0200
707 #define LYS_SET_UNITS 0x0400
708 #define LYS_SET_CONFIG 0x0800
710 #define LYS_SINGLEQUOTED 0x0100
712 #define LYS_DOUBLEQUOTED 0x0200
715 #define LYS_YIN_ATTR 0x0400
716 #define LYS_YIN_ARGUMENT 0x0800
718 #define LYS_INTERNAL 0x1000
720 #define LYS_IS_ENUM 0x0200
722 #define LYS_IS_INPUT 0x1000
724 #define LYS_IS_OUTPUT 0x2000
726 #define LYS_IS_NOTIF 0x4000
728 #define LYS_FLAGS_COMPILED_MASK 0xff
734 struct lysp_node {
735  struct lysp_node *parent;
736  uint16_t nodetype;
737  uint16_t flags;
738  struct lysp_node *next;
739  const char *name;
740  const char *dsc;
741  const char *ref;
742  struct lysp_qname *iffeatures;
745 };
750 struct lysp_node_container {
751  union {
752  struct lysp_node node;
754  struct {
755  struct lysp_node *parent;
756  uint16_t nodetype;
757  uint16_t flags;
758  struct lysp_node *next;
759  const char *name;
760  const char *dsc;
761  const char *ref;
762  struct lysp_qname *iffeatures;
763  struct lysp_ext_instance *exts;
764  };
765  };
767  /* container */
768  struct lysp_restr *musts;
769  struct lysp_when *when;
770  const char *presence;
771  struct lysp_tpdf *typedefs;
773  struct lysp_node *child;
774  struct lysp_node_action *actions;
775  struct lysp_node_notif *notifs;
776 };
777 
778 struct lysp_node_leaf {
779  union {
780  struct lysp_node node;
782  struct {
783  struct lysp_node *parent;
784  uint16_t nodetype;
785  uint16_t flags;
786  struct lysp_node *next;
787  const char *name;
788  const char *dsc;
789  const char *ref;
790  struct lysp_qname *iffeatures;
792  };
793  };
795  /* leaf */
796  struct lysp_restr *musts;
797  struct lysp_when *when;
798  struct lysp_type type;
799  const char *units;
800  struct lysp_qname dflt;
801 };
802 
803 struct lysp_node_leaflist {
804  union {
805  struct lysp_node node;
807  struct {
808  struct lysp_node *parent;
809  uint16_t nodetype;
810  uint16_t flags;
811  struct lysp_node *next;
812  const char *name;
813  const char *dsc;
814  const char *ref;
815  struct lysp_qname *iffeatures;
817  };
818  };
820  /* leaf-list */
821  struct lysp_restr *musts;
822  struct lysp_when *when;
823  struct lysp_type type;
824  const char *units;
825  struct lysp_qname *dflts;
827  uint32_t min;
828  uint32_t max;
829 };
830 
831 struct lysp_node_list {
832  union {
833  struct lysp_node node;
835  struct {
836  struct lysp_node *parent;
837  uint16_t nodetype;
838  uint16_t flags;
839  struct lysp_node *next;
840  const char *name;
841  const char *dsc;
842  const char *ref;
843  struct lysp_qname *iffeatures;
844  struct lysp_ext_instance *exts;
845  };
846  };
848  /* list */
849  struct lysp_restr *musts;
850  struct lysp_when *when;
851  const char *key;
852  struct lysp_tpdf *typedefs;
854  struct lysp_node *child;
855  struct lysp_node_action *actions;
856  struct lysp_node_notif *notifs;
857  struct lysp_qname *uniques;
858  uint32_t min;
859  uint32_t max;
860 };
861 
862 struct lysp_node_choice {
863  union {
864  struct lysp_node node;
866  struct {
867  struct lysp_node *parent;
868  uint16_t nodetype;
869  uint16_t flags;
870  struct lysp_node *next;
871  const char *name;
872  const char *dsc;
873  const char *ref;
874  struct lysp_qname *iffeatures;
876  };
877  };
879  /* choice */
880  struct lysp_node *child;
881  struct lysp_when *when;
882  struct lysp_qname dflt;
883 };
885 struct lysp_node_case {
886  union {
887  struct lysp_node node;
889  struct {
890  struct lysp_node *parent;
891  uint16_t nodetype;
892  uint16_t flags;
893  struct lysp_node *next;
894  const char *name;
895  const char *dsc;
896  const char *ref;
897  struct lysp_qname *iffeatures;
899  };
900  };
902  /* case */
903  struct lysp_node *child;
904  struct lysp_when *when;
905 };
906 
908  union {
909  struct lysp_node node;
911  struct {
912  struct lysp_node *parent;
913  uint16_t nodetype;
914  uint16_t flags;
915  struct lysp_node *next;
916  const char *name;
917  const char *dsc;
918  const char *ref;
919  struct lysp_qname *iffeatures;
920  struct lysp_ext_instance *exts;
921  };
922  };
924  /* anyxml/anydata */
925  struct lysp_restr *musts;
926  struct lysp_when *when;
927 };
928 
930  union {
931  struct lysp_node node;
933  struct {
934  struct lysp_node *parent;
935  uint16_t nodetype;
936  uint16_t flags;
937  struct lysp_node *next;
938  const char *name;
939  const char *dsc;
940  const char *ref;
941  struct lysp_qname *iffeatures;
942  struct lysp_ext_instance *exts;
943  };
944  };
946  /* uses */
949  struct lysp_when *when;
950 };
955 struct lysp_node_action_inout {
956  union {
957  struct lysp_node node;
959  struct {
960  struct lysp_node *parent;
961  uint16_t nodetype;
962  uint16_t flags;
963  struct lysp_node *next;
964  const char *name;
965  const char *dsc;
966  const char *ref;
967  struct lysp_qname *iffeatures;
968  struct lysp_ext_instance *exts;
969  };
970  };
972  /* inout */
973  struct lysp_restr *musts;
974  struct lysp_tpdf *typedefs;
975  struct lysp_node_grp *groupings;
976  struct lysp_node *child;
977 };
978 
982 struct lysp_node_action {
983  union {
984  struct lysp_node node;
986  struct {
987  struct lysp_node *parent;
988  uint16_t nodetype;
989  uint16_t flags;
990  struct lysp_node_action *next;
991  const char *name;
992  const char *dsc;
993  const char *ref;
994  struct lysp_qname *iffeatures;
995  struct lysp_ext_instance *exts;
996  };
997  };
999  /* action */
1003  struct lysp_node_action_inout input;
1005 };
1006 
1010 struct lysp_node_notif {
1011  union {
1012  struct lysp_node node;
1014  struct {
1015  struct lysp_node *parent;
1016  uint16_t nodetype;
1017  uint16_t flags;
1018  struct lysp_node_notif *next;
1019  const char *name;
1020  const char *dsc;
1021  const char *ref;
1022  struct lysp_qname *iffeatures;
1023  struct lysp_ext_instance *exts;
1024  };
1025  };
1027  /* notif */
1028  struct lysp_restr *musts;
1030  struct lysp_node_grp *groupings;
1031  struct lysp_node *child;
1032 };
1033 
1037 struct lysp_node_grp {
1038  union {
1039  struct lysp_node node;
1041  struct {
1042  struct lysp_node *parent;
1043  uint16_t nodetype;
1044  uint16_t flags;
1045  struct lysp_node_grp *next;
1046  const char *name;
1047  const char *dsc;
1048  const char *ref;
1049  struct lysp_qname *iffeatures;
1050  struct lysp_ext_instance *exts;
1051  };
1052  };
1054  /* grp */
1057  struct lysp_node *child;
1058  struct lysp_node_action *actions;
1060 };
1061 
1065 struct lysp_node_augment {
1066  union {
1067  struct lysp_node node;
1069  struct {
1070  struct lysp_node *parent;
1071  uint16_t nodetype;
1072  uint16_t flags;
1073  struct lysp_node_augment *next;
1074  const char *nodeid;
1075  const char *dsc;
1076  const char *ref;
1077  struct lysp_qname *iffeatures;
1078  struct lysp_ext_instance *exts;
1079  };
1080  };
1082  struct lysp_node *child;
1083  struct lysp_when *when;
1085  struct lysp_node_notif *notifs;
1086 };
1091 typedef enum LYS_VERSION {
1092  LYS_VERSION_UNDEF = 0,
1093  LYS_VERSION_1_0 = 1,
1094  LYS_VERSION_1_1 = 2
1095 } LYS_VERSION;
1096 
1102 struct lysp_module {
1103  struct lys_module *mod;
1105  struct lysp_revision *revs;
1107  struct lysp_import *imports;
1108  struct lysp_include *includes;
1113  struct lysp_node_grp *groupings;
1114  struct lysp_node *data;
1115  struct lysp_node_augment *augments;
1116  struct lysp_node_action *rpcs;
1117  struct lysp_node_notif *notifs;
1118  struct lysp_deviation *deviations;
1119  struct lysp_ext_instance *exts;
1121  uint8_t version;
1122  uint8_t parsing : 1;
1123  uint8_t is_submod : 1;
1124 };
1127  struct lys_module *mod;
1138  struct lysp_node *data;
1142  struct lysp_deviation *deviations;
1143  struct lysp_ext_instance *exts;
1145  uint8_t version;
1146  uint8_t parsing : 1;
1147  uint8_t is_submod : 1;
1149  uint8_t latest_revision : 2;
1153  const char *name;
1154  const char *filepath;
1155  const char *prefix;
1156  const char *org;
1157  const char *contact;
1158  const char *dsc;
1159  const char *ref;
1160 };
1168 #define LYSP_MODULE_NAME(PMOD) (PMOD->is_submod ? ((struct lysp_submodule *)PMOD)->name : ((struct lysp_module *)PMOD)->mod->name)
1169 
1174 struct lysc_prefix {
1175  char *prefix;
1176  const struct lys_module *mod;
1177 };
1178 
1186 struct lysc_ext {
1187  const char *name;
1188  const char *argname;
1189  struct lysc_ext_instance *exts;
1190  struct lyplg_ext *plugin;
1191  struct lys_module *module;
1192  uint16_t flags;
1193 };
1198 struct lysc_when {
1199  struct lyxp_expr *cond;
1200  struct lysc_node *context;
1201  struct lysc_prefix *prefixes;
1202  const char *dsc;
1203  const char *ref;
1205  uint32_t refcount;
1206  uint16_t flags;
1207 };
1212 struct lysc_ident {
1213  const char *name;
1214  const char *dsc;
1215  const char *ref;
1216  struct lys_module *module;
1217  struct lysc_ident **derived;
1220  uint16_t flags;
1221 };
1229 #define LYS_IFF_NOT 0x00
1230 #define LYS_IFF_AND 0x01
1231 #define LYS_IFF_OR 0x02
1232 #define LYS_IFF_F 0x03
1238 struct lysc_revision {
1239  char date[LY_REV_SIZE];
1240  struct lysc_ext_instance *exts;
1241 };
1242 
1243 struct lysc_range {
1244  struct lysc_range_part {
1245  union {
1246  int64_t min_64;
1247  uint64_t min_u64;
1248  };
1249  union {
1250  int64_t max_64;
1251  uint64_t max_u64;
1252  };
1253  } *parts;
1254  const char *dsc;
1255  const char *ref;
1256  const char *emsg;
1257  const char *eapptag;
1259 };
1260 
1262  const char *expr;
1263  pcre2_code *code;
1264  const char *dsc;
1265  const char *ref;
1266  const char *emsg;
1267  const char *eapptag;
1268  struct lysc_ext_instance *exts;
1269  uint32_t inverted : 1;
1270  uint32_t refcount : 31;
1271 };
1273 struct lysc_must {
1274  struct lyxp_expr *cond;
1276  const char *dsc;
1277  const char *ref;
1278  const char *emsg;
1279  const char *eapptag;
1281 };
1283 struct lysc_type {
1284  const char *name;
1286  struct lyplg_type *plugin;
1288  uint32_t refcount;
1290 };
1293  const char *name;
1295  struct lyplg_type *plugin;
1297  uint32_t refcount;
1299  struct lysc_range *range;
1300 };
1303  const char *name;
1305  struct lyplg_type *plugin;
1307  uint32_t refcount;
1309  uint8_t fraction_digits;
1310  struct lysc_range *range;
1311 };
1314  const char *name;
1316  struct lyplg_type *plugin;
1318  uint32_t refcount;
1320  struct lysc_range *length;
1322 };
1325  const char *name;
1326  const char *dsc;
1327  const char *ref;
1330  union {
1331  int32_t value;
1332  uint32_t position;
1333  };
1334  uint16_t flags;
1336 };
1337 
1339  const char *name;
1340  struct lysc_ext_instance *exts;
1341  struct lyplg_type *plugin;
1343  uint32_t refcount;
1346 };
1347 
1349  const char *name;
1350  struct lysc_ext_instance *exts;
1351  struct lyplg_type *plugin;
1353  uint32_t refcount;
1355  struct lysc_type_bitenum_item *bits;
1357 };
1360  const char *name;
1362  struct lyplg_type *plugin;
1364  uint32_t refcount;
1366  struct lyxp_expr *path;
1370 };
1372 struct lysc_type_identityref {
1373  const char *name;
1374  struct lysc_ext_instance *exts;
1375  struct lyplg_type *plugin;
1377  uint32_t refcount;
1379  struct lysc_ident **bases;
1381 };
1383 struct lysc_type_instanceid {
1384  const char *name;
1386  struct lyplg_type *plugin;
1388  uint32_t refcount;
1391 };
1394  const char *name;
1396  struct lyplg_type *plugin;
1398  uint32_t refcount;
1400  struct lysc_type **types;
1401 };
1404  const char *name;
1406  struct lyplg_type *plugin;
1408  uint32_t refcount;
1410  struct lysc_range *length;
1411 };
1416 #define LYS_NODE_HASH_COUNT 4
1417 
1421 struct lysc_node {
1422  uint16_t nodetype;
1423  uint16_t flags;
1425  struct lys_module *module;
1426  struct lysc_node *parent;
1427  struct lysc_node *next;
1428  struct lysc_node *prev;
1432  const char *name;
1433  const char *dsc;
1434  const char *ref;
1435  struct lysc_ext_instance *exts;
1436  void *priv;
1437 };
1438 
1440  union {
1441  struct lysc_node node;
1443  struct {
1444  uint16_t nodetype;
1445  uint16_t flags;
1446  uint8_t hash[LYS_NODE_HASH_COUNT];
1447  struct lys_module *module;
1448  struct lysc_node *parent;
1449  struct lysc_node *next;
1450  struct lysc_node *prev;
1451  const char *name;
1452  const char *dsc;
1453  const char *ref;
1455  void *priv;
1456  };
1457  };
1459  struct lysc_node *child;
1460  struct lysc_must *musts;
1461 };
1462 
1463 struct lysc_node_action {
1464  union {
1465  struct lysc_node node;
1467  struct {
1468  uint16_t nodetype;
1469  uint16_t flags;
1470  uint8_t hash[LYS_NODE_HASH_COUNT];
1471  struct lys_module *module;
1472  struct lysc_node *parent;
1473  struct lysc_node_action *next;
1474  struct lysc_node_action *prev;
1478  const char *name;
1479  const char *dsc;
1480  const char *ref;
1482  void *priv;
1483  };
1484  };
1486  struct lysc_when **when;
1489  struct lysc_node_action_inout input;
1492 };
1493 
1494 struct lysc_node_notif {
1495  union {
1496  struct lysc_node node;
1498  struct {
1499  uint16_t nodetype;
1500  uint16_t flags;
1501  uint8_t hash[LYS_NODE_HASH_COUNT];
1502  struct lys_module *module;
1503  struct lysc_node *parent;
1504  struct lysc_node_notif *next;
1505  struct lysc_node_notif *prev;
1509  const char *name;
1510  const char *dsc;
1511  const char *ref;
1513  void *priv;
1514  };
1515  };
1517  struct lysc_node *child;
1518  struct lysc_must *musts;
1519  struct lysc_when **when;
1522 };
1523 
1524 struct lysc_node_container {
1525  union {
1526  struct lysc_node node;
1528  struct {
1529  uint16_t nodetype;
1530  uint16_t flags;
1531  uint8_t hash[LYS_NODE_HASH_COUNT];
1532  struct lys_module *module;
1533  struct lysc_node *parent;
1534  struct lysc_node *next;
1535  struct lysc_node *prev;
1539  const char *name;
1540  const char *dsc;
1541  const char *ref;
1543  void *priv;
1544  };
1545  };
1547  struct lysc_node *child;
1548  struct lysc_must *musts;
1549  struct lysc_when **when;
1550  struct lysc_node_action *actions;
1551  struct lysc_node_notif *notifs;
1552 };
1553 
1554 struct lysc_node_case {
1555  union {
1556  struct lysc_node node;
1558  struct {
1559  uint16_t nodetype;
1560  uint16_t flags;
1561  uint8_t hash[LYS_NODE_HASH_COUNT];
1562  struct lys_module *module;
1563  struct lysc_node *parent;
1564  struct lysc_node *next;
1565  struct lysc_node *prev;
1569  const char *name;
1570  const char *dsc;
1571  const char *ref;
1573  void *priv;
1574  };
1575  };
1577  struct lysc_node *child;
1579  struct lysc_when **when;
1580 };
1581 
1582 struct lysc_node_choice {
1583  union {
1584  struct lysc_node node;
1586  struct {
1587  uint16_t nodetype;
1588  uint16_t flags;
1589  uint8_t hash[LYS_NODE_HASH_COUNT];
1590  struct lys_module *module;
1591  struct lysc_node *parent;
1592  struct lysc_node *next;
1593  struct lysc_node *prev;
1597  const char *name;
1598  const char *dsc;
1599  const char *ref;
1601  void *priv;
1602  };
1603  };
1605  struct lysc_node_case *cases;
1606  struct lysc_when **when;
1607  struct lysc_node_case *dflt;
1608 };
1609 
1610 struct lysc_node_leaf {
1611  union {
1612  struct lysc_node node;
1614  struct {
1615  uint16_t nodetype;
1616  uint16_t flags;
1617  uint8_t hash[LYS_NODE_HASH_COUNT];
1618  struct lys_module *module;
1619  struct lysc_node *parent;
1620  struct lysc_node *next;
1621  struct lysc_node *prev;
1625  const char *name;
1626  const char *dsc;
1627  const char *ref;
1629  void *priv;
1630  };
1631  };
1633  struct lysc_must *musts;
1634  struct lysc_when **when;
1635  struct lysc_type *type;
1637  const char *units;
1638  struct lyd_value *dflt;
1639 };
1640 
1641 struct lysc_node_leaflist {
1642  union {
1643  struct lysc_node node;
1645  struct {
1646  uint16_t nodetype;
1647  uint16_t flags;
1648  uint8_t hash[LYS_NODE_HASH_COUNT];
1649  struct lys_module *module;
1650  struct lysc_node *parent;
1651  struct lysc_node *next;
1652  struct lysc_node *prev;
1656  const char *name;
1657  const char *dsc;
1658  const char *ref;
1660  void *priv;
1661  };
1662  };
1664  struct lysc_must *musts;
1665  struct lysc_when **when;
1666  struct lysc_type *type;
1668  const char *units;
1669  struct lyd_value **dflts;
1672  uint32_t min;
1673  uint32_t max;
1675 };
1676 
1677 struct lysc_node_list {
1678  union {
1679  struct lysc_node node;
1681  struct {
1682  uint16_t nodetype;
1683  uint16_t flags;
1684  uint8_t hash[LYS_NODE_HASH_COUNT];
1685  struct lys_module *module;
1686  struct lysc_node *parent;
1687  struct lysc_node *next;
1688  struct lysc_node *prev;
1692  const char *name;
1693  const char *dsc;
1694  const char *ref;
1696  void *priv;
1697  };
1698  };
1700  struct lysc_node *child;
1701  struct lysc_must *musts;
1702  struct lysc_when **when;
1703  struct lysc_node_action *actions;
1704  struct lysc_node_notif *notifs;
1706  struct lysc_node_leaf ***uniques;
1707  uint32_t min;
1708  uint32_t max;
1709 };
1710 
1711 struct lysc_node_anydata {
1712  union {
1713  struct lysc_node node;
1715  struct {
1716  uint16_t nodetype;
1717  uint16_t flags;
1718  uint8_t hash[LYS_NODE_HASH_COUNT];
1719  struct lys_module *module;
1720  struct lysc_node *parent;
1721  struct lysc_node *next;
1722  struct lysc_node *prev;
1726  const char *name;
1727  const char *dsc;
1728  const char *ref;
1730  void *priv;
1731  };
1732  };
1734  struct lysc_must *musts;
1735  struct lysc_when **when;
1736 };
1737 
1744 struct lysc_module {
1745  struct lys_module *mod;
1747  struct lysc_node *data;
1748  struct lysc_node_action *rpcs;
1749  struct lysc_node_notif *notifs;
1750  struct lysc_ext_instance *exts;
1751 };
1759 #define lysc_is_userordered(lysc_node) \
1760  ((!lysc_node || !(lysc_node->nodetype & (LYS_LEAFLIST | LYS_LIST)) || !(lysc_node->flags & LYS_ORDBY_USER)) ? 0 : 1)
1761 
1768 #define lysc_is_key(lysc_node) \
1769  ((!lysc_node || (lysc_node->nodetype != LYS_LEAF) || !(lysc_node->flags & LYS_KEY)) ? 0 : 1)
1770 
1777 #define lysc_is_np_cont(lysc_node) \
1778  ((!lysc_node || (lysc_node->nodetype != LYS_CONTAINER) || (lysc_node->flags & LYS_PRESENCE)) ? 0 : 1)
1779 
1786 #define lysc_is_dup_inst_list(lysc_node) \
1787  ((lysc_node && (((lysc_node->nodetype == LYS_LIST) && (lysc_node->flags & LYS_KEYLESS)) || \
1788  ((lysc_node->nodetype == LYS_LEAFLIST) && !(lysc_node->flags & LYS_CONFIG_W)))) ? 1 : 0)
1789 
1796 LIBYANG_API_DECL const struct lysc_node *lysc_data_node(const struct lysc_node *schema);
1797 
1801 #define lysc_data_parent(SCHEMA) lysc_data_node((SCHEMA) ? (SCHEMA)->parent : NULL)
1802 
1813 LIBYANG_API_DECL const struct lysc_when *lysc_has_when(const struct lysc_node *node);
1814 
1822 LIBYANG_API_DECL const struct lys_module *lysc_owner_module(const struct lysc_node *node);
1823 
1830 LIBYANG_API_DECL const struct lysp_node_grp *lysp_node_groupings(const struct lysp_node *node);
1831 
1838 LIBYANG_API_DECL const struct lysp_tpdf *lysp_node_typedefs(const struct lysp_node *node);
1839 
1846 LIBYANG_API_DECL const struct lysp_node_action *lysp_node_actions(const struct lysp_node *node);
1847 
1854 LIBYANG_API_DECL const struct lysp_node_notif *lysp_node_notifs(const struct lysp_node *node);
1855 
1862 LIBYANG_API_DECL const struct lysp_node *lysp_node_child(const struct lysp_node *node);
1863 
1870 LIBYANG_API_DECL const struct lysc_node_action *lysc_node_actions(const struct lysc_node *node);
1871 
1878 LIBYANG_API_DECL const struct lysc_node_notif *lysc_node_notifs(const struct lysc_node *node);
1879 
1890 LIBYANG_API_DECL const struct lysc_node *lysc_node_child(const struct lysc_node *node);
1891 
1899 LIBYANG_API_DECL struct lysc_must *lysc_node_musts(const struct lysc_node *node);
1900 
1908 LIBYANG_API_DECL struct lysc_when **lysc_node_when(const struct lysc_node *node);
1909 
1916 LIBYANG_API_DECL const struct lysc_node *lysc_node_lref_target(const struct lysc_node *node);
1917 
1927 typedef LY_ERR (*lysc_dfs_clb)(struct lysc_node *node, void *data, ly_bool *dfs_continue);
1928 
1945 LIBYANG_API_DECL LY_ERR lysc_tree_dfs_full(const struct lysc_node *root, lysc_dfs_clb dfs_clb, void *data);
1946 
1958 LIBYANG_API_DECL LY_ERR lysc_module_dfs_full(const struct lys_module *mod, lysc_dfs_clb dfs_clb, void *data);
1959 
1968 LIBYANG_API_DECL LY_ERR lysc_iffeature_value(const struct lysc_iffeature *iff);
1969 
1981 LIBYANG_API_DECL LY_ERR lys_identity_iffeature_value(const struct lysc_ident *ident);
1982 
1991 LIBYANG_API_DECL struct lysp_feature *lysp_feature_next(const struct lysp_feature *last, const struct lysp_module *pmod,
1992  uint32_t *idx);
1993 
1999 #define LYS_FIND_XP_SCHEMA 0x08
2000 #define LYS_FIND_XP_OUTPUT 0x10
2001 #define LYS_FIND_NO_MATCH_ERROR 0x40
2003 #define LYS_FIND_SCHEMAMOUNT 0x0200
2018 LIBYANG_API_DECL LY_ERR lys_find_xpath_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath,
2019  uint32_t options, struct ly_set **set);
2020 
2033 LIBYANG_API_DECL LY_ERR lys_find_expr_atoms(const struct lysc_node *ctx_node, const struct lys_module *cur_mod,
2034  const struct lyxp_expr *expr, const struct lysc_prefix *prefixes, uint32_t options, struct ly_set **set);
2035 
2047 LIBYANG_API_DECL LY_ERR lys_find_xpath(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath,
2048  uint32_t options, struct ly_set **set);
2049 
2058 LIBYANG_API_DECL LY_ERR lys_find_lypath_atoms(const struct ly_path *path, struct ly_set **set);
2059 
2070 LIBYANG_API_DECL LY_ERR lys_find_path_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path,
2071  ly_bool output, struct ly_set **set);
2072 
2082 LIBYANG_API_DECL const struct lysc_node *lys_find_path(const struct ly_ctx *ctx, const struct lysc_node *ctx_node,
2083  const char *path, ly_bool output);
2084 
2088 typedef enum {
2089  LYSC_PATH_LOG,
2090  LYSC_PATH_DATA,
2093 } LYSC_PATH_TYPE;
2094 
2106 LIBYANG_API_DECL char *lysc_path(const struct lysc_node *node, LYSC_PATH_TYPE pathtype, char *buffer, size_t buflen);
2107 
2111 struct lys_module {
2112  struct ly_ctx *ctx;
2113  const char *name;
2114  const char *revision;
2115  const char *ns;
2116  const char *prefix;
2117  const char *filepath;
2118  const char *org;
2119  const char *contact;
2120  const char *dsc;
2121  const char *ref;
2123  struct lysp_module *parsed;
2124  struct lysc_module *compiled;
2127  struct lysc_ident *identities;
2142 };
2151 #define LYS_MOD_LATEST_REV 0x01
2152 #define LYS_MOD_LATEST_SEARCHDIRS 0x02
2153 #define LYS_MOD_IMPORTED_REV 0x04
2156 #define LYS_MOD_LATEST_IMPCLB 0x08
2171 LIBYANG_API_DECL LY_ERR lys_feature_value(const struct lys_module *module, const char *feature);
2192 LIBYANG_API_DECL const struct lysc_node *lys_getnext(const struct lysc_node *last, const struct lysc_node *parent,
2193  const struct lysc_module *module, uint32_t options);
2194 
2207 LIBYANG_API_DECL const struct lysc_node *lys_getnext_ext(const struct lysc_node *last, const struct lysc_node *parent,
2208  const struct lysc_ext_instance *ext, uint32_t options);
2209 
2217 #define LYS_GETNEXT_WITHCHOICE 0x01
2218 #define LYS_GETNEXT_NOCHOICE 0x02
2219 #define LYS_GETNEXT_WITHCASE 0x04
2220 #define LYS_GETNEXT_INTONPCONT 0x08
2221 #define LYS_GETNEXT_OUTPUT 0x10
2223 #define LYS_GETNEXT_WITHSCHEMAMOUNT 0x20
2240 LIBYANG_API_DECL const struct lysc_node *lys_find_child(const struct lysc_node *parent, const struct lys_module *module,
2241  const char *name, size_t name_len, uint16_t nodetype, uint32_t options);
2258 LIBYANG_API_DECL LY_ERR lys_set_implemented(struct lys_module *mod, const char **features);
2259 
2266 LIBYANG_API_DECL const char *lys_nodetype2str(uint16_t nodetype);
2267 
2274 LIBYANG_API_DECL const char *lyxp_get_expr(const struct lyxp_expr *path);
2275 
2278 #ifdef __cplusplus
2279 }
2280 #endif
2281 
2282 #endif /* LY_TREE_SCHEMA_H_ */
struct lys_module * mod
Definition: tree_schema.h:1121
struct lyplg_type * plugin
Definition: tree_schema.h:1414
struct lysp_node_action * actions
Definition: tree_schema.h:1102
const char * name
Definition: tree_schema.h:297
const char * units
Definition: tree_schema.h:515
Compiled prefix data pair mapping of prefixes to modules. In case the format is LY_VALUE_SCHEMA_RESOL...
Definition: tree_schema.h:1192
uint8_t version
Definition: tree_schema.h:1139
struct lysp_node_grp * groupings
Definition: tree_schema.h:993
struct lysp_type type
Definition: tree_schema.h:816
struct lyd_value ** dflts
Definition: tree_schema.h:1687
struct lysc_ext_instance * exts
Definition: tree_schema.h:1358
struct lysp_feature ** depfeatures
Definition: tree_schema.h:317
Compiled YANG data node.
Definition: tree_schema.h:1439
const char * argname
Definition: tree_schema.h:1206
struct lysp_when * when
Definition: tree_schema.h:899
LY_DATA_TYPE basetype
Definition: tree_schema.h:1394
struct lysp_tpdf * typedefs
Definition: tree_schema.h:870
struct lysp_qname * dflts
Definition: tree_schema.h:507
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1018
struct lysp_node * data
Definition: tree_schema.h:1132
Qualified name (optional prefix followed by an identifier).
Definition: tree_schema.h:337
struct lysc_ident ** derived
Definition: tree_schema.h:1235
struct lysc_node_case * dflt
Definition: tree_schema.h:1625
struct lysp_when * when
Definition: tree_schema.h:1101
LY_DATA_TYPE basetype
Definition: tree_schema.h:1425
struct lysp_node * next
Definition: tree_schema.h:756
struct lysp_restr * musts
Definition: tree_schema.h:455
struct lysc_type_bitenum_item * bits
Definition: tree_schema.h:1373
uint16_t flags
Definition: tree_schema.h:434
struct ly_ctx * ctx
Definition: tree_schema.h:2132
const char * units
Definition: tree_schema.h:1655
struct lysp_ext_instance * exts
Definition: tree_schema.h:484
ly_bool to_compile
Definition: tree_schema.h:2159
const char * dsc
Definition: tree_schema.h:758
struct lysc_must * musts
Definition: tree_schema.h:1478
const char * name
Definition: tree_schema.h:1422
struct lysp_module * parsed
Definition: tree_schema.h:2143
struct lysc_node * context
Definition: tree_schema.h:1218
Compiled YANG if-feature-stmt.
Definition: tree_schema.h:329
const char * name
Definition: tree_schema.h:1205
uint16_t flags
Definition: tree_schema.h:1238
const char * name
Definition: tree_schema.h:1321
struct lysp_node_action * actions
Definition: tree_schema.h:1076
struct lysc_when ** when
Definition: tree_schema.h:1504
struct lyplg_type * plugin
Definition: tree_schema.h:1304
struct lysc_ext_instance * exts
Definition: tree_schema.h:1312
LY_DATA_TYPE basetype
Definition: tree_schema.h:1415
struct lysp_tpdf * typedefs
Definition: tree_schema.h:992
Hold type-specific functions for various operations with the data values.
const char * dsc
Definition: tree_schema.h:369
YANG import-stmt.
Definition: tree_schema.h:265
Extension plugin implementing various aspects of a YANG extension.
Definition: plugins_exts.h:938
Covers restrictions: range, length, pattern, must.
Definition: tree_schema.h:361
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1073
const char * name
Definition: tree_schema.h:1412
struct lysp_import * imports
Definition: tree_schema.h:1149
struct lysc_ext_instance * exts
Definition: tree_schema.h:1423
struct lysp_type * types
Definition: tree_schema.h:412
struct lysc_when ** when
Definition: tree_schema.h:1720
struct lysp_node_augment * augments
Definition: tree_schema.h:1133
struct lysc_prefix * prefixes
Definition: tree_schema.h:1293
YANG extension compiled instance.
Definition: plugins_exts.h:437
char rev[11]
Definition: tree_schema.h:287
struct lysp_when * when
Definition: tree_schema.h:840
struct lysc_when ** when
Definition: tree_schema.h:1624
struct lysc_range::lysc_range_part * parts
const char * dsc
Definition: tree_schema.h:1232
struct lysc_ext_instance * exts
Definition: tree_schema.h:1403
uint32_t max
Definition: tree_schema.h:459
const char * prefix
Definition: tree_schema.h:2136
struct lysp_include * includes
Definition: tree_schema.h:1126
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:28
Compiled YANG extension-stmt.
Definition: tree_schema.h:1204
const char * name
Definition: tree_schema.h:1357
uint16_t flags
Definition: tree_schema.h:355
struct lysc_node * child
Definition: tree_schema.h:1718
struct lysp_ext_instance * exts
Definition: plugins_exts.h:422
struct lysc_ext_instance * exts
Definition: tree_schema.h:1379
uint32_t refcount
Definition: tree_schema.h:1426
struct lyplg_type * plugin
Definition: tree_schema.h:1393
uint8_t latest_revision
Definition: tree_schema.h:2161
struct lysc_ext_instance * exts
Definition: tree_schema.h:1237
struct lysp_restr * musts
Definition: tree_schema.h:943
YANG refine-stmt.
Definition: tree_schema.h:450
struct lysp_qname dflt
Definition: tree_schema.h:900
struct lys_module * module
Definition: tree_schema.h:1234
struct lyplg_type * plugin
Definition: tree_schema.h:1369
uint16_t flags
Definition: tree_schema.h:1210
struct lysp_when * when
Definition: tree_schema.h:944
const char * name
Definition: tree_schema.h:1171
uint8_t latest_revision
Definition: tree_schema.h:1167
struct lysp_node * child
Definition: tree_schema.h:1049
struct lysp_qname * iffeatures
Definition: tree_schema.h:350
struct lysp_when * when
Definition: tree_schema.h:922
const char * ref
Definition: tree_schema.h:380
struct lysc_node * child
Definition: tree_schema.h:1535
struct lysc_ident * identities
Definition: tree_schema.h:2147
const char * ref
Definition: tree_schema.h:2141
struct lysp_ext * extensions
Definition: tree_schema.h:1127
const char * ns
Definition: tree_schema.h:2135
ly_bool implemented
Definition: tree_schema.h:2158
uint32_t refcount
Definition: tree_schema.h:1361
const char * name
Definition: tree_schema.h:1450
const char * dsc
Definition: tree_schema.h:299
LY_DATA_TYPE
YANG built-in types.
Definition: tree.h:202
const char * org
Definition: tree_schema.h:2138
struct lysc_must * musts
Definition: tree_schema.h:1536
struct lysp_ext_instance * exts
Definition: tree_schema.h:413
YANG feature-stmt.
Definition: tree_schema.h:313
const char * ref
Definition: tree_schema.h:1177
struct lys_module * mod
Definition: tree_schema.h:1194
YANG identity-stmt.
Definition: tree_schema.h:1230
struct lysc_node * parent
Definition: tree_schema.h:1444
const char * contact
Definition: tree_schema.h:1175
struct lysp_qname * dflts
Definition: tree_schema.h:843
libyang generic macros and functions to work with YANG schema or data trees.
struct lysc_when ** when
Definition: tree_schema.h:1652
struct lysp_node_action * rpcs
Definition: tree_schema.h:1134
struct lyplg_type * plugin
Definition: tree_schema.h:1323
struct lysp_ext_instance * exts
Definition: tree_schema.h:272
struct lysp_qname * dflts
Definition: tree_schema.h:494
struct lysc_ext_instance * exts
Definition: tree_schema.h:1207
LY_DATA_TYPE basetype
Definition: tree_schema.h:1405
struct lysc_ext_instance * exts
Definition: plugins_exts.h:441
const char * dsc
Definition: tree_schema.h:319
const char * dsc
Definition: tree_schema.h:389
const char * cond
Definition: tree_schema.h:441
uint32_t refcount
Definition: tree_schema.h:1336
const char * filepath
Definition: tree_schema.h:1172
const char * name
Definition: tree_schema.h:268
YANG identity-stmt.
Definition: tree_schema.h:348
const char * ref
Definition: tree_schema.h:1233
struct lys_module * module
Definition: tree_schema.h:1209
struct lysc_ext_instance * exts
Definition: tree_schema.h:1286
LY_DATA_TYPE basetype
Definition: tree_schema.h:1381
struct lysc_iffeature * iffeatures_c
Definition: tree_schema.h:316
uint32_t refcount
Definition: tree_schema.h:1371
const char * ref
Definition: tree_schema.h:353
LIBYANG_API_DECL struct lysp_node_grp * lysp_node_groupings(const struct lysp_node *node)
Get the groupings linked list of the given (parsed) schema node. Decides the node&#39;s type and in case ...
const char * units
Definition: tree_schema.h:504
struct lysp_node_grp * groupings
Definition: tree_schema.h:1048
const char * dsc
Definition: tree_schema.h:452
const char * name
Definition: tree_schema.h:404
const char * ref
Definition: tree_schema.h:443
LY_DATA_TYPE basetype
Definition: tree_schema.h:1370
const char * name
Definition: tree_schema.h:757
const char * ref
Definition: tree_schema.h:320
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1154
LIBYANG_API_DECL struct lysc_node * lys_getnext_ext(const struct lysc_node *last, const struct lysc_node *parent, const struct lysc_ext_instance *ext, uint32_t options)
Get next schema (sibling) node element in the schema order of an extension that can be instantiated i...
struct lysp_ident * identities
Definition: tree_schema.h:1153
struct lysp_node * child
Definition: tree_schema.h:872
struct lysp_node * child
Definition: tree_schema.h:898
const char * dsc
Definition: tree_schema.h:1282
char * prefix
Definition: tree_schema.h:1193
uint8_t is_submod
Definition: tree_schema.h:1141
struct lysp_node_action * actions
Definition: tree_schema.h:792
uint32_t min
Definition: tree_schema.h:876
struct lysc_ext_instance * exts
Definition: tree_schema.h:1392
struct lysc_ext_instance * exts
Definition: tree_schema.h:1346
const char * ref
Definition: tree_schema.h:759
LY_DATA_TYPE basetype
Definition: tree_schema.h:1335
uint16_t nodetype
Definition: tree_schema.h:1440
Extension structure of the lysp_node for YANG container.
Definition: tree_schema.h:768
uint16_t flags
Definition: tree_schema.h:1224
const char * name
Definition: tree_schema.h:1378
const char * ref
Definition: tree_schema.h:1273
struct lys_module * module
Definition: tree_schema.h:266
#define LY_REV_SIZE
Definition: tree_schema.h:232
LIBYANG_API_DECL LY_ERR lys_find_expr_atoms(const struct lysc_node *ctx_node, const struct lys_module *cur_mod, const struct lyxp_expr *expr, const struct lysc_prefix *prefixes, uint32_t options, struct ly_set **set)
Get all the schema nodes that are required for expr to be evaluated (atoms).
struct lysp_restr * length
Definition: tree_schema.h:406
uint32_t refcount
Definition: tree_schema.h:1416
const char * ref
Definition: tree_schema.h:453
struct lysp_ext_instance * exts
Definition: tree_schema.h:1137
struct lysc_node_case * cases
Definition: tree_schema.h:1623
Enumeration/Bit value definition.
Definition: tree_schema.h:387
struct lysc_type * compiled
Definition: tree_schema.h:416
LIBYANG_API_DECL struct lysc_node_notif * lysc_node_notifs(const struct lysc_node *node)
Get the Notifications linked list of the given (compiled) schema node. Decides the node&#39;s type and in...
Compiled YANG schema tree structure representing YANG module.
Definition: tree_schema.h:1762
const char * name
Definition: tree_schema.h:1367
uint32_t inverted
Definition: tree_schema.h:1287
struct lysc_node * child
Definition: tree_schema.h:1565
struct lysp_qname dflt
Definition: tree_schema.h:516
struct lysp_qname dflt
Definition: tree_schema.h:429
struct lysp_restr * musts
Definition: tree_schema.h:991
struct lysp_ext_instance * exts
Definition: tree_schema.h:286
struct lysp_ext_instance * exts
Definition: tree_schema.h:1161
struct lysp_qname * iffeatures
Definition: tree_schema.h:315
YANG grouping-stmt.
Definition: tree_schema.h:1055
struct lysp_deviate * next
Definition: tree_schema.h:512
const char * eapptag
Definition: tree_schema.h:368
struct lys_module * mod
Definition: tree_schema.h:1145
struct lysp_ext_instance * exts
Definition: tree_schema.h:527
struct lysp_deviate * next
Definition: tree_schema.h:483
struct lysc_range * range
Definition: tree_schema.h:1328
struct lysp_ext_instance * exts
Definition: tree_schema.h:490
ly_bool injected
Definition: tree_schema.h:288
void * priv
Definition: tree_schema.h:1454
struct lysc_node_action * rpcs
Definition: tree_schema.h:1766
uint32_t refcount
Definition: tree_schema.h:1325
const char * ref
Definition: tree_schema.h:285
struct lysp_type_enum * enums
Definition: tree_schema.h:408
const char * name
Definition: tree_schema.h:314
const char * nodeid
Definition: tree_schema.h:451
struct lysc_node_leaf *** uniques
Definition: tree_schema.h:1724
struct lysc_type ** types
Definition: tree_schema.h:1418
struct lysp_ext_instance * exts
Definition: tree_schema.h:513
uint8_t hash[4]
Definition: tree_schema.h:1442
LIBYANG_API_DECL struct lysc_node * lys_getnext(const struct lysc_node *last, const struct lysc_node *parent, const struct lysc_module *module, uint32_t options)
Get next schema (sibling) node element in the schema order that can be instantiated in a data tree...
struct lysp_qname arg
Definition: tree_schema.h:364
LY_ERR(* lysc_dfs_clb)(struct lysc_node *node, void *data, ly_bool *dfs_continue)
Callback to be called for every schema node in a DFS traversal.
Definition: tree_schema.h:1945
const char * units
Definition: tree_schema.h:842
LIBYANG_API_DECL LY_ERR lys_find_xpath(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath, uint32_t options, struct ly_set **set)
Evaluate an xpath expression on schema nodes.
struct lysc_range * length
Definition: tree_schema.h:1428
struct lysp_submodule * submodule
Definition: tree_schema.h:281
YANG type-stmt.
Definition: tree_schema.h:403
uint8_t fraction_digits
Definition: tree_schema.h:1327
const char * ref
Definition: tree_schema.h:370
LY_DATA_TYPE basetype
Definition: tree_schema.h:1360
struct lysc_pattern ** patterns
Definition: tree_schema.h:1339
LIBYANG_API_DECL const char * lys_nodetype2str(uint16_t nodetype)
Stringify schema nodetype.
struct lysp_restr * musts
Definition: tree_schema.h:492
struct lysc_range * length
Definition: tree_schema.h:1338
const char * prefix
Definition: tree_schema.h:269
struct lysc_must * musts
Definition: tree_schema.h:1752
const char * dsc
Definition: tree_schema.h:524
YANG data representation.
Definition: tree_data.h:571
LIBYANG_API_DECL LY_ERR lys_find_path_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path, ly_bool output, struct ly_set **set)
Get all the schema nodes that are required for path to be evaluated (atoms).
const char * name
Definition: tree_schema.h:283
struct lysc_node_notif * notifs
Definition: tree_schema.h:1722
struct lyplg_type * plugin
Definition: tree_schema.h:1424
struct lysc_node * next
Definition: tree_schema.h:1445
struct lysp_qname * uniques
Definition: tree_schema.h:506
YANG revision-stmt.
Definition: tree_schema.h:377
struct lysp_qname dflt
Definition: tree_schema.h:818
struct lyxp_expr * path
Definition: tree_schema.h:1384
struct lysc_ext_instance * exts
Definition: tree_schema.h:1303
struct lysp_ext_instance * exts
Definition: tree_schema.h:301
struct lysp_node * child
Definition: tree_schema.h:791
const char * presence
Definition: tree_schema.h:788
struct lysp_deviation * deviations
Definition: tree_schema.h:1136
struct lysp_type type
Definition: tree_schema.h:841
Generic deviate structure to get type and cast to lysp_deviate_* structure.
Definition: tree_schema.h:481
const char * ref
Definition: tree_schema.h:431
const char * dsc
Definition: tree_schema.h:379
struct lyplg_type * plugin
Definition: tree_schema.h:1334
struct lysc_node_action_inout input
Definition: tree_schema.h:1507
struct lysp_type * type
Definition: tree_schema.h:514
char date[11]
Definition: tree_schema.h:378
const char * name
Definition: tree_schema.h:388
struct lysp_include * includes
Definition: tree_schema.h:1150
struct lyd_value * dflt
Definition: tree_schema.h:1656
LIBYANG_API_DECL struct lysc_node * lysc_node_child(const struct lysc_node *node)
Get the children linked list of the given (compiled) schema node.
struct lysc_ext_instance * exts
Definition: tree_schema.h:1413
struct lysp_node_grp * groupings
Definition: tree_schema.h:790
YANG notification-stmt.
Definition: tree_schema.h:1028
const char * dsc
Definition: tree_schema.h:1272
struct lysp_node_notif * notifs
Definition: tree_schema.h:793
struct lysp_when * when
Definition: tree_schema.h:787
const char * dsc
Definition: tree_schema.h:1451
LIBYANG_API_DECL LY_ERR lysc_iffeature_value(const struct lysc_iffeature *iff)
Get how the if-feature statement currently evaluates.
struct lysc_when ** when
Definition: tree_schema.h:1537
struct lyplg_type * plugin
Definition: tree_schema.h:1404
struct lysp_revision * revs
Definition: tree_schema.h:1147
YANG extension-stmt.
Definition: tree_schema.h:296
uint16_t flags
Definition: tree_schema.h:273
struct lysp_node_notif * notifs
Definition: tree_schema.h:874
struct lysp_restr * musts
Definition: tree_schema.h:786
struct lysc_node * child
Definition: tree_schema.h:1477
uint16_t flags
Definition: tree_schema.h:341
uint32_t refcount
Definition: tree_schema.h:1223
struct lysp_ext_instance * exts
Definition: tree_schema.h:321
uint32_t max
Definition: tree_schema.h:877
const char ** bases
Definition: tree_schema.h:351
struct lyxp_expr * cond
Definition: tree_schema.h:1292
const char * units
Definition: tree_schema.h:1686
const char * eapptag
Definition: tree_schema.h:1275
struct lysp_ext_instance * exts
Definition: tree_schema.h:503
LIBYANG_API_DECL LY_ERR lys_find_lypath_atoms(const struct ly_path *path, struct ly_set **set)
Get all the schema nodes that are required for path to be evaluated (atoms).
LIBYANG_API_DECL struct lysc_node_action * lysc_node_actions(const struct lysc_node *node)
Get the actions/RPCs linked list of the given (compiled) schema node. Decides the node&#39;s type and in ...
struct lysp_tpdf * typedefs
Definition: tree_schema.h:789
struct lysp_node_grp * groupings
Definition: tree_schema.h:871
YANG uses-augment-stmt and augment-stmt (compatible with struct lysp_node )
Definition: tree_schema.h:1083
struct lysc_must * musts
Definition: tree_schema.h:1719
struct lysc_ext_instance * exts
Definition: tree_schema.h:1768
const char * dsc
Definition: tree_schema.h:284
struct lysp_module * mod
Definition: tree_schema.h:339
struct lysp_ident * identities
Definition: tree_schema.h:1129
struct lysp_node_notif * notifs
Definition: tree_schema.h:1077
struct lysp_module * pmod
Definition: tree_schema.h:415
Structure to hold a set of (not necessary somehow connected) objects. Usually used for lyd_node...
Definition: set.h:47
const char * ref
Definition: tree_schema.h:271
LIBYANG_API_DECL struct lysc_node * lys_find_path(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path, ly_bool output)
Get a schema node based on the given data path (JSON format, see XPath Addressing).
LIBYANG_API_DECL LY_ERR lys_identity_iffeature_value(const struct lysc_ident *ident)
Get how the if-feature statement is evaluated for certain identity.
LIBYANG_API_DECL struct lysc_when ** lysc_node_when(const struct lysc_node *node)
Get the when statements list if present in the node.
struct lysc_node_action_inout output
Definition: tree_schema.h:1508
struct lysp_ext_instance * exts
Definition: tree_schema.h:371
struct lysp_qname * uniques
Definition: tree_schema.h:493
const char * name
Definition: tree_schema.h:1332
uint8_t is_submod
Definition: tree_schema.h:1165
struct lysc_node_action * actions
Definition: tree_schema.h:1568
Printable YANG schema tree structure representing YANG module.
Definition: tree_schema.h:1120
struct lysc_prefix * prefixes
Definition: tree_schema.h:1219
struct lysp_when * when
Definition: tree_schema.h:967
YANG rpc-stmt and action-stmt.
Definition: tree_schema.h:1000
const char ** bases
Definition: tree_schema.h:411
Available YANG schema tree structures representing YANG module.
Definition: tree_schema.h:2131
const char * name
Definition: tree_schema.h:1302
struct lysp_feature * features
Definition: tree_schema.h:1152
const char * name
Definition: tree_schema.h:427
const char * units
Definition: tree_schema.h:491
struct lyxp_expr * cond
Definition: tree_schema.h:1217
LIBYANG_API_DECL LY_ERR lys_set_implemented(struct lys_module *mod, const char **features)
Make the specific module implemented.
struct lyplg_type * plugin
Definition: tree_schema.h:1380
struct lysc_range * range
Definition: tree_schema.h:1317
struct lysc_node_notif * notifs
Definition: tree_schema.h:1569
struct lysc_ext_instance * exts
Definition: tree_schema.h:1333
const char * eapptag
Definition: tree_schema.h:1285
const char * emsg
Definition: tree_schema.h:1296
struct lysp_qname * uniques
Definition: tree_schema.h:875
struct lysp_ext_instance * exts
Definition: tree_schema.h:393
const char * ref
Definition: tree_schema.h:1452
LIBYANG_API_DECL struct lysc_node * lysc_data_node(const struct lysc_node *schema)
Get nearest schema parent (including the node itself) that can be instantiated in data...
#define LYS_NODE_HASH_COUNT
Maximum number of hashes stored in a schema node.
Definition: tree_schema.h:1434
struct lysc_type * type
Definition: tree_schema.h:1653
uint16_t flags
Definition: tree_schema.h:302
struct lysp_node * child
Definition: tree_schema.h:1100
struct lys_module ** deviated_by
Definition: tree_schema.h:2156
struct lysp_node_grp * groupings
Definition: tree_schema.h:1074
const char * filepath
Definition: tree_schema.h:2137
const char * str
Definition: tree_schema.h:338
struct lysp_ext_instance * exts
Definition: tree_schema.h:354
struct lysc_ext_instance * exts
Definition: tree_schema.h:1222
LIBYANG_API_DECL struct lysp_node_notif * lysp_node_notifs(const struct lysp_node *node)
Get the Notifications linked list of the given (parsed) schema node. Decides the node&#39;s type and in c...
uint8_t require_instance
Definition: tree_schema.h:419
const char * ref
Definition: tree_schema.h:390
struct lysp_restr * range
Definition: tree_schema.h:405
YANG input-stmt and output-stmt.
Definition: tree_schema.h:973
pcre2_code * code
Definition: tree_schema.h:1281
struct lysc_when ** when
Definition: tree_schema.h:1567
struct lysp_node * child
Definition: tree_schema.h:921
YANG when-stmt.
Definition: tree_schema.h:440
LYSC_PATH_TYPE
Types of the different schema paths.
Definition: tree_schema.h:2108
struct lysc_when ** when
Definition: tree_schema.h:1683
struct lysc_when ** when
Definition: tree_schema.h:1597
struct lysp_node_grp * groupings
Definition: tree_schema.h:1019
uint8_t parsing
Definition: tree_schema.h:1140
struct lyplg_type * plugin
Definition: tree_schema.h:1313
struct lysp_deviate * next
Definition: tree_schema.h:489
struct lysp_node_notif * notifs
Definition: tree_schema.h:1103
struct lysp_revision * revs
Definition: tree_schema.h:1123
uint32_t refcount
Definition: tree_schema.h:1315
uint8_t require_instance
Definition: tree_schema.h:1387
LY_DATA_TYPE basetype
Definition: tree_schema.h:1324
struct lysp_deviate * next
Definition: tree_schema.h:502
LYS_VERSION
supported YANG schema version values
Definition: tree_schema.h:1109
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1047
uint16_t flags
Definition: tree_schema.h:1441
const char * dsc
Definition: tree_schema.h:430
struct lysp_ext_instance * exts
Definition: tree_schema.h:444
struct lysp_node * child
Definition: tree_schema.h:994
struct lys_module * module
Definition: tree_schema.h:1443
LIBYANG_API_DECL struct lysp_node * lysp_node_child(const struct lysp_node *node)
Get the children linked list of the given (parsed) schema node. Decides the node&#39;s type and in case i...
struct lysc_ext_instance * exts
Definition: tree_schema.h:1298
uint16_t flags
Definition: tree_schema.h:322
LIBYANG_API_DECL struct lysp_tpdf * lysp_node_typedefs(const struct lysp_node *node)
Get the typedefs sized array of the given (parsed) schema node. Decides the node&#39;s type and in case i...
struct lysp_restr * musts
Definition: tree_schema.h:814
const char * dsc
Definition: tree_schema.h:270
struct lysc_must * musts
Definition: tree_schema.h:1651
LIBYANG_API_DECL LY_ERR lysc_tree_dfs_full(const struct lysc_node *root, lysc_dfs_clb dfs_clb, void *data)
DFS traversal of all the schema nodes in a (sub)tree including any actions and nested notifications...
struct lysp_qname * iffeatures
Definition: tree_schema.h:454
Generic YANG data node.
Definition: tree_schema.h:752
struct lysp_deviate * deviates
Definition: tree_schema.h:526
uint16_t flags
Definition: tree_schema.h:755
const char * org
Definition: tree_schema.h:1174
const char * expr
Definition: tree_schema.h:1280
const char * dsc
Definition: tree_schema.h:2140
uint16_t flags
Definition: tree_schema.h:420
struct lysp_restr * patterns
Definition: tree_schema.h:407
const char * ref
Definition: tree_schema.h:300
const char * emsg
Definition: tree_schema.h:1284
struct lysc_must * musts
Definition: tree_schema.h:1682
const char * eapptag
Definition: tree_schema.h:1297
struct lysp_restr * musts
Definition: tree_schema.h:1046
LIBYANG_API_DECL struct lys_module * lysc_owner_module(const struct lysc_node *node)
Get the owner module of the schema node. It is the module of the top-level node. Generally, in case of augments it is the target module, recursively, otherwise it is the module where the node is defined.
const char * name
Definition: tree_schema.h:349
const char * dsc
Definition: tree_schema.h:352
LIBYANG_API_DECL const char * lyxp_get_expr(const struct lyxp_expr *path)
Getter for original XPath expression from a parsed expression.
struct lysp_ext_instance * exts
Definition: tree_schema.h:432
uint32_t refcount
Definition: tree_schema.h:1288
struct lysc_type_bitenum_item * enums
Definition: tree_schema.h:1363
const char * nodeid
Definition: tree_schema.h:523
YANG include-stmt.
Definition: tree_schema.h:280
struct lysc_ext_instance * exts
Definition: tree_schema.h:1258
struct lysp_ext_instance * exts
Definition: tree_schema.h:381
struct lysp_node_action_inout input
Definition: tree_schema.h:1021
uint16_t flags
Definition: tree_schema.h:461
struct lysp_ext * extensions
Definition: tree_schema.h:1151
struct lysp_qname * iffeatures
Definition: tree_schema.h:392
LY_DATA_TYPE basetype
Definition: tree_schema.h:1314
struct lysc_node * data
Definition: tree_schema.h:1765
uint8_t mod
Definition: tree_schema.h:482
struct lysc_ident ** bases
Definition: tree_schema.h:1397
struct lyplg_type * plugin
Definition: tree_schema.h:1359
const char * units
Definition: tree_schema.h:428
LIBYANG_API_DECL char * lysc_path(const struct lysc_node *node, LYSC_PATH_TYPE pathtype, char *buffer, size_t buflen)
Generate path of the given node in the requested format.
struct lysc_node_notif * notifs
Definition: tree_schema.h:1767
struct lysp_node_augment * augments
Definition: tree_schema.h:966
struct lysc_ext_instance * exts
Definition: tree_schema.h:1322
struct lysc_module * compiled
Definition: tree_schema.h:2144
const char * units
Definition: tree_schema.h:817
const char * argname
Definition: tree_schema.h:298
uint16_t nodetype
Definition: tree_schema.h:754
LIBYANG_API_DECL struct lysc_when * lysc_has_when(const struct lysc_node *node)
Check whether the schema node data instance existence depends on any when conditions. This node and any direct parent choice and case schema nodes are also examined for when conditions.
struct lysc_node * child
Definition: tree_schema.h:1595
struct lysp_restr * musts
Definition: tree_schema.h:867
const char * contact
Definition: tree_schema.h:2139
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1130
struct lysp_node_grp * groupings
Definition: tree_schema.h:1131
LY_DATA_TYPE basetype
Definition: tree_schema.h:1305
struct lysp_node * parent
Definition: tree_schema.h:753
struct lysp_when * when
Definition: tree_schema.h:868
struct lysp_restr * musts
Definition: tree_schema.h:839
struct lys_module ** augmented_by
Definition: tree_schema.h:2155
struct lysp_node_notif * notifs
Definition: tree_schema.h:1159
LIBYANG_API_DECL struct lysp_node_action * lysp_node_actions(const struct lysp_node *node)
Get the actions/RPCs linked list of the given (parsed) schema node. Decides the node&#39;s type and in ca...
struct lys_module * mod
Definition: tree_schema.h:1763
struct lysp_refine * refines
Definition: tree_schema.h:965
const char * emsg
Definition: tree_schema.h:367
LIBYANG_API_DECL struct lysc_node * lysc_node_lref_target(const struct lysc_node *node)
Get the target node of a leafref node.
const char * ref
Definition: tree_schema.h:1283
struct lysp_feature ** features
Definition: tree_schema.h:331
Logger manipulation routines and error definitions.
const char * ref
Definition: tree_schema.h:1221
const char * dsc
Definition: tree_schema.h:1176
struct lysc_ext * compiled
Definition: tree_schema.h:304
struct lysc_must * musts
Definition: tree_schema.h:1566
struct lysp_qname * dflts
Definition: tree_schema.h:457
struct lysp_ext_instance * exts
Definition: tree_schema.h:460
const char * dsc
Definition: tree_schema.h:442
uint32_t min
Definition: tree_schema.h:458
const char * ref
Definition: tree_schema.h:525
const char * name
Definition: tree_schema.h:1311
const char * dsc
Definition: tree_schema.h:1294
struct lysp_when * when
Definition: tree_schema.h:815
struct lysp_node_augment * augments
Definition: tree_schema.h:1157
struct lysp_feature * features
Definition: tree_schema.h:1128
LIBYANG_API_DECL LY_ERR lysc_module_dfs_full(const struct lys_module *mod, lysc_dfs_clb dfs_clb, void *data)
DFS traversal of all the schema nodes in a module including RPCs and notifications.
const char * name
Definition: tree_schema.h:1231
struct lysc_type * type
Definition: tree_schema.h:1684
const char * presence
Definition: tree_schema.h:456
struct lysp_deviation * deviations
Definition: tree_schema.h:1160
struct lysp_type_enum * bits
Definition: tree_schema.h:409
const char * revision
Definition: tree_schema.h:2134
const char * emsg
Definition: tree_schema.h:1274
const char * key
Definition: tree_schema.h:869
uint16_t flags
Definition: tree_schema.h:394
uint8_t * expr
Definition: tree_schema.h:330
LY_ERR
libyang&#39;s error codes returned by the libyang functions.
Definition: log.h:240
uint8_t fraction_digits
Definition: tree_schema.h:418
struct lysc_when ** when
Definition: tree_schema.h:1753
struct lysc_type * realtype
Definition: tree_schema.h:1386
struct lysp_node_notif * notifs
Definition: tree_schema.h:1135
libyang context handler.
YANG typedef-stmt.
Definition: tree_schema.h:426
struct lysp_node_action * actions
Definition: tree_schema.h:873
struct lysc_ext_instance * exts
Definition: tree_schema.h:1368
const char * ref
Definition: tree_schema.h:1295
struct lysp_restr * musts
Definition: tree_schema.h:505
YANG when-stmt.
Definition: tree_schema.h:1216
const char * name
Definition: tree_schema.h:2133
struct lyplg_ext * plugin
Definition: tree_schema.h:1208
LIBYANG_API_DECL struct lysc_must * lysc_node_musts(const struct lysc_node *node)
Get the must statements list if present in the node.
struct lysc_prefix * prefixes
Definition: tree_schema.h:1385
struct lysp_node_action_inout output
Definition: tree_schema.h:1022
LIBYANG_API_DECL struct lysp_feature * lysp_feature_next(const struct lysp_feature *last, const struct lysp_module *pmod, uint32_t *idx)
Get the next feature in the module or submodules.
struct lysc_ext_instance * exts
Definition: tree_schema.h:1453
struct lysp_import * imports
Definition: tree_schema.h:1125
struct lysp_node_grp * groupings
Definition: tree_schema.h:1155
struct lysp_node * child
Definition: tree_schema.h:1075
struct lyxp_expr * path
Definition: tree_schema.h:410
const char * dsc
Definition: tree_schema.h:1220
struct lysp_type type
Definition: tree_schema.h:433
struct lysc_node * prev
Definition: tree_schema.h:1446
const char * prefix
Definition: tree_schema.h:1173
struct lysp_node_action * rpcs
Definition: tree_schema.h:1158
struct lysc_node_action * actions
Definition: tree_schema.h:1721
YANG extension parsed instance.
Definition: plugins_exts.h:403
struct lysp_node * data
Definition: tree_schema.h:1156