Formatting of comments

This commit is contained in:
Olof Hagsand 2023-03-30 15:39:35 +02:00
parent 2c104daee2
commit 7eb37273b8
8 changed files with 108 additions and 27 deletions

View file

@ -77,6 +77,7 @@
#define _STATEFILTER
/*! Yang action
*
* Start backend with -- -a <instance-id>
* where instance-id points to an action node in some YANG
* Hard-coded to action "reset" from RFC7950 7.15
@ -84,12 +85,14 @@
static char *_action_instanceid = NULL;
/*! Notification stream
*
* Enable notification streams for netconf/restconf
* Start backend with -- -n
*/
static int _notification_stream = 0;
/*! Variable to control if reset code is run.
*
* The reset code inserts "extra XML" which assumes ietf-interfaces is
* loaded, and this is not always the case.
* Start backend with -- -r
@ -97,18 +100,21 @@ static int _notification_stream = 0;
static int _reset = 0;
/*! Variable to control if state code is run
*
* The state code adds extra non-config data
* Start backend with -- -s
*/
static int _state = 0;
/*! File where state XML is read from, if _state is true -- -sS <file>
*
* Primarily for testing
* Start backend with -- -sS <file>
*/
static char *_state_file = NULL;
/*! XPath to register for pagination state XML from file,
*
* if _state is true -- -sS <file> -x <xpath>
* Primarily for testing
* Start backend with -- -sS <file> -x <xpath>
@ -116,18 +122,21 @@ static char *_state_file = NULL;
static char *_state_xpath = NULL;
/*! Read state file init on startup instead of on request
*
* Primarily for testing: -i
* Start backend with -- -siS <file>
*/
static int _state_file_cached = 0;
/*! Cache control of read state file pagination example,
*
* keep xml tree cache as long as db is locked
*/
static cxobj *_state_xml_cache = NULL; /* XML cache */
static int _state_file_transaction = 0;
/*! Variable to control module-specific upgrade callbacks.
*
* If set, call test-case for upgrading ietf-interfaces, otherwise call
* auto-upgrade
* Start backend with -- -u
@ -135,17 +144,20 @@ static int _state_file_transaction = 0;
static int _module_upgrade = 0;
/*! Variable to control general-purpose upgrade callbacks.
*
* Start backend with -- -U
*/
static int _general_upgrade = 0;
/*! Variable to control transaction logging (for debug)
*
* If set, call syslog for every transaction callback
* Start backend with -- -t
*/
static int _transaction_log = 0;
/*! Variable to trigger validation/commit errors (synthetic errors) for tests
*
* XPath to trigger validation error, ie if the XPath matches, then validate fails
* This is to make tests where a transaction fails midway and aborts/reverts the transaction.
* Start backend with -- -V <xpath>
@ -154,6 +166,7 @@ static int _transaction_log = 0;
static char *_validate_fail_xpath = NULL;
/*! Sub state variable to fail on validate/commit (not configured)
*
* Obscure, but a way to first trigger a validation error, next time to trigger a commit error
*/
static int _validate_fail_toggle = 0; /* fail at validate and commit */
@ -169,6 +182,7 @@ main_begin(clicon_handle h,
transaction_log(h, td, LOG_NOTICE, __FUNCTION__);
return 0;
}
/*! This is called on validate (and commit). Check validity of candidate
*/
int
@ -307,6 +321,7 @@ example_stream_timer_setup(clicon_handle h)
}
/*! Smallest possible RPC declaration for test
*
* Yang/XML:
* If the RPC operation invocation succeeded and no output parameters
* are returned, the <rpc-reply> contains a single <ok/> element defined
@ -324,6 +339,7 @@ empty_rpc(clicon_handle h, /* Clicon handle */
}
/*! More elaborate example RPC for testing
*
* The RPC returns the incoming parameters
*/
static int
@ -384,7 +400,8 @@ example_copy_extra(clicon_handle h, /* Clicon handle */
}
/*! Action callback, example from RFC7950 7.15
* Note callback is hardcoded C, while registration is controlled by -- -a option
*
* @note callback is hardcoded C, while registration is controlled by -- -a option
*/
static int
example_action_reset(clicon_handle h, /* Clicon handle */
@ -709,12 +726,13 @@ example_pagination(void *h0,
}
/*! Lock databse status has changed status
*
* @param[in] h Clixon handle
* @param[in] db Database name (eg "running")
* @param[in] lock Lock status: 0: unlocked, 1: locked
* @param[in] id Session id (of locker/unlocker)
* @retval -1 Fatal error
* @retval 0 OK
* @retval -1 Fatal error
*/
int
example_lockdb(clicon_handle h,
@ -725,7 +743,6 @@ example_lockdb(clicon_handle h,
int retval = -1;
clicon_debug(1, "%s Lock callback: db%s: locked:%d", __FUNCTION__, db, lock);
/* Part of cached pagination example
*/
if (strcmp(db, "running") == 0 && lock == 0 &&
@ -736,7 +753,6 @@ example_lockdb(clicon_handle h,
}
_state_file_transaction = 0;
}
retval = 0;
// done:
return retval;
@ -811,8 +827,8 @@ static const map_str2str namespace_map[] = {
* @param[in] db Name of datastore, eg "running", "startup" or "tmp"
* @param[in] xt XML tree. Upgrade this "in place"
* @param[in] msd Info on datastore module-state, if any
* @retval -1 Error
* @retval 0 OK
* @retval -1 Error
*/
int
example_upgrade(clicon_handle h,
@ -949,6 +965,7 @@ main_yang_mount(clicon_handle h,
}
/*! Testcase module-specific upgrade function moving interfaces-state to interfaces
*
* @param[in] h Clicon handle
* @param[in] xn XML tree to be updated
* @param[in] ns Namespace of module (for info)
@ -1053,6 +1070,7 @@ upgrade_2014_to_2016(clicon_handle h,
}
/*! Testcase upgrade function removing interfaces-state
*
* @param[in] h Clicon handle
* @param[in] xn XML tree to be updated
* @param[in] ns Namespace of module (for info)
@ -1152,6 +1170,7 @@ upgrade_2016_to_2018(clicon_handle h,
}
/*! Testcase module-specific upgrade function moving interfaces-state to interfaces
*
* @param[in] h Clicon handle
* @param[in] xn XML tree to be updated
* @param[in] ns Namespace of module (for info)
@ -1307,8 +1326,8 @@ example_start(clicon_handle h)
}
/*! Plugin daemon.
* @param[in] h Clicon handle
*
* @param[in] h Clicon handle
* plugin_daemon is called once after daemonization has been made but before lowering of privileges
* the main event loop is entered.
*/
@ -1380,6 +1399,7 @@ static clixon_plugin_api api = {
};
/*! Backend plugin initialization
*
* @param[in] h Clixon handle
* @retval NULL Error with clicon_err set
* @retval api Pointer to API struct