Skip to content

Commit b7adea4

Browse files
stewegsamuel-gauthier
authored andcommitted
schema: adds PNode and its exact variants
This patch introduces PNode alternative to SNode, which allows to traverse parsed module tree including groupings, uses and other special nodes. Closes: #102 Signed-off-by: Stefan Gula <steweg@gmail.com> Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>
1 parent 5f05203 commit b7adea4

File tree

5 files changed

+1181
-6
lines changed

5 files changed

+1181
-6
lines changed

cffi/cdefs.h

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,25 @@ typedef enum {
528528

529529
char* lysc_path(const struct lysc_node *, LYSC_PATH_TYPE, char *, size_t);
530530

531+
struct lysp_when {
532+
const char *cond;
533+
...;
534+
};
535+
536+
struct lysp_refine {
537+
const char *nodeid;
538+
const char *dsc;
539+
const char *ref;
540+
struct lysp_qname *iffeatures;
541+
struct lysp_restr *musts;
542+
const char *presence;
543+
struct lysp_qname *dflts;
544+
uint32_t min;
545+
uint32_t max;
546+
struct lysp_ext_instance *exts;
547+
uint16_t flags;
548+
};
549+
531550
struct lysp_node_container {
532551
struct lysp_restr *musts;
533552
struct lysp_when *when;
@@ -615,6 +634,101 @@ struct lysp_node_list {
615634
...;
616635
};
617636

637+
struct lysp_node_choice {
638+
struct lysp_node *child;
639+
struct lysp_when *when;
640+
struct lysp_qname dflt;
641+
...;
642+
};
643+
644+
struct lysp_node_case {
645+
struct lysp_node *child;
646+
struct lysp_when *when;
647+
...;
648+
};
649+
650+
struct lysp_node_anydata {
651+
struct lysp_restr *musts;
652+
struct lysp_when *when;
653+
...;
654+
};
655+
656+
struct lysp_node_uses {
657+
struct lysp_refine *refines;
658+
struct lysp_node_augment *augments;
659+
struct lysp_when *when;
660+
...;
661+
};
662+
663+
struct lysp_node_action_inout {
664+
struct lysp_restr *musts;
665+
struct lysp_tpdf *typedefs;
666+
struct lysp_node_grp *groupings;
667+
struct lysp_node *child;
668+
...;
669+
};
670+
671+
struct lysp_node_action {
672+
union {
673+
struct lysp_node node;
674+
struct {
675+
struct lysp_node_action *next;
676+
...;
677+
};
678+
};
679+
struct lysp_tpdf *typedefs;
680+
struct lysp_node_grp *groupings;
681+
struct lysp_node_action_inout input;
682+
struct lysp_node_action_inout output;
683+
...;
684+
};
685+
686+
struct lysp_node_notif {
687+
union {
688+
struct lysp_node node;
689+
struct {
690+
struct lysp_node_notif *next;
691+
...;
692+
};
693+
};
694+
struct lysp_restr *musts;
695+
struct lysp_tpdf *typedefs;
696+
struct lysp_node_grp *groupings;
697+
struct lysp_node *child;
698+
...;
699+
};
700+
701+
struct lysp_node_grp {
702+
union {
703+
struct lysp_node node;
704+
struct {
705+
struct lysp_node_grp *next;
706+
...;
707+
};
708+
};
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+
union {
719+
struct lysp_node node;
720+
struct {
721+
struct lysp_node_augment *next;
722+
...;
723+
};
724+
};
725+
struct lysp_node *child;
726+
struct lysp_when *when;
727+
struct lysp_node_action *actions;
728+
struct lysp_node_notif *notifs;
729+
...;
730+
};
731+
618732
struct lysc_type {
619733
const char *name;
620734
struct lysc_ext_instance *exts;
@@ -623,6 +737,16 @@ struct lysc_type {
623737
uint32_t refcount;
624738
};
625739

740+
struct lysp_type_enum {
741+
const char *name;
742+
const char *dsc;
743+
const char *ref;
744+
int64_t value;
745+
struct lysp_qname *iffeatures;
746+
struct lysp_ext_instance *exts;
747+
uint16_t flags;
748+
};
749+
626750
struct lysp_type {
627751
const char *name;
628752
struct lysp_restr *range;

libyang/__init__.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,23 @@
7676
IfOrFeatures,
7777
Module,
7878
Must,
79+
PAction,
80+
PActionInOut,
81+
PAnydata,
82+
PAugment,
83+
PCase,
84+
PChoice,
85+
PContainer,
86+
PEnum,
87+
PGrouping,
88+
PLeaf,
89+
PLeafList,
90+
PList,
91+
PNode,
92+
PNotif,
93+
PRefine,
94+
PType,
95+
PUses,
7996
Pattern,
8097
Revision,
8198
SAnydata,
@@ -152,6 +169,23 @@
152169
"NodeTypeRemoved",
153170
"OrderedByUserAdded",
154171
"OrderedByUserRemoved",
172+
"PAction",
173+
"PActionInOut",
174+
"PAnydata",
175+
"PAugment",
176+
"PCase",
177+
"PChoice",
178+
"PContainer",
179+
"PEnum",
180+
"PGrouping",
181+
"PLeaf",
182+
"PLeafList",
183+
"PList",
184+
"PNode",
185+
"PNotif",
186+
"PRefine",
187+
"PType",
188+
"PUses",
155189
"Pattern",
156190
"PatternAdded",
157191
"PatternRemoved",

0 commit comments

Comments
 (0)