Skip to content

Commit 7c451a5

Browse files
committed
schema: adds PNode and its exact variants
This patch introduces PNode alternative to SNode, which allows to travers parsed module tree including groupings, uses and other special nodes Signed-off-by: Stefan Gula <[email protected]>
1 parent 25be575 commit 7c451a5

File tree

6 files changed

+1168
-13
lines changed

6 files changed

+1168
-13
lines changed

cffi/cdefs.h

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,25 @@ typedef enum {
549549

550550
char* lysc_path(const struct lysc_node *, LYSC_PATH_TYPE, char *, size_t);
551551

552+
struct lysp_when {
553+
const char *cond;
554+
...;
555+
};
556+
557+
struct lysp_refine {
558+
const char *nodeid;
559+
const char *dsc;
560+
const char *ref;
561+
struct lysp_qname *iffeatures;
562+
struct lysp_restr *musts;
563+
const char *presence;
564+
struct lysp_qname *dflts;
565+
uint32_t min;
566+
uint32_t max;
567+
struct lysp_ext_instance *exts;
568+
uint16_t flags;
569+
};
570+
552571
struct lysp_node_container {
553572
struct lysp_restr *musts;
554573
struct lysp_when *when;
@@ -636,6 +655,73 @@ struct lysp_node_list {
636655
...;
637656
};
638657

658+
struct lysp_node_choice {
659+
struct lysp_node *child;
660+
struct lysp_when *when;
661+
struct lysp_qname dflt;
662+
...;
663+
};
664+
665+
struct lysp_node_case {
666+
struct lysp_node *child;
667+
struct lysp_when *when;
668+
...;
669+
};
670+
671+
struct lysp_node_anydata {
672+
struct lysp_restr *musts;
673+
struct lysp_when *when;
674+
...;
675+
};
676+
677+
struct lysp_node_uses {
678+
struct lysp_refine *refines;
679+
struct lysp_node_augment *augments;
680+
struct lysp_when *when;
681+
...;
682+
};
683+
684+
struct lysp_node_action_inout {
685+
struct lysp_restr *musts;
686+
struct lysp_tpdf *typedefs;
687+
struct lysp_node_grp *groupings;
688+
struct lysp_node *child;
689+
...;
690+
};
691+
692+
struct lysp_node_action {
693+
struct lysp_tpdf *typedefs;
694+
struct lysp_node_grp *groupings;
695+
struct lysp_node_action_inout input;
696+
struct lysp_node_action_inout output;
697+
...;
698+
};
699+
700+
struct lysp_node_notif {
701+
struct lysp_restr *musts;
702+
struct lysp_tpdf *typedefs;
703+
struct lysp_node_grp *groupings;
704+
struct lysp_node *child;
705+
...;
706+
};
707+
708+
struct lysp_node_grp {
709+
struct lysp_tpdf *typedefs;
710+
struct lysp_node_grp *groupings;
711+
struct lysp_node *child;
712+
struct lysp_node_action *actions;
713+
struct lysp_node_notif *notifs;
714+
...;
715+
};
716+
717+
struct lysp_node_augment {
718+
struct lysp_node *child;
719+
struct lysp_when *when;
720+
struct lysp_node_action *actions;
721+
struct lysp_node_notif *notifs;
722+
...;
723+
};
724+
639725
struct lysc_type {
640726
const char *name;
641727
struct lysc_ext_instance *exts;
@@ -644,6 +730,16 @@ struct lysc_type {
644730
uint32_t refcount;
645731
};
646732

733+
struct lysp_type_enum {
734+
const char *name;
735+
const char *dsc;
736+
const char *ref;
737+
int64_t value;
738+
struct lysp_qname *iffeatures;
739+
struct lysp_ext_instance *exts;
740+
uint16_t flags;
741+
};
742+
647743
struct lysp_type {
648744
const char *name;
649745
struct lysp_restr *range;

libyang/__init__.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,26 @@
7979
IfOrFeatures,
8080
Module,
8181
Must,
82+
PAction,
83+
PActionInOut,
84+
PAnydata,
8285
Pattern,
86+
PAugment,
87+
PCase,
88+
PChoice,
89+
PContainer,
90+
PEnum,
91+
PGrouping,
92+
PLeaf,
93+
PLeafList,
94+
PList,
95+
PNode,
96+
PNotif,
97+
PRefine,
98+
PType,
99+
PUses,
83100
Revision,
101+
SAnydata,
84102
SCase,
85103
SChoice,
86104
SContainer,
@@ -156,6 +174,23 @@
156174
"NodeTypeRemoved",
157175
"OrderedByUserAdded",
158176
"OrderedByUserRemoved",
177+
"PAction",
178+
"PActionInOut",
179+
"PAnydata",
180+
"PAugment",
181+
"PCase",
182+
"PChoice",
183+
"PContainer",
184+
"PEnum",
185+
"PGrouping",
186+
"PLeaf",
187+
"PLeafList",
188+
"PList",
189+
"PNode",
190+
"PNotif",
191+
"PRefine",
192+
"PType",
193+
"PUses",
159194
"Pattern",
160195
"PatternAdded",
161196
"PatternRemoved",

0 commit comments

Comments
 (0)