libyang  5.4.9
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 #include <stdint.h>
20 #include <stdio.h>
21 
22 #include "log.h"
23 #include "ly_config.h"
24 #include "tree.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 struct ly_ctx;
31 struct ly_path;
32 struct ly_set;
33 struct lys_module;
34 struct lysc_node;
35 struct lyxp_expr;
36 
150 /* *INDENT-OFF* */
151 
180 #define LYSC_TREE_DFS_BEGIN(START, ELEM) \
181  { ly_bool LYSC_TREE_DFS_continue = 0; struct lysc_node *LYSC_TREE_DFS_next; \
182  for ((ELEM) = (LYSC_TREE_DFS_next) = (struct lysc_node *)(START); \
183  (ELEM); \
184  (ELEM) = (LYSC_TREE_DFS_next), LYSC_TREE_DFS_continue = 0)
185 
199 #define LYSC_TREE_DFS_END(START, ELEM) \
200  /* select element for the next run - children first */ \
201  if (LYSC_TREE_DFS_continue) { \
202  (LYSC_TREE_DFS_next) = NULL; \
203  } else { \
204  (LYSC_TREE_DFS_next) = (struct lysc_node *)lysc_node_child(ELEM); \
205  } \
206  if (!(LYSC_TREE_DFS_next)) { \
207  /* no children, try siblings */ \
208  _LYSC_TREE_DFS_NEXT(START, ELEM, LYSC_TREE_DFS_next); \
209  } \
210  while (!(LYSC_TREE_DFS_next)) { \
211  /* parent is already processed, go to its sibling */ \
212  (ELEM) = (ELEM)->parent; \
213  _LYSC_TREE_DFS_NEXT(START, ELEM, LYSC_TREE_DFS_next); \
214  } }
215 
219 #define _LYSC_TREE_DFS_NEXT(START, ELEM, NEXT) \
220  if ((ELEM) == (struct lysc_node *)(START)) { \
221  /* we are done, no next element to process */ \
222  break; \
223  } \
224  (NEXT) = (ELEM)->next;
225 
226 /* *INDENT-ON* */
227 
228 #define LY_REV_SIZE 11
235 #define LYS_UNKNOWN 0x0000
236 #define LYS_CONTAINER 0x0001
237 #define LYS_CHOICE 0x0002
238 #define LYS_LEAF 0x0004
239 #define LYS_LEAFLIST 0x0008
240 #define LYS_LIST 0x0010
241 #define LYS_ANYXML 0x0020
242 #define LYS_ANYDATA 0x0060
243 #define LYS_CASE 0x0080
245 #define LYS_RPC 0x0100
246 #define LYS_ACTION 0x0200
247 #define LYS_NOTIF 0x0400
249 #define LYS_USES 0x0800
250 #define LYS_INPUT 0x1000
251 #define LYS_OUTPUT 0x2000
252 #define LYS_GROUPING 0x4000
253 #define LYS_AUGMENT 0x8000
254 
255 #define LYS_NODETYPE_MASK 0xffff
261 struct lysp_import {
262  struct lys_module *module;
264  const char *name;
265  const char *prefix;
266  const char *dsc;
267  const char *ref;
269  uint16_t flags;
270  char rev[LY_REV_SIZE];
271 };
272 
276 struct lysp_include {
279  const char *name;
280  const char *dsc;
281  const char *ref;
283  char rev[LY_REV_SIZE];
287 };
288 
292 struct lysp_ext {
293  const char *name;
294  const char *argname;
295  const char *dsc;
296  const char *ref;
298  uintptr_t plugin_ref;
299  uint16_t flags;
300 };
301 
305 struct lysp_feature {
306  const char *name;
311  const char *dsc;
312  const char *ref;
314  uint16_t flags;
316 };
317 
322  uint8_t *expr;
324 };
325 
329 struct lysp_qname {
330  const char *str;
331  const struct lysp_module *mod;
333  uint16_t flags;
335 };
336 
340 struct lysp_ident {
341  const char *name;
343  const char **bases;
344  const char *dsc;
345  const char *ref;
347  uint16_t flags;
348 };
349 
353 struct lysp_restr {
354 #define LYSP_RESTR_PATTERN_ACK 0x06
355 #define LYSP_RESTR_PATTERN_NACK 0x15
356  struct lysp_qname arg;
359  const char *emsg;
360  const char *eapptag;
361  const char *dsc;
362  const char *ref;
364 };
365 
371  const char *dsc;
372  const char *ref;
374 };
375 
380  const char *name;
381  const char *dsc;
382  const char *ref;
383  int64_t value;
386  uint16_t flags;
388 };
389 
395 struct lysp_type {
396  const char *name;
397  struct lysp_restr *range;
398  struct lysp_restr *length;
402  struct lyxp_expr *path;
403  const char **bases;
404  struct lysp_type *types;
407  const struct lysp_module *pmod;
408  struct lysc_type *compiled;
410  uint8_t fraction_digits;
412  uint16_t flags;
413 };
414 
418 struct lysp_tpdf {
419  const char *name;
420  const char *units;
421  struct lysp_qname dflt;
422  const char *dsc;
423  const char *ref;
425  struct lysp_type type;
426  uint16_t flags;
427 };
428 
432 struct lysp_when {
433  const char *cond;
434  const char *dsc;
435  const char *ref;
437 };
438 
442 struct lysp_refine {
443  const char *nodeid;
444  const char *dsc;
445  const char *ref;
447  struct lysp_restr *musts;
448  const char *presence;
449  struct lysp_qname *dflts;
450  uint32_t min;
451  uint32_t max;
453  uint16_t flags;
454 };
455 
464 #define LYS_DEV_NOT_SUPPORTED 1
465 #define LYS_DEV_ADD 2
466 #define LYS_DEV_DELETE 3
467 #define LYS_DEV_REPLACE 4
473 struct lysp_deviate {
474  uint8_t mod;
475  struct lysp_deviate *next;
477 };
478 
480  uint8_t mod;
481  struct lysp_deviate *next;
483  const char *units;
484  struct lysp_restr *musts;
485  struct lysp_qname *uniques;
486  struct lysp_qname *dflts;
487  uint16_t flags;
488  uint32_t min;
489  uint32_t max;
490 };
491 
493  uint8_t mod;
494  struct lysp_deviate *next;
496  const char *units;
497  struct lysp_restr *musts;
498  struct lysp_qname *uniques;
499  struct lysp_qname *dflts;
500 };
501 
503  uint8_t mod;
504  struct lysp_deviate *next;
506  struct lysp_type *type;
507  const char *units;
508  struct lysp_qname dflt;
509  uint16_t flags;
510  uint32_t min;
511  uint32_t max;
512 };
513 
515  const char *nodeid;
516  const char *dsc;
517  const char *ref;
520 };
521 
645 #define LYS_CONFIG_W 0x01
646 #define LYS_CONFIG_R 0x02
647 #define LYS_CONFIG_MASK 0x03
648 #define LYS_STATUS_CURR 0x04
649 #define LYS_STATUS_DEPRC 0x08
650 #define LYS_STATUS_OBSLT 0x10
651 #define LYS_STATUS_MASK 0x1C
652 #define LYS_MAND_TRUE 0x20
657 #define LYS_MAND_FALSE 0x40
660 #define LYS_MAND_MASK 0x60
661 #define LYS_PRESENCE 0x80
664 #define LYS_UNIQUE 0x80
665 #define LYS_KEY 0x0100
666 #define LYS_KEYLESS 0x0200
667 #define LYS_DISABLED 0x0100
668 #define LYS_FENABLED 0x20
669 #define LYS_ORDBY_SYSTEM 0x80
671 #define LYS_ORDBY_USER 0x40
674 #define LYS_ORDBY_MASK 0xC0
675 #define LYS_YINELEM_TRUE 0x80
676 #define LYS_YINELEM_FALSE 0x0100
677 #define LYS_YINELEM_MASK 0x0180
678 #define LYS_USED_GRP 0x0400
680 #define LYS_SET_VALUE 0x0200
681 #define LYS_SET_MIN 0x0200
682 #define LYS_SET_MAX 0x0400
684 #define LYS_SET_BASE 0x0001
685 #define LYS_SET_BIT 0x0002
686 #define LYS_SET_ENUM 0x0004
687 #define LYS_SET_FRDIGITS 0x0008
688 #define LYS_SET_LENGTH 0x0010
689 #define LYS_SET_PATH 0x0020
690 #define LYS_SET_PATTERN 0x0040
691 #define LYS_SET_RANGE 0x0080
692 #define LYS_SET_TYPE 0x0100
693 #define LYS_SET_REQINST 0x0200
694 #define LYS_SET_DFLT 0x0200
699 #define LYS_SET_UNITS 0x0400
700 #define LYS_SET_CONFIG 0x0800
702 #define LYS_SINGLEQUOTED 0x0100
704 #define LYS_DOUBLEQUOTED 0x0200
707 #define LYS_YIN_ATTR 0x0400
708 #define LYS_YIN_ARGUMENT 0x0800
710 #define LYS_INTERNAL 0x1000
712 #define LYS_IS_ENUM 0x0200
714 #define LYS_IS_INPUT 0x1000
716 #define LYS_IS_OUTPUT 0x2000
718 #define LYS_IS_NOTIF 0x4000
720 #define LYS_FLAGS_COMPILED_MASK 0xff
726 struct lysp_node {
727  struct lysp_node *parent;
728  uint16_t nodetype;
729  uint16_t flags;
730  struct lysp_node *next;
731  const char *name;
732  const char *dsc;
733  const char *ref;
734  struct lysp_qname *iffeatures;
737 };
742 struct lysp_node_container {
743  union {
744  struct lysp_node node;
746  struct {
747  struct lysp_node *parent;
748  uint16_t nodetype;
749  uint16_t flags;
750  struct lysp_node *next;
751  const char *name;
752  const char *dsc;
753  const char *ref;
754  struct lysp_qname *iffeatures;
755  struct lysp_ext_instance *exts;
756  };
757  };
759  /* container */
760  struct lysp_restr *musts;
761  struct lysp_when *when;
762  const char *presence;
763  struct lysp_tpdf *typedefs;
765  struct lysp_node *child;
766  struct lysp_node_action *actions;
767  struct lysp_node_notif *notifs;
768 };
769 
770 struct lysp_node_leaf {
771  union {
772  struct lysp_node node;
774  struct {
775  struct lysp_node *parent;
776  uint16_t nodetype;
777  uint16_t flags;
778  struct lysp_node *next;
779  const char *name;
780  const char *dsc;
781  const char *ref;
782  struct lysp_qname *iffeatures;
784  };
785  };
787  /* leaf */
788  struct lysp_restr *musts;
789  struct lysp_when *when;
790  struct lysp_type type;
791  const char *units;
792  struct lysp_qname dflt;
793 };
794 
795 struct lysp_node_leaflist {
796  union {
797  struct lysp_node node;
799  struct {
800  struct lysp_node *parent;
801  uint16_t nodetype;
802  uint16_t flags;
803  struct lysp_node *next;
804  const char *name;
805  const char *dsc;
806  const char *ref;
807  struct lysp_qname *iffeatures;
809  };
810  };
812  /* leaf-list */
813  struct lysp_restr *musts;
814  struct lysp_when *when;
815  struct lysp_type type;
816  const char *units;
817  struct lysp_qname *dflts;
819  uint32_t min;
820  uint32_t max;
821 };
822 
823 struct lysp_node_list {
824  union {
825  struct lysp_node node;
827  struct {
828  struct lysp_node *parent;
829  uint16_t nodetype;
830  uint16_t flags;
831  struct lysp_node *next;
832  const char *name;
833  const char *dsc;
834  const char *ref;
835  struct lysp_qname *iffeatures;
836  struct lysp_ext_instance *exts;
837  };
838  };
840  /* list */
841  struct lysp_restr *musts;
842  struct lysp_when *when;
843  const char *key;
844  struct lysp_tpdf *typedefs;
846  struct lysp_node *child;
847  struct lysp_node_action *actions;
848  struct lysp_node_notif *notifs;
849  struct lysp_qname *uniques;
850  uint32_t min;
851  uint32_t max;
852 };
853 
854 struct lysp_node_choice {
855  union {
856  struct lysp_node node;
858  struct {
859  struct lysp_node *parent;
860  uint16_t nodetype;
861  uint16_t flags;
862  struct lysp_node *next;
863  const char *name;
864  const char *dsc;
865  const char *ref;
866  struct lysp_qname *iffeatures;
868  };
869  };
871  /* choice */
872  struct lysp_node *child;
873  struct lysp_when *when;
874  struct lysp_qname dflt;
875 };
877 struct lysp_node_case {
878  union {
879  struct lysp_node node;
881  struct {
882  struct lysp_node *parent;
883  uint16_t nodetype;
884  uint16_t flags;
885  struct lysp_node *next;
886  const char *name;
887  const char *dsc;
888  const char *ref;
889  struct lysp_qname *iffeatures;
891  };
892  };
894  /* case */
895  struct lysp_node *child;
896  struct lysp_when *when;
897 };
898 
900  union {
901  struct lysp_node node;
903  struct {
904  struct lysp_node *parent;
905  uint16_t nodetype;
906  uint16_t flags;
907  struct lysp_node *next;
908  const char *name;
909  const char *dsc;
910  const char *ref;
911  struct lysp_qname *iffeatures;
912  struct lysp_ext_instance *exts;
913  };
914  };
916  /* anyxml/anydata */
917  struct lysp_restr *musts;
918  struct lysp_when *when;
919 };
920 
922  union {
923  struct lysp_node node;
925  struct {
926  struct lysp_node *parent;
927  uint16_t nodetype;
928  uint16_t flags;
929  struct lysp_node *next;
930  const char *name;
931  const char *dsc;
932  const char *ref;
933  struct lysp_qname *iffeatures;
934  struct lysp_ext_instance *exts;
935  };
936  };
938  /* uses */
941  struct lysp_when *when;
942 };
947 struct lysp_node_action_inout {
948  union {
949  struct lysp_node node;
951  struct {
952  struct lysp_node *parent;
953  uint16_t nodetype;
954  uint16_t flags;
955  struct lysp_node *next;
956  const char *name;
957  const char *dsc;
958  const char *ref;
959  struct lysp_qname *iffeatures;
960  struct lysp_ext_instance *exts;
961  };
962  };
964  /* inout */
965  struct lysp_restr *musts;
966  struct lysp_tpdf *typedefs;
967  struct lysp_node_grp *groupings;
968  struct lysp_node *child;
969 };
970 
974 struct lysp_node_action {
975  union {
976  struct lysp_node node;
978  struct {
979  struct lysp_node *parent;
980  uint16_t nodetype;
981  uint16_t flags;
982  struct lysp_node_action *next;
983  const char *name;
984  const char *dsc;
985  const char *ref;
986  struct lysp_qname *iffeatures;
987  struct lysp_ext_instance *exts;
988  };
989  };
991  /* action */
992  struct lysp_tpdf *typedefs;
997 };
998 
1002 struct lysp_node_notif {
1003  union {
1004  struct lysp_node node;
1006  struct {
1007  struct lysp_node *parent;
1008  uint16_t nodetype;
1009  uint16_t flags;
1010  struct lysp_node_notif *next;
1011  const char *name;
1012  const char *dsc;
1013  const char *ref;
1014  struct lysp_qname *iffeatures;
1015  struct lysp_ext_instance *exts;
1016  };
1017  };
1019  /* notif */
1020  struct lysp_restr *musts;
1022  struct lysp_node_grp *groupings;
1023  struct lysp_node *child;
1024 };
1025 
1029 struct lysp_node_grp {
1030  union {
1031  struct lysp_node node;
1033  struct {
1034  struct lysp_node *parent;
1035  uint16_t nodetype;
1036  uint16_t flags;
1037  struct lysp_node_grp *next;
1038  const char *name;
1039  const char *dsc;
1040  const char *ref;
1041  struct lysp_qname *iffeatures;
1042  struct lysp_ext_instance *exts;
1043  };
1044  };
1046  /* grp */
1049  struct lysp_node *child;
1050  struct lysp_node_action *actions;
1052 };
1053 
1057 struct lysp_node_augment {
1058  union {
1059  struct lysp_node node;
1061  struct {
1062  struct lysp_node *parent;
1063  uint16_t nodetype;
1064  uint16_t flags;
1065  struct lysp_node_augment *next;
1066  const char *nodeid;
1067  const char *dsc;
1068  const char *ref;
1069  struct lysp_qname *iffeatures;
1070  struct lysp_ext_instance *exts;
1071  };
1072  };
1074  struct lysp_node *child;
1075  struct lysp_when *when;
1077  struct lysp_node_notif *notifs;
1078 };
1083 typedef enum LYS_VERSION {
1084  LYS_VERSION_UNDEF = 0,
1085  LYS_VERSION_1_0 = 1,
1086  LYS_VERSION_1_1 = 2
1087 } LYS_VERSION;
1088 
1094 struct lysp_module {
1095  struct lys_module *mod;
1097  struct lysp_revision *revs;
1099  struct lysp_import *imports;
1100  struct lysp_include *includes;
1105  struct lysp_node_grp *groupings;
1106  struct lysp_node *data;
1107  struct lysp_node_augment *augments;
1108  struct lysp_node_action *rpcs;
1109  struct lysp_node_notif *notifs;
1110  struct lysp_deviation *deviations;
1111  struct lysp_ext_instance *exts;
1113  uint8_t version;
1114  uint8_t parsing : 1;
1115  uint8_t is_submod : 1;
1116 };
1119  struct lys_module *mod;
1130  struct lysp_node *data;
1134  struct lysp_deviation *deviations;
1135  struct lysp_ext_instance *exts;
1137  uint8_t version;
1138  uint8_t parsing : 1;
1139  uint8_t is_submod : 1;
1141  uint8_t latest_revision : 2;
1145  const char *name;
1146  const char *filepath;
1147  const char *prefix;
1148  const char *org;
1149  const char *contact;
1150  const char *dsc;
1151  const char *ref;
1152 };
1160 #define LYSP_MODULE_NAME(PMOD) (PMOD->is_submod ? ((struct lysp_submodule *)PMOD)->name : ((struct lysp_module *)PMOD)->mod->name)
1161 
1166 struct lysc_prefix {
1167  char *prefix;
1168  const struct lys_module *mod;
1169 };
1170 
1178 struct lysc_ext {
1179  const char *name;
1180  const char *argname;
1181  struct lysc_ext_instance *exts;
1182  uintptr_t plugin_ref;
1183  struct lys_module *module;
1184  uint16_t flags;
1185 };
1190 struct lysc_when {
1191  struct lyxp_expr *cond;
1192  struct lysc_node *context;
1193  struct lysc_prefix *prefixes;
1194  const char *dsc;
1195  const char *ref;
1197  uint32_t refcount;
1198  uint16_t flags;
1199 };
1204 struct lysc_ident {
1205  const char *name;
1206  const char *dsc;
1207  const char *ref;
1208  struct lys_module *module;
1209  struct lysc_ident **derived;
1212  uint16_t flags;
1213 };
1221 #define LYS_IFF_NOT 0x00
1222 #define LYS_IFF_AND 0x01
1223 #define LYS_IFF_OR 0x02
1224 #define LYS_IFF_F 0x03
1230 struct lysc_revision {
1231  char date[LY_REV_SIZE];
1232  struct lysc_ext_instance *exts;
1233 };
1234 
1235 struct lysc_range {
1236  struct lysc_range_part {
1237  union {
1238  int64_t min_64;
1239  uint64_t min_u64;
1240  };
1241  union {
1242  int64_t max_64;
1243  uint64_t max_u64;
1244  };
1245  } *parts;
1246  const char *dsc;
1247  const char *ref;
1248  const char *emsg;
1249  const char *eapptag;
1251 };
1252 
1254  const char *expr;
1255  const char *dsc;
1256  const char *ref;
1257  const char *emsg;
1258  const char *eapptag;
1260  uint32_t inverted : 1;
1261  uint32_t format : 1;
1262  uint32_t refcount : 30;
1263 };
1265 struct lysc_must {
1266  struct lyxp_expr *cond;
1268  const char *dsc;
1269  const char *ref;
1270  const char *emsg;
1271  const char *eapptag;
1273 };
1275 struct lysc_type {
1276  const char *name;
1278  uintptr_t plugin_ref;
1280  uint32_t refcount;
1282 };
1285  const char *name;
1287  uintptr_t plugin_ref;
1289  uint32_t refcount;
1291  struct lysc_range *range;
1292 };
1295  const char *name;
1297  uintptr_t plugin_ref;
1299  uint32_t refcount;
1301  uint8_t fraction_digits;
1302  struct lysc_range *range;
1303 };
1306  const char *name;
1308  uintptr_t plugin_ref;
1310  uint32_t refcount;
1312  struct lysc_range *length;
1314 };
1317  const char *name;
1318  const char *dsc;
1319  const char *ref;
1322  union {
1323  int32_t value;
1324  uint32_t position;
1325  };
1326  uint16_t flags;
1328 };
1329 
1331  const char *name;
1332  struct lysc_ext_instance *exts;
1333  uintptr_t plugin_ref;
1335  uint32_t refcount;
1338 };
1339 
1341  const char *name;
1342  struct lysc_ext_instance *exts;
1343  uintptr_t plugin_ref;
1345  uint32_t refcount;
1347  struct lysc_type_bitenum_item *bits;
1349 };
1352  const char *name;
1354  uintptr_t plugin_ref;
1356  uint32_t refcount;
1358  struct lyxp_expr *path;
1362 };
1364 struct lysc_type_identityref {
1365  const char *name;
1366  struct lysc_ext_instance *exts;
1367  uintptr_t plugin_ref;
1369  uint32_t refcount;
1371  struct lysc_ident **bases;
1373 };
1375 struct lysc_type_instanceid {
1376  const char *name;
1378  uintptr_t plugin_ref;
1380  uint32_t refcount;
1383 };
1386  const char *name;
1388  uintptr_t plugin_ref;
1390  uint32_t refcount;
1392  struct lysc_type **types;
1393 };
1396  const char *name;
1398  uintptr_t plugin_ref;
1400  uint32_t refcount;
1402  struct lysc_range *length;
1403 };
1408 #define LYS_NODE_HASH_COUNT 4
1409 
1413 struct lysc_node {
1414  uint16_t nodetype;
1415  uint16_t flags;
1417  struct lys_module *module;
1418  struct lysc_node *parent;
1419  struct lysc_node *next;
1420  struct lysc_node *prev;
1424  const char *name;
1425  const char *dsc;
1426  const char *ref;
1427  struct lysc_ext_instance *exts;
1428  void *priv;
1429 };
1430 
1432  union {
1433  struct lysc_node node;
1435  struct {
1436  uint16_t nodetype;
1437  uint16_t flags;
1438  uint8_t hash[LYS_NODE_HASH_COUNT];
1439  struct lys_module *module;
1440  struct lysc_node *parent;
1441  struct lysc_node *next;
1442  struct lysc_node *prev;
1443  const char *name;
1444  const char *dsc;
1445  const char *ref;
1447  void *priv;
1448  };
1449  };
1451  struct lysc_node *child;
1452  struct lysc_must *musts;
1453 };
1454 
1455 struct lysc_node_action {
1456  union {
1457  struct lysc_node node;
1459  struct {
1460  uint16_t nodetype;
1461  uint16_t flags;
1462  uint8_t hash[LYS_NODE_HASH_COUNT];
1463  struct lys_module *module;
1464  struct lysc_node *parent;
1465  struct lysc_node_action *next;
1466  struct lysc_node_action *prev;
1470  const char *name;
1471  const char *dsc;
1472  const char *ref;
1474  void *priv;
1475  };
1476  };
1478  struct lysc_when **when;
1481  struct lysc_node_action_inout input;
1484 };
1485 
1486 struct lysc_node_notif {
1487  union {
1488  struct lysc_node node;
1490  struct {
1491  uint16_t nodetype;
1492  uint16_t flags;
1493  uint8_t hash[LYS_NODE_HASH_COUNT];
1494  struct lys_module *module;
1495  struct lysc_node *parent;
1496  struct lysc_node_notif *next;
1497  struct lysc_node_notif *prev;
1501  const char *name;
1502  const char *dsc;
1503  const char *ref;
1505  void *priv;
1506  };
1507  };
1509  struct lysc_node *child;
1510  struct lysc_must *musts;
1511  struct lysc_when **when;
1514 };
1515 
1516 struct lysc_node_container {
1517  union {
1518  struct lysc_node node;
1520  struct {
1521  uint16_t nodetype;
1522  uint16_t flags;
1523  uint8_t hash[LYS_NODE_HASH_COUNT];
1524  struct lys_module *module;
1525  struct lysc_node *parent;
1526  struct lysc_node *next;
1527  struct lysc_node *prev;
1531  const char *name;
1532  const char *dsc;
1533  const char *ref;
1535  void *priv;
1536  };
1537  };
1539  struct lysc_node *child;
1540  struct lysc_must *musts;
1541  struct lysc_when **when;
1542  struct lysc_node_action *actions;
1543  struct lysc_node_notif *notifs;
1544 };
1545 
1546 struct lysc_node_case {
1547  union {
1548  struct lysc_node node;
1550  struct {
1551  uint16_t nodetype;
1552  uint16_t flags;
1553  uint8_t hash[LYS_NODE_HASH_COUNT];
1554  struct lys_module *module;
1555  struct lysc_node *parent;
1556  struct lysc_node *next;
1557  struct lysc_node *prev;
1561  const char *name;
1562  const char *dsc;
1563  const char *ref;
1565  void *priv;
1566  };
1567  };
1569  struct lysc_node *child;
1571  struct lysc_when **when;
1572 };
1573 
1574 struct lysc_node_choice {
1575  union {
1576  struct lysc_node node;
1578  struct {
1579  uint16_t nodetype;
1580  uint16_t flags;
1581  uint8_t hash[LYS_NODE_HASH_COUNT];
1582  struct lys_module *module;
1583  struct lysc_node *parent;
1584  struct lysc_node *next;
1585  struct lysc_node *prev;
1589  const char *name;
1590  const char *dsc;
1591  const char *ref;
1593  void *priv;
1594  };
1595  };
1597  struct lysc_node_case *cases;
1598  struct lysc_when **when;
1599  struct lysc_node_case *dflt;
1600 };
1601 
1602 struct lysc_value {
1603  const char *str;
1604  struct lysc_prefix *prefixes;
1605 };
1606 
1607 struct lysc_node_leaf {
1608  union {
1609  struct lysc_node node;
1611  struct {
1612  uint16_t nodetype;
1613  uint16_t flags;
1614  uint8_t hash[LYS_NODE_HASH_COUNT];
1615  struct lys_module *module;
1616  struct lysc_node *parent;
1617  struct lysc_node *next;
1618  struct lysc_node *prev;
1622  const char *name;
1623  const char *dsc;
1624  const char *ref;
1626  void *priv;
1627  };
1628  };
1630  struct lysc_must *musts;
1631  struct lysc_when **when;
1632  struct lysc_type *type;
1634  const char *units;
1635  struct lysc_value dflt;
1636 };
1637 
1638 struct lysc_node_leaflist {
1639  union {
1640  struct lysc_node node;
1642  struct {
1643  uint16_t nodetype;
1644  uint16_t flags;
1645  uint8_t hash[LYS_NODE_HASH_COUNT];
1646  struct lys_module *module;
1647  struct lysc_node *parent;
1648  struct lysc_node *next;
1649  struct lysc_node *prev;
1653  const char *name;
1654  const char *dsc;
1655  const char *ref;
1657  void *priv;
1658  };
1659  };
1661  struct lysc_must *musts;
1662  struct lysc_when **when;
1663  struct lysc_type *type;
1665  const char *units;
1666  struct lysc_value *dflts;
1669  uint32_t min;
1670  uint32_t max;
1672 };
1673 
1674 struct lysc_node_list {
1675  union {
1676  struct lysc_node node;
1678  struct {
1679  uint16_t nodetype;
1680  uint16_t flags;
1681  uint8_t hash[LYS_NODE_HASH_COUNT];
1682  struct lys_module *module;
1683  struct lysc_node *parent;
1684  struct lysc_node *next;
1685  struct lysc_node *prev;
1689  const char *name;
1690  const char *dsc;
1691  const char *ref;
1693  void *priv;
1694  };
1695  };
1697  struct lysc_node *child;
1698  struct lysc_must *musts;
1699  struct lysc_when **when;
1700  struct lysc_node_action *actions;
1701  struct lysc_node_notif *notifs;
1703  struct lysc_node_leaf ***uniques;
1704  uint32_t min;
1705  uint32_t max;
1706 };
1707 
1708 struct lysc_node_anydata {
1709  union {
1710  struct lysc_node node;
1712  struct {
1713  uint16_t nodetype;
1714  uint16_t flags;
1715  uint8_t hash[LYS_NODE_HASH_COUNT];
1716  struct lys_module *module;
1717  struct lysc_node *parent;
1718  struct lysc_node *next;
1719  struct lysc_node *prev;
1723  const char *name;
1724  const char *dsc;
1725  const char *ref;
1727  void *priv;
1728  };
1729  };
1731  struct lysc_must *musts;
1732  struct lysc_when **when;
1733 };
1734 
1738 struct lysc_submodule {
1739  const char *name;
1740  const char *revision;
1741  const char *filepath;
1742 };
1743 
1750 struct lysc_module {
1751  struct lys_module *mod;
1753  const char **features;
1755  struct lysc_node *data;
1759 };
1760 
1767 #define lysc_is_userordered(lysc_node) \
1768  ((!lysc_node || !(lysc_node->nodetype & (LYS_LEAFLIST | LYS_LIST)) || !(lysc_node->flags & LYS_ORDBY_USER)) ? 0 : 1)
1776 #define lysc_is_key(lysc_node) \
1777  ((!lysc_node || (lysc_node->nodetype != LYS_LEAF) || !(lysc_node->flags & LYS_KEY)) ? 0 : 1)
1778 
1785 #define lysc_is_np_cont(lysc_node) \
1786  ((!lysc_node || (lysc_node->nodetype != LYS_CONTAINER) || (lysc_node->flags & LYS_PRESENCE)) ? 0 : 1)
1787 
1794 #define lysc_is_dup_inst_list(lysc_node) \
1795  ((lysc_node && (((lysc_node->nodetype == LYS_LIST) && (lysc_node->flags & LYS_KEYLESS)) || \
1796  ((lysc_node->nodetype == LYS_LEAFLIST) && !(lysc_node->flags & LYS_CONFIG_W)))) ? 1 : 0)
1797 
1805 LIBYANG_API_DECL struct lyplg_type *lysc_get_type_plugin(uintptr_t plugin_ref);
1806 
1814 LIBYANG_API_DECL struct lyplg_ext *lysc_get_ext_plugin(uintptr_t plugin_ref);
1815 
1822 LIBYANG_API_DECL const struct lysc_node *lysc_data_node(const struct lysc_node *schema);
1823 
1827 #define lysc_data_parent(SCHEMA) lysc_data_node((SCHEMA) ? (SCHEMA)->parent : NULL)
1828 
1839 LIBYANG_API_DECL const struct lysc_when *lysc_has_when(const struct lysc_node *node);
1840 
1848 LIBYANG_API_DECL const struct lys_module *lysc_owner_module(const struct lysc_node *node);
1849 
1856 LIBYANG_API_DECL const struct lysp_node_grp *lysp_node_groupings(const struct lysp_node *node);
1857 
1864 LIBYANG_API_DECL const struct lysp_tpdf *lysp_node_typedefs(const struct lysp_node *node);
1865 
1872 LIBYANG_API_DECL const struct lysp_node_action *lysp_node_actions(const struct lysp_node *node);
1873 
1880 LIBYANG_API_DECL const struct lysp_node_notif *lysp_node_notifs(const struct lysp_node *node);
1881 
1888 LIBYANG_API_DECL const struct lysp_node *lysp_node_child(const struct lysp_node *node);
1889 
1896 LIBYANG_API_DECL const struct lysc_node_action *lysc_node_actions(const struct lysc_node *node);
1897 
1904 LIBYANG_API_DECL const struct lysc_node_notif *lysc_node_notifs(const struct lysc_node *node);
1905 
1916 LIBYANG_API_DECL const struct lysc_node *lysc_node_child(const struct lysc_node *node);
1917 
1925 LIBYANG_API_DECL struct lysc_must *lysc_node_musts(const struct lysc_node *node);
1926 
1934 LIBYANG_API_DECL struct lysc_when **lysc_node_when(const struct lysc_node *node);
1935 
1943 LIBYANG_API_DECL const struct lysc_node *lysc_node_lref_target(const struct lysc_node *node);
1944 
1954 LIBYANG_API_DECL LY_ERR lysc_node_lref_targets(const struct lysc_node *node, struct ly_set **set);
1955 
1967 LIBYANG_API_DECL LY_ERR lysc_node_lref_backlinks(const struct ly_ctx *ctx, const struct lysc_node *node,
1968  ly_bool match_ancestors, struct ly_set **set);
1969 
1979 typedef LY_ERR (*lysc_dfs_clb)(struct lysc_node *node, void *data, ly_bool *dfs_continue);
1980 
1997 LIBYANG_API_DECL LY_ERR lysc_tree_dfs_full(const struct lysc_node *root, lysc_dfs_clb dfs_clb, void *data);
1998 
2010 LIBYANG_API_DECL LY_ERR lysc_module_dfs_full(const struct lys_module *mod, lysc_dfs_clb dfs_clb, void *data);
2011 
2020 LIBYANG_API_DECL LY_ERR lysc_iffeature_value(const struct lysc_iffeature *iff);
2021 
2033 LIBYANG_API_DECL LY_ERR lys_identity_iffeature_value(const struct lysc_ident *ident);
2034 
2043 LIBYANG_API_DECL struct lysp_feature *lysp_feature_next(const struct lysp_feature *last, const struct lysp_module *pmod,
2044  uint32_t *idx);
2045 
2058 LIBYANG_API_DECL const struct lys_module *lys_find_module(const struct ly_ctx *ctx, const struct lysc_node *ctx_node,
2059  const char *prefix, uint32_t prefix_len, LY_VALUE_FORMAT format, const void *prefix_data);
2060 
2068 #define LYS_GETNEXT_WITHCHOICE 0x01
2069 #define LYS_GETNEXT_NOCHOICE 0x02
2070 #define LYS_GETNEXT_WITHCASE 0x04
2071 #define LYS_GETNEXT_INTONPCONT 0x08
2073 #define LYS_GETNEXT_OUTPUT 0x10
2098 LIBYANG_API_DECL const struct lysc_node *lys_getnext(const struct lysc_node *last, const struct lysc_node *parent,
2099  const struct lysc_module *module, uint32_t options);
2100 
2116 LIBYANG_API_DECL const struct lysc_node *lys_find_child(const struct ly_ctx *ctx, const struct lysc_node *parent,
2117  const struct lys_module *mod, const char *mod_name, uint32_t mod_len, const char *name, uint32_t name_len,
2118  uint32_t options);
2119 
2125 #define LYS_FIND_XP_SCHEMA 0x08
2126 #define LYS_FIND_XP_OUTPUT 0x10
2127 #define LYS_FIND_NO_MATCH_ERROR 0x40
2142 LIBYANG_API_DECL LY_ERR lys_find_xpath_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath,
2143  uint32_t options, struct ly_set **set);
2144 
2157 LIBYANG_API_DECL LY_ERR lys_find_expr_atoms(const struct lysc_node *ctx_node, const struct lys_module *cur_mod,
2158  const struct lyxp_expr *expr, const struct lysc_prefix *prefixes, uint32_t options, struct ly_set **set);
2159 
2171 LIBYANG_API_DECL LY_ERR lys_find_xpath(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath,
2172  uint32_t options, struct ly_set **set);
2173 
2182 LIBYANG_API_DECL LY_ERR lys_find_lypath_atoms(const struct ly_path *path, struct ly_set **set);
2183 
2194 LIBYANG_API_DECL LY_ERR lys_find_path_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path,
2195  ly_bool output, struct ly_set **set);
2196 
2206 LIBYANG_API_DECL const struct lysc_node *lys_find_path(const struct ly_ctx *ctx, const struct lysc_node *ctx_node,
2207  const char *path, ly_bool output);
2208 
2212 typedef enum {
2213  LYSC_PATH_LOG,
2214  LYSC_PATH_DATA,
2217 } LYSC_PATH_TYPE;
2218 
2230 LIBYANG_API_DECL char *lysc_path(const struct lysc_node *node, LYSC_PATH_TYPE pathtype, char *buffer, size_t buflen);
2231 
2235 struct lys_module {
2236  struct ly_ctx *ctx;
2237  const char *name;
2238  const char *revision;
2239  const char *ns;
2240  const char *prefix;
2241  const char *filepath;
2242  const char *org;
2243  const char *contact;
2244  const char *dsc;
2245  const char *ref;
2247  struct lysp_module *parsed;
2248  struct lysc_module *compiled;
2251  struct lysc_ext *extensions;
2253  struct lysc_ident *identities;
2268  uint8_t version : 2;
2269  uint8_t latest_revision : 4;
2271 };
2280 #define LYS_MOD_LATEST_REV 0x01
2281 #define LYS_MOD_LATEST_SEARCHDIRS 0x02
2282 #define LYS_MOD_IMPORTED_REV 0x04
2285 #define LYS_MOD_LATEST_IMPCLB 0x08
2300 LIBYANG_API_DECL LY_ERR lys_feature_value(const struct lys_module *module, const char *feature);
2317 LIBYANG_API_DECL LY_ERR lys_set_implemented(struct lys_module *mod, const char **features);
2318 
2325 LIBYANG_API_DECL const char *lys_nodetype2str(uint16_t nodetype);
2326 
2333 LIBYANG_API_DECL const char *lyxp_get_expr(const struct lyxp_expr *path);
2334 
2337 #ifdef __cplusplus
2338 }
2339 #endif
2340 
2341 #endif /* LY_TREE_SCHEMA_H_ */
struct lys_module * mod
Definition: tree_schema.h:1113
struct lysp_node_action * actions
Definition: tree_schema.h:1094
const char * name
Definition: tree_schema.h:293
const char * units
Definition: tree_schema.h:507
Compiled prefix data pair mapping of prefixes to modules. In case the format is LY_VALUE_SCHEMA_RESOL...
Definition: tree_schema.h:1184
uint8_t version
Definition: tree_schema.h:1131
struct lysp_node_grp * groupings
Definition: tree_schema.h:985
struct lysc_ext * extensions
Definition: tree_schema.h:2272
struct lysp_type type
Definition: tree_schema.h:808
struct lysc_ext_instance * exts
Definition: tree_schema.h:1350
struct lysp_feature ** depfeatures
Definition: tree_schema.h:309
Compiled YANG data node.
Definition: tree_schema.h:1431
const char * argname
Definition: tree_schema.h:1198
struct lysp_when * when
Definition: tree_schema.h:891
LY_DATA_TYPE basetype
Definition: tree_schema.h:1386
struct lysp_tpdf * typedefs
Definition: tree_schema.h:862
struct lysp_qname * dflts
Definition: tree_schema.h:499
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1010
struct lysp_node * data
Definition: tree_schema.h:1124
Qualified name (optional prefix followed by an identifier).
Definition: tree_schema.h:329
struct lysc_ident ** derived
Definition: tree_schema.h:1227
struct lysc_node_case * dflt
Definition: tree_schema.h:1617
struct lysp_when * when
Definition: tree_schema.h:1093
LY_DATA_TYPE basetype
Definition: tree_schema.h:1417
struct lysp_node * next
Definition: tree_schema.h:748
struct lysp_restr * musts
Definition: tree_schema.h:447
struct lysc_type_bitenum_item * bits
Definition: tree_schema.h:1365
uint16_t flags
Definition: tree_schema.h:426
struct ly_ctx * ctx
Definition: tree_schema.h:2257
const char * units
Definition: tree_schema.h:1652
struct lysp_ext_instance * exts
Definition: tree_schema.h:476
ly_bool to_compile
Definition: tree_schema.h:2287
const char * dsc
Definition: tree_schema.h:750
struct lysc_must * musts
Definition: tree_schema.h:1470
const char * name
Definition: tree_schema.h:1414
uintptr_t plugin_ref
Definition: tree_schema.h:1326
struct lysp_module * parsed
Definition: tree_schema.h:2268
struct lysc_node * context
Definition: tree_schema.h:1210
Compiled YANG if-feature-stmt.
Definition: tree_schema.h:321
const char * name
Definition: tree_schema.h:1197
uint16_t flags
Definition: tree_schema.h:1230
const char * name
Definition: tree_schema.h:1313
struct lysp_node_action * actions
Definition: tree_schema.h:1068
struct lysc_when ** when
Definition: tree_schema.h:1496
struct lysc_ext_instance * exts
Definition: tree_schema.h:1304
LY_DATA_TYPE basetype
Definition: tree_schema.h:1407
struct lysp_tpdf * typedefs
Definition: tree_schema.h:984
Hold type-specific functions for various operations with the data values.
const char * dsc
Definition: tree_schema.h:361
YANG import-stmt.
Definition: tree_schema.h:261
Extension plugin implementing various aspects of a YANG extension.
Definition: plugins_exts.h:970
Covers restrictions: range, length, pattern, must.
Definition: tree_schema.h:353
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1065
const char * revision
Definition: tree_schema.h:1758
const char * name
Definition: tree_schema.h:1404
struct lysp_import * imports
Definition: tree_schema.h:1141
struct lysc_ext_instance * exts
Definition: tree_schema.h:1415
struct lysp_type * types
Definition: tree_schema.h:404
struct lysc_when ** when
Definition: tree_schema.h:1717
struct lysp_node_augment * augments
Definition: tree_schema.h:1125
struct lysc_prefix * prefixes
Definition: tree_schema.h:1285
YANG extension compiled instance.
Definition: plugins_exts.h:430
char rev[11]
Definition: tree_schema.h:283
struct lysp_when * when
Definition: tree_schema.h:832
struct lysc_when ** when
Definition: tree_schema.h:1616
struct lysc_range::lysc_range_part * parts
LIBYANG_API_DECL LY_ERR lysc_node_lref_backlinks(const struct ly_ctx *ctx, const struct lysc_node *node, ly_bool match_ancestors, struct ly_set **set)
Get all the leafref (or union with leafrefs) nodes that target a specific node.
const char * dsc
Definition: tree_schema.h:1224
struct lysc_ext_instance * exts
Definition: tree_schema.h:1395
LIBYANG_API_DECL struct lys_module * lys_find_module(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *prefix, uint32_t prefix_len, LY_VALUE_FORMAT format, const void *prefix_data)
Find a module matching a prefix (or a default one).
uint32_t max
Definition: tree_schema.h:451
const char * prefix
Definition: tree_schema.h:2261
LY_ERR
libyang&#39;s error codes returned by the libyang functions.
Definition: log.h:255
struct lysp_include * includes
Definition: tree_schema.h:1118
uintptr_t plugin_ref
Definition: tree_schema.h:1372
LIBYANG_API_DECL struct lyplg_type * lysc_get_type_plugin(uintptr_t plugin_ref)
Get a type plugin.
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:29
Compiled YANG extension-stmt.
Definition: tree_schema.h:1196
const char * name
Definition: tree_schema.h:1349
uint16_t flags
Definition: tree_schema.h:347
struct lysc_node * child
Definition: tree_schema.h:1715
struct lysp_ext_instance * exts
Definition: plugins_exts.h:415
struct lysc_ext_instance * exts
Definition: tree_schema.h:1371
uint32_t refcount
Definition: tree_schema.h:1418
uint8_t latest_revision
Definition: tree_schema.h:2290
struct lysc_ext_instance * exts
Definition: tree_schema.h:1229
struct lysp_restr * musts
Definition: tree_schema.h:935
YANG refine-stmt.
Definition: tree_schema.h:442
struct lysp_qname dflt
Definition: tree_schema.h:892
struct lys_module * module
Definition: tree_schema.h:1226
uint16_t flags
Definition: tree_schema.h:1202
struct lysp_when * when
Definition: tree_schema.h:936
const char * name
Definition: tree_schema.h:1163
uint8_t latest_revision
Definition: tree_schema.h:1159
struct lysp_node * child
Definition: tree_schema.h:1041
struct lysp_qname * iffeatures
Definition: tree_schema.h:342
struct lysp_when * when
Definition: tree_schema.h:914
const char * ref
Definition: tree_schema.h:372
struct lysc_node * child
Definition: tree_schema.h:1527
struct lysc_ident * identities
Definition: tree_schema.h:2274
const char * ref
Definition: tree_schema.h:2266
struct lysp_ext * extensions
Definition: tree_schema.h:1119
const char * ns
Definition: tree_schema.h:2260
ly_bool implemented
Definition: tree_schema.h:2286
uint32_t refcount
Definition: tree_schema.h:1353
const char * name
Definition: tree_schema.h:1442
const char * dsc
Definition: tree_schema.h:295
LY_DATA_TYPE
YANG built-in types.
Definition: tree.h:202
const char * org
Definition: tree_schema.h:2263
struct lysc_must * musts
Definition: tree_schema.h:1528
struct lysp_ext_instance * exts
Definition: tree_schema.h:405
YANG feature-stmt.
Definition: tree_schema.h:305
const char * ref
Definition: tree_schema.h:1169
struct lys_module * mod
Definition: tree_schema.h:1186
YANG identity-stmt.
Definition: tree_schema.h:1222
struct lysc_node * parent
Definition: tree_schema.h:1436
const char * contact
Definition: tree_schema.h:1167
struct lysc_value dflt
Definition: tree_schema.h:1653
LIBYANG_API_DECL struct lyplg_ext * lysc_get_ext_plugin(uintptr_t plugin_ref)
Get an extension plugin.
struct lysp_qname * dflts
Definition: tree_schema.h:835
libyang generic macros and functions to work with YANG schema or data trees.
struct lysc_when ** when
Definition: tree_schema.h:1649
struct lysp_node_action * rpcs
Definition: tree_schema.h:1126
struct lysp_ext_instance * exts
Definition: tree_schema.h:268
struct lysp_qname * dflts
Definition: tree_schema.h:486
struct lysc_ext_instance * exts
Definition: tree_schema.h:1199
LY_DATA_TYPE basetype
Definition: tree_schema.h:1397
struct lysc_ext_instance * exts
Definition: plugins_exts.h:434
const char * dsc
Definition: tree_schema.h:311
const char * dsc
Definition: tree_schema.h:381
uintptr_t plugin_ref
Definition: tree_schema.h:1296
const char * cond
Definition: tree_schema.h:433
uint32_t refcount
Definition: tree_schema.h:1328
const char * filepath
Definition: tree_schema.h:1164
const char * name
Definition: tree_schema.h:264
YANG identity-stmt.
Definition: tree_schema.h:340
const char * ref
Definition: tree_schema.h:1225
struct lys_module * module
Definition: tree_schema.h:1201
struct lysc_ext_instance * exts
Definition: tree_schema.h:1277
LY_DATA_TYPE basetype
Definition: tree_schema.h:1373
struct lysc_iffeature * iffeatures_c
Definition: tree_schema.h:308
uint32_t refcount
Definition: tree_schema.h:1363
const char * ref
Definition: tree_schema.h:345
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:496
LIBYANG_API_DECL struct lysc_node * lys_find_child(const struct ly_ctx *ctx, const struct lysc_node *parent, const struct lys_module *mod, const char *mod_name, uint32_t mod_len, const char *name, uint32_t name_len, uint32_t options)
Get a child node according to the specified criteria.
struct lysp_node_grp * groupings
Definition: tree_schema.h:1040
uint8_t version
Definition: tree_schema.h:2289
const char * dsc
Definition: tree_schema.h:444
const char * name
Definition: tree_schema.h:396
const char * ref
Definition: tree_schema.h:435
LY_DATA_TYPE basetype
Definition: tree_schema.h:1362
const char * name
Definition: tree_schema.h:749
const char * ref
Definition: tree_schema.h:312
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1146
struct lysp_ident * identities
Definition: tree_schema.h:1145
struct lysp_node * child
Definition: tree_schema.h:864
struct lysp_node * child
Definition: tree_schema.h:890
Compiled YANG submodule with only some basic metadata required for generating ietf-yang-library data...
Definition: tree_schema.h:1756
const char * dsc
Definition: tree_schema.h:1273
char * prefix
Definition: tree_schema.h:1185
uint8_t is_submod
Definition: tree_schema.h:1133
struct lysp_node_action * actions
Definition: tree_schema.h:784
uint32_t min
Definition: tree_schema.h:868
struct lysc_ext_instance * exts
Definition: tree_schema.h:1384
struct lysc_ext_instance * exts
Definition: tree_schema.h:1338
const char * ref
Definition: tree_schema.h:751
LIBYANG_API_DECL LY_ERR lysc_node_lref_targets(const struct lysc_node *node, struct ly_set **set)
Get the target node(s) of a leafref node or union node with leafrefs.
LY_DATA_TYPE basetype
Definition: tree_schema.h:1327
uint16_t nodetype
Definition: tree_schema.h:1432
Extension structure of the lysp_node for YANG container.
Definition: tree_schema.h:760
uint16_t flags
Definition: tree_schema.h:1216
const char * name
Definition: tree_schema.h:1370
const char * ref
Definition: tree_schema.h:1265
struct lys_module * module
Definition: tree_schema.h:262
#define LY_REV_SIZE
Definition: tree_schema.h:228
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:398
uint32_t refcount
Definition: tree_schema.h:1408
const char * ref
Definition: tree_schema.h:445
struct lysp_ext_instance * exts
Definition: tree_schema.h:1129
struct lysc_node_case * cases
Definition: tree_schema.h:1615
Enumeration/Bit value definition.
Definition: tree_schema.h:379
struct lysc_type * compiled
Definition: tree_schema.h:408
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:1768
const char * name
Definition: tree_schema.h:1359
uint32_t inverted
Definition: tree_schema.h:1278
struct lysc_node * child
Definition: tree_schema.h:1557
struct lysp_qname dflt
Definition: tree_schema.h:508
struct lysp_qname dflt
Definition: tree_schema.h:421
struct lysp_restr * musts
Definition: tree_schema.h:983
struct lysp_ext_instance * exts
Definition: tree_schema.h:282
struct lysp_ext_instance * exts
Definition: tree_schema.h:1153
struct lysp_qname * iffeatures
Definition: tree_schema.h:307
YANG grouping-stmt.
Definition: tree_schema.h:1047
struct lysp_deviate * next
Definition: tree_schema.h:504
const char * eapptag
Definition: tree_schema.h:360
struct lys_module * mod
Definition: tree_schema.h:1137
struct lysp_ext_instance * exts
Definition: tree_schema.h:519
struct lysp_deviate * next
Definition: tree_schema.h:475
struct lysc_range * range
Definition: tree_schema.h:1320
struct lysp_ext_instance * exts
Definition: tree_schema.h:482
ly_bool injected
Definition: tree_schema.h:284
void * priv
Definition: tree_schema.h:1446
struct lysc_node_action * rpcs
Definition: tree_schema.h:1774
uint32_t refcount
Definition: tree_schema.h:1317
const char * ref
Definition: tree_schema.h:281
struct lysp_type_enum * enums
Definition: tree_schema.h:400
const char * name
Definition: tree_schema.h:306
const char * nodeid
Definition: tree_schema.h:443
struct lysc_node_leaf *** uniques
Definition: tree_schema.h:1721
struct lysc_type ** types
Definition: tree_schema.h:1410
struct lysp_ext_instance * exts
Definition: tree_schema.h:505
uint8_t hash[4]
Definition: tree_schema.h:1434
struct lysp_qname arg
Definition: tree_schema.h:356
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:1997
const char * units
Definition: tree_schema.h:834
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:1420
struct lysp_submodule * submodule
Definition: tree_schema.h:277
YANG type-stmt.
Definition: tree_schema.h:395
uint8_t fraction_digits
Definition: tree_schema.h:1319
uintptr_t plugin_ref
Definition: tree_schema.h:1361
const char * ref
Definition: tree_schema.h:362
LY_DATA_TYPE basetype
Definition: tree_schema.h:1352
struct lysc_pattern ** patterns
Definition: tree_schema.h:1331
LIBYANG_API_DECL const char * lys_nodetype2str(uint16_t nodetype)
Stringify schema nodetype.
struct lysp_restr * musts
Definition: tree_schema.h:484
struct lysc_range * length
Definition: tree_schema.h:1330
const char * prefix
Definition: tree_schema.h:265
struct lysc_must * musts
Definition: tree_schema.h:1749
const char * dsc
Definition: tree_schema.h:516
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:279
struct lysc_node_notif * notifs
Definition: tree_schema.h:1719
struct lysc_node * next
Definition: tree_schema.h:1437
struct lysp_qname * uniques
Definition: tree_schema.h:498
YANG revision-stmt.
Definition: tree_schema.h:369
struct lysp_qname dflt
Definition: tree_schema.h:810
struct lyxp_expr * path
Definition: tree_schema.h:1376
struct lysp_ext_instance * exts
Definition: tree_schema.h:297
struct lysp_node * child
Definition: tree_schema.h:783
const char * presence
Definition: tree_schema.h:780
struct lysp_deviation * deviations
Definition: tree_schema.h:1128
struct lysp_type type
Definition: tree_schema.h:833
Generic deviate structure to get type and cast to lysp_deviate_* structure.
Definition: tree_schema.h:473
const char * ref
Definition: tree_schema.h:423
const char * dsc
Definition: tree_schema.h:371
uintptr_t plugin_ref
Definition: tree_schema.h:1315
struct lysc_node_action_inout input
Definition: tree_schema.h:1499
struct lysp_type * type
Definition: tree_schema.h:506
char date[11]
Definition: tree_schema.h:370
const char * name
Definition: tree_schema.h:380
struct lysp_include * includes
Definition: tree_schema.h:1142
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:1405
struct lysp_node_grp * groupings
Definition: tree_schema.h:782
YANG notification-stmt.
Definition: tree_schema.h:1020
const char * dsc
Definition: tree_schema.h:1264
struct lysp_node_notif * notifs
Definition: tree_schema.h:785
struct lysp_when * when
Definition: tree_schema.h:779
const char * dsc
Definition: tree_schema.h:1443
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:1529
struct lysp_revision * revs
Definition: tree_schema.h:1139
YANG extension-stmt.
Definition: tree_schema.h:292
uint16_t flags
Definition: tree_schema.h:269
struct lysp_node_notif * notifs
Definition: tree_schema.h:866
struct lysp_restr * musts
Definition: tree_schema.h:778
struct lysc_node * child
Definition: tree_schema.h:1469
uint16_t flags
Definition: tree_schema.h:333
uint32_t refcount
Definition: tree_schema.h:1215
struct lysp_ext_instance * exts
Definition: tree_schema.h:313
uint32_t max
Definition: tree_schema.h:869
const char ** bases
Definition: tree_schema.h:343
struct lyxp_expr * cond
Definition: tree_schema.h:1284
const char * units
Definition: tree_schema.h:1683
const char * eapptag
Definition: tree_schema.h:1267
struct lysp_ext_instance * exts
Definition: tree_schema.h:495
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:781
struct lysp_node_grp * groupings
Definition: tree_schema.h:863
YANG uses-augment-stmt and augment-stmt (compatible with struct lysp_node )
Definition: tree_schema.h:1075
struct lysc_must * musts
Definition: tree_schema.h:1716
struct lysc_ext_instance * exts
Definition: tree_schema.h:1776
uintptr_t plugin_ref
Definition: tree_schema.h:1406
const char * dsc
Definition: tree_schema.h:280
struct lysp_module * mod
Definition: tree_schema.h:331
struct lysp_ident * identities
Definition: tree_schema.h:1121
struct lysp_node_notif * notifs
Definition: tree_schema.h:1069
struct lysp_module * pmod
Definition: tree_schema.h:407
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:267
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:1500
struct lysp_ext_instance * exts
Definition: tree_schema.h:363
struct lysp_qname * uniques
Definition: tree_schema.h:485
const char * name
Definition: tree_schema.h:1324
uint8_t is_submod
Definition: tree_schema.h:1157
struct lysc_node_action * actions
Definition: tree_schema.h:1560
Printable YANG schema tree structure representing YANG module.
Definition: tree_schema.h:1112
struct lysc_prefix * prefixes
Definition: tree_schema.h:1211
struct lysp_when * when
Definition: tree_schema.h:959
YANG rpc-stmt and action-stmt.
Definition: tree_schema.h:992
const char ** bases
Definition: tree_schema.h:403
Available YANG schema tree structures representing YANG module.
Definition: tree_schema.h:2256
const char * name
Definition: tree_schema.h:1294
struct lysp_feature * features
Definition: tree_schema.h:1144
const char * name
Definition: tree_schema.h:419
const char * units
Definition: tree_schema.h:483
struct lyxp_expr * cond
Definition: tree_schema.h:1209
LIBYANG_API_DECL LY_ERR lys_set_implemented(struct lys_module *mod, const char **features)
Make the specific module implemented.
struct lysc_range * range
Definition: tree_schema.h:1309
struct lysc_node_notif * notifs
Definition: tree_schema.h:1561
struct lysc_ext_instance * exts
Definition: tree_schema.h:1325
const char * eapptag
Definition: tree_schema.h:1276
const char * emsg
Definition: tree_schema.h:1288
struct lysp_qname * uniques
Definition: tree_schema.h:867
struct lysp_ext_instance * exts
Definition: tree_schema.h:385
const char * ref
Definition: tree_schema.h:1444
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:1426
struct lysc_type * type
Definition: tree_schema.h:1650
uint16_t flags
Definition: tree_schema.h:299
struct lysp_node * child
Definition: tree_schema.h:1092
struct lys_module ** deviated_by
Definition: tree_schema.h:2284
struct lysp_node_grp * groupings
Definition: tree_schema.h:1066
const char * filepath
Definition: tree_schema.h:2262
const char * str
Definition: tree_schema.h:330
struct lysp_ext_instance * exts
Definition: tree_schema.h:346
struct lysc_ext_instance * exts
Definition: tree_schema.h:1214
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:411
const char * ref
Definition: tree_schema.h:382
struct lysp_restr * range
Definition: tree_schema.h:397
YANG input-stmt and output-stmt.
Definition: tree_schema.h:965
const char * filepath
Definition: tree_schema.h:1759
struct lysc_when ** when
Definition: tree_schema.h:1559
struct lysp_node * child
Definition: tree_schema.h:913
YANG when-stmt.
Definition: tree_schema.h:432
LYSC_PATH_TYPE
Types of the different schema paths.
Definition: tree_schema.h:2233
struct lysc_when ** when
Definition: tree_schema.h:1680
struct lysc_when ** when
Definition: tree_schema.h:1589
struct lysp_node_grp * groupings
Definition: tree_schema.h:1011
struct lysc_prefix * prefixes
Definition: tree_schema.h:1622
uint8_t parsing
Definition: tree_schema.h:1132
struct lysp_deviate * next
Definition: tree_schema.h:481
struct lysp_node_notif * notifs
Definition: tree_schema.h:1095
struct lysp_revision * revs
Definition: tree_schema.h:1115
uint32_t refcount
Definition: tree_schema.h:1307
uint8_t require_instance
Definition: tree_schema.h:1379
LY_DATA_TYPE basetype
Definition: tree_schema.h:1316
struct lysp_deviate * next
Definition: tree_schema.h:494
LYS_VERSION
supported YANG schema version values
Definition: tree_schema.h:1101
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1039
uint16_t flags
Definition: tree_schema.h:1433
const char * dsc
Definition: tree_schema.h:422
struct lysp_ext_instance * exts
Definition: tree_schema.h:436
struct lysp_node * child
Definition: tree_schema.h:986
struct lys_module * module
Definition: tree_schema.h:1435
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:1290
uint16_t flags
Definition: tree_schema.h:314
uintptr_t plugin_ref
Definition: tree_schema.h:298
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:806
const char * dsc
Definition: tree_schema.h:266
struct lysc_must * musts
Definition: tree_schema.h:1648
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:446
Generic YANG data node.
Definition: tree_schema.h:744
struct lysp_deviate * deviates
Definition: tree_schema.h:518
uint16_t flags
Definition: tree_schema.h:747
const char * org
Definition: tree_schema.h:1166
const char * expr
Definition: tree_schema.h:1272
const char * dsc
Definition: tree_schema.h:2265
uint16_t flags
Definition: tree_schema.h:412
struct lysp_restr * patterns
Definition: tree_schema.h:399
uintptr_t plugin_ref
Definition: tree_schema.h:1305
const char * ref
Definition: tree_schema.h:296
const char * emsg
Definition: tree_schema.h:1275
struct lysc_must * musts
Definition: tree_schema.h:1679
const char * eapptag
Definition: tree_schema.h:1289
LY_VALUE_FORMAT
All kinds of supported value formats and prefix mappings to modules.
Definition: tree.h:234
struct lysp_restr * musts
Definition: tree_schema.h:1038
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:341
const char * dsc
Definition: tree_schema.h:344
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:424
uint32_t refcount
Definition: tree_schema.h:1280
struct lysc_type_bitenum_item * enums
Definition: tree_schema.h:1355
const char * nodeid
Definition: tree_schema.h:515
uintptr_t plugin_ref
Definition: tree_schema.h:1351
YANG include-stmt.
Definition: tree_schema.h:276
struct lysc_ext_instance * exts
Definition: tree_schema.h:1250
struct lysp_ext_instance * exts
Definition: tree_schema.h:373
struct lysp_node_action_inout input
Definition: tree_schema.h:1013
uint16_t flags
Definition: tree_schema.h:453
struct lysp_ext * extensions
Definition: tree_schema.h:1143
uint32_t format
Definition: tree_schema.h:1279
struct lysp_qname * iffeatures
Definition: tree_schema.h:384
uintptr_t plugin_ref
Definition: tree_schema.h:1200
LY_DATA_TYPE basetype
Definition: tree_schema.h:1306
struct lysc_node * data
Definition: tree_schema.h:1773
uint8_t mod
Definition: tree_schema.h:474
struct lysc_ident ** bases
Definition: tree_schema.h:1389
const char * units
Definition: tree_schema.h:420
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:1775
struct lysp_node_augment * augments
Definition: tree_schema.h:958
struct lysc_ext_instance * exts
Definition: tree_schema.h:1314
struct lysc_module * compiled
Definition: tree_schema.h:2269
const char * units
Definition: tree_schema.h:809
const char * argname
Definition: tree_schema.h:294
uint16_t nodetype
Definition: tree_schema.h:746
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:1587
struct lysp_restr * musts
Definition: tree_schema.h:859
const char * contact
Definition: tree_schema.h:2264
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1122
struct lysp_node_grp * groupings
Definition: tree_schema.h:1123
LY_DATA_TYPE basetype
Definition: tree_schema.h:1297
struct lysp_node * parent
Definition: tree_schema.h:745
struct lysp_when * when
Definition: tree_schema.h:860
struct lysp_restr * musts
Definition: tree_schema.h:831
struct lys_module ** augmented_by
Definition: tree_schema.h:2283
struct lysp_node_notif * notifs
Definition: tree_schema.h:1151
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:1769
struct lysc_value * dflts
Definition: tree_schema.h:1684
struct lysp_refine * refines
Definition: tree_schema.h:957
const char * emsg
Definition: tree_schema.h:359
LIBYANG_API_DECL struct lysc_node * lysc_node_lref_target(const struct lysc_node *node)
Get the target node of a leafref node. Function lysc_node_lref_targets() should be used instead to ge...
const char * ref
Definition: tree_schema.h:1274
struct lysp_feature ** features
Definition: tree_schema.h:323
Logger manipulation routines and error definitions.
const char * ref
Definition: tree_schema.h:1213
const char * str
Definition: tree_schema.h:1621
const char * dsc
Definition: tree_schema.h:1168
struct lysc_submodule * submodules
Definition: tree_schema.h:2282
struct lysc_must * musts
Definition: tree_schema.h:1558
struct lysp_qname * dflts
Definition: tree_schema.h:449
struct lysp_ext_instance * exts
Definition: tree_schema.h:452
const char * dsc
Definition: tree_schema.h:434
const char ** features
Definition: tree_schema.h:1771
uint32_t min
Definition: tree_schema.h:450
const char * ref
Definition: tree_schema.h:517
const char * name
Definition: tree_schema.h:1303
const char * dsc
Definition: tree_schema.h:1286
struct lysp_when * when
Definition: tree_schema.h:807
struct lysp_node_augment * augments
Definition: tree_schema.h:1149
struct lysp_feature * features
Definition: tree_schema.h:1120
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.
uintptr_t plugin_ref
Definition: tree_schema.h:1416
const char * name
Definition: tree_schema.h:1223
struct lysc_type * type
Definition: tree_schema.h:1681
const char * presence
Definition: tree_schema.h:448
struct lysp_deviation * deviations
Definition: tree_schema.h:1152
struct lysp_type_enum * bits
Definition: tree_schema.h:401
const char * revision
Definition: tree_schema.h:2259
const char * emsg
Definition: tree_schema.h:1266
const char * key
Definition: tree_schema.h:861
uint16_t flags
Definition: tree_schema.h:386
uint8_t * expr
Definition: tree_schema.h:322
uint8_t fraction_digits
Definition: tree_schema.h:410
struct lysc_when ** when
Definition: tree_schema.h:1750
struct lysc_type * realtype
Definition: tree_schema.h:1378
struct lysp_node_notif * notifs
Definition: tree_schema.h:1127
libyang context handler.
YANG typedef-stmt.
Definition: tree_schema.h:418
struct lysp_node_action * actions
Definition: tree_schema.h:865
struct lysc_ext_instance * exts
Definition: tree_schema.h:1360
const char * ref
Definition: tree_schema.h:1287
struct lysp_restr * musts
Definition: tree_schema.h:497
YANG when-stmt.
Definition: tree_schema.h:1208
const char * name
Definition: tree_schema.h:1757
const char * name
Definition: tree_schema.h:2258
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:1377
struct lysp_node_action_inout output
Definition: tree_schema.h:1014
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:1445
struct lysp_import * imports
Definition: tree_schema.h:1117
struct lysp_node_grp * groupings
Definition: tree_schema.h:1147
struct lysp_node * child
Definition: tree_schema.h:1067
struct lyxp_expr * path
Definition: tree_schema.h:402
const char * dsc
Definition: tree_schema.h:1212
struct lysp_type type
Definition: tree_schema.h:425
struct lysc_node * prev
Definition: tree_schema.h:1438
const char * prefix
Definition: tree_schema.h:1165
struct lysp_node_action * rpcs
Definition: tree_schema.h:1150
struct lysc_node_action * actions
Definition: tree_schema.h:1718
YANG extension parsed instance.
Definition: plugins_exts.h:396
struct lysp_node * data
Definition: tree_schema.h:1148