Formatting of comments
This commit is contained in:
parent
2c104daee2
commit
7eb37273b8
8 changed files with 108 additions and 27 deletions
|
|
@ -73,6 +73,7 @@
|
|||
#include "backend_client.h"
|
||||
|
||||
/*! Find client by session-id
|
||||
*
|
||||
* @param[in] ce_list List of clients
|
||||
* @param[in] id Session id
|
||||
*/
|
||||
|
|
@ -89,6 +90,7 @@ ce_find_byid(struct client_entry *ce_list,
|
|||
}
|
||||
|
||||
/*! Stream callback for netconf stream notification (RFC 5277)
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] op 0:event, 1:rm
|
||||
* @param[in] event Event as XML
|
||||
|
|
@ -125,6 +127,7 @@ ce_event_cb(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Unlock all db:s of a client and call user unlock calback
|
||||
*
|
||||
* @see xmldb_unlock_all unlocks, but does not call user callbacks which is a backend thing
|
||||
*/
|
||||
static int
|
||||
|
|
@ -167,9 +170,9 @@ release_all_dbs(clicon_handle h,
|
|||
* @param[in] nsc XML Namespace context for xpath
|
||||
* @param[in,out] xret Existing XML tree, merge x into this
|
||||
* @param[out] xerr XML error tree, if retval = 0
|
||||
* @retval -1 Error (fatal)
|
||||
* @retval 0 Statedata callback failed, error in xerr
|
||||
* @retval 1 OK
|
||||
* @retval 0 Statedata callback failed, error in xerr
|
||||
* @retval -1 Error (fatal)
|
||||
* @see RFC 6022
|
||||
*/
|
||||
int
|
||||
|
|
@ -242,6 +245,7 @@ backend_monitoring_state_get(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Remove client entry state
|
||||
*
|
||||
* Close down everything wrt clients (eg sockets, subscriptions)
|
||||
* Finally actually remove client struct in handle
|
||||
* @param[in] h Clicon handle
|
||||
|
|
@ -308,6 +312,7 @@ backend_client_rm(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Get clixon per datastore stats
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] dbname Datastore name
|
||||
* @param[in,out] cb Cligen buf
|
||||
|
|
@ -351,6 +356,7 @@ clixon_stats_datastore_get(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Get clixon per datastore stats
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] dbname Datastore name
|
||||
* @param[in,out] cb Cligen buf
|
||||
|
|
@ -616,6 +622,7 @@ from_client_edit_config(clicon_handle h,
|
|||
} /* from_client_edit_config */
|
||||
|
||||
/*! Create or replace an entire config with another complete config db
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xe Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -701,6 +708,7 @@ from_client_copy_config(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Delete a configuration datastore.
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xe Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -951,6 +959,7 @@ from_client_unlock(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Request graceful termination of a NETCONF session.
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xe Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -1034,6 +1043,7 @@ from_client_kill_session(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Create a notification subscription
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xe Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -1256,6 +1266,7 @@ from_client_get_schema(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Set debug level.
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xe Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -1293,6 +1304,7 @@ from_client_debug(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Check liveness of backend daemon, just send a reply
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xe Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -1313,6 +1325,7 @@ from_client_ping(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Check liveness of backend daemon, just send a reply
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xe Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -1370,6 +1383,7 @@ from_client_stats(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Request restart of specific plugins
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xe Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -1417,6 +1431,7 @@ from_client_restart_plugin(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Control a specific process or daemon: start/stop, etc
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xe Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -1766,6 +1781,7 @@ from_client_msg(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! An internal clicon message has arrived from a client. Receive and dispatch.
|
||||
*
|
||||
* @param[in] s Socket where message arrived. read from this.
|
||||
* @param[in] arg Client entry (from).
|
||||
* @retval 0 OK
|
||||
|
|
@ -1805,6 +1821,7 @@ from_client(int s,
|
|||
}
|
||||
|
||||
/*! Init backend rpc: Set up standard netconf rpc callbacks
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error (fatal)
|
||||
|
|
|
|||
|
|
@ -706,7 +706,6 @@ candidate_commit(clicon_handle h,
|
|||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* 7. Call plugin transaction commit callbacks */
|
||||
if (plugin_transaction_commit_all(h, td) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@
|
|||
#include "clixon_backend_commit.h"
|
||||
|
||||
/*! Request plugins to reset system state
|
||||
*
|
||||
* The system 'state' should be the same as the contents of running_db
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clicon handle
|
||||
|
|
@ -102,6 +103,7 @@ clixon_plugin_reset_one(clixon_plugin_t *cp,
|
|||
}
|
||||
|
||||
/*! Call all plugins reset callbacks
|
||||
*
|
||||
* The system 'state' should be the same as the contents of running_db
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] db Name of datastore
|
||||
|
|
@ -127,6 +129,7 @@ clixon_plugin_reset_all(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Call single plugin "pre-" daemonize callback
|
||||
*
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @retval 0 OK
|
||||
|
|
@ -188,6 +191,7 @@ clixon_plugin_pre_daemon_all(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Call single plugin "post-" daemonize callback
|
||||
*
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @retval 0 OK
|
||||
|
|
@ -270,9 +274,9 @@ clixon_plugin_daemon_all(clicon_handle h)
|
|||
* @param[in] limit Limit, for list pagination
|
||||
* @param[out] remaining Remaining elements (if limit is non-zero)
|
||||
* @param[out] xp If retval=1, state tree created and returned: <config>...
|
||||
* @retval -1 Fatal error
|
||||
* @retval 0 Statedata callback failed. no XML tree returned
|
||||
* @retval 1 OK if callback found (and called) xret is set
|
||||
* @retval 0 Statedata callback failed. no XML tree returned
|
||||
* @retval -1 Fatal error
|
||||
*/
|
||||
static int
|
||||
clixon_plugin_statedata_one(clixon_plugin_t *cp,
|
||||
|
|
@ -314,6 +318,7 @@ clixon_plugin_statedata_one(clixon_plugin_t *cp,
|
|||
}
|
||||
|
||||
/*! Go through all backend statedata callbacks and collect state data
|
||||
*
|
||||
* This is internal system call, plugin is invoked (does not call) this function
|
||||
* Backend plugins can register
|
||||
* @param[in] h clicon handle
|
||||
|
|
@ -322,9 +327,9 @@ clixon_plugin_statedata_one(clixon_plugin_t *cp,
|
|||
* @param[in] xpath String with XPATH syntax. or NULL for all
|
||||
* @param[in] wdef With-defaults parameter, see RFC 6243
|
||||
* @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
|
||||
* @retval 0 Statedata callback failed (xret set with netconf-error)
|
||||
* @retval -1 Error
|
||||
* @note xret can be replaced in this function
|
||||
*/
|
||||
int
|
||||
|
|
@ -412,13 +417,14 @@ clixon_plugin_statedata_all(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Lock database status has changed status
|
||||
*
|
||||
* @param[in] cp Plugin handle
|
||||
* @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
|
||||
*/
|
||||
static int
|
||||
clixon_plugin_lockdb_one(clixon_plugin_t *cp,
|
||||
|
|
@ -446,12 +452,13 @@ clixon_plugin_lockdb_one(clixon_plugin_t *cp,
|
|||
}
|
||||
|
||||
/*! Lock database 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
|
||||
clixon_plugin_lockdb_all(clicon_handle h,
|
||||
|
|
@ -548,6 +555,7 @@ clixon_pagination_free(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Create and initialize a validate/commit transaction
|
||||
*
|
||||
* @retval td New alloced transaction,
|
||||
* @retval NULL Error
|
||||
* @see transaction_free which deallocates the returned handle
|
||||
|
|
@ -591,6 +599,7 @@ transaction_free(transaction_data_t *td)
|
|||
}
|
||||
|
||||
/*! Call single plugin transaction_begin() before a validate/commit.
|
||||
*
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] td Transaction data
|
||||
|
|
@ -629,6 +638,7 @@ plugin_transaction_begin_one(clixon_plugin_t *cp,
|
|||
/* The plugin_transaction routines need access to struct plugin which is local to this file */
|
||||
|
||||
/*! Call transaction_begin() in all plugins before a validate/commit.
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] td Transaction data
|
||||
* @retval 0 OK
|
||||
|
|
@ -652,6 +662,7 @@ plugin_transaction_begin_all(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Call single plugin transaction_validate() in a validate/commit transaction
|
||||
*
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] td Transaction data
|
||||
|
|
@ -689,6 +700,7 @@ plugin_transaction_validate_one(clixon_plugin_t *cp,
|
|||
}
|
||||
|
||||
/*! Call transaction_validate callbacks in all backend plugins
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] td Transaction data
|
||||
* @retval 0 OK. Validation succeeded in all plugins
|
||||
|
|
@ -711,6 +723,7 @@ plugin_transaction_validate_all(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Call single plugin transaction_complete() in a validate/commit transaction
|
||||
*
|
||||
* complete is called after validate (before commit)
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
|
|
@ -748,6 +761,7 @@ plugin_transaction_complete_one(clixon_plugin_t *cp,
|
|||
}
|
||||
|
||||
/*! Call transaction_complete() in all plugins after validation (before commit)
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] td Transaction data
|
||||
* @retval 0 OK
|
||||
|
|
@ -772,6 +786,7 @@ plugin_transaction_complete_all(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Revert a commit
|
||||
*
|
||||
* @param[in] h CLICON handle
|
||||
* @param[in] td Transaction data
|
||||
* @param[in] nr The plugin where an error occured.
|
||||
|
|
@ -803,6 +818,7 @@ plugin_transaction_revert_all(clicon_handle h,
|
|||
|
||||
|
||||
/*! Call single plugin transaction_commit() in a commit transaction
|
||||
*
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] td Transaction data
|
||||
|
|
@ -839,6 +855,7 @@ plugin_transaction_commit_one(clixon_plugin_t *cp,
|
|||
}
|
||||
|
||||
/*! Call transaction_commit callbacks in all backend plugins
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] td Transaction data
|
||||
* @retval 0 OK
|
||||
|
|
@ -869,6 +886,7 @@ plugin_transaction_commit_all(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Call single plugin transaction_commit_done() in a commit transaction
|
||||
*
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] td Transaction data
|
||||
|
|
@ -905,6 +923,7 @@ plugin_transaction_commit_done_one(clixon_plugin_t *cp,
|
|||
}
|
||||
|
||||
/*! Call transaction_commit_done callbacks in all backend plugins
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] td Transaction data
|
||||
* @retval 0 OK
|
||||
|
|
@ -928,6 +947,7 @@ plugin_transaction_commit_done_all(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Call single plugin transaction_end() in a commit/validate transaction
|
||||
*
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] td Transaction data
|
||||
|
|
@ -964,6 +984,7 @@ plugin_transaction_end_one(clixon_plugin_t *cp,
|
|||
}
|
||||
|
||||
/*! Call transaction_end() in all plugins after a successful commit.
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] td Transaction data
|
||||
* @retval 0 OK
|
||||
|
|
@ -1016,6 +1037,7 @@ plugin_transaction_abort_one(clixon_plugin_t *cp,
|
|||
}
|
||||
|
||||
/*! Call transaction_abort() in all plugins after a failed validation/commit.
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] td Transaction data
|
||||
* @retval 0 OK
|
||||
|
|
|
|||
|
|
@ -1420,10 +1420,15 @@ yang2cli_yspec(clicon_handle h,
|
|||
fprintf(stderr, "%s\n", cbuf_get(cb));
|
||||
goto done;
|
||||
}
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s Generated auto-cli for module:%s",
|
||||
__FUNCTION__, yang_argument_get(ymod));
|
||||
/* Add prefix: assume new are appended */
|
||||
for (i=0; i<pt_len_get(pt); i++){
|
||||
if ((co = pt_vec_i_get(pt, i)) != NULL)
|
||||
if ((co = pt_vec_i_get(pt, i)) != NULL){
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s command: %s",
|
||||
__FUNCTION__, co->co_command);
|
||||
co_prefix_set(co, prefix);
|
||||
}
|
||||
}
|
||||
/* Post-processing, iterate over the generated cligen parse-tree with corresponding yang
|
||||
* Note cannot do it inline in yang2cli above since:
|
||||
|
|
@ -1435,7 +1440,7 @@ yang2cli_yspec(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
// pt_print(stderr,pt);
|
||||
clicon_debug(1, "%s Generated auto-cli for %s", __FUNCTION__, yang_argument_get(ymod));
|
||||
|
||||
if (printgen)
|
||||
clicon_log(LOG_NOTICE, "%s: Top-level cli-spec %s:\n%s",
|
||||
__FUNCTION__, treename, cbuf_get(cb));
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
*/
|
||||
|
||||
/*! Registered RPC callback function
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xn Request: <rpc><xn></rpc>
|
||||
* @param[out] cbret Return xml tree, eg <rpc-reply>..., <rpc-error..
|
||||
|
|
@ -69,6 +70,7 @@ typedef int (*clicon_rpc_cb)(
|
|||
);
|
||||
|
||||
/*! Registered Upgrade callback function
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xn XML tree to be updated
|
||||
* @param[in] ns Namespace of module
|
||||
|
|
@ -178,9 +180,9 @@ typedef int (plgextension_t)(clicon_handle h, yang_stmt *yext, yang_stmt *ys);
|
|||
* @param[out] authp NULL: Credentials failed, no user set (401 returned).
|
||||
* String: Credentials OK, the associated user, must be mallloc:ed
|
||||
* Parameter signtificant only if retval is 1/OK
|
||||
* @retval -1 Fatal error
|
||||
* @retval 0 Ignore, undecided, not handled, same as no callback
|
||||
* @retval 1 OK, see authp parameter for result.
|
||||
* @retval 0 Ignore, undecided, not handled, same as no callback
|
||||
* @retval -1 Fatal error
|
||||
* @note If authp returns string, it should be malloced
|
||||
*
|
||||
* @note user should be freed by caller
|
||||
|
|
@ -198,8 +200,8 @@ typedef int (plgauth_t)(clicon_handle h, void *req, clixon_auth_type_t auth_type
|
|||
* flags etc.
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] db Database name (eg "running")
|
||||
* @retval -1 Fatal error
|
||||
* @retval 0 OK
|
||||
* @retval -1 Fatal error
|
||||
*/
|
||||
typedef int (plgreset_t)(clicon_handle h, const char *db);
|
||||
|
||||
|
|
@ -215,8 +217,8 @@ typedef int (plgreset_t)(clicon_handle h, const char *db);
|
|||
* @param[in] xpath Part of state requested
|
||||
* @param[in] nsc XPATH namespace context.
|
||||
* @param[out] xtop XML tree where statedata is added
|
||||
* @retval -1 Fatal error
|
||||
* @retval 0 OK
|
||||
* @retval -1 Fatal error
|
||||
*
|
||||
* @note The system will make an xpath check and filter out non-matching trees
|
||||
* @note The system does not validate the xml, unless CLICON_VALIDATE_STATE_XML is set
|
||||
|
|
@ -231,12 +233,13 @@ typedef int (plgstatedata_t)(clicon_handle h, cvec *nsc, char *xpath, cxobj *xto
|
|||
typedef void *pagination_data;
|
||||
|
||||
/*! Lock database 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 0 OK
|
||||
* @retval -1 Fatal error
|
||||
*/
|
||||
typedef int (plglockdb_t)(clicon_handle h, char *db, int lock, int id);
|
||||
|
||||
|
|
@ -264,8 +267,8 @@ typedef char *(cli_prompthook_t)(clicon_handle, char *mode);
|
|||
* @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
|
||||
*/
|
||||
typedef int (datastore_upgrade_t)(clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
|
||||
|
|
@ -423,6 +426,7 @@ typedef struct {
|
|||
*/
|
||||
|
||||
/*! Plugin initialization function. Must appear in all plugins, not a clixon system function
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @retval api Pointer to API struct
|
||||
* @retval NULL Failure (if clixon_err() called), module disabled otherwise.
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ clicon_strsep(char *string,
|
|||
}
|
||||
|
||||
/*! Concatenate elements of a string array into a string.
|
||||
*
|
||||
* An optional delimiter string can be specified which will be inserted betwen
|
||||
* each element.
|
||||
* @retval str Joined string. Free after use.
|
||||
|
|
@ -150,6 +151,7 @@ clicon_strjoin(int argc,
|
|||
}
|
||||
|
||||
/*! Join two string with delimiter.
|
||||
*
|
||||
* @param[in] str1 string 1 (will be freed) (optional)
|
||||
* @param[in] del delimiter string (not freed) cannot be NULL (but "")
|
||||
* @param[in] str2 string 2 (not freed) mandatory
|
||||
|
|
@ -186,6 +188,7 @@ clixon_string_del_join(char *str1,
|
|||
}
|
||||
|
||||
/*! Split a string once into two parts: prefix and suffix
|
||||
*
|
||||
* @param[in] string
|
||||
* @param[in] delim
|
||||
* @param[out] prefix If non-NULL, return malloced string, or NULL.
|
||||
|
|
@ -263,6 +266,7 @@ uri_unreserved(unsigned char in)
|
|||
}
|
||||
|
||||
/*! Percent encoding according to RFC 3986 URI Syntax
|
||||
*
|
||||
* @param[out] encp Encoded malloced output string
|
||||
* @param[in] fmt Not-encoded input string (stdarg format string)
|
||||
* @param[in] ... stdarg variable parameters
|
||||
|
|
@ -334,6 +338,7 @@ uri_percent_encode(char **encp,
|
|||
}
|
||||
|
||||
/*! Percent decoding according to RFC 3986 URI Syntax
|
||||
*
|
||||
* @param[in] enc Encoded input string
|
||||
* @param[out] strp Decoded malloced output string. Deallocate with free()
|
||||
* @retval 0 OK
|
||||
|
|
@ -388,6 +393,7 @@ uri_percent_decode(char *enc,
|
|||
}
|
||||
|
||||
/*! Encode escape characters according to XML definition
|
||||
*
|
||||
* @param[out] encp Encoded malloced output string
|
||||
* @param[in] fmt Not-encoded input string (stdarg format string)
|
||||
* @param[in] ... stdarg variable parameters
|
||||
|
|
@ -534,6 +540,7 @@ xml_chardata_encode(char **escp,
|
|||
}
|
||||
|
||||
/*! Escape characters according to XML definition and append to cbuf
|
||||
*
|
||||
* @param[in] cb CLIgen buf
|
||||
* @param[in] str Not-encoded input string
|
||||
* @retdata 0 OK
|
||||
|
|
@ -661,6 +668,7 @@ xml_chardata_decode_ampersand(char *str,
|
|||
}
|
||||
|
||||
/*! Decode escape characters according to XML definition
|
||||
*
|
||||
* @param[out] decp Decoded malloced output string
|
||||
* @param[in] fmt Encoded input string (stdarg format string)
|
||||
* @see xml_chardata_encode for encoding
|
||||
|
|
@ -834,6 +842,7 @@ uri_str2cvec(char *string,
|
|||
}
|
||||
|
||||
/*! Map from int to string using str2int map
|
||||
*
|
||||
* @param[in] ms String, integer map
|
||||
* @param[in] i Input integer
|
||||
* @retval str String value
|
||||
|
|
@ -853,6 +862,7 @@ clicon_int2str(const map_str2int *mstab,
|
|||
}
|
||||
|
||||
/*! Map from string to int using str2int map
|
||||
*
|
||||
* @param[in] ms String, integer map
|
||||
* @param[in] str Input string
|
||||
* @retval int Value
|
||||
|
|
@ -872,14 +882,15 @@ clicon_str2int(const map_str2int *mstab,
|
|||
}
|
||||
|
||||
/*! Map from string to int using binary (alphatical) search
|
||||
*
|
||||
* @param[in] ms String, integer map
|
||||
* @param[in] str Input string
|
||||
* @param[in] low Lower bound index
|
||||
* @param[in] upper Upper bound index
|
||||
* @param[in] len Length of array (max)
|
||||
* @param[out] found Integer found (can also be negative)
|
||||
* @retval 0 Not found
|
||||
* @retval 1 Found with "found" value set.
|
||||
* @retval 1 Found with "found" value set.
|
||||
* @retval 0 Not found
|
||||
* @note Assumes sorted strings, tree search
|
||||
*/
|
||||
static int
|
||||
|
|
@ -911,6 +922,7 @@ str2int_search1(const map_str2int *mstab,
|
|||
}
|
||||
|
||||
/*! Map from string to int using str2int map
|
||||
*
|
||||
* @param[in] ms String, integer map
|
||||
* @param[in] str Input string
|
||||
* @retval int Value
|
||||
|
|
@ -931,6 +943,7 @@ clicon_str2int_search(const map_str2int *mstab,
|
|||
}
|
||||
|
||||
/*! Map from string to string using str2str map
|
||||
*
|
||||
* @param[in] mstab String, string map
|
||||
* @param[in] str Input string
|
||||
* @retval str Output string
|
||||
|
|
@ -949,6 +962,7 @@ clicon_str2str(const map_str2str *mstab,
|
|||
}
|
||||
|
||||
/*! Split colon-separated node identifier into prefix and name
|
||||
*
|
||||
* @param[in] node-id
|
||||
* @param[out] prefix If non-NULL, return malloced string, or NULL.
|
||||
* @param[out] id If non-NULL, return malloced identifier.
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ yang_argument_get(yang_stmt *ys)
|
|||
*/
|
||||
/*! Set yang argument, not not copied
|
||||
* @param[in] ys Yang statement node
|
||||
* @param[in] arg Argument
|
||||
* @param[in] arg Argument, note must be malloced
|
||||
* Typically only done at parsing / initiation
|
||||
*/
|
||||
int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue