diff --git a/apps/backend/backend_plugin.c b/apps/backend/backend_plugin.c index 7d6ab008..e02270c7 100644 --- a/apps/backend/backend_plugin.c +++ b/apps/backend/backend_plugin.c @@ -166,13 +166,24 @@ clixon_plugin_daemon_all(clicon_handle h) } /*! Call single backend statedata callback + * + * Create an xml state tree (xret) for one callback only on the form: + * ..., + * call a user supplied function (ca_statedata) which can do two things: + * - Fill in state XML in the tree and return 0 + * - Call cli_error() and return -1 + * In the former case, this function returns the state XML tree to the caller (which + * typically merges the tree with other state trees). + * In the latter error case, this function returns 0 (invalid) to the caller with no tree + * If a fatal error occurs in this function, -1 is returned. + * * @param[in] cp Plugin handle * @param[in] h clicon handle * @param[in] xpath String with XPATH syntax. or NULL for all - * @retval -1 Error - * @retval 0 Statedata callback failed - * @retval 1 OK if callback found (and called) xp is set, otherwise xp is not set - * @note xtop can be replaced + * @param[out] xret If retval=1, state tree created and returned: ... + * @retval -1 Fatal error + * @retval 0 Statedata callback failed. no XML tree returned + * @retval 1 OK if callback found (and called) xret is set */ static int clixon_plugin_statedata_one(clixon_plugin *cp, @@ -194,6 +205,7 @@ clixon_plugin_statedata_one(clixon_plugin *cp, __FUNCTION__, cp->cp_name); goto fail; /* Dont quit here on user callbacks */ } + } if (xp && x) *xp = x; @@ -212,11 +224,11 @@ clixon_plugin_statedata_one(clixon_plugin *cp, * @param[in] yspec Yang spec * @param[in] nsc Namespace context * @param[in] xpath String with XPATH syntax. or NULL for all - * @param[in,out] xtop State XML tree is merged with existing tree. + * @param[in,out] xret State XML tree is merged with existing tree. * @retval -1 Error * @retval 0 Statedata callback failed (xret set with netconf-error) * @retval 1 OK - * @note xtop can be replaced + * @note xret can be replaced in this function */ int clixon_plugin_statedata_all(clicon_handle h, diff --git a/lib/src/clixon_xpath.c b/lib/src/clixon_xpath.c index 3959a446..434c3125 100644 --- a/lib/src/clixon_xpath.c +++ b/lib/src/clixon_xpath.c @@ -210,7 +210,7 @@ xpath_tree_print_cb(cbuf *cb, * @see xpath_tree2str */ int -xpath_tree_print(FILE *f, +xpath_tree_print(FILE *f, xpath_tree *xs) { int retval = -1; diff --git a/lib/src/clixon_xpath_eval.h b/lib/src/clixon_xpath_eval.h index d8c9b296..28ab024a 100644 --- a/lib/src/clixon_xpath_eval.h +++ b/lib/src/clixon_xpath_eval.h @@ -2,7 +2,8 @@ * ***** BEGIN LICENSE BLOCK ***** - Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren + Copyright (C) 2009-2019 Olof Hagsandc + Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate) This file is part of CLIXON.