comments and typos

This commit is contained in:
Olof hagsand 2020-09-22 22:41:59 +02:00
parent c616aa1569
commit 2994d2f9a9
3 changed files with 21 additions and 8 deletions

View file

@ -166,13 +166,24 @@ clixon_plugin_daemon_all(clicon_handle h)
} }
/*! Call single backend statedata callback /*! Call single backend statedata callback
*
* Create an xml state tree (xret) for one callback only on the form:
* <config>...</config>,
* 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] cp Plugin handle
* @param[in] h clicon handle * @param[in] h clicon handle
* @param[in] xpath String with XPATH syntax. or NULL for all * @param[in] xpath String with XPATH syntax. or NULL for all
* @retval -1 Error * @param[out] xret If retval=1, state tree created and returned: <config>...
* @retval 0 Statedata callback failed * @retval -1 Fatal error
* @retval 1 OK if callback found (and called) xp is set, otherwise xp is not set * @retval 0 Statedata callback failed. no XML tree returned
* @note xtop can be replaced * @retval 1 OK if callback found (and called) xret is set
*/ */
static int static int
clixon_plugin_statedata_one(clixon_plugin *cp, clixon_plugin_statedata_one(clixon_plugin *cp,
@ -194,6 +205,7 @@ clixon_plugin_statedata_one(clixon_plugin *cp,
__FUNCTION__, cp->cp_name); __FUNCTION__, cp->cp_name);
goto fail; /* Dont quit here on user callbacks */ goto fail; /* Dont quit here on user callbacks */
} }
} }
if (xp && x) if (xp && x)
*xp = x; *xp = x;
@ -212,11 +224,11 @@ clixon_plugin_statedata_one(clixon_plugin *cp,
* @param[in] yspec Yang spec * @param[in] yspec Yang spec
* @param[in] nsc Namespace context * @param[in] nsc Namespace context
* @param[in] xpath String with XPATH syntax. or NULL for all * @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 -1 Error
* @retval 0 Statedata callback failed (xret set with netconf-error) * @retval 0 Statedata callback failed (xret set with netconf-error)
* @retval 1 OK * @retval 1 OK
* @note xtop can be replaced * @note xret can be replaced in this function
*/ */
int int
clixon_plugin_statedata_all(clicon_handle h, clixon_plugin_statedata_all(clicon_handle h,

View file

@ -2,7 +2,8 @@
* *
***** BEGIN LICENSE BLOCK ***** ***** 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. This file is part of CLIXON.