summaryrefslogtreecommitdiffstats
path: root/lib/yang.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yang.h')
-rw-r--r--lib/yang.h50
1 files changed, 47 insertions, 3 deletions
diff --git a/lib/yang.h b/lib/yang.h
index 65f6a73..57131f4 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -45,9 +45,6 @@ struct yang_module {
RB_ENTRY(yang_module) entry;
const char *name;
const struct lys_module *info;
-#ifdef HAVE_CONFD
- int confd_hash;
-#endif
#ifdef HAVE_SYSREPO
sr_subscription_ctx_t *sr_subscription;
struct event *sr_thread;
@@ -539,6 +536,21 @@ extern struct lyd_node *yang_dnode_dup(const struct lyd_node *dnode);
extern void yang_dnode_free(struct lyd_node *dnode);
/*
+ * Add a libyang data node to an RPC/action output container.
+ *
+ * output
+ * RPC/action output container.
+ *
+ * xpath
+ * XPath of the data node to add, relative to the output container.
+ *
+ * value
+ * String representing the value of the data node.
+ */
+extern void yang_dnode_rpc_output_add(struct lyd_node *output,
+ const char *xpath, const char *value);
+
+/*
* Create a new yang_data structure.
*
* xpath
@@ -623,6 +635,25 @@ extern LY_ERR yang_parse_notification(const char *xpath, LYD_FORMAT format,
const char *data, struct lyd_node **notif);
/*
+ * Parse a YANG RPC.
+ *
+ * Args:
+ * xpath: xpath of an RPC/action.
+ * format: LYD_FORMAT of input data.
+ * data: input data.
+ * reply: true if the data represents a reply to an RPC/action.
+ * rpc: pointer to the libyang data tree to store the parsed RPC/action.
+ * If data represents an action, the pointer to the action node is
+ * still returned, but it's part of the full data tree with all its
+ * parents.
+ *
+ * Returns:
+ * LY_ERR from underlying calls.
+ */
+LY_ERR yang_parse_rpc(const char *xpath, LYD_FORMAT format, const char *data,
+ bool reply, struct lyd_node **rpc);
+
+/*
* "Print" the yang tree in `root` into dynamic sized array.
*
* Args:
@@ -771,6 +802,14 @@ extern int yang_get_key_preds(char *s, const struct lysc_node *snode,
extern int yang_get_node_keys(struct lyd_node *node, struct yang_list_keys *keys);
/**
+ * yang_xpath_pop_node() - remove the last node from xpath string
+ * @xpath: an xpath string
+ *
+ * Return: NB_OK or NB_ERR_NOT_FOUND if nothing left to pop.
+ */
+extern int yang_xpath_pop_node(char *xpath);
+
+/**
* yang_resolve_snodes() - Resolve an XPath to matching schema nodes.
* @ly_ctx: libyang context to operate on.
* @xpath: the path or XPath to resolve.
@@ -800,6 +839,11 @@ extern LY_ERR yang_lyd_new_list(struct lyd_node_inner *parent,
const struct yang_list_keys *keys,
struct lyd_node **nodes);
extern LY_ERR yang_lyd_trim_xpath(struct lyd_node **rootp, const char *xpath);
+extern LY_ERR yang_lyd_parse_data(const struct ly_ctx *ctx,
+ struct lyd_node *parent, struct ly_in *in,
+ LYD_FORMAT format, uint32_t parse_options,
+ uint32_t validate_options,
+ struct lyd_node **tree);
#ifdef __cplusplus
}