schema CHANGE add lysp_node_groupings()
To get the groupings member from some of the schema nodes.
diff --git a/src/tree_schema.h b/src/tree_schema.h
index fbab721..b5f5410 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -1359,6 +1359,14 @@
};
/**
+ * @brief Get the groupings sized array of the given (parsed) schema node.
+ * Decides the node's type and in case it has a groupings array, returns it.
+ * @param[in] node Node to examine.
+ * @return The node's groupings sized array if any, NULL otherwise.
+ */
+const struct lysp_grp *lysp_node_groupings(const struct lysp_node *node);
+
+/**
* @brief Get the typedefs sized array of the given (parsed) schema node.
* Decides the node's type and in case it has a typedefs array, returns it.
* @param[in] node Node to examine.
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 0146f43..f9059fe 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -921,6 +921,27 @@
}
}
+API const struct lysp_grp *
+lysp_node_groupings(const struct lysp_node *node)
+{
+ switch (node->nodetype) {
+ case LYS_CONTAINER:
+ return ((struct lysp_node_container*)node)->groupings;
+ case LYS_LIST:
+ return ((struct lysp_node_list*)node)->groupings;
+ case LYS_GROUPING:
+ return ((struct lysp_grp*)node)->groupings;
+ case LYS_ACTION:
+ return ((struct lysp_action*)node)->groupings;
+ case LYS_INOUT:
+ return ((struct lysp_action_inout*)node)->groupings;
+ case LYS_NOTIF:
+ return ((struct lysp_notif*)node)->groupings;
+ default:
+ return NULL;
+ }
+}
+
struct lysp_action **
lysp_node_actions_p(struct lysp_node *node)
{