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

@ -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)

View file

@ -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;

View file

@ -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

View file

@ -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));