libyang  2.1.30
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 "config.h"
27 #include "log.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 };
342 
346 struct lysp_ident {
347  const char *name;
349  const char **bases;
350  const char *dsc;
351  const char *ref;
353  uint16_t flags;
354 };
355 
359 struct lysp_restr {
360 #define LYSP_RESTR_PATTERN_ACK 0x06
361 #define LYSP_RESTR_PATTERN_NACK 0x15
362  struct lysp_qname arg;
365  const char *emsg;
366  const char *eapptag;
367  const char *dsc;
368  const char *ref;
370 };
371 
377  const char *dsc;
378  const char *ref;
380 };
381 
386  const char *name;
387  const char *dsc;
388  const char *ref;
389  int64_t value;
392  uint16_t flags;
394 };
395 
401 struct lysp_type {
402  const char *name;
403  struct lysp_restr *range;
404  struct lysp_restr *length;
408  struct lyxp_expr *path;
409  const char **bases;
410  struct lysp_type *types;
413  const struct lysp_module *pmod;
414  struct lysc_type *compiled;
416  uint8_t fraction_digits;
418  uint16_t flags;
419 };
420 
424 struct lysp_tpdf {
425  const char *name;
426  const char *units;
427  struct lysp_qname dflt;
428  const char *dsc;
429  const char *ref;
431  struct lysp_type type;
432  uint16_t flags;
433 };
434 
438 struct lysp_when {
439  const char *cond;
440  const char *dsc;
441  const char *ref;
443 };
444 
448 struct lysp_refine {
449  const char *nodeid;
450  const char *dsc;
451  const char *ref;
453  struct lysp_restr *musts;
454  const char *presence;
455  struct lysp_qname *dflts;
456  uint32_t min;
457  uint32_t max;
459  uint16_t flags;
460 };
461 
470 #define LYS_DEV_NOT_SUPPORTED 1
471 #define LYS_DEV_ADD 2
472 #define LYS_DEV_DELETE 3
473 #define LYS_DEV_REPLACE 4
479 struct lysp_deviate {
480  uint8_t mod;
481  struct lysp_deviate *next;
483 };
484 
486  uint8_t mod;
487  struct lysp_deviate *next;
489  const char *units;
490  struct lysp_restr *musts;
491  struct lysp_qname *uniques;
492  struct lysp_qname *dflts;
493  uint16_t flags;
494  uint32_t min;
495  uint32_t max;
496 };
497 
499  uint8_t mod;
500  struct lysp_deviate *next;
502  const char *units;
503  struct lysp_restr *musts;
504  struct lysp_qname *uniques;
505  struct lysp_qname *dflts;
506 };
507 
509  uint8_t mod;
510  struct lysp_deviate *next;
512  struct lysp_type *type;
513  const char *units;
514  struct lysp_qname dflt;
515  uint16_t flags;
516  uint32_t min;
517  uint32_t max;
518 };
519 
521  const char *nodeid;
522  const char *dsc;
523  const char *ref;
526 };
527 
651 #define LYS_CONFIG_W 0x01
652 #define LYS_CONFIG_R 0x02
653 #define LYS_CONFIG_MASK 0x03
654 #define LYS_STATUS_CURR 0x04
655 #define LYS_STATUS_DEPRC 0x08
656 #define LYS_STATUS_OBSLT 0x10
657 #define LYS_STATUS_MASK 0x1C
658 #define LYS_MAND_TRUE 0x20
663 #define LYS_MAND_FALSE 0x40
666 #define LYS_MAND_MASK 0x60
667 #define LYS_PRESENCE 0x80
670 #define LYS_UNIQUE 0x80
671 #define LYS_KEY 0x0100
672 #define LYS_KEYLESS 0x0200
673 #define LYS_DISABLED 0x0100
674 #define LYS_FENABLED 0x20
675 #define LYS_ORDBY_SYSTEM 0x80
677 #define LYS_ORDBY_USER 0x40
680 #define LYS_ORDBY_MASK 0x60
681 #define LYS_YINELEM_TRUE 0x80
682 #define LYS_YINELEM_FALSE 0x0100
683 #define LYS_YINELEM_MASK 0x0180
684 #define LYS_USED_GRP 0x0400
686 #define LYS_SET_VALUE 0x0200
687 #define LYS_SET_MIN 0x0200
688 #define LYS_SET_MAX 0x0400
690 #define LYS_SET_BASE 0x0001
691 #define LYS_SET_BIT 0x0002
692 #define LYS_SET_ENUM 0x0004
693 #define LYS_SET_FRDIGITS 0x0008
694 #define LYS_SET_LENGTH 0x0010
695 #define LYS_SET_PATH 0x0020
696 #define LYS_SET_PATTERN 0x0040
697 #define LYS_SET_RANGE 0x0080
698 #define LYS_SET_TYPE 0x0100
699 #define LYS_SET_REQINST 0x0200
700 #define LYS_SET_DFLT 0x0200
705 #define LYS_SET_UNITS 0x0400
706 #define LYS_SET_CONFIG 0x0800
708 #define LYS_SINGLEQUOTED 0x0100
709 #define LYS_DOUBLEQUOTED 0x0200
711 #define LYS_YIN_ATTR 0x0400
712 #define LYS_YIN_ARGUMENT 0x0800
714 #define LYS_INTERNAL 0x1000
716 #define LYS_IS_ENUM 0x0200
718 #define LYS_IS_INPUT 0x1000
720 #define LYS_IS_OUTPUT 0x2000
722 #define LYS_IS_NOTIF 0x4000
724 #define LYS_FLAGS_COMPILED_MASK 0xff
730 struct lysp_node {
731  struct lysp_node *parent;
732  uint16_t nodetype;
733  uint16_t flags;
734  struct lysp_node *next;
735  const char *name;
736  const char *dsc;
737  const char *ref;
738  struct lysp_qname *iffeatures;
740  struct lysp_ext_instance *exts;
741 };
742 
747  union {
748  struct lysp_node node;
750  struct {
751  struct lysp_node *parent;
752  uint16_t nodetype;
753  uint16_t flags;
754  struct lysp_node *next;
755  const char *name;
756  const char *dsc;
757  const char *ref;
758  struct lysp_qname *iffeatures;
759  struct lysp_ext_instance *exts;
760  };
761  };
763  /* container */
764  struct lysp_restr *musts;
765  struct lysp_when *when;
766  const char *presence;
767  struct lysp_tpdf *typedefs;
768  struct lysp_node_grp *groupings;
769  struct lysp_node *child;
770  struct lysp_node_action *actions;
771  struct lysp_node_notif *notifs;
772 };
773 
774 struct lysp_node_leaf {
775  union {
776  struct lysp_node node;
778  struct {
779  struct lysp_node *parent;
780  uint16_t nodetype;
781  uint16_t flags;
782  struct lysp_node *next;
783  const char *name;
784  const char *dsc;
785  const char *ref;
786  struct lysp_qname *iffeatures;
787  struct lysp_ext_instance *exts;
788  };
789  };
791  /* leaf */
792  struct lysp_restr *musts;
793  struct lysp_when *when;
794  struct lysp_type type;
795  const char *units;
796  struct lysp_qname dflt;
797 };
798 
799 struct lysp_node_leaflist {
800  union {
801  struct lysp_node node;
803  struct {
804  struct lysp_node *parent;
805  uint16_t nodetype;
806  uint16_t flags;
807  struct lysp_node *next;
808  const char *name;
809  const char *dsc;
810  const char *ref;
811  struct lysp_qname *iffeatures;
812  struct lysp_ext_instance *exts;
813  };
814  };
816  /* leaf-list */
817  struct lysp_restr *musts;
818  struct lysp_when *when;
819  struct lysp_type type;
820  const char *units;
821  struct lysp_qname *dflts;
823  uint32_t min;
824  uint32_t max;
825 };
826 
827 struct lysp_node_list {
828  union {
829  struct lysp_node node;
831  struct {
832  struct lysp_node *parent;
833  uint16_t nodetype;
834  uint16_t flags;
835  struct lysp_node *next;
836  const char *name;
837  const char *dsc;
838  const char *ref;
839  struct lysp_qname *iffeatures;
840  struct lysp_ext_instance *exts;
841  };
842  };
844  /* list */
845  struct lysp_restr *musts;
846  struct lysp_when *when;
847  const char *key;
848  struct lysp_tpdf *typedefs;
849  struct lysp_node_grp *groupings;
850  struct lysp_node *child;
851  struct lysp_node_action *actions;
852  struct lysp_node_notif *notifs;
853  struct lysp_qname *uniques;
854  uint32_t min;
855  uint32_t max;
856 };
857 
858 struct lysp_node_choice {
859  union {
860  struct lysp_node node;
862  struct {
863  struct lysp_node *parent;
864  uint16_t nodetype;
865  uint16_t flags;
866  struct lysp_node *next;
867  const char *name;
868  const char *dsc;
869  const char *ref;
870  struct lysp_qname *iffeatures;
871  struct lysp_ext_instance *exts;
872  };
873  };
875  /* choice */
876  struct lysp_node *child;
877  struct lysp_when *when;
878  struct lysp_qname dflt;
879 };
880 
881 struct lysp_node_case {
882  union {
883  struct lysp_node node;
885  struct {
886  struct lysp_node *parent;
887  uint16_t nodetype;
888  uint16_t flags;
889  struct lysp_node *next;
890  const char *name;
891  const char *dsc;
892  const char *ref;
893  struct lysp_qname *iffeatures;
894  struct lysp_ext_instance *exts;
895  };
896  };
898  /* case */
899  struct lysp_node *child;
900  struct lysp_when *when;
901 };
902 
903 struct lysp_node_anydata {
904  union {
905  struct lysp_node node;
907  struct {
908  struct lysp_node *parent;
909  uint16_t nodetype;
910  uint16_t flags;
911  struct lysp_node *next;
912  const char *name;
913  const char *dsc;
914  const char *ref;
915  struct lysp_qname *iffeatures;
916  struct lysp_ext_instance *exts;
917  };
918  };
920  /* anyxml/anydata */
921  struct lysp_restr *musts;
922  struct lysp_when *when;
923 };
924 
925 struct lysp_node_uses {
926  union {
927  struct lysp_node node;
929  struct {
930  struct lysp_node *parent;
931  uint16_t nodetype;
932  uint16_t flags;
933  struct lysp_node *next;
934  const char *name;
935  const char *dsc;
936  const char *ref;
937  struct lysp_qname *iffeatures;
938  struct lysp_ext_instance *exts;
939  };
940  };
942  /* uses */
943  struct lysp_refine *refines;
944  struct lysp_node_augment *augments;
945  struct lysp_when *when;
946 };
947 
951 struct lysp_node_action_inout {
952  union {
953  struct lysp_node node;
955  struct {
956  struct lysp_node *parent;
957  uint16_t nodetype;
958  uint16_t flags;
959  struct lysp_node *next;
960  const char *name;
961  const char *dsc;
962  const char *ref;
963  struct lysp_qname *iffeatures;
964  struct lysp_ext_instance *exts;
965  };
966  };
968  /* inout */
969  struct lysp_restr *musts;
970  struct lysp_tpdf *typedefs;
972  struct lysp_node *child;
973 };
974 
978 struct lysp_node_action {
979  union {
980  struct lysp_node node;
982  struct {
983  struct lysp_node *parent;
984  uint16_t nodetype;
985  uint16_t flags;
986  struct lysp_node_action *next;
987  const char *name;
988  const char *dsc;
989  const char *ref;
990  struct lysp_qname *iffeatures;
991  struct lysp_ext_instance *exts;
992  };
993  };
995  /* action */
996  struct lysp_tpdf *typedefs;
997  struct lysp_node_grp *groupings;
1001 };
1002 
1006 struct lysp_node_notif {
1007  union {
1008  struct lysp_node node;
1010  struct {
1011  struct lysp_node *parent;
1012  uint16_t nodetype;
1013  uint16_t flags;
1014  struct lysp_node_notif *next;
1015  const char *name;
1016  const char *dsc;
1017  const char *ref;
1018  struct lysp_qname *iffeatures;
1019  struct lysp_ext_instance *exts;
1020  };
1021  };
1023  /* notif */
1024  struct lysp_restr *musts;
1025  struct lysp_tpdf *typedefs;
1027  struct lysp_node *child;
1028 };
1029 
1033 struct lysp_node_grp {
1034  union {
1035  struct lysp_node node;
1037  struct {
1038  struct lysp_node *parent;
1039  uint16_t nodetype;
1040  uint16_t flags;
1041  struct lysp_node_grp *next;
1042  const char *name;
1043  const char *dsc;
1044  const char *ref;
1045  struct lysp_qname *iffeatures;
1046  struct lysp_ext_instance *exts;
1047  };
1048  };
1050  /* grp */
1051  struct lysp_tpdf *typedefs;
1052  struct lysp_node_grp *groupings;
1053  struct lysp_node *child;
1054  struct lysp_node_action *actions;
1055  struct lysp_node_notif *notifs;
1056 };
1057 
1061 struct lysp_node_augment {
1062  union {
1063  struct lysp_node node;
1065  struct {
1066  struct lysp_node *parent;
1067  uint16_t nodetype;
1068  uint16_t flags;
1069  struct lysp_node_augment *next;
1070  const char *nodeid;
1071  const char *dsc;
1072  const char *ref;
1073  struct lysp_qname *iffeatures;
1074  struct lysp_ext_instance *exts;
1075  };
1076  };
1078  struct lysp_node *child;
1079  struct lysp_when *when;
1080  struct lysp_node_action *actions;
1082 };
1083 
1087 typedef enum LYS_VERSION {
1088  LYS_VERSION_UNDEF = 0,
1089  LYS_VERSION_1_0 = 1,
1090  LYS_VERSION_1_1 = 2
1091 } LYS_VERSION;
1092 
1098 struct lysp_module {
1099  struct lys_module *mod;
1101  struct lysp_revision *revs;
1107  struct lysp_ident *identities;
1108  struct lysp_tpdf *typedefs;
1109  struct lysp_node_grp *groupings;
1110  struct lysp_node *data;
1111  struct lysp_node_augment *augments;
1112  struct lysp_node_action *rpcs;
1113  struct lysp_node_notif *notifs;
1117  uint8_t version;
1118  uint8_t parsing : 1;
1119  uint8_t is_submod : 1;
1120 };
1123  struct lys_module *mod;
1132  struct lysp_tpdf *typedefs;
1134  struct lysp_node *data;
1136  struct lysp_node_action *rpcs;
1137  struct lysp_node_notif *notifs;
1141  uint8_t version;
1142  uint8_t parsing : 1;
1143  uint8_t is_submod : 1;
1145  uint8_t latest_revision : 2;
1149  const char *name;
1150  const char *filepath;
1151  const char *prefix;
1152  const char *org;
1153  const char *contact;
1154  const char *dsc;
1155  const char *ref;
1156 };
1164 #define LYSP_MODULE_NAME(PMOD) (PMOD->is_submod ? ((struct lysp_submodule *)PMOD)->name : ((struct lysp_module *)PMOD)->mod->name)
1170 struct lysc_prefix {
1171  char *prefix;
1172  const struct lys_module *mod;
1173 };
1174 
1182 struct lysc_ext {
1183  const char *name;
1184  const char *argname;
1185  struct lysc_ext_instance *exts;
1186  struct lyplg_ext *plugin;
1187  struct lys_module *module;
1188  uint32_t refcount;
1189  uint16_t flags;
1190 };
1191 
1195 struct lysc_when {
1196  struct lyxp_expr *cond;
1197  struct lysc_node *context;
1199  const char *dsc;
1200  const char *ref;
1202  uint32_t refcount;
1203  uint16_t flags;
1204 };
1209 struct lysc_ident {
1210  const char *name;
1211  const char *dsc;
1212  const char *ref;
1213  struct lys_module *module;
1214  struct lysc_ident **derived;
1217  uint16_t flags;
1218 };
1226 #define LYS_IFF_NOT 0x00
1227 #define LYS_IFF_AND 0x01
1228 #define LYS_IFF_OR 0x02
1229 #define LYS_IFF_F 0x03
1235 struct lysc_revision {
1236  char date[LY_REV_SIZE];
1237  struct lysc_ext_instance *exts;
1238 };
1239 
1240 struct lysc_range {
1241  struct lysc_range_part {
1242  union {
1243  int64_t min_64;
1244  uint64_t min_u64;
1245  };
1246  union {
1247  int64_t max_64;
1248  uint64_t max_u64;
1249  };
1250  } *parts;
1251  const char *dsc;
1252  const char *ref;
1253  const char *emsg;
1254  const char *eapptag;
1255  struct lysc_ext_instance *exts;
1256 };
1259  const char *expr;
1260  pcre2_code *code;
1261  const char *dsc;
1262  const char *ref;
1263  const char *emsg;
1264  const char *eapptag;
1265  struct lysc_ext_instance *exts;
1266  uint32_t inverted : 1;
1267  uint32_t refcount : 31;
1268 };
1270 struct lysc_must {
1271  struct lyxp_expr *cond;
1272  struct lysc_prefix *prefixes;
1273  const char *dsc;
1274  const char *ref;
1275  const char *emsg;
1276  const char *eapptag;
1278 };
1280 struct lysc_type {
1282  struct lyplg_type *plugin;
1284  uint32_t refcount;
1286 };
1290  struct lyplg_type *plugin;
1292  uint32_t refcount;
1293  struct lysc_range *range;
1294 };
1295 
1298  struct lyplg_type *plugin;
1300  uint32_t refcount;
1301  uint8_t fraction_digits;
1302  struct lysc_range *range;
1303 };
1307  struct lyplg_type *plugin;
1309  uint32_t refcount;
1310  struct lysc_range *length;
1311  struct lysc_pattern **patterns;
1312 };
1315  const char *name;
1316  const char *dsc;
1317  const char *ref;
1320  union {
1321  int32_t value;
1322  uint32_t position;
1323  };
1324  uint16_t flags;
1326 };
1328 struct lysc_type_enum {
1329  struct lysc_ext_instance *exts;
1330  struct lyplg_type *plugin;
1332  uint32_t refcount;
1334 };
1335 
1337  struct lysc_ext_instance *exts;
1338  struct lyplg_type *plugin;
1340  uint32_t refcount;
1341  struct lysc_type_bitenum_item *bits;
1343 };
1347  struct lyplg_type *plugin;
1349  uint32_t refcount;
1350  struct lyxp_expr *path;
1351  struct lysc_prefix *prefixes;
1352  const struct lys_module *cur_mod;
1355 };
1358  struct lysc_ext_instance *exts;
1359  struct lyplg_type *plugin;
1361  uint32_t refcount;
1362  struct lysc_ident **bases;
1364 };
1368  struct lyplg_type *plugin;
1370  uint32_t refcount;
1371  uint8_t require_instance;
1372 };
1376  struct lyplg_type *plugin;
1378  uint32_t refcount;
1379  struct lysc_type **types;
1380 };
1381 
1384  struct lyplg_type *plugin;
1386  uint32_t refcount;
1387  struct lysc_range *length;
1388 };
1389 
1393 #define LYS_NODE_HASH_COUNT 4
1398 struct lysc_node {
1399  uint16_t nodetype;
1400  uint16_t flags;
1402  struct lys_module *module;
1403  struct lysc_node *parent;
1404  struct lysc_node *next;
1405  struct lysc_node *prev;
1409  const char *name;
1410  const char *dsc;
1411  const char *ref;
1412  struct lysc_ext_instance *exts;
1413  void *priv;
1414 };
1417  union {
1418  struct lysc_node node;
1420  struct {
1421  uint16_t nodetype;
1422  uint16_t flags;
1423  uint8_t hash[LYS_NODE_HASH_COUNT];
1424  struct lys_module *module;
1426  struct lysc_node *next;
1427  struct lysc_node *prev;
1428  const char *name;
1429  const char *dsc;
1430  const char *ref;
1431  struct lysc_ext_instance *exts;
1432  void *priv;
1433  };
1434  };
1435 
1436  struct lysc_node *child;
1437  struct lysc_must *musts;
1438 };
1439 
1440 struct lysc_node_action {
1441  union {
1442  struct lysc_node node;
1444  struct {
1445  uint16_t nodetype;
1446  uint16_t flags;
1447  uint8_t hash[LYS_NODE_HASH_COUNT];
1448  struct lys_module *module;
1449  struct lysc_node *parent;
1450  struct lysc_node_action *next;
1451  struct lysc_node_action *prev;
1455  const char *name;
1456  const char *dsc;
1457  const char *ref;
1458  struct lysc_ext_instance *exts;
1459  void *priv;
1460  };
1461  };
1462 
1463  struct lysc_when **when;
1466  struct lysc_node_action_inout input;
1469 };
1470 
1471 struct lysc_node_notif {
1472  union {
1473  struct lysc_node node;
1475  struct {
1476  uint16_t nodetype;
1477  uint16_t flags;
1478  uint8_t hash[LYS_NODE_HASH_COUNT];
1479  struct lys_module *module;
1480  struct lysc_node *parent;
1481  struct lysc_node_notif *next;
1482  struct lysc_node_notif *prev;
1486  const char *name;
1487  const char *dsc;
1488  const char *ref;
1489  struct lysc_ext_instance *exts;
1490  void *priv;
1491  };
1492  };
1493 
1494  struct lysc_node *child;
1495  struct lysc_must *musts;
1496  struct lysc_when **when;
1499 };
1500 
1501 struct lysc_node_container {
1502  union {
1503  struct lysc_node node;
1505  struct {
1506  uint16_t nodetype;
1507  uint16_t flags;
1508  uint8_t hash[LYS_NODE_HASH_COUNT];
1509  struct lys_module *module;
1510  struct lysc_node *parent;
1511  struct lysc_node *next;
1512  struct lysc_node *prev;
1516  const char *name;
1517  const char *dsc;
1518  const char *ref;
1519  struct lysc_ext_instance *exts;
1520  void *priv;
1521  };
1522  };
1523 
1524  struct lysc_node *child;
1525  struct lysc_must *musts;
1526  struct lysc_when **when;
1527  struct lysc_node_action *actions;
1528  struct lysc_node_notif *notifs;
1529 };
1530 
1531 struct lysc_node_case {
1532  union {
1533  struct lysc_node node;
1535  struct {
1536  uint16_t nodetype;
1537  uint16_t flags;
1538  uint8_t hash[LYS_NODE_HASH_COUNT];
1539  struct lys_module *module;
1540  struct lysc_node *parent;
1541  struct lysc_node *next;
1542  struct lysc_node *prev;
1546  const char *name;
1547  const char *dsc;
1548  const char *ref;
1549  struct lysc_ext_instance *exts;
1550  void *priv;
1551  };
1552  };
1553 
1554  struct lysc_node *child;
1556  struct lysc_when **when;
1557 };
1558 
1559 struct lysc_node_choice {
1560  union {
1561  struct lysc_node node;
1563  struct {
1564  uint16_t nodetype;
1565  uint16_t flags;
1566  uint8_t hash[LYS_NODE_HASH_COUNT];
1567  struct lys_module *module;
1568  struct lysc_node *parent;
1569  struct lysc_node *next;
1570  struct lysc_node *prev;
1574  const char *name;
1575  const char *dsc;
1576  const char *ref;
1577  struct lysc_ext_instance *exts;
1578  void *priv;
1579  };
1580  };
1581 
1582  struct lysc_node_case *cases;
1585  struct lysc_when **when;
1586  struct lysc_node_case *dflt;
1587 };
1588 
1589 struct lysc_node_leaf {
1590  union {
1591  struct lysc_node node;
1593  struct {
1594  uint16_t nodetype;
1595  uint16_t flags;
1596  uint8_t hash[LYS_NODE_HASH_COUNT];
1597  struct lys_module *module;
1598  struct lysc_node *parent;
1599  struct lysc_node *next;
1600  struct lysc_node *prev;
1604  const char *name;
1605  const char *dsc;
1606  const char *ref;
1607  struct lysc_ext_instance *exts;
1608  void *priv;
1609  };
1610  };
1611 
1612  struct lysc_must *musts;
1613  struct lysc_when **when;
1614  struct lysc_type *type;
1616  const char *units;
1617  struct lyd_value *dflt;
1618 };
1619 
1620 struct lysc_node_leaflist {
1621  union {
1622  struct lysc_node node;
1624  struct {
1625  uint16_t nodetype;
1626  uint16_t flags;
1627  uint8_t hash[LYS_NODE_HASH_COUNT];
1628  struct lys_module *module;
1629  struct lysc_node *parent;
1630  struct lysc_node *next;
1631  struct lysc_node *prev;
1635  const char *name;
1636  const char *dsc;
1637  const char *ref;
1638  struct lysc_ext_instance *exts;
1639  void *priv;
1640  };
1641  };
1642 
1643  struct lysc_must *musts;
1644  struct lysc_when **when;
1645  struct lysc_type *type;
1647  const char *units;
1648  struct lyd_value **dflts;
1651  uint32_t min;
1652  uint32_t max;
1654 };
1655 
1656 struct lysc_node_list {
1657  union {
1658  struct lysc_node node;
1660  struct {
1661  uint16_t nodetype;
1662  uint16_t flags;
1663  uint8_t hash[LYS_NODE_HASH_COUNT];
1664  struct lys_module *module;
1665  struct lysc_node *parent;
1666  struct lysc_node *next;
1667  struct lysc_node *prev;
1671  const char *name;
1672  const char *dsc;
1673  const char *ref;
1674  struct lysc_ext_instance *exts;
1675  void *priv;
1676  };
1677  };
1678 
1679  struct lysc_node *child;
1680  struct lysc_must *musts;
1681  struct lysc_when **when;
1682  struct lysc_node_action *actions;
1683  struct lysc_node_notif *notifs;
1685  struct lysc_node_leaf ***uniques;
1686  uint32_t min;
1687  uint32_t max;
1688 };
1689 
1690 struct lysc_node_anydata {
1691  union {
1692  struct lysc_node node;
1694  struct {
1695  uint16_t nodetype;
1696  uint16_t flags;
1697  uint8_t hash[LYS_NODE_HASH_COUNT];
1698  struct lys_module *module;
1699  struct lysc_node *parent;
1700  struct lysc_node *next;
1701  struct lysc_node *prev;
1705  const char *name;
1706  const char *dsc;
1707  const char *ref;
1708  struct lysc_ext_instance *exts;
1709  void *priv;
1710  };
1711  };
1712 
1713  struct lysc_must *musts;
1714  struct lysc_when **when;
1715 };
1716 
1723 struct lysc_module {
1724  struct lys_module *mod;
1726  struct lysc_node *data;
1727  struct lysc_node_action *rpcs;
1728  struct lysc_node_notif *notifs;
1730 };
1731 
1738 #define lysc_is_userordered(lysc_node) \
1739  ((!lysc_node || !(lysc_node->nodetype & (LYS_LEAFLIST | LYS_LIST)) || !(lysc_node->flags & LYS_ORDBY_USER)) ? 0 : 1)
1747 #define lysc_is_key(lysc_node) \
1748  ((!lysc_node || (lysc_node->nodetype != LYS_LEAF) || !(lysc_node->flags & LYS_KEY)) ? 0 : 1)
1749 
1756 #define lysc_is_np_cont(lysc_node) \
1757  ((!lysc_node || (lysc_node->nodetype != LYS_CONTAINER) || (lysc_node->flags & LYS_PRESENCE)) ? 0 : 1)
1758 
1765 #define lysc_is_dup_inst_list(lysc_node) \
1766  ((lysc_node && (((lysc_node->nodetype == LYS_LIST) && (lysc_node->flags & LYS_KEYLESS)) || \
1767  ((lysc_node->nodetype == LYS_LEAFLIST) && !(lysc_node->flags & LYS_CONFIG_W)))) ? 1 : 0)
1768 
1775 LIBYANG_API_DECL const struct lysc_node *lysc_data_node(const struct lysc_node *schema);
1776 
1780 #define lysc_data_parent(SCHEMA) lysc_data_node((SCHEMA) ? (SCHEMA)->parent : NULL)
1792 LIBYANG_API_DECL const struct lysc_when *lysc_has_when(const struct lysc_node *node);
1793 
1801 LIBYANG_API_DECL const struct lys_module *lysc_owner_module(const struct lysc_node *node);
1802 
1809 LIBYANG_API_DECL const struct lysp_node_grp *lysp_node_groupings(const struct lysp_node *node);
1810 
1817 LIBYANG_API_DECL const struct lysp_tpdf *lysp_node_typedefs(const struct lysp_node *node);
1818 
1825 LIBYANG_API_DECL const struct lysp_node_action *lysp_node_actions(const struct lysp_node *node);
1826 
1833 LIBYANG_API_DECL const struct lysp_node_notif *lysp_node_notifs(const struct lysp_node *node);
1834 
1841 LIBYANG_API_DECL const struct lysp_node *lysp_node_child(const struct lysp_node *node);
1842 
1849 LIBYANG_API_DECL const struct lysc_node_action *lysc_node_actions(const struct lysc_node *node);
1850 
1857 LIBYANG_API_DECL const struct lysc_node_notif *lysc_node_notifs(const struct lysc_node *node);
1858 
1869 LIBYANG_API_DECL const struct lysc_node *lysc_node_child(const struct lysc_node *node);
1870 
1878 LIBYANG_API_DECL struct lysc_must *lysc_node_musts(const struct lysc_node *node);
1879 
1887 LIBYANG_API_DECL struct lysc_when **lysc_node_when(const struct lysc_node *node);
1888 
1898 typedef LY_ERR (*lysc_dfs_clb)(struct lysc_node *node, void *data, ly_bool *dfs_continue);
1899 
1916 LIBYANG_API_DECL LY_ERR lysc_tree_dfs_full(const struct lysc_node *root, lysc_dfs_clb dfs_clb, void *data);
1917 
1929 LIBYANG_API_DECL LY_ERR lysc_module_dfs_full(const struct lys_module *mod, lysc_dfs_clb dfs_clb, void *data);
1930 
1939 LIBYANG_API_DECL LY_ERR lysc_iffeature_value(const struct lysc_iffeature *iff);
1940 
1952 LIBYANG_API_DECL LY_ERR lys_identity_iffeature_value(const struct lysc_ident *ident);
1953 
1962 LIBYANG_API_DECL struct lysp_feature *lysp_feature_next(const struct lysp_feature *last, const struct lysp_module *pmod,
1963  uint32_t *idx);
1964 
1970 #define LYS_FIND_XP_SCHEMA 0x08
1971 #define LYS_FIND_XP_OUTPUT 0x10
1972 #define LYS_FIND_NO_MATCH_ERROR 0x40
1987 LIBYANG_API_DECL LY_ERR lys_find_xpath_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath,
1988  uint32_t options, struct ly_set **set);
1989 
2002 LIBYANG_API_DECL LY_ERR lys_find_expr_atoms(const struct lysc_node *ctx_node, const struct lys_module *cur_mod,
2003  const struct lyxp_expr *expr, const struct lysc_prefix *prefixes, uint32_t options, struct ly_set **set);
2004 
2016 LIBYANG_API_DECL LY_ERR lys_find_xpath(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *xpath,
2017  uint32_t options, struct ly_set **set);
2018 
2027 LIBYANG_API_DECL LY_ERR lys_find_lypath_atoms(const struct ly_path *path, struct ly_set **set);
2028 
2039 LIBYANG_API_DECL LY_ERR lys_find_path_atoms(const struct ly_ctx *ctx, const struct lysc_node *ctx_node, const char *path,
2040  ly_bool output, struct ly_set **set);
2041 
2051 LIBYANG_API_DECL const struct lysc_node *lys_find_path(const struct ly_ctx *ctx, const struct lysc_node *ctx_node,
2052  const char *path, ly_bool output);
2053 
2057 typedef enum {
2058  LYSC_PATH_LOG,
2059  LYSC_PATH_DATA,
2062 } LYSC_PATH_TYPE;
2063 
2075 LIBYANG_API_DECL char *lysc_path(const struct lysc_node *node, LYSC_PATH_TYPE pathtype, char *buffer, size_t buflen);
2080 struct lys_module {
2081  struct ly_ctx *ctx;
2082  const char *name;
2083  const char *revision;
2084  const char *ns;
2085  const char *prefix;
2086  const char *filepath;
2087  const char *org;
2088  const char *contact;
2089  const char *dsc;
2090  const char *ref;
2092  struct lysp_module *parsed;
2093  struct lysc_module *compiled;
2096  struct lysc_ident *identities;
2111 };
2112 
2120 #define LYS_MOD_LATEST_REV 0x01
2121 #define LYS_MOD_LATEST_SEARCHDIRS 0x02
2122 #define LYS_MOD_IMPORTED_REV 0x04
2125 #define LYS_MOD_LATEST_IMPCLB 0x08
2140 LIBYANG_API_DECL LY_ERR lys_feature_value(const struct lys_module *module, const char *feature);
2141 
2161 LIBYANG_API_DECL const struct lysc_node *lys_getnext(const struct lysc_node *last, const struct lysc_node *parent,
2162  const struct lysc_module *module, uint32_t options);
2163 
2176 LIBYANG_API_DECL const struct lysc_node *lys_getnext_ext(const struct lysc_node *last, const struct lysc_node *parent,
2177  const struct lysc_ext_instance *ext, uint32_t options);
2178 
2186 #define LYS_GETNEXT_WITHCHOICE 0x01
2187 #define LYS_GETNEXT_NOCHOICE 0x02
2188 #define LYS_GETNEXT_WITHCASE 0x04
2189 #define LYS_GETNEXT_INTONPCONT 0x08
2190 #define LYS_GETNEXT_OUTPUT 0x10
2206 LIBYANG_API_DECL const struct lysc_node *lys_find_child(const struct lysc_node *parent, const struct lys_module *module,
2207  const char *name, size_t name_len, uint16_t nodetype, uint32_t options);
2224 LIBYANG_API_DECL LY_ERR lys_set_implemented(struct lys_module *mod, const char **features);
2225 
2232 LIBYANG_API_DECL const char *lys_nodetype2str(uint16_t nodetype);
2233 
2240 LIBYANG_API_DECL const char *lyxp_get_expr(const struct lyxp_expr *path);
2241 
2244 #ifdef __cplusplus
2245 }
2246 #endif
2247 
2248 #endif /* LY_TREE_SCHEMA_H_ */
struct lys_module * mod
Definition: tree_schema.h:1115
struct lyplg_type * plugin
Definition: tree_schema.h:1392
struct lysp_node_action * actions
Definition: tree_schema.h:1096
const char * name
Definition: tree_schema.h:297
const char * units
Definition: tree_schema.h:513
Compiled prefix data pair mapping of prefixes to modules. In case the format is LY_VALUE_SCHEMA_RESOL...
Definition: tree_schema.h:1186
uint8_t version
Definition: tree_schema.h:1133
struct lysp_node_grp * groupings
Definition: tree_schema.h:987
struct lysp_type type
Definition: tree_schema.h:810
struct lyd_value ** dflts
Definition: tree_schema.h:1664
struct lysc_ext_instance * exts
Definition: tree_schema.h:1345
struct lysp_feature ** depfeatures
Definition: tree_schema.h:317
Compiled YANG data node.
Definition: tree_schema.h:1414
const char * argname
Definition: tree_schema.h:1200
struct lysp_when * when
Definition: tree_schema.h:893
LY_DATA_TYPE basetype
Definition: tree_schema.h:1376
struct lysp_tpdf * typedefs
Definition: tree_schema.h:864
struct lysp_qname * dflts
Definition: tree_schema.h:505
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1012
struct lysp_node * data
Definition: tree_schema.h:1126
Qualified name (optional prefix followed by an identifier).
Definition: tree_schema.h:337
struct lysc_ident ** derived
Definition: tree_schema.h:1230
struct lysc_node_case * dflt
Definition: tree_schema.h:1602
struct lysp_when * when
Definition: tree_schema.h:1095
struct lysp_node * next
Definition: tree_schema.h:750
struct lysp_restr * musts
Definition: tree_schema.h:453
struct lysc_type_bitenum_item * bits
Definition: tree_schema.h:1357
uint16_t flags
Definition: tree_schema.h:432
struct ly_ctx * ctx
Definition: tree_schema.h:2098
const char * units
Definition: tree_schema.h:1632
struct lysp_ext_instance * exts
Definition: tree_schema.h:482
ly_bool to_compile
Definition: tree_schema.h:2125
const char * dsc
Definition: tree_schema.h:752
struct lysc_must * musts
Definition: tree_schema.h:1453
struct lysp_module * parsed
Definition: tree_schema.h:2109
struct lysc_node * context
Definition: tree_schema.h:1213
Compiled YANG if-feature-stmt.
Definition: tree_schema.h:329
const char * name
Definition: tree_schema.h:1199
uint16_t flags
Definition: tree_schema.h:1233
struct lysp_node_action * actions
Definition: tree_schema.h:1070
struct lysc_when ** when
Definition: tree_schema.h:1479
struct lyplg_type * plugin
Definition: tree_schema.h:1298
struct lysc_ext_instance * exts
Definition: tree_schema.h:1305
LY_DATA_TYPE basetype
Definition: tree_schema.h:1393
struct lysp_tpdf * typedefs
Definition: tree_schema.h:986
Hold type-specific functions for various operations with the data values.
const char * dsc
Definition: tree_schema.h:367
YANG import-stmt.
Definition: tree_schema.h:265
Extension plugin implementing various aspects of a YANG extension.
Definition: plugins_exts.h:926
Covers restrictions: range, length, pattern, must.
Definition: tree_schema.h:359
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1067
struct lysp_import * imports
Definition: tree_schema.h:1143
struct lysp_type * types
Definition: tree_schema.h:410
struct lysc_when ** when
Definition: tree_schema.h:1697
struct lysp_node_augment * augments
Definition: tree_schema.h:1127
struct lysc_prefix * prefixes
Definition: tree_schema.h:1288
YANG extension compiled instance.
Definition: plugins_exts.h:436
char rev[11]
Definition: tree_schema.h:287
struct lysp_when * when
Definition: tree_schema.h:834
struct lysc_when ** when
Definition: tree_schema.h:1601
struct lysc_range::lysc_range_part * parts
const char * dsc
Definition: tree_schema.h:1227
struct lysc_ext_instance * exts
Definition: tree_schema.h:1383
uint32_t max
Definition: tree_schema.h:457
const char * prefix
Definition: tree_schema.h:2102
struct lysp_include * includes
Definition: tree_schema.h:1120
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:28
Compiled YANG extension-stmt.
Definition: tree_schema.h:1198
uint16_t flags
Definition: tree_schema.h:353
struct lysc_node * child
Definition: tree_schema.h:1695
struct lysc_ext_instance * exts
Definition: tree_schema.h:1362
struct lyplg_type * plugin
Definition: tree_schema.h:1375
uint8_t latest_revision
Definition: tree_schema.h:2127
struct lysc_ext_instance * exts
Definition: tree_schema.h:1232
struct lysp_restr * musts
Definition: tree_schema.h:937
YANG refine-stmt.
Definition: tree_schema.h:448
struct lysp_qname dflt
Definition: tree_schema.h:894
struct lys_module * module
Definition: tree_schema.h:1229
struct lyplg_type * plugin
Definition: tree_schema.h:1354
uint16_t flags
Definition: tree_schema.h:1205
struct lysp_when * when
Definition: tree_schema.h:938
const char * name
Definition: tree_schema.h:1165
uint8_t latest_revision
Definition: tree_schema.h:1161
struct lysp_node * child
Definition: tree_schema.h:1043
struct lysp_qname * iffeatures
Definition: tree_schema.h:348
struct lysp_when * when
Definition: tree_schema.h:916
const char * ref
Definition: tree_schema.h:378
struct lysc_node * child
Definition: tree_schema.h:1510
struct lysc_ident * identities
Definition: tree_schema.h:2113
const char * ref
Definition: tree_schema.h:2107
struct lysp_ext * extensions
Definition: tree_schema.h:1121
const char * ns
Definition: tree_schema.h:2101
ly_bool implemented
Definition: tree_schema.h:2124
uint32_t refcount
Definition: tree_schema.h:1348
const char * name
Definition: tree_schema.h:1425
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:2104
struct lysc_must * musts
Definition: tree_schema.h:1511
struct lysp_ext_instance * exts
Definition: tree_schema.h:411
YANG feature-stmt.
Definition: tree_schema.h:313
const char * ref
Definition: tree_schema.h:1171
struct lys_module * mod
Definition: tree_schema.h:1188
YANG identity-stmt.
Definition: tree_schema.h:1225
struct lysc_node * parent
Definition: tree_schema.h:1419
const char * contact
Definition: tree_schema.h:1169
struct lysp_qname * dflts
Definition: tree_schema.h:837
libyang generic macros and functions to work with YANG schema or data trees.
struct lysc_when ** when
Definition: tree_schema.h:1629
struct lysp_node_action * rpcs
Definition: tree_schema.h:1128
struct lysp_ext_instance * exts
Definition: tree_schema.h:272
struct lysp_qname * dflts
Definition: tree_schema.h:492
struct lysc_ext_instance * exts
Definition: tree_schema.h:1201
LY_DATA_TYPE basetype
Definition: tree_schema.h:1385
struct lysc_ext_instance * exts
Definition: plugins_exts.h:440
const char * dsc
Definition: tree_schema.h:319
const char * dsc
Definition: tree_schema.h:387
const char * cond
Definition: tree_schema.h:439
uint32_t refcount
Definition: tree_schema.h:1325
const char * filepath
Definition: tree_schema.h:1166
const char * name
Definition: tree_schema.h:268
YANG identity-stmt.
Definition: tree_schema.h:346
const char * ref
Definition: tree_schema.h:1228
struct lysc_ext_instance * exts
Definition: tree_schema.h:1271
struct lys_module * module
Definition: tree_schema.h:1203
struct lysc_ext_instance * exts
Definition: tree_schema.h:1281
LY_DATA_TYPE basetype
Definition: tree_schema.h:1364
struct lysc_iffeature * iffeatures_c
Definition: tree_schema.h:316
uint32_t refcount
Definition: tree_schema.h:1356
const char * ref
Definition: tree_schema.h:351
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:502
struct lysp_node_grp * groupings
Definition: tree_schema.h:1042
const char * dsc
Definition: tree_schema.h:450
const char * name
Definition: tree_schema.h:402
const char * ref
Definition: tree_schema.h:441
LY_DATA_TYPE basetype
Definition: tree_schema.h:1355
const char * name
Definition: tree_schema.h:751
const char * ref
Definition: tree_schema.h:320
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1148
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:1147
struct lysp_node * child
Definition: tree_schema.h:866
struct lysp_node * child
Definition: tree_schema.h:892
const char * dsc
Definition: tree_schema.h:1277
char * prefix
Definition: tree_schema.h:1187
uint8_t is_submod
Definition: tree_schema.h:1135
struct lysp_node_action * actions
Definition: tree_schema.h:786
uint32_t min
Definition: tree_schema.h:870
struct lysc_ext_instance * exts
Definition: tree_schema.h:1374
struct lysc_ext_instance * exts
Definition: tree_schema.h:1334
const char * ref
Definition: tree_schema.h:753
LY_DATA_TYPE basetype
Definition: tree_schema.h:1324
uint16_t nodetype
Definition: tree_schema.h:1415
Extension structure of the lysp_node for YANG container.
Definition: tree_schema.h:762
uint16_t flags
Definition: tree_schema.h:1219
const char * ref
Definition: tree_schema.h:1268
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:404
uint32_t refcount
Definition: tree_schema.h:1394
const char * ref
Definition: tree_schema.h:451
struct lysp_ext_instance * exts
Definition: tree_schema.h:1131
struct lysc_node_case * cases
Definition: tree_schema.h:1598
Enumeration/Bit value definition.
Definition: tree_schema.h:385
struct lysc_type * compiled
Definition: tree_schema.h:414
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:1739
uint32_t inverted
Definition: tree_schema.h:1282
struct lysc_node * child
Definition: tree_schema.h:1540
struct lysp_qname dflt
Definition: tree_schema.h:514
struct lysp_qname dflt
Definition: tree_schema.h:427
struct lysp_restr * musts
Definition: tree_schema.h:985
struct lysp_ext_instance * exts
Definition: tree_schema.h:286
struct lysp_ext_instance * exts
Definition: tree_schema.h:1155
struct lysp_qname * iffeatures
Definition: tree_schema.h:315
YANG grouping-stmt.
Definition: tree_schema.h:1049
struct lysp_deviate * next
Definition: tree_schema.h:510
const char * eapptag
Definition: tree_schema.h:366
struct lys_module * mod
Definition: tree_schema.h:1139
struct lysp_ext_instance * exts
Definition: tree_schema.h:525
struct lysp_deviate * next
Definition: tree_schema.h:481
struct lysc_range * range
Definition: tree_schema.h:1318
struct lysp_ext_instance * exts
Definition: tree_schema.h:488
ly_bool injected
Definition: tree_schema.h:288
void * priv
Definition: tree_schema.h:1429
struct lysc_node_action * rpcs
Definition: tree_schema.h:1743
const char * ref
Definition: tree_schema.h:285
struct lysp_type_enum * enums
Definition: tree_schema.h:406
const char * name
Definition: tree_schema.h:314
const char * nodeid
Definition: tree_schema.h:449
struct lysc_node_leaf *** uniques
Definition: tree_schema.h:1701
struct lysc_type ** types
Definition: tree_schema.h:1395
struct lysp_ext_instance * exts
Definition: tree_schema.h:511
uint8_t hash[4]
Definition: tree_schema.h:1417
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:362
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:1914
const char * units
Definition: tree_schema.h:836
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:1403
struct lysp_submodule * submodule
Definition: tree_schema.h:281
YANG type-stmt.
Definition: tree_schema.h:401
uint8_t fraction_digits
Definition: tree_schema.h:1317
const char * ref
Definition: tree_schema.h:368
LY_DATA_TYPE basetype
Definition: tree_schema.h:1347
struct lysc_pattern ** patterns
Definition: tree_schema.h:1327
LIBYANG_API_DECL const char * lys_nodetype2str(uint16_t nodetype)
Stringify schema nodetype.
struct lysp_restr * musts
Definition: tree_schema.h:490
struct lysc_range * length
Definition: tree_schema.h:1326
const char * prefix
Definition: tree_schema.h:269
struct lysc_must * musts
Definition: tree_schema.h:1729
const char * dsc
Definition: tree_schema.h:522
YANG data representation.
Definition: tree_data.h:560
uint32_t refcount
Definition: tree_schema.h:1300
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:1699
struct lysc_node * next
Definition: tree_schema.h:1420
struct lysp_qname * uniques
Definition: tree_schema.h:504
YANG revision-stmt.
Definition: tree_schema.h:375
struct lysp_qname dflt
Definition: tree_schema.h:812
struct lyxp_expr * path
Definition: tree_schema.h:1366
struct lysc_ext_instance * exts
Definition: tree_schema.h:1297
struct lysp_ext_instance * exts
Definition: tree_schema.h:301
struct lysp_node * child
Definition: tree_schema.h:785
const char * presence
Definition: tree_schema.h:782
struct lysp_deviation * deviations
Definition: tree_schema.h:1130
struct lysp_type type
Definition: tree_schema.h:835
Generic deviate structure to get type and cast to lysp_deviate_* structure.
Definition: tree_schema.h:479
const char * ref
Definition: tree_schema.h:429
uint32_t refcount
Definition: tree_schema.h:1204
const char * dsc
Definition: tree_schema.h:377
struct lyplg_type * plugin
Definition: tree_schema.h:1323
struct lysc_node_action_inout input
Definition: tree_schema.h:1482
struct lysp_type * type
Definition: tree_schema.h:512
char date[11]
Definition: tree_schema.h:376
const char * name
Definition: tree_schema.h:386
struct lysp_include * includes
Definition: tree_schema.h:1144
struct lyd_value * dflt
Definition: tree_schema.h:1633
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:1391
struct lysp_node_grp * groupings
Definition: tree_schema.h:784
YANG notification-stmt.
Definition: tree_schema.h:1022
const char * dsc
Definition: tree_schema.h:1267
struct lysp_node_notif * notifs
Definition: tree_schema.h:787
struct lysp_when * when
Definition: tree_schema.h:781
const char * dsc
Definition: tree_schema.h:1426
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:1512
struct lyplg_type * plugin
Definition: tree_schema.h:1384
struct lysp_revision * revs
Definition: tree_schema.h:1141
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:868
struct lysp_restr * musts
Definition: tree_schema.h:780
struct lysc_node * child
Definition: tree_schema.h:1452
uint32_t refcount
Definition: tree_schema.h:1218
struct lysp_ext_instance * exts
Definition: tree_schema.h:321
uint32_t max
Definition: tree_schema.h:871
const char ** bases
Definition: tree_schema.h:349
struct lyxp_expr * cond
Definition: tree_schema.h:1287
const char * units
Definition: tree_schema.h:1663
const char * eapptag
Definition: tree_schema.h:1270
struct lysp_ext_instance * exts
Definition: tree_schema.h:501
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:783
struct lysp_node_grp * groupings
Definition: tree_schema.h:865
YANG uses-augment-stmt and augment-stmt (compatible with struct lysp_node )
Definition: tree_schema.h:1077
struct lysc_must * musts
Definition: tree_schema.h:1696
struct lysc_ext_instance * exts
Definition: tree_schema.h:1745
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:1123
struct lysp_node_notif * notifs
Definition: tree_schema.h:1071
struct lysp_module * pmod
Definition: tree_schema.h:413
Structure to hold a set of (not necessary somehow connected) objects. Usually used for lyd_node...
Definition: set.h:46
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:1483
struct lysp_ext_instance * exts
Definition: tree_schema.h:369
struct lysp_qname * uniques
Definition: tree_schema.h:491
uint8_t is_submod
Definition: tree_schema.h:1159
struct lysc_node_action * actions
Definition: tree_schema.h:1543
Printable YANG schema tree structure representing YANG module.
Definition: tree_schema.h:1114
struct lysc_prefix * prefixes
Definition: tree_schema.h:1214
struct lysp_when * when
Definition: tree_schema.h:961
YANG rpc-stmt and action-stmt.
Definition: tree_schema.h:994
const char ** bases
Definition: tree_schema.h:409
Available YANG schema tree structures representing YANG module.
Definition: tree_schema.h:2097
struct lysp_feature * features
Definition: tree_schema.h:1146
const char * name
Definition: tree_schema.h:425
const char * units
Definition: tree_schema.h:489
struct lyxp_expr * cond
Definition: tree_schema.h:1212
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:1363
struct lysc_range * range
Definition: tree_schema.h:1309
struct lysc_node_notif * notifs
Definition: tree_schema.h:1544
struct lysc_ext_instance * exts
Definition: tree_schema.h:1322
const char * eapptag
Definition: tree_schema.h:1280
const char * emsg
Definition: tree_schema.h:1291
struct lysp_qname * uniques
Definition: tree_schema.h:869
struct lysp_ext_instance * exts
Definition: tree_schema.h:391
const char * ref
Definition: tree_schema.h:1427
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:1409
struct lysc_type * type
Definition: tree_schema.h:1630
uint16_t flags
Definition: tree_schema.h:302
struct lysp_node * child
Definition: tree_schema.h:1094
struct lys_module ** deviated_by
Definition: tree_schema.h:2122
struct lysp_node_grp * groupings
Definition: tree_schema.h:1068
const char * filepath
Definition: tree_schema.h:2103
const char * str
Definition: tree_schema.h:338
struct lysp_ext_instance * exts
Definition: tree_schema.h:352
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:417
const char * ref
Definition: tree_schema.h:388
struct lysp_restr * range
Definition: tree_schema.h:403
YANG input-stmt and output-stmt.
Definition: tree_schema.h:967
pcre2_code * code
Definition: tree_schema.h:1276
struct lysc_when ** when
Definition: tree_schema.h:1542
struct lysp_node * child
Definition: tree_schema.h:915
YANG when-stmt.
Definition: tree_schema.h:438
LYSC_PATH_TYPE
Types of the different schema paths.
Definition: tree_schema.h:2074
struct lysc_when ** when
Definition: tree_schema.h:1660
struct lysc_when ** when
Definition: tree_schema.h:1572
struct lysp_node_grp * groupings
Definition: tree_schema.h:1013
uint8_t parsing
Definition: tree_schema.h:1134
struct lyplg_type * plugin
Definition: tree_schema.h:1306
struct lysp_deviate * next
Definition: tree_schema.h:487
struct lysp_node_notif * notifs
Definition: tree_schema.h:1097
struct lysp_revision * revs
Definition: tree_schema.h:1117
uint32_t refcount
Definition: tree_schema.h:1308
uint8_t require_instance
Definition: tree_schema.h:1370
struct lysp_deviate * next
Definition: tree_schema.h:500
LYS_VERSION
supported YANG schema version values
Definition: tree_schema.h:1103
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1041
uint16_t flags
Definition: tree_schema.h:1416
const char * dsc
Definition: tree_schema.h:428
struct lysp_ext_instance * exts
Definition: tree_schema.h:442
struct lysp_node * child
Definition: tree_schema.h:988
struct lys_module * module
Definition: tree_schema.h:1418
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:1293
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:808
const char * dsc
Definition: tree_schema.h:270
struct lysc_must * musts
Definition: tree_schema.h:1628
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:452
Generic YANG data node.
Definition: tree_schema.h:746
struct lysp_deviate * deviates
Definition: tree_schema.h:524
uint16_t flags
Definition: tree_schema.h:749
const char * org
Definition: tree_schema.h:1168
const char * expr
Definition: tree_schema.h:1275
const char * dsc
Definition: tree_schema.h:2106
uint16_t flags
Definition: tree_schema.h:418
struct lysp_restr * patterns
Definition: tree_schema.h:405
const char * ref
Definition: tree_schema.h:300
const char * emsg
Definition: tree_schema.h:1279
struct lysc_must * musts
Definition: tree_schema.h:1659
const char * eapptag
Definition: tree_schema.h:1292
struct lysp_restr * musts
Definition: tree_schema.h:1040
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:347
const char * dsc
Definition: tree_schema.h:350
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:430
uint32_t refcount
Definition: tree_schema.h:1283
struct lysc_type_bitenum_item * enums
Definition: tree_schema.h:1349
const char * nodeid
Definition: tree_schema.h:521
YANG include-stmt.
Definition: tree_schema.h:280
struct lysp_ext_instance * exts
Definition: tree_schema.h:379
struct lysp_node_action_inout input
Definition: tree_schema.h:1015
uint16_t flags
Definition: tree_schema.h:459
struct lysp_ext * extensions
Definition: tree_schema.h:1145
struct lysp_qname * iffeatures
Definition: tree_schema.h:390
LY_DATA_TYPE basetype
Definition: tree_schema.h:1307
struct lysc_node * data
Definition: tree_schema.h:1742
uint8_t mod
Definition: tree_schema.h:480
struct lysc_ident ** bases
Definition: tree_schema.h:1378
struct lyplg_type * plugin
Definition: tree_schema.h:1346
const char * units
Definition: tree_schema.h:426
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:1744
struct lysp_node_augment * augments
Definition: tree_schema.h:960
struct lysc_module * compiled
Definition: tree_schema.h:2110
const char * units
Definition: tree_schema.h:811
const char * argname
Definition: tree_schema.h:298
uint16_t nodetype
Definition: tree_schema.h:748
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:1570
struct lysp_restr * musts
Definition: tree_schema.h:861
const char * contact
Definition: tree_schema.h:2105
struct lysp_tpdf * typedefs
Definition: tree_schema.h:1124
struct lysp_node_grp * groupings
Definition: tree_schema.h:1125
LY_DATA_TYPE basetype
Definition: tree_schema.h:1299
struct lysp_node * parent
Definition: tree_schema.h:747
struct lysp_when * when
Definition: tree_schema.h:862
struct lysp_restr * musts
Definition: tree_schema.h:833
struct lys_module ** augmented_by
Definition: tree_schema.h:2121
struct lysp_node_notif * notifs
Definition: tree_schema.h:1153
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:1740
struct lysp_refine * refines
Definition: tree_schema.h:959
const char * emsg
Definition: tree_schema.h:365
LY_ERR
libyang&#39;s error codes returned by the libyang functions.
Definition: log.h:254
const char * ref
Definition: tree_schema.h:1278
struct lysp_feature ** features
Definition: tree_schema.h:331
Logger manipulation routines and error definitions.
const char * ref
Definition: tree_schema.h:1216
const char * dsc
Definition: tree_schema.h:1170
struct lysc_ext * compiled
Definition: tree_schema.h:304
struct lysc_must * musts
Definition: tree_schema.h:1541
struct lysp_qname * dflts
Definition: tree_schema.h:455
struct lysp_ext_instance * exts
Definition: tree_schema.h:458
const char * dsc
Definition: tree_schema.h:440
uint32_t min
Definition: tree_schema.h:456
const char * ref
Definition: tree_schema.h:523
const char * dsc
Definition: tree_schema.h:1289
struct lysp_when * when
Definition: tree_schema.h:809
struct lysp_node_augment * augments
Definition: tree_schema.h:1151
struct lysp_feature * features
Definition: tree_schema.h:1122
struct lys_module * cur_mod
Definition: tree_schema.h:1368
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:1226
struct lysc_type * type
Definition: tree_schema.h:1661
const char * presence
Definition: tree_schema.h:454
struct lysp_deviation * deviations
Definition: tree_schema.h:1154
struct lysp_type_enum * bits
Definition: tree_schema.h:407
const char * revision
Definition: tree_schema.h:2100
const char * emsg
Definition: tree_schema.h:1269
const char * key
Definition: tree_schema.h:863
uint16_t flags
Definition: tree_schema.h:392
uint8_t * expr
Definition: tree_schema.h:330
uint8_t fraction_digits
Definition: tree_schema.h:416
struct lysc_when ** when
Definition: tree_schema.h:1730
struct lysc_type * realtype
Definition: tree_schema.h:1369
struct lysp_node_notif * notifs
Definition: tree_schema.h:1129
libyang context handler.
YANG typedef-stmt.
Definition: tree_schema.h:424
struct lysp_node_action * actions
Definition: tree_schema.h:867
struct lysc_ext_instance * exts
Definition: tree_schema.h:1353
const char * ref
Definition: tree_schema.h:1290
struct lysp_restr * musts
Definition: tree_schema.h:503
YANG when-stmt.
Definition: tree_schema.h:1211
const char * name
Definition: tree_schema.h:2099
struct lyplg_ext * plugin
Definition: tree_schema.h:1202
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:1367
struct lysp_node_action_inout output
Definition: tree_schema.h:1016
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:1428
struct lysp_import * imports
Definition: tree_schema.h:1119
struct lysp_node_grp * groupings
Definition: tree_schema.h:1149
struct lysp_node * child
Definition: tree_schema.h:1069
struct lyxp_expr * path
Definition: tree_schema.h:408
const char * dsc
Definition: tree_schema.h:1215
struct lysp_type type
Definition: tree_schema.h:431
struct lysc_node * prev
Definition: tree_schema.h:1421
const char * prefix
Definition: tree_schema.h:1167
struct lysp_node_action * rpcs
Definition: tree_schema.h:1152
struct lysc_node_action * actions
Definition: tree_schema.h:1698
YANG extension parsed instance.
Definition: plugins_exts.h:403
struct lysp_node * data
Definition: tree_schema.h:1150