diff --git a/CHANGELOG.md b/CHANGELOG.md
index 838ccf64..2a31af71 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -45,6 +45,14 @@
## 6.5.0
Expected: December 2023
+### C/CLI-API changes on existing features
+Developers may need to change their code
+
+* Changed function name for `clicon_debug` functions. You need to rename as follows:
+ * clicon_debug() -> clixon_debug()
+ * clicon_debug_init() -> clixon_debug_init()
+ * clicon_debug_get() -> clixon_debug_get()
+
### Corrected Bugs
* Fixed: [Does clixon cli support autocompletion for leafrefs pointed to another module?](https://github.com/clicon/clixon/issues/455)
diff --git a/apps/backend/backend_client.c b/apps/backend/backend_client.c
index a1381d07..ab8d0b6c 100644
--- a/apps/backend/backend_client.c
+++ b/apps/backend/backend_client.c
@@ -104,8 +104,8 @@ ce_event_cb(clicon_handle h,
void *arg)
{
struct client_entry *ce = (struct client_entry *)arg;
-
- clicon_debug(1, "%s op:%d", __FUNCTION__, op);
+
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s op:%d", __FUNCTION__, op);
switch (op){
case 1:
/* Risk of recursion here */
@@ -140,7 +140,7 @@ ce_client_string(struct client_entry *ce,
int retval = -1;
cbuf *cb = NULL;
char *id = NULL;
-
+
if (ce == NULL || cbp == NULL){
clicon_err(OE_UNIX, EINVAL, "ce or cbp is NULL");
goto done;
@@ -273,7 +273,7 @@ backend_monitoring_state_get(clicon_handle h,
goto fail;
retval = 1;
done:
- clicon_debug(1, "%s %d", __FUNCTION__, retval);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
if (cb)
cbuf_free(cb);
return retval;
@@ -293,7 +293,7 @@ backend_monitoring_state_get(clicon_handle h,
* @see backend_client_delete for actual deallocation of client entry struct
*/
int
-backend_client_rm(clicon_handle h,
+backend_client_rm(clicon_handle h,
struct client_entry *ce)
{
struct client_entry *c;
@@ -311,10 +311,10 @@ backend_client_rm(clicon_handle h,
if (if_feature(yspec, "ietf-netconf", "confirmed-commit")) {
if (confirmed_commit_state_get(h) == EPHEMERAL) {
/* See if this client is the origin */
- clicon_debug(1, "session_id: %u, confirmed_commit.session_id: %u", ce->ce_id, confirmed_commit_session_id_get(h));
+ clixon_debug(CLIXON_DBG_DEFAULT, "session_id: %u, confirmed_commit.session_id: %u", ce->ce_id, confirmed_commit_session_id_get(h));
if (myid == confirmed_commit_session_id_get(h)) {
- clicon_debug(1, "ok, rolling back");
+ clixon_debug(CLIXON_DBG_DEFAULT, "ok, rolling back");
clicon_log(LOG_NOTICE, "a client with an active ephemeral confirmed-commit has disconnected; rolling back");
/* do_rollback errors are logged internally and there is no client to report errors to, so errors are
@@ -326,7 +326,7 @@ backend_client_rm(clicon_handle h,
}
}
- clicon_debug(1, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
/* for all streams: XXX better to do it top-level? */
stream_ss_delete_all(h, ce_event_cb, (void*)ce);
c0 = backend_client_list(h);
@@ -367,8 +367,8 @@ clixon_stats_datastore_get(clicon_handle h,
uint64_t nr = 0;
size_t sz = 0;
cxobj *xn = NULL;
-
- clicon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, dbname);
+
+ clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, dbname);
/* This is the db cache */
if ((xt = xmldb_cache_get(h, dbname)) == NULL){
/* Trigger cache if no exist (trick to ensure cache is present) */
@@ -409,7 +409,7 @@ clixon_stats_module_get(clicon_handle h,
uint64_t nr = 0;
size_t sz = 0;
cxobj *xn = NULL;
-
+
if (ys == NULL)
return 0;
if (yang_stats(ys, &nr, &sz) < 0)
@@ -439,7 +439,7 @@ clixon_stats_module_get(clicon_handle h,
* However, what really should be done is to apply the change to the datastore and then
* validate, if error, discard to previous state.
* But this could discard other previous changes to candidate.
- */
+ */
static int
from_client_edit_config(clicon_handle h,
cxobj *xn,
@@ -480,7 +480,7 @@ from_client_edit_config(clicon_handle h,
if ((cbx = cbuf_new()) == NULL){
clicon_err(OE_XML, errno, "cbuf_new");
goto done;
- }
+ }
/* Check if target locked by other client */
iddb = xmldb_islocked(h, target);
if (iddb && myid != iddb){
@@ -645,22 +645,21 @@ from_client_edit_config(clicon_handle h,
xml_free(xret);
if (cbx)
cbuf_free(cbx);
- clicon_debug(1, "%s done cbret:%s", __FUNCTION__, cbuf_get(cbret));
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s done cbret:%s", __FUNCTION__, cbuf_get(cbret));
return retval;
-
} /* from_client_edit_config */
/*! Create or replace an entire config with another complete config db
*
- * @param[in] h Clixon handle
- * @param[in] xe Request:
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., only exec permission
- * else:
+ * else:
* - omit data nodes to which the client does not have read access
* - access denied if user lacks create/delete/update
*/
@@ -679,7 +678,7 @@ from_client_copy_config(clicon_handle h,
uint32_t myid = ce->ce_id;
cbuf *cbx = NULL; /* Assist cbuf */
cbuf *cbmsg = NULL;
-
+
if ((source = netconf_db_find(xe, "source")) == NULL){
if (netconf_missing_element(cbret, "protocol", "source", NULL) < 0)
goto done;
@@ -688,7 +687,7 @@ from_client_copy_config(clicon_handle h,
if ((cbx = cbuf_new()) == NULL){
clicon_err(OE_XML, errno, "cbuf_new");
goto done;
- }
+ }
if ((target = netconf_db_find(xe, "target")) == NULL){
if (netconf_missing_element(cbret, "protocol", "target", NULL) < 0)
goto done;
@@ -727,10 +726,10 @@ from_client_copy_config(clicon_handle h,
/*! Delete a configuration datastore.
*
* @param[in] h Clixon handle
- * @param[in] xe Request:
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ...,
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ...,
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., ", NETCONF_BASE_NAMESPACE) < 0)
goto done;
@@ -959,7 +958,7 @@ from_client_unlock(clicon_handle h,
/*! Request graceful termination of a NETCONF session.
*
- * @param[in] h Clixon handle
+ * @param[in] h Clixon handle
* @param[in] xe Request:
* @param[out] cbret Return xml tree, eg ...,
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., ", NETCONF_BASE_NAMESPACE);
@@ -1043,11 +1042,11 @@ from_client_kill_session(clicon_handle h,
/*! Create a notification subscription
*
- * @param[in] h Clixon handle
- * @param[in] xe Request:
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., is not present, this is not a replay
* subscription.
* Schedule the replay to occur right after this RPC completes, eg "now"
*/
- if (starttime){
+ if (starttime){
if (stream_replay_trigger(h, stream, ce_event_cb, (void*)ce) < 0)
goto done;
}
@@ -1143,7 +1142,7 @@ from_client_create_subscription(clicon_handle h,
/*! Retrieve a schema from the NETCONF server.
*
- * @param[in] h Clixon handle
+ * @param[in] h Clixon handle
* @param[in] xe Request:
* @param[out] cbret Return xml tree, eg ...,
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., ", NETCONF_BASE_NAMESPACE);
ok:
retval = 0;
@@ -1304,11 +1303,11 @@ from_client_debug(clicon_handle h,
/*! Check liveness of backend daemon, just send a reply
*
- * @param[in] h Clixon handle
- * @param[in] xe Request:
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ...,
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., %s", yang_argument_get(ym));
if (clixon_stats_module_get(h, ym, cbret) < 0)
goto done;
@@ -1418,11 +1417,11 @@ from_client_stats(clicon_handle h,
/*! Request restart of specific plugins
*
- * @param[in] h Clixon handle
- * @param[in] xe Request:
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ...,
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., ce_id != op_id && strcmp(rpcname, "create-subscription")){
- clicon_debug(1, "%s Warning: incoming session-id:%u does not match ce_id:%u on socket: %d", __FUNCTION__, op_id, ce->ce_id, ce->ce_s);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s Warning: incoming session-id:%u does not match ce_id:%u on socket: %d", __FUNCTION__, op_id, ce->ce_id, ce->ce_s);
}
/* Note that this validation is also made in xml_yang_validate_rpc, but not for hello
*/
@@ -1707,7 +1706,7 @@ from_client_msg(clicon_handle h,
goto done;
}
module = yang_argument_get(ymod);
- clicon_debug(CLIXON_DBG_DEFAULT, "%s module:%s rpc:%s ce_id:%u s:%d", __FUNCTION__, module,
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s module:%s rpc:%s ce_id:%u s:%d", __FUNCTION__, module,
rpc, ce->ce_id, ce->ce_s);
/* Pre-NACM access step */
xnacm = NULL;
@@ -1773,7 +1772,7 @@ from_client_msg(clicon_handle h,
if (cbuf_len(cbret) == 0)
if (netconf_operation_failed(cbret, "application", clicon_errno?clicon_err_reason:"unknown")< 0)
goto done;
- // XXX clicon_debug(CLIXON_DBG_MSG, "Reply:%s", cbuf_get(cbret));
+ // XXX clixon_debug(CLIXON_DBG_MSG, "Reply:%s", cbuf_get(cbret));
/* XXX problem here is that cbret has not been parsed so may contain
parse errors */
if (ce_client_string(ce, &cbce) < 0)
@@ -1797,8 +1796,8 @@ from_client_msg(clicon_handle h,
}
// ok:
retval = 0;
- done:
- clicon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
+ done:
+ clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
if (xnacm){
xml_free(xnacm);
if (clicon_nacm_cache_set(h, NULL) < 0)
@@ -1813,10 +1812,10 @@ from_client_msg(clicon_handle h,
if (cbret)
cbuf_free(cbret);
/* Sanity: log if clicon_err() is not called ! */
- if (retval < 0 && clicon_errno < 0)
+ if (retval < 0 && clicon_errno < 0)
clicon_log(LOG_NOTICE, "%s: Internal error: No clicon_err call on RPC error (message: %s)",
__FUNCTION__, rpc?rpc:"");
- // clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
+ // clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
return retval;// -1 here terminates backend
}
@@ -1829,7 +1828,7 @@ from_client_msg(clicon_handle h,
* propagated back to client.
*/
int
-from_client(int s,
+from_client(int s,
void* arg)
{
int retval = -1;
@@ -1839,7 +1838,7 @@ from_client(int s,
int eof = 0;
cbuf *cbce = NULL;
- clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
if (s != ce->ce_s){
clicon_err(OE_NETCONF, EINVAL, "Internal error: s != ce->ce_s");
goto done;
@@ -1849,7 +1848,7 @@ from_client(int s,
if (clicon_msg_rcv(ce->ce_s, cbuf_get(cbce), 0, &msg, &eof) < 0)
goto done;
if (eof){
- backend_client_rm(h, ce);
+ backend_client_rm(h, ce);
netconf_monitoring_counter_inc(h, "dropped-sessions");
}
else
@@ -1857,7 +1856,7 @@ from_client(int s,
goto done;
retval = 0;
done:
- clicon_debug(CLIXON_DBG_DETAIL, "%s retval=%d", __FUNCTION__, retval);
+ clixon_debug(CLIXON_DBG_DETAIL, "%s retval=%d", __FUNCTION__, retval);
if (cbce)
cbuf_free(cbce);
if (msg)
diff --git a/apps/backend/backend_client.h b/apps/backend/backend_client.h
index 590d024b..5d2547c9 100644
--- a/apps/backend/backend_client.h
+++ b/apps/backend/backend_client.h
@@ -39,7 +39,7 @@
/*
* Prototypes
- */
+ */
int backend_monitoring_state_get(clicon_handle h, yang_stmt *yspec, char *xpath, cvec *nsc, cxobj **xret, cxobj **xerr);
int backend_client_rm(clicon_handle h, struct client_entry *ce);
int from_client(int fd, void *arg);
diff --git a/apps/backend/backend_commit.c b/apps/backend/backend_commit.c
index f7f578df..a61dc4d1 100644
--- a/apps/backend/backend_commit.c
+++ b/apps/backend/backend_commit.c
@@ -102,7 +102,7 @@ generic_validate(clicon_handle h,
cbuf *cb = NULL;
/* All entries */
- if ((ret = xml_yang_validate_all_top(h, td->td_target, xret)) < 0)
+ if ((ret = xml_yang_validate_all_top(h, td->td_target, xret)) < 0)
goto done;
if (ret == 0)
goto fail;
@@ -135,10 +135,11 @@ generic_validate(clicon_handle h,
}
/*! Common startup validation
+ *
* Get db, upgrade it w potential transformed XML, populate it w yang spec,
* sort it, validate it by triggering a transaction
* and call application callback validations.
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] db The startup database. The wanted backend state
* @param[in] td Transaction data
* @param[out] cbret CLIgen buffer w error stmt if retval = 0
@@ -157,7 +158,7 @@ generic_validate(clicon_handle h,
* @see validate_common for incoming validate/commit
*/
static int
-startup_common(clicon_handle h,
+startup_common(clicon_handle h,
char *db,
transaction_data_t *td,
cbuf *cbret)
@@ -177,7 +178,7 @@ startup_common(clicon_handle h,
if (clicon_option_bool(h, "CLICON_XMLDB_MODSTATE"))
if ((msdiff = modstate_diff_new()) == NULL)
goto done;
- clicon_debug(1, "Reading initial config from %s", db);
+ clixon_debug(CLIXON_DBG_DEFAULT, "Reading initial config from %s", db);
/* Get the startup datastore WITHOUT binding to YANG, sorting and default setting.
* It is done below, later in this function
*/
@@ -189,7 +190,7 @@ startup_common(clicon_handle h,
if (clicon_quit_upgrade_get(h) == 1){
xml_print(stderr, xerr);
clicon_err(OE_XML, 0, "invalid configuration before upgrade");
- exit(0); /* This is fairly abrupt , but need to avoid side-effects of rewinding
+ exit(0); /* This is fairly abrupt , but need to avoid side-effects of rewinding
* See similar clause below
*/
}
@@ -202,7 +203,7 @@ startup_common(clicon_handle h,
if (xmldb_get0(h, db, YB_NONE, NULL, "/", 0, 0, &xt, msdiff, &xerr) < 0)
goto done;
}
- clicon_debug_xml(CLIXON_DBG_DETAIL, xt, "startup");
+ clixon_debug_xml(CLIXON_DBG_DETAIL, xt, "startup");
if (msdiff && msdiff->md_status == 0){ // Possibly check for CLICON_XMLDB_MODSTATE
clicon_log(LOG_WARNING, "Modstate expected in startup datastore but not found\n"
"This may indicate that the datastore is not initialized corrrectly, such as copy/pasted.\n"
@@ -212,7 +213,7 @@ startup_common(clicon_handle h,
clicon_err(OE_YANG, 0, "Yang spec not set");
goto done;
}
- clicon_debug(1, "Reading startup config done");
+ clixon_debug(CLIXON_DBG_DEFAULT, "Reading startup config done");
/* Clear flags xpath for get */
xml_apply0(xt, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset,
(void*)(XML_FLAG_MARK|XML_FLAG_CHANGE));
@@ -253,7 +254,7 @@ startup_common(clicon_handle h,
stack. Alternative is to make a separate function stack for this. */
}
/* If empty skip. Note upgrading can add children, so it may be empty before that. */
- if (xml_child_nr(xt) == 0){
+ if (xml_child_nr(xt) == 0){
td->td_target = xt;
xt = NULL;
goto ok;
@@ -264,7 +265,7 @@ startup_common(clicon_handle h,
if (ret == 0){
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
- goto fail;
+ goto fail;
}
/* After upgrade check no state data */
if ((ret = xml_non_config_data(xt, &xret)) < 0)
@@ -272,7 +273,7 @@ startup_common(clicon_handle h,
if (ret == 0){
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
goto done;
- goto fail;
+ goto fail;
}
/* Sort xml */
if (xml_sort_recurse(xt) < 0)
@@ -283,7 +284,7 @@ startup_common(clicon_handle h,
/* Apply default values (removed in clear function) */
if (xml_default_recurse(xt, 0) < 0)
goto done;
-
+
/* Handcraft transition with with only add tree */
td->td_target = xt;
xt = NULL;
@@ -291,7 +292,7 @@ startup_common(clicon_handle h,
while ((x = xml_child_each(td->td_target, x, CX_ELMNT)) != NULL){
xml_flag_set(x, XML_FLAG_ADD); /* Also down */
xml_apply(x, CX_ELMNT, (xml_applyfn_t*)xml_flag_set, (void*)XML_FLAG_ADD);
- if (cxvec_append(x, &td->td_avec, &td->td_alen) < 0)
+ if (cxvec_append(x, &td->td_avec, &td->td_alen) < 0)
goto done;
}
@@ -301,7 +302,7 @@ startup_common(clicon_handle h,
/* 5. Make generic validation on all new or changed data.
Note this is only call that uses 3-values */
- clicon_debug(1, "Validating startup %s", db);
+ clixon_debug(CLIXON_DBG_DEFAULT, "Validating startup %s", db);
if ((ret = generic_validate(h, yspec, td, &xret)) < 0)
goto done;
if (ret == 0){
@@ -328,14 +329,14 @@ startup_common(clicon_handle h,
if (msdiff)
modstate_diff_free(msdiff);
return retval;
- fail:
+ fail:
retval = 0;
goto done;
}
/*! Read startup db, check upgrades and validate it, return upgraded XML
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] db The startup database. The wanted backend state
* @param[out] xtr (Potentially) transformed XML
* @param[out] cbret CLIgen buffer w error stmt if retval = 0
@@ -344,7 +345,7 @@ startup_common(clicon_handle h,
* @retval -1 Error - or validation failed (but cbret not set)
*/
int
-startup_validate(clicon_handle h,
+startup_validate(clicon_handle h,
char *db,
cxobj **xtr,
cbuf *cbret)
@@ -369,7 +370,7 @@ startup_validate(clicon_handle h,
if (xmldb_get0_clear(h, td->td_target) < 0)
goto done;
if (xtr){
- *xtr = td->td_target;
+ *xtr = td->td_target;
td->td_target = NULL;
}
retval = 1;
@@ -386,7 +387,7 @@ startup_validate(clicon_handle h,
/*! Read startup db, check upgrades and commit it
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] db The startup database. The wanted backend state
* @param[out] cbret CLIgen buffer w error stmt if retval = 0
* @retval 1 Validation OK
@@ -395,7 +396,7 @@ startup_validate(clicon_handle h,
* Only called from startup_mode_startup
*/
int
-startup_commit(clicon_handle h,
+startup_commit(clicon_handle h,
char *db,
cbuf *cbret)
{
@@ -426,7 +427,7 @@ startup_commit(clicon_handle h,
/* [Delete and] create running db */
if (xmldb_exists(h, "running") == 1){
- if (xmldb_delete(h, "running") != 0 && errno != ENOENT)
+ if (xmldb_delete(h, "running") != 0 && errno != ENOENT)
goto done;;
}
if (xmldb_create(h, "running") < 0)
@@ -463,9 +464,10 @@ startup_commit(clicon_handle h,
}
/*! Validate a candidate db and comnpare to running
+ *
* Get both source and dest datastore, validate target, compute diffs
* and call application callback validations.
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] db The (candidate) database. The wanted backend state
* @param[in] td Transaction data
* @param[out] xret Error XML tree, if retval is 0. Free with xml_free after use
@@ -477,7 +479,7 @@ startup_commit(clicon_handle h,
* @see startup_common for startup scenario
*/
static int
-validate_common(clicon_handle h,
+validate_common(clicon_handle h,
char *db,
transaction_data_t *td,
cxobj **xret)
@@ -487,11 +489,11 @@ validate_common(clicon_handle h,
int i;
cxobj *xn;
int ret;
-
+
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clicon_err(OE_FATAL, 0, "No DB_SPEC");
goto done;
- }
+ }
/* This is the state we are going to */
if ((ret = xmldb_get0(h, db, YB_MODULE, NULL, "/", 0, 0, &td->td_target, NULL, xret)) < 0)
goto done;
@@ -500,7 +502,7 @@ validate_common(clicon_handle h,
/* Clear flags xpath for get */
xml_apply0(td->td_target, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset,
(void*)(XML_FLAG_MARK|XML_FLAG_CHANGE));
- /* 2. Parse xml trees
+ /* 2. Parse xml trees
* This is the state we are going from */
if ((ret = xmldb_get0(h, "running", YB_MODULE, NULL, "/", 0, 0, &td->td_src, NULL, xret)) < 0)
goto done;
@@ -520,7 +522,7 @@ validate_common(clicon_handle h,
&td->td_tcvec, /* changed: wanted values */
&td->td_clen) < 0)
goto done;
- if (clicon_debug_get() & CLIXON_DBG_DETAIL)
+ if (clixon_debug_get() & CLIXON_DBG_DETAIL)
transaction_dbg(h, CLIXON_DBG_DETAIL, td, __FUNCTION__);
/* Mark as changed in tree */
for (i=0; itd_dlen; i++){ /* Also down */
@@ -571,7 +573,7 @@ validate_common(clicon_handle h,
/*! Start a validate transaction
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] db A candidate database, typically "candidate" but not necessarily so
* @param[out] cbret CLIgen buffer w error stmt if retval = 0
* @retval 1 Validation OK
@@ -579,7 +581,7 @@ validate_common(clicon_handle h,
* @retval -1 Error - or validation failed
*/
int
-candidate_validate(clicon_handle h,
+candidate_validate(clicon_handle h,
char *db,
cbuf *cbret)
{
@@ -587,8 +589,8 @@ candidate_validate(clicon_handle h,
transaction_data_t *td = NULL;
cxobj *xret = NULL;
int ret;
-
- clicon_debug(1, "%s", __FUNCTION__);
+
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
if (db == NULL || cbret == NULL){
clicon_err(OE_CFG, EINVAL, "db or cbret is NULL");
goto done;
@@ -647,7 +649,7 @@ candidate_validate(clicon_handle h,
* The code reverts changes if the commit fails. But if the revert
* fails, we just ignore the errors and proceed. Maybe we should
* do something more drastic?
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] xe Request: (or NULL)
* @param[in] db A candidate database, not necessarily "candidate"
* @param[in] myid Client id of triggering incoming message (or 0)
@@ -658,7 +660,7 @@ candidate_validate(clicon_handle h,
* @retval -1 Error - or validation failed
*/
int
-candidate_commit(clicon_handle h,
+candidate_commit(clicon_handle h,
cxobj *xe,
char *db,
uint32_t myid,
@@ -713,7 +715,7 @@ candidate_commit(clicon_handle h,
/* After commit, make a post-commit call (sure that all plugins have committed) */
if (plugin_transaction_commit_done_all(h, td) < 0)
goto done;
-
+
/* Clear cached trees from default values and marking */
if (xmldb_get0_clear(h, td->td_target) < 0)
goto done;
@@ -738,7 +740,6 @@ candidate_commit(clicon_handle h,
/* 9. Call plugin transaction end callbacks */
plugin_transaction_end_all(h, td);
-
retval = 1;
done:
/* In case of failure (or error), call plugin transaction termination callbacks */
@@ -759,11 +760,11 @@ candidate_commit(clicon_handle h,
/*! Commit the candidate configuration as the device's new current configuration
*
- * @param[in] h Clicon handle
- * @param[in] xe Request:
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ...,
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., ce_id;
uint32_t iddb;
cbuf *cbx = NULL; /* Assist cbuf */
-
+
/* Check if target locked by other client */
iddb = xmldb_islocked(h, "candidate");
if (iddb && myid != iddb){
if ((cbx = cbuf_new()) == NULL){
clicon_err(OE_XML, errno, "cbuf_new");
goto done;
- }
+ }
cprintf(cbx, "%u", iddb);
if (netconf_lock_denied(cbret, cbuf_get(cbx), "Operation failed, lock is already held") < 0)
goto done;
@@ -890,11 +890,12 @@ from_client_discard_changes(clicon_handle h,
}
/*! Validates the contents of the specified configuration.
- * @param[in] h Clicon handle
- * @param[in] xe Request:
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., cc_persist_id != NULL)
@@ -130,7 +131,7 @@ enum confirmed_commit_state
confirmed_commit_state_get(clicon_handle h)
{
struct confirmed_commit *cc = NULL;
-
+
clicon_ptr_get(h, "confirmed-commit-struct", (void**)&cc);
return cc->cc_state;
}
@@ -140,7 +141,7 @@ confirmed_commit_state_set(clicon_handle h,
enum confirmed_commit_state state)
{
struct confirmed_commit *cc = NULL;
-
+
clicon_ptr_get(h, "confirmed-commit-struct", (void**)&cc);
cc->cc_state = state;
return 0;
@@ -150,7 +151,7 @@ char *
confirmed_commit_persist_id_get(clicon_handle h)
{
struct confirmed_commit *cc = NULL;
-
+
clicon_ptr_get(h, "confirmed-commit-struct", (void**)&cc);
return cc->cc_persist_id;
}
@@ -160,7 +161,7 @@ confirmed_commit_persist_id_set(clicon_handle h,
char *persist_id)
{
struct confirmed_commit *cc = NULL;
-
+
clicon_ptr_get(h, "confirmed-commit-struct", (void**)&cc);
if (cc->cc_persist_id)
free(cc->cc_persist_id);
@@ -179,7 +180,7 @@ uint32_t
confirmed_commit_session_id_get(clicon_handle h)
{
struct confirmed_commit *cc = NULL;
-
+
clicon_ptr_get(h, "confirmed-commit-struct", (void**)&cc);
return cc->cc_session_id;
}
@@ -189,7 +190,7 @@ confirmed_commit_session_id_set(clicon_handle h,
uint32_t session_id)
{
struct confirmed_commit *cc = NULL;
-
+
clicon_ptr_get(h, "confirmed-commit-struct", (void**)&cc);
cc->cc_session_id = session_id;
return 0;
@@ -201,7 +202,7 @@ confirmed_commit_fn_arg_get(clicon_handle h,
void **arg)
{
struct confirmed_commit *cc = NULL;
-
+
clicon_ptr_get(h, "confirmed-commit-struct", (void**)&cc);
*fn = cc->cc_fn;
*arg = cc->cc_arg;
@@ -214,7 +215,7 @@ confirmed_commit_fn_arg_set(clicon_handle h,
void *arg)
{
struct confirmed_commit *cc = NULL;
-
+
clicon_ptr_get(h, "confirmed-commit-struct", (void**)&cc);
cc->cc_fn = fn;
cc->cc_arg = arg;
@@ -222,6 +223,7 @@ confirmed_commit_fn_arg_set(clicon_handle h,
}
/*! Return if confirmed tag found
+ *
* @param[in] xe Commit rpc xml
* @retval 1 Confirmed tag exists
* @retval 0 Confirmed tag does not exist
@@ -233,6 +235,7 @@ xe_confirmed(cxobj *xe)
}
/*! Return if persist exists and its string value field
+ *
* @param[in] xe Commit rpc xml
* @param[out] str Pointer to persist
* @retval 1 Persist field exists
@@ -274,6 +277,7 @@ xe_persist_id(cxobj *xe,
}
/*! Return timeout
+ *
* @param[in] xe Commit rpc xml
* @retval sec Timeout in seconds, can be 0 if no timeout exists or is zero
*/
@@ -282,7 +286,7 @@ xe_timeout(cxobj *xe)
{
cxobj *xml;
char *str;
-
+
if ((xml = xml_find_type(xe, NULL, "confirm-timeout", CX_ELMNT)) != NULL &&
(str = xml_body(xml)) != NULL)
return strtoul(str, NULL, 10);
@@ -293,7 +297,7 @@ xe_timeout(cxobj *xe)
*
* @param[in] h Clixon handle
* @retval 0 Rollback event successfully cancelled
- * @retval -1 No Rollback event was found
+ * @retval -1 No Rollback event was found
*/
int
cancel_rollback_event(clicon_handle h)
@@ -317,7 +321,7 @@ cancel_rollback_event(clicon_handle h)
* @param[in] fd a dummy argument per the event callback semantics
* @param[in] arg a void pointer to a clicon_handle
* @retval 0 the rollback was successful
- * @retval -1 the rollback failed
+ * @retval -1 the rollback failed
* @see do_rollback()
*/
static int
@@ -337,7 +341,7 @@ rollback_fn(int fd,
* @param[in] timeout a uint32 representing the number of seconds before the rollback event should fire
*
* @retval 0 Rollback event successfully scheduled
- * @retval -1 Rollback event was not scheduled
+ * @retval -1 Rollback event was not scheduled
*/
static int
schedule_rollback_event(clicon_handle h,
@@ -373,6 +377,7 @@ schedule_rollback_event(clicon_handle h,
}
/*! Cancel a confirming commit by removing rollback, and free state
+ *
* @param[in] h
* @param[out] cbret
* @retval 0 OK
@@ -401,12 +406,12 @@ cancel_confirmed_commit(clicon_handle h)
* without a value, OR
* 2) be presented with a value that matches the value accompanying the prior confirmed-commit
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] xe Request:
* @param[in] myid current client session-id
* @retval 1 The confirming-commit is valid
* @retval 0 The confirming-commit is not valid
- * @retval -1 Error
+ * @retval -1 Error
*/
static int
check_valid_confirming_commit(clicon_handle h,
@@ -452,7 +457,7 @@ check_valid_confirming_commit(clicon_handle h,
"not issued on the same session as the confirmed-commit");
goto invalid;
default:
- clicon_debug(1, "commit-confirmed state !? %d", confirmed_commit_state_get(h));
+ clixon_debug(CLIXON_DBG_DEFAULT, "commit-confirmed state !? %d", confirmed_commit_state_get(h));
goto invalid;
}
retval = 1; // valid
@@ -471,11 +476,11 @@ check_valid_confirming_commit(clicon_handle h,
* In the second phase, the action taken is to handle both confirming- and confirmed-commit by creating the
* rollback database as required, then deleting it once the sequence is complete.
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] xe Commit rpc xml or NULL
* @param[in] myid Current session-id, only valid > 0 if call is made as a result of an incoming message
* @retval 0 OK
- * @retval -1 Error
+ * @retval -1 Error
* @note There are some calls to this function where myid is 0 (which is invalid). It is unclear if such calls
* actually occur, and if so, if they are correctly handled. The calls are from do_rollback() and load_failsafe()
*/
@@ -622,9 +627,9 @@ handle_confirmed_commit(clicon_handle h,
* 2. from_client_cancel_commit() (invoked either by netconf client, or CLI)
* 3. rollback_fn() (invoked by expiration of the rollback event timer)
*
- * @param[in] h Clicon handle
- * @retval -1 Error
+ * @param[in] h Clixon handle
* @retval 0 Success
+ * @retval -1 Error
* @see backend_client_rm()
* @see from_client_cancel_commit()
* @see rollback_fn()
@@ -696,12 +701,13 @@ do_rollback(clicon_handle h,
}
/*! Cancel an ongoing confirmed commit.
+ *
* If the confirmed commit is persistent, the parameter 'persist-id' must be
* given, and it must match the value of the 'persist' parameter.
* If the confirmed-commit is ephemeral, the 'persist-id' must not be given and both the confirmed-commit and the
* cancel-commit must originate from the same session.
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] xe Request:
* @param[out] cbret Return xml tree, eg ...,
* @param[in] myid Client-id
* @param[out] cbret Return xml tree
diff --git a/apps/backend/backend_get.c b/apps/backend/backend_get.c
index 174d09fd..55291511 100644
--- a/apps/backend/backend_get.c
+++ b/apps/backend/backend_get.c
@@ -72,12 +72,15 @@
#include "backend_handle.h"
#include "backend_get.h"
-/*!
+/*! restrconf get capabilities
+ *
* Maybe should be in the restconf client instead of backend?
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] yspec Yang spec
* @param[in] xpath Xpath selection, not used but may be to filter early
* @param[out] xrs XML restconf-state node
+ * @retval 0 OK
+ * @retval -1 Error
* @see netconf_hello_server
* @see rfc8040 Sections 9.1
*/
@@ -114,7 +117,8 @@ restconf_client_get_capabilities(clicon_handle h,
}
/*! Get streams state according to RFC 8040 or RFC5277 common function
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] yspec Yang spec
* @param[in] xpath Xpath selection, not used but may be to filter early
* @param[in] module Name of yang module
@@ -176,7 +180,8 @@ client_get_streams(clicon_handle h,
}
/*! Get system state-data, including streams and plugins
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] xpath XPath selection, may be used to filter early
* @param[in] nsc XML Namespace context for xpath
* @param[in] wdef With-defaults parameter, see RFC 6243
@@ -213,7 +218,7 @@ get_statedata(clicon_handle h,
cbuf *cb = NULL;
cxobj *xerr = NULL;
- clicon_debug(1, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clicon_err(OE_YANG, ENOENT, "No yang spec");
goto done;
@@ -368,7 +373,7 @@ get_statedata(clicon_handle h,
} /* switch wdef */
retval = 1; /* OK */
done:
- clicon_debug(1, "%s %d", __FUNCTION__, retval);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
if (xerr)
xml_free(xerr);
if (x1)
@@ -390,7 +395,7 @@ get_statedata(clicon_handle h,
* and we need to re-add it.
* Note original xpath
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] yspec Yang spec
* @param[in] xret Result XML tree
* @param[in] xvec xpath lookup result on xret
@@ -438,7 +443,7 @@ filter_xpath_again(clicon_handle h,
/*! Help function for NACM access and return message
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] xret Result XML tree
* @param[in] xvec xpath lookup result on xret
* @param[in] xlen length of xvec
@@ -520,7 +525,7 @@ element2value(clicon_handle h,
/*! Extract offset and limit from get/list-pagination
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] xe Request:
* @param[out] offset Number of entries in the working result-set that should be skipped
* @param[out] limit Limits the number of entries returned from the working result-set
@@ -552,7 +557,7 @@ list_pagination_hdr(clicon_handle h,
*
* It is specialized enough to have its own function. Specifically, extra attributes as well
* as the list-paginaiton API
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] ce Client entry, for locking
* @param[in] xe Request:
* @param[in] content Get config/state/both
@@ -764,7 +769,7 @@ get_list_pagination(clicon_handle h,
if ((ret = xml_bind_yang(h, xret, YB_MODULE, yspec, &xerr)) < 0)
goto done;
if (ret == 0){
- clicon_debug_xml(1, xret, "Yang bind pagination state");
+ clixon_debug_xml(1, xret, "Yang bind pagination state");
if (clixon_netconf_internal_error(xerr,
". Internal error, state callback returned invalid XML",
NULL) < 0)
@@ -821,7 +826,7 @@ get_list_pagination(clicon_handle h,
/*! Common get/get-config code for retrieving configuration and state information.
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] ce Client entry, for locking
* @param[in] xe Request:
* @param[in] content Get config/state/both
@@ -867,7 +872,7 @@ get_common(clicon_handle h,
char *wdefstr;
wdef = WITHDEFAULTS_EXPLICIT;
- clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
username = clicon_username_get(h);
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clicon_err(OE_YANG, ENOENT, "No yang spec9");
@@ -1013,7 +1018,7 @@ get_common(clicon_handle h,
(ret = xml_yang_validate_add(h, xret, &xerr)) < 0)
goto done;
if (ret == 0){
- clicon_debug_xml(1, xret, "VALIDATE_STATE");
+ clixon_debug_xml(1, xret, "VALIDATE_STATE");
if (clixon_netconf_internal_error(xerr,
". Internal error, state callback returned invalid XML",
NULL) < 0)
@@ -1044,7 +1049,7 @@ get_common(clicon_handle h,
ok:
retval = 0;
done:
- clicon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
+ clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
if (xvec)
free(xvec);
if (xret)
@@ -1067,12 +1072,12 @@ get_common(clicon_handle h,
}
/*! Retrieve all or part of a specified configuration.
- *
- * @param[in] h Clicon handle
- * @param[in] xe Request:
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ...,
- * @param[out] cbret Return xml tree, eg ...,
+ * @param[out] cbret Return xml tree, eg ..., ca_daemon) != NULL){
@@ -212,7 +212,7 @@ clixon_plugin_daemon_one(clixon_plugin_t *cp,
if (fn(h) < 0) {
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
- if (clicon_errno < 0)
+ if (clicon_errno < 0)
clicon_log(LOG_WARNING, "%s: Internal error: Daemon callback in plugin: %s returned -1 but did not make a clicon_err call",
__FUNCTION__, clixon_plugin_name_get(cp));
goto done;
@@ -224,14 +224,14 @@ clixon_plugin_daemon_one(clixon_plugin_t *cp,
done:
return retval;
}
-
+
/*! Call all plugins "post-" daemonize callbacks
- *
+ *
* This point in time is after "start" and after "pre-daemon" and
* after daemonization/fork, ie when
* daemon is in the background but before dropped privileges.
* In case of foreground mode (-F) it is still called but no fork has occured.
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @retval 0 OK
* @retval -1 Error
* @note Also called for non-background mode
@@ -241,8 +241,8 @@ clixon_plugin_daemon_all(clicon_handle h)
{
int retval = -1;
clixon_plugin_t *cp = NULL;
-
- clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
+
+ clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
/* Loop through all plugins, call callbacks in each */
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
if (clixon_plugin_daemon_one(cp, h) < 0)
@@ -289,7 +289,7 @@ clixon_plugin_statedata_one(clixon_plugin_t *cp,
plgstatedata_t *fn; /* Plugin statedata fn */
cxobj *x = NULL;
void *wh = NULL;
-
+
if ((fn = clixon_plugin_api_get(cp)->ca_statedata) != NULL){
if ((x = xml_new(DATASTORE_TOP_SYMBOL, NULL, CX_ELMNT)) == NULL)
goto done;
@@ -299,7 +299,7 @@ clixon_plugin_statedata_one(clixon_plugin_t *cp,
if (fn(h, nsc, xpath, x) < 0){
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
- if (clicon_errno < 0)
+ if (clicon_errno < 0)
clicon_log(LOG_WARNING, "%s: Internal error: State callback in plugin: %s returned -1 but did not make a clicon_err call",
__FUNCTION__, clixon_plugin_name_get(cp));
goto fail; /* Dont quit here on user callbacks */
@@ -344,10 +344,10 @@ clixon_plugin_statedata_all(clicon_handle h,
int ret;
cxobj *x = NULL;
clixon_plugin_t *cp = NULL;
- cbuf *cberr = NULL;
+ cbuf *cberr = NULL;
cxobj *xerr = NULL;
-
- clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
+
+ clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
if ((ret = clixon_plugin_statedata_one(cp, h, nsc, xpath, &x)) < 0)
goto done;
@@ -373,7 +373,7 @@ clixon_plugin_statedata_all(clicon_handle h,
x = NULL;
continue;
}
- clicon_debug_xml(CLIXON_DBG_DETAIL, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp));
+ clixon_debug_xml(CLIXON_DBG_DETAIL, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp));
/* XXX: ret == 0 invalid yang binding should be handled as internal error */
if ((ret = xml_bind_yang(h, x, YB_MODULE, yspec, &xerr)) < 0)
goto done;
@@ -436,13 +436,13 @@ clixon_plugin_lockdb_one(clixon_plugin_t *cp,
int retval = -1;
plglockdb_t *fn; /* Plugin statedata fn */
void *wh = NULL;
-
+
if ((fn = clixon_plugin_api_get(cp)->ca_lockdb) != NULL){
wh = NULL;
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
if (fn(h, db, lock, id) < 0)
- goto done;
+ goto done;
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
}
@@ -470,12 +470,12 @@ clixon_plugin_lockdb_all(clicon_handle h,
{
int retval = -1;
clixon_plugin_t *cp = NULL;
-
- clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
+
+ clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
if (clixon_plugin_lockdb_one(cp, h, db, lock, id) < 0)
goto done;
- }
+ }
retval = 0;
done:
return retval;
@@ -485,6 +485,8 @@ clixon_plugin_lockdb_all(clicon_handle h,
*
* @param[in] h Clixon handle
* @param[in] xpath Registered XPath using canonical prefixes
+ * @retval 1 OK
+ * @retval -1 Error
*/
int
clixon_pagination_cb_call(clicon_handle h,
@@ -505,17 +507,19 @@ clixon_pagination_cb_call(clicon_handle h,
clicon_ptr_get(h, "pagination-entries", (void**)&htable);
if (htable && dispatcher_call_handlers(htable, h, xpath, &pd) < 0)
goto done;
- retval = 1;
+ retval = 1; // XXX 0?
done:
return retval;
}
-/*! Register a state data callback
- *
+/*! Register a state data callback
+ *
* @param[in] h Clixon handle
* @param[in] fn Callback
* @param[in] xpath Registered XPath using canonical prefixes
* @param[in] arg Domain-specific argument to send to callback
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
clixon_pagination_cb_register(clicon_handle h,
@@ -526,7 +530,7 @@ clixon_pagination_cb_register(clicon_handle h,
int retval = -1;
dispatcher_definition x = {xpath, fn, arg};
dispatcher_entry_t *htable = NULL;
-
+
clicon_ptr_get(h, "pagination-entries", (void**)&htable);
if (dispatcher_register_handler(&htable, &x) < 0){
clicon_err(OE_PLUGIN, errno, "dispatcher");
@@ -547,7 +551,7 @@ int
clixon_pagination_free(clicon_handle h)
{
dispatcher_entry_t *htable = NULL;
-
+
clicon_ptr_get(h, "pagination-entries", (void**)&htable);
if (htable)
dispatcher_free(htable);
@@ -579,7 +583,7 @@ transaction_new(void)
*
* @param[in] td Transaction data will be deallocated after the call
*/
-int
+int
transaction_free(transaction_data_t *td)
{
if (td->td_src)
@@ -608,13 +612,13 @@ transaction_free(transaction_data_t *td)
*/
int
plugin_transaction_begin_one(clixon_plugin_t *cp,
- clicon_handle h,
+ clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
trans_cb_t *fn;
void *wh = NULL;
-
+
if ((fn = clixon_plugin_api_get(cp)->ca_trans_begin) != NULL){
wh = NULL;
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
@@ -623,7 +627,7 @@ plugin_transaction_begin_one(clixon_plugin_t *cp,
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
if (!clicon_errno) /* sanity: log if clicon_err() is not called ! */
- clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
+ clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
__FUNCTION__, clixon_plugin_name_get(cp));
goto done;
}
@@ -639,19 +643,19 @@ plugin_transaction_begin_one(clixon_plugin_t *cp,
/*! Call transaction_begin() in all plugins before a validate/commit.
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] td Transaction data
* @retval 0 OK
* @retval -1 Error: one of the plugin callbacks returned error
*/
int
-plugin_transaction_begin_all(clicon_handle h,
+plugin_transaction_begin_all(clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
clixon_plugin_t *cp = NULL;
- clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
if (plugin_transaction_begin_one(cp, h, td) < 0)
goto done;
@@ -670,8 +674,8 @@ plugin_transaction_begin_all(clicon_handle h,
* @retval -1 Error
*/
int
-plugin_transaction_validate_one(clixon_plugin_t *cp,
- clicon_handle h,
+plugin_transaction_validate_one(clixon_plugin_t *cp,
+ clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
@@ -686,7 +690,7 @@ plugin_transaction_validate_one(clixon_plugin_t *cp,
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
if (!clicon_errno) /* sanity: log if clicon_err() is not called ! */
- clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
+ clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
__FUNCTION__, clixon_plugin_name_get(cp));
goto done;
@@ -701,13 +705,13 @@ plugin_transaction_validate_one(clixon_plugin_t *cp,
/*! Call transaction_validate callbacks in all backend plugins
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] td Transaction data
* @retval 0 OK. Validation succeeded in all plugins
* @retval -1 Error: one of the plugin callbacks returned validation fail
*/
int
-plugin_transaction_validate_all(clicon_handle h,
+plugin_transaction_validate_all(clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
@@ -732,14 +736,14 @@ plugin_transaction_validate_all(clicon_handle h,
* @retval -1 Error
*/
int
-plugin_transaction_complete_one(clixon_plugin_t *cp,
- clicon_handle h,
+plugin_transaction_complete_one(clixon_plugin_t *cp,
+ clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
trans_cb_t *fn;
void *wh = NULL;
-
+
if ((fn = clixon_plugin_api_get(cp)->ca_trans_complete) != NULL){
wh = NULL;
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
@@ -748,7 +752,7 @@ plugin_transaction_complete_one(clixon_plugin_t *cp,
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
if (!clicon_errno) /* sanity: log if clicon_err() is not called ! */
- clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
+ clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
__FUNCTION__, clixon_plugin_name_get(cp));
goto done;
}
@@ -762,7 +766,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] h Clixon handle
* @param[in] td Transaction data
* @retval 0 OK
* @retval -1 Error: one of the plugin callbacks returned error
@@ -770,7 +774,7 @@ plugin_transaction_complete_one(clixon_plugin_t *cp,
* @note Rename to transaction_complete?
*/
int
-plugin_transaction_complete_all(clicon_handle h,
+plugin_transaction_complete_all(clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
@@ -796,21 +800,21 @@ plugin_transaction_complete_all(clicon_handle h,
* plugin 2, then the revert will be made in plugins 1 and 0.
*/
static int
-plugin_transaction_revert_all(clicon_handle h,
+plugin_transaction_revert_all(clicon_handle h,
transaction_data_t *td,
int nr)
{
int retval = 0;
clixon_plugin_t *cp = NULL;
trans_cb_t *fn;
-
+
while ((cp = clixon_plugin_each_revert(h, cp, nr)) != NULL) {
if ((fn = clixon_plugin_api_get(cp)->ca_trans_revert) == NULL)
continue;
if ((retval = fn(h, (transaction_data)td)) < 0){
- clicon_log(LOG_NOTICE, "%s: Plugin '%s' trans_revert callback failed",
+ clicon_log(LOG_NOTICE, "%s: Plugin '%s' trans_revert callback failed",
__FUNCTION__, clixon_plugin_name_get(cp));
- break;
+ break;
}
}
return retval; /* ignore errors */
@@ -827,13 +831,13 @@ plugin_transaction_revert_all(clicon_handle h,
*/
int
plugin_transaction_commit_one(clixon_plugin_t *cp,
- clicon_handle h,
+ clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
trans_cb_t *fn;
void *wh = NULL;
-
+
if ((fn = clixon_plugin_api_get(cp)->ca_trans_commit) != NULL){
wh = NULL;
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
@@ -842,7 +846,7 @@ plugin_transaction_commit_one(clixon_plugin_t *cp,
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
if (!clicon_errno) /* sanity: log if clicon_err() is not called ! */
- clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
+ clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
__FUNCTION__, clixon_plugin_name_get(cp));
goto done;
}
@@ -856,7 +860,7 @@ plugin_transaction_commit_one(clixon_plugin_t *cp,
/*! Call transaction_commit callbacks in all backend plugins
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] td Transaction data
* @retval 0 OK
* @retval -1 Error: one of the plugin callbacks returned error
@@ -865,18 +869,18 @@ plugin_transaction_commit_one(clixon_plugin_t *cp,
* and in reverse order.
*/
int
-plugin_transaction_commit_all(clicon_handle h,
+plugin_transaction_commit_all(clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
clixon_plugin_t *cp = NULL;
int i=0;
-
+
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
i++;
if (plugin_transaction_commit_one(cp, h, td) < 0){
/* Make an effort to revert transaction */
- plugin_transaction_revert_all(h, td, i-1);
+ plugin_transaction_revert_all(h, td, i-1);
goto done;
}
}
@@ -894,14 +898,14 @@ plugin_transaction_commit_all(clicon_handle h,
* @retval -1 Error
*/
int
-plugin_transaction_commit_done_one(clixon_plugin_t *cp,
- clicon_handle h,
+plugin_transaction_commit_done_one(clixon_plugin_t *cp,
+ clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
trans_cb_t *fn;
void *wh = NULL;
-
+
if ((fn = clixon_plugin_api_get(cp)->ca_trans_commit_done) != NULL){
wh = NULL;
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
@@ -910,7 +914,7 @@ plugin_transaction_commit_done_one(clixon_plugin_t *cp,
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
if (!clicon_errno) /* sanity: log if clicon_err() is not called ! */
- clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
+ clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
__FUNCTION__, clixon_plugin_name_get(cp));
goto done;
}
@@ -924,14 +928,14 @@ 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] h Clixon handle
* @param[in] td Transaction data
* @retval 0 OK
* @retval -1 Error: one of the plugin callbacks returned error
* @note no revert is done
*/
int
-plugin_transaction_commit_done_all(clicon_handle h,
+plugin_transaction_commit_done_all(clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
@@ -955,14 +959,14 @@ plugin_transaction_commit_done_all(clicon_handle h,
* @retval -1 Error
*/
int
-plugin_transaction_end_one(clixon_plugin_t *cp,
- clicon_handle h,
+plugin_transaction_end_one(clixon_plugin_t *cp,
+ clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
trans_cb_t *fn;
void *wh = NULL;
-
+
if ((fn = clixon_plugin_api_get(cp)->ca_trans_end) != NULL){
wh = NULL;
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
@@ -971,7 +975,7 @@ plugin_transaction_end_one(clixon_plugin_t *cp,
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
if (!clicon_errno) /* sanity: log if clicon_err() is not called ! */
- clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
+ clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
__FUNCTION__, clixon_plugin_name_get(cp));
goto done;
}
@@ -985,7 +989,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] h Clixon handle
* @param[in] td Transaction data
* @retval 0 OK
* @retval -1 Error
@@ -997,7 +1001,7 @@ plugin_transaction_end_all(clicon_handle h,
int retval = -1;
clixon_plugin_t *cp = NULL;
- clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
if (plugin_transaction_end_one(cp, h, td) < 0)
goto done;
@@ -1008,14 +1012,14 @@ plugin_transaction_end_all(clicon_handle h,
}
int
-plugin_transaction_abort_one(clixon_plugin_t *cp,
- clicon_handle h,
+plugin_transaction_abort_one(clixon_plugin_t *cp,
+ clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
trans_cb_t *fn;
void *wh = NULL;
-
+
if ((fn = clixon_plugin_api_get(cp)->ca_trans_abort) != NULL){
wh = NULL;
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
@@ -1024,7 +1028,7 @@ plugin_transaction_abort_one(clixon_plugin_t *cp,
if (plugin_context_check(h, &wh, clixon_plugin_name_get(cp), __FUNCTION__) < 0)
goto done;
if (!clicon_errno) /* sanity: log if clicon_err() is not called ! */
- clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
+ clicon_log(LOG_NOTICE, "%s: Plugin '%s' callback does not make clicon_err call on error",
__FUNCTION__, clixon_plugin_name_get(cp));
goto done;
}
@@ -1038,19 +1042,19 @@ 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] h Clixon handle
* @param[in] td Transaction data
* @retval 0 OK
* @retval -1 Error
*/
int
-plugin_transaction_abort_all(clicon_handle h,
+plugin_transaction_abort_all(clicon_handle h,
transaction_data_t *td)
{
int retval = -1;
clixon_plugin_t *cp = NULL;
- clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
if (plugin_transaction_abort_one(cp, h, td) < 0)
; /* dont abort on error */
diff --git a/apps/backend/backend_plugin_restconf.c b/apps/backend/backend_plugin_restconf.c
index b43489f4..9c87c603 100644
--- a/apps/backend/backend_plugin_restconf.c
+++ b/apps/backend/backend_plugin_restconf.c
@@ -70,6 +70,8 @@
* is started.
* @param[in] h Clixon backend
* @param[in] xt XML target
+ * @retval 0 OK
+ * @retval -1 Error
*/
static int
restconf_pseudo_set_log(clicon_handle h,
@@ -78,8 +80,8 @@ restconf_pseudo_set_log(clicon_handle h,
int retval = -1;
char **argv;
int argc;
- int i;
- char *log = NULL;
+ int i;
+ char *log = NULL;
char *dbg = NULL;
cxobj *xb;
@@ -138,6 +140,8 @@ restconf_pseudo_set_log(clicon_handle h,
* and insert it as a optimization to reading it from the backend.
* @param[in] h Clixon backend
* @param[in] xt XML target
+ * @retval 0 OK
+ * @retval -1 Error
*/
static int
restconf_pseudo_set_inline(clicon_handle h,
@@ -146,11 +150,11 @@ restconf_pseudo_set_inline(clicon_handle h,
int retval = -1;
char **argv;
int argc;
- int i;
+ int i;
cxobj *xrestconf;
cbuf *cb = NULL;
- clicon_debug(1, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
if (clixon_process_argv_get(h, RESTCONF_PROCESS, &argv, &argc) < 0)
goto done;
if ((xrestconf = xpath_first(xt, NULL, "restconf")) != NULL)
@@ -170,7 +174,7 @@ restconf_pseudo_set_inline(clicon_handle h,
clicon_err(OE_XML, errno, "stdup");
goto done;
}
- clicon_debug(1, "%s str:%s", __FUNCTION__, str);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s str:%s", __FUNCTION__, str);
if (argv[i+1])
free(argv[i+1]);
argv[i+1] = str;
@@ -186,6 +190,7 @@ restconf_pseudo_set_inline(clicon_handle h,
}
/*! Process rpc callback function
+ *
* - if RPC op is start, if enable is true, start the service, if false, error or ignore it
* - if RPC op is stop, stop the service
* These rules give that if RPC op is start and enable is false -> change op to none
@@ -197,14 +202,14 @@ restconf_rpc_wrapper(clicon_handle h,
{
int retval = -1;
cxobj *xt = NULL;
-
- clicon_debug(1, "%s", __FUNCTION__);
+
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
switch (*operation){
case PROC_OP_STOP:
/* if RPC op is stop, stop the service */
break;
case PROC_OP_START:
- /* RPC op is start & enable is true, then start the service,
+ /* RPC op is start & enable is true, then start the service,
& enable is false, error or ignore it */
if (xmldb_get(h, "running", NULL, "/restconf", &xt) < 0)
goto done;
@@ -235,7 +240,8 @@ restconf_rpc_wrapper(clicon_handle h,
}
/*! Enable process-control of restconf daemon, ie start/stop restconf by registering restconf process
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @note Could also look in clixon-restconf and start process if enable is true, but that needs to
* be in start callback using a pseudo plugin.
* - Debug flag inheritance only works if backend is started with debug. If debug is set later
@@ -277,24 +283,24 @@ restconf_pseudo_process_control(clicon_handle h)
cprintf(cb, "%s/clixon_restconf", dir0);
pgm = cbuf_get(cb);
if (stat(pgm, &fstat) == 0){ /* Sanity check: program exists */
- clicon_debug(1, "Found %s", pgm);
+ clixon_debug(CLIXON_DBG_DEFAULT, "Found %s", pgm);
found++;
}
else
- clicon_debug(1, "Not found: %s", pgm);
+ clixon_debug(CLIXON_DBG_DEFAULT, "Not found: %s", pgm);
}
if (!found &&
(dir1 = CLIXON_CONFIG_SBINDIR) != NULL){
cbuf_reset(cb);
cprintf(cb, "%s/clixon_restconf", dir1);
pgm = cbuf_get(cb);
- clicon_debug(1, "Looking for %s", pgm);
+ clixon_debug(CLIXON_DBG_DEFAULT, "Looking for %s", pgm);
if (stat(pgm, &fstat) == 0){ /* Sanity check: program exists */
- clicon_debug(1, "Found %s", pgm);
+ clixon_debug(CLIXON_DBG_DEFAULT, "Found %s", pgm);
found++;
}
else
- clicon_debug(1, "Not found: %s", pgm);
+ clixon_debug(CLIXON_DBG_DEFAULT, "Not found: %s", pgm);
}
if (!found){
clicon_err(OE_RESTCONF, 0, "clixon_restconf not found in neither CLICON_RESTCONF_INSTALLDIR(%s) nor CLIXON_CONFIG_SBINDIR(%s). Try overriding with CLICON_RESTCONF_INSTALLDIR",
@@ -343,7 +349,7 @@ restconf_pseudo_process_validate(clicon_handle h,
int retval = -1;
cxobj *xtarget;
- clicon_debug(1, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
xtarget = transaction_target(td);
/* If ssl-enable is true and (at least a) socket has ssl,
* then server-cert-path and server-key-path must exist */
@@ -374,8 +380,8 @@ restconf_pseudo_process_commit(clicon_handle h,
cxobj *xsource;
cxobj *cx;
int enabled = 0;
-
- clicon_debug(1, "%s", __FUNCTION__);
+
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
xtarget = transaction_target(td);
xsource = transaction_src(td);
if (xpath_first(xtarget, NULL, "/restconf[enable='true']") != NULL)
@@ -425,13 +431,16 @@ restconf_pseudo_process_commit(clicon_handle h,
}
/*! Register start/stop restconf RPC and create pseudo-plugin to monitor enable flag
+ *
* @param[in] h Clixon handle
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
backend_plugin_restconf_register(clicon_handle h,
yang_stmt *yspec)
{
- int retval = -1;
+ int retval = -1;
clixon_plugin_t *cp = NULL;
if (clixon_pseudo_plugin(h, "restconf pseudo plugin", &cp) < 0)
diff --git a/apps/backend/backend_socket.c b/apps/backend/backend_socket.c
index 998f99cf..a7cb1adc 100644
--- a/apps/backend/backend_socket.c
+++ b/apps/backend/backend_socket.c
@@ -78,7 +78,7 @@
/*! Open an INET stream socket and bind it to a file descriptor
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] dst IPv4 address (see inet_pton(3))
* @retval s Socket file descriptor (see socket(2))
* @retval -1 Error
@@ -111,7 +111,7 @@ config_socket_init_ipv4(clicon_handle h,
clicon_err(OE_UNIX, errno, "bind");
goto err;
}
- clicon_debug(1, "Listen on server socket at %s:%hu", dst, port);
+ clixon_debug(CLIXON_DBG_DEFAULT, "Listen on server socket at %s:%hu", dst, port);
if (listen(s, 5) < 0){
clicon_err(OE_UNIX, errno, "listen");
goto err;
@@ -126,7 +126,7 @@ config_socket_init_ipv4(clicon_handle h,
*
* The socket is accessed via CLICON_SOCK option, has 770 permissions
* and group according to CLICON_SOCK_GROUP option.
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] sock Unix file-system path
* @retval s Socket file descriptor (see socket(2))
* @retval -1 Error
@@ -154,7 +154,7 @@ config_socket_init_unix(clicon_handle h,
if (group_name2gid(config_group, &gid) < 0)
return -1;
#if 0
- if (gid == 0)
+ if (gid == 0)
clicon_log(LOG_WARNING, "%s: No such group: %s", __FUNCTION__, config_group);
#endif
/* create unix socket */
@@ -169,16 +169,16 @@ config_socket_init_unix(clicon_handle h,
old_mask = umask(S_IRWXO | S_IXGRP | S_IXUSR);
if (bind(s, (struct sockaddr *)&addr, SUN_LEN(&addr)) < 0){
clicon_err(OE_UNIX, errno, "bind");
- umask(old_mask);
+ umask(old_mask);
goto err;
}
- umask(old_mask);
+ umask(old_mask);
/* change socket path file group */
if (lchown(sock, -1, gid) < 0){
clicon_err(OE_UNIX, errno, "lchown(%s, %s)", sock, config_group);
goto err;
}
- clicon_debug(1, "Listen on server socket at %s", addr.sun_path);
+ clixon_debug(CLIXON_DBG_DEFAULT, "Listen on server socket at %s", addr.sun_path);
if (listen(s, 5) < 0){
clicon_err(OE_UNIX, errno, "listen");
goto err;
@@ -190,8 +190,8 @@ config_socket_init_unix(clicon_handle h,
}
/*! Open backend socket, the one clients send requests to, either ip or unix
- *
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @retval s Socket file descriptor (see socket(2))
* @retval -1 Error
*/
@@ -220,12 +220,15 @@ backend_socket_init(clicon_handle h)
}
/*! Accept new socket client
+ *
* @param[in] fd Socket (unix or ip)
* @param[in] arg typecast clicon_handle
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
backend_accept_client(int fd,
- void *arg)
+ void *arg)
{
int retval = -1;
clicon_handle h = (clicon_handle)arg;
@@ -242,7 +245,7 @@ backend_accept_client(int fd,
uid_t guid;
#endif
- clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
len = sizeof(from);
if ((s = accept(fd, &from, &len)) < 0){
clicon_err(OE_UNIX, errno, "accept");
@@ -251,7 +254,7 @@ backend_accept_client(int fd,
if ((ce = backend_client_add(h, &from)) == NULL)
goto done;
- /*
+ /*
* Get credentials of connected peer - only for unix socket
*/
switch (from.sa_family){
@@ -281,7 +284,7 @@ backend_accept_client(int fd,
name = NULL;
}
break;
- case AF_INET:
+ case AF_INET:
break;
case AF_INET6:
default:
diff --git a/apps/backend/backend_socket.h b/apps/backend/backend_socket.h
index 82ebc2ea..edb5dfe4 100644
--- a/apps/backend/backend_socket.h
+++ b/apps/backend/backend_socket.h
@@ -41,7 +41,7 @@
/*
* Prototypes
- */
+ */
int backend_socket_init(clicon_handle h);
int backend_accept_client(int fd, void *arg);
diff --git a/apps/backend/backend_startup.c b/apps/backend/backend_startup.c
index fd2a2c63..0056ea53 100644
--- a/apps/backend/backend_startup.c
+++ b/apps/backend/backend_startup.c
@@ -85,7 +85,7 @@ db_merge(clicon_handle h,
{
int retval = -1;
cxobj *xt = NULL;
-
+
/* Get data as xml from db1 */
if (xmldb_get0(h, (char*)db1, YB_MODULE, NULL, NULL, 1, WITHDEFAULTS_EXPLICIT, &xt, NULL, NULL) < 0)
goto done;
@@ -138,7 +138,7 @@ startup_mode_startup(clicon_handle h,
int ret = 0;
int rollback_exists;
yang_stmt *yspec = clicon_dbspec_yang(h);
-
+
if (strcmp(db, "running")==0){
clicon_err(OE_FATAL, 0, "Invalid startup db: %s", db);
goto done;
@@ -273,8 +273,6 @@ load_extraxml(clicon_handle h,
* @retval 1 OK
* @retval 0 Validation failed
* @retval -1 Error
-
-
running -----------------+----+------>
reset loadfile / merge
@@ -289,14 +287,14 @@ startup_extraxml(clicon_handle h,
int retval = -1;
char *tmp_db = "tmp";
int ret;
- cxobj *xt0 = NULL;
- cxobj *xt = NULL;
-
+ cxobj *xt0 = NULL;
+ cxobj *xt = NULL;
+
/* Clear tmp db */
if (xmldb_db_reset(h, tmp_db) < 0)
goto done;
/* Application may define extra xml in its reset function */
- if (clixon_plugin_reset_all(h, tmp_db) < 0)
+ if (clixon_plugin_reset_all(h, tmp_db) < 0)
goto done;
/* Extra XML can also be added via file */
if (file){
@@ -306,7 +304,7 @@ startup_extraxml(clicon_handle h,
if (ret == 0)
goto fail;
}
- /*
+ /*
* Check if tmp db is empty.
* It should be empty if extra-xml is null and reset plugins did nothing
* then skip validation.
@@ -325,7 +323,7 @@ startup_extraxml(clicon_handle h,
goto done;
if (ret == 0)
goto fail;
- if (xt==NULL || xml_child_nr(xt)==0)
+ if (xt==NULL || xml_child_nr(xt)==0)
goto ok;
/* Merge tmp into running (no commit) */
if ((ret = db_merge(h, tmp_db, "running", cbret)) < 0)
@@ -338,7 +336,7 @@ startup_extraxml(clicon_handle h,
if (xt0)
xml_free(xt0);
xmldb_get0_free(h, &xt);
- if (xmldb_delete(h, tmp_db) != 0 && errno != ENOENT)
+ if (xmldb_delete(h, tmp_db) != 0 && errno != ENOENT)
return -1;
return retval;
fail:
@@ -360,10 +358,10 @@ startup_module_state(clicon_handle h,
int retval = -1;
cxobj *x = NULL;
int ret;
-
+
if (!clicon_option_bool(h, "CLICON_XMLDB_MODSTATE"))
goto ok;
- /* Set up cache
+ /* Set up cache
* Now, access brief module cache with clicon_modst_cache_get(h, 1) */
if ((ret = yang_modules_state_get(h, yspec, NULL, NULL, 1, &x)) < 0)
goto done;
diff --git a/apps/backend/backend_startup.h b/apps/backend/backend_startup.h
index 7191f028..e233f96f 100644
--- a/apps/backend/backend_startup.h
+++ b/apps/backend/backend_startup.h
@@ -41,7 +41,7 @@
/*
* Prototypes
- */
+ */
int startup_mode_startup(clicon_handle h, char *db, cbuf *cbret);
int startup_extraxml(clicon_handle h, char *file, cbuf *cbret);
int startup_module_state(clicon_handle h, yang_stmt *yspec);
diff --git a/apps/backend/clixon_backend_handle.c b/apps/backend/clixon_backend_handle.c
index df3fa2d9..cdcccb62 100644
--- a/apps/backend/clixon_backend_handle.c
+++ b/apps/backend/clixon_backend_handle.c
@@ -78,6 +78,7 @@
* entries in the struct below.
*/
/*! Backend specific handle added to header CLICON handle
+ *
* This file should only contain access functions for the _specific_
* entries in the struct below.
* @note The top part must be equivalent to struct clicon_handle in clixon_handle.c
@@ -89,7 +90,7 @@ struct backend_handle {
clicon_hash_t *bh_data; /* internal clicon data (HDR) */
clicon_hash_t *ch_db_elmnt; /* xml datastore element cache data */
event_stream_t *bh_stream; /* notification streams, see clixon_stream.[ch] */
-
+
/* ------ end of common handle ------ */
struct client_entry *bh_ce_list; /* The client list */
int bh_ce_nr; /* Number of clients, just increment */
@@ -104,7 +105,8 @@ backend_handle_init(void)
}
/*! Deallocates a backend handle, including all client structs
- * @Note: handle 'h' cannot be used in calls after this
+ *
+ * @note: handle 'h' cannot be used in calls after this
* @see backend_client_rm
*/
int
@@ -125,13 +127,14 @@ backend_handle_exit(clicon_handle h)
}
/*! Add new client, typically frontend such as cli, netconf, restconf
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] addr Address of client
* @retval ce Client entry
* @retval NULL Error
*/
struct client_entry *
-backend_client_add(clicon_handle h,
+backend_client_add(clicon_handle h,
struct sockaddr *addr)
{
struct backend_handle *bh = handle(h);
@@ -158,7 +161,8 @@ backend_client_add(clicon_handle h,
}
/*! Return client list
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @retval ce_list Client entry list (all sessions)
*/
struct client_entry *
@@ -170,7 +174,8 @@ backend_client_list(clicon_handle h)
}
/*! Actually remove client from client list
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] ce Client handle
* @see backend_client_rm which is more high-level
*/
@@ -201,7 +206,8 @@ backend_client_delete(clicon_handle h,
}
/*! Debug print backend clients
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] f UNIX output stream
*/
int
diff --git a/apps/backend/clixon_backend_plugin.h b/apps/backend/clixon_backend_plugin.h
index b0adbb05..8a3d1206 100644
--- a/apps/backend/clixon_backend_plugin.h
+++ b/apps/backend/clixon_backend_plugin.h
@@ -43,6 +43,7 @@
*/
/*! Transaction data describing a system transition from a src to target state
+ *
* Clixon internal, presented as void* to app's callback in the 'transaction_data'
* type in clicon_backend_api.h
* The struct contains source and target XML tree (e.g. candidate/running)
@@ -68,6 +69,7 @@ typedef struct {
} transaction_data_t;
/*! Pagination userdata
+ *
* Pagination can use a lock/transaction mechanism
* If locking is not used, the plugin cannot expect more pagination calls, and no state or
* caching should be used
@@ -104,7 +106,7 @@ int clixon_plugin_lockdb_all(clicon_handle h, char *db, int lock, int id);
int clixon_pagination_cb_register(clicon_handle h, handler_function fn, char *path, void *arg);
int clixon_pagination_cb_call(clicon_handle h, char *xpath, int locked,
- uint32_t offset, uint32_t limit,
+ uint32_t offset, uint32_t limit,
cxobj *xstate);
int clixon_pagination_free(clicon_handle h);
diff --git a/apps/backend/clixon_backend_transaction.c b/apps/backend/clixon_backend_transaction.c
index b40c8652..e61c4110 100644
--- a/apps/backend/clixon_backend_transaction.c
+++ b/apps/backend/clixon_backend_transaction.c
@@ -69,6 +69,7 @@
* would give running in source and 'a' and candidate in 'target'.
*/
/*! Get transaction id
+ *
* @param[in] td transaction_data
* @retval id transaction id
*/
@@ -79,6 +80,7 @@ transaction_id(transaction_data td)
}
/*! Get plugin/application specific callback argument
+ *
* @param[in] td transaction_data
* @retval arg callback argument
*/
@@ -89,6 +91,7 @@ transaction_arg(transaction_data td)
}
/*! Set plugin/application specific callback argument
+ *
* @param[in] td transaction_data
* @param[in] arg callback argument
*/
@@ -101,6 +104,7 @@ transaction_arg_set(transaction_data td,
}
/*! Get source database xml tree
+ *
* @param[in] td transaction_data
* @retval src source xml tree containing original state
*/
@@ -111,6 +115,7 @@ transaction_src(transaction_data td)
}
/*! Get target database xml tree
+ *
* @param[in] td transaction_data
* @retval xml target xml tree containing wanted state
*/
@@ -121,6 +126,7 @@ transaction_target(transaction_data td)
}
/*! Get delete xml vector, ie vector of xml nodes that are deleted src->target
+ *
* @param[in] td transaction_data
* @retval vec Vector of xml nodes
*/
@@ -131,6 +137,7 @@ transaction_dvec(transaction_data td)
}
/*! Get length of delete xml vector
+ *
* @param[in] td transaction_data
* @retval len Length of vector of xml nodes
* @see transaction_dvec
@@ -142,6 +149,7 @@ transaction_dlen(transaction_data td)
}
/*! Get add xml vector, ie vector of xml nodes that are added src->target
+ *
* @param[in] td transaction_data
* @retval vec Vector of xml nodes
*/
@@ -152,6 +160,7 @@ transaction_avec(transaction_data td)
}
/*! Get length of add xml vector
+ *
* @param[in] td transaction_data
* @retval len Length of vector of xml nodes
* @see transaction_avec
@@ -163,6 +172,7 @@ transaction_alen(transaction_data td)
}
/*! Get source changed xml vector, ie vector of xml nodes that changed
+ *
* @param[in] td transaction_data
* @retval vec Vector of xml nodes
* These are only nodes of type LEAF.
@@ -177,6 +187,7 @@ transaction_scvec(transaction_data td)
}
/*! Get target changed xml vector, ie vector of xml nodes that changed
+ *
* @param[in] td transaction_data
* @retval vec Vector of xml nodes
* These are only nodes of type LEAF.
@@ -191,6 +202,7 @@ transaction_tcvec(transaction_data td)
}
/*! Get length of changed xml vector
+ *
* @param[in] td transaction_data
* @retval len Length of vector of xml nodes
* This is the length of both the src change vector and the target change vector
@@ -211,8 +223,8 @@ int
transaction_print(FILE *f,
transaction_data th)
{
- cxobj *xn;
- int i;
+ cxobj *xn;
+ int i;
transaction_data_t *td;
td = (transaction_data_t *)th;
@@ -267,7 +279,7 @@ transaction_dbg(clicon_handle h,
goto done;
}
if (i)
- clicon_debug(dbglevel, "%s %" PRIu64 " %s del: %s",
+ clixon_debug(dbglevel, "%s %" PRIu64 " %s del: %s",
__FUNCTION__, td->td_id, msg, cbuf_get(cb));
cbuf_reset(cb);
for (i=0; itd_alen; i++){
@@ -276,7 +288,7 @@ transaction_dbg(clicon_handle h,
goto done;
}
if (i)
- clicon_debug(dbglevel, "%s %" PRIu64 " %s add: %s",
+ clixon_debug(dbglevel, "%s %" PRIu64 " %s add: %s",
__FUNCTION__, td->td_id, msg, cbuf_get(cb));
cbuf_reset(cb);
for (i=0; itd_clen; i++){
@@ -290,7 +302,7 @@ transaction_dbg(clicon_handle h,
goto done;
}
if (i)
- clicon_debug(dbglevel, "%s %" PRIu64 " %s change: %s",
+ clixon_debug(dbglevel, "%s %" PRIu64 " %s change: %s",
__FUNCTION__, td->td_id, msg, cbuf_get(cb));
done:
if (cb)
@@ -299,7 +311,6 @@ transaction_dbg(clicon_handle h,
}
/*! Log a transaction
- *
*/
int
transaction_log(clicon_handle h,
diff --git a/apps/backend/clixon_backend_transaction.h b/apps/backend/clixon_backend_transaction.h
index 6019ab54..e6344841 100644
--- a/apps/backend/clixon_backend_transaction.h
+++ b/apps/backend/clixon_backend_transaction.h
@@ -69,9 +69,9 @@ int transaction_log(clicon_handle h, transaction_data th, int level, const char
/* Pagination callbacks
* @see pagination_data_t internal structure
*/
-uint32_t pagination_offset(pagination_data pd);
-uint32_t pagination_limit(pagination_data pd);
-int pagination_locked(pagination_data pd);
-cxobj *pagination_xstate(pagination_data pd);
+uint32_t pagination_offset(pagination_data pd);
+uint32_t pagination_limit(pagination_data pd);
+int pagination_locked(pagination_data pd);
+cxobj *pagination_xstate(pagination_data pd);
#endif /* _CLIXON_BACKEND_TRANSACTION_H_ */
diff --git a/apps/cli/cli_auto.c b/apps/cli/cli_auto.c
index 5af4d9d5..c5467a98 100644
--- a/apps/cli/cli_auto.c
+++ b/apps/cli/cli_auto.c
@@ -86,7 +86,7 @@ co2apipath(cg_obj *co)
cg_callback *cb;
cvec *cvv;
cg_var *cv;
-
+
if (co == NULL)
return NULL;
if ((cb = co->co_callbacks) == NULL)
@@ -121,7 +121,7 @@ cli_auto_edit(clicon_handle h,
char *api_path_fmt; /* xml key format */
char *api_path = NULL;
char *treename;
- pt_head *ph;
+ pt_head *ph;
cg_obj *co;
cg_obj *coorig;
cvec *cvv2 = NULL; /* cvv2 = cvv0 + cvv1 */
@@ -137,7 +137,7 @@ cli_auto_edit(clicon_handle h,
str = cv_string_get(cvec_i(argv, argc++));
if (str && strncmp(str, "mtpoint:", strlen("mtpoint:")) == 0){
mtpoint = str + strlen("mtpoint:");
- clicon_debug(1, "%s mtpoint:%s", __FUNCTION__, mtpoint);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s mtpoint:%s", __FUNCTION__, mtpoint);
treename = cv_string_get(cvec_i(argv, argc++));
}
else
@@ -181,7 +181,7 @@ cli_auto_edit(clicon_handle h,
char *mtpoint2;
if ((mtpoint2 = strdup(mtpoint)) == NULL){
clicon_err(OE_UNIX, errno, "strdup");
- goto done;
+ goto done;
}
if (clicon_data_set(h, "cli-edit-mtpoint", mtpoint2) < 0)
goto done;
@@ -205,9 +205,12 @@ cli_auto_edit(clicon_handle h,
}
/*! CLI callback: Working point tree up to parent
+ *
* @param[in] h CLICON handle
* @param[in] cvv Vector of variables from CLIgen command-line
* @param[in] argv Vector of user-supplied keywords
+ * @retval 0 OK
+ * @retval -1 Error
* Format of argv:
* Name of generated cligen parse-tree, eg "datamodel"
*/
@@ -231,7 +234,7 @@ cli_auto_up(clicon_handle h,
int j;
size_t len;
cvec *cvv_filter = NULL;
-
+
if (cvec_len(argv) != 1){
clicon_err(OE_PLUGIN, EINVAL, "Usage: %s()", __FUNCTION__);
goto done;
@@ -283,7 +286,7 @@ cli_auto_up(clicon_handle h,
cvv1 = cvec_new(0);
for (i=0; i Name of generated cligen parse-tree, eg "datamodel"
*/
@@ -315,7 +321,7 @@ cli_auto_top(clicon_handle h,
cg_var *cv;
char *treename;
pt_head *ph;
-
+
cv = cvec_i(argv, 0);
treename = cv_string_get(cv);
if ((ph = cligen_ph_find(cli_cligen(h), treename)) == NULL){
@@ -333,20 +339,23 @@ cli_auto_top(clicon_handle h,
}
/*! CLI callback: set auto db item
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector. First element xml key format string, eg "/aaa/%s"
+ * @retval 0 OK
+ * @retval -1 Error
* Format of argv:
* Generated
*/
-int
+int
cli_auto_set(clicon_handle h,
cvec *cvv,
cvec *argv)
{
int retval = -1;
cvec *cvv2 = NULL;
-
+
cvv2 = cvec_append(clicon_data_cvec_get(h, "cli-edit-cvv"), cvv);
if (cli_dbxml(h, cvv2, argv, OP_REPLACE, NULL) < 0)
goto done;
@@ -358,18 +367,21 @@ cli_auto_set(clicon_handle h,
}
/*! Merge datastore xml entry
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector. First element xml key format string, eg "/aaa/%s"
+ * @retval 0 OK
+ * @retval -1 Error
*/
-int
+int
cli_auto_merge(clicon_handle h,
cvec *cvv,
cvec *argv)
{
int retval = -1;
cvec *cvv2 = NULL;
-
+
cvv2 = cvec_append(clicon_data_cvec_get(h, "cli-edit-cvv"), cvv);
if (cli_dbxml(h, cvv2, argv, OP_MERGE, NULL) < 0)
goto done;
@@ -381,18 +393,21 @@ cli_auto_merge(clicon_handle h,
}
/*! Create datastore xml entry
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector. First element xml key format string, eg "/aaa/%s"
+ * @retval 0 OK
+ * @retval -1 Error
*/
-int
+int
cli_auto_create(clicon_handle h,
cvec *cvv,
cvec *argv)
{
- int retval = -1;
+ int retval = -1;
cvec *cvv2 = NULL;
-
+
cvv2 = cvec_append(clicon_data_cvec_get(h, "cli-edit-cvv"), cvv);
if (cli_dbxml(h, cvv2, argv, OP_CREATE, NULL) < 0)
goto done;
@@ -404,18 +419,21 @@ cli_auto_create(clicon_handle h,
}
/*! Delete datastore xml
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector. First element xml key format string, eg "/aaa/%s"
+ * @retval 0 OK
+ * @retval -1 Error
*/
-int
+int
cli_auto_del(clicon_handle h,
cvec *cvv,
cvec *argv)
{
int retval = -1;
cvec *cvv2 = NULL;
-
+
cvv2 = cvec_append(clicon_data_cvec_get(h, "cli-edit-cvv"), cvv);
if (cli_dbxml(h, cvv2, argv, OP_REMOVE, NULL) < 0)
goto done;
@@ -438,7 +456,6 @@ struct findpt_arg{
* @param[in] arg Argument, cast to application-specific info
* @retval 1 OK and return (abort iteration)
* @retval 0 OK and continue
- * @retval -1 Error: break and return
*/
static int
cli_auto_findpt(cg_obj *co,
@@ -456,9 +473,12 @@ cli_auto_findpt(cg_obj *co,
}
/*! Enter edit mode
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector of args to function in command.
+ * @retval 0 OK
+ * @retval -1 Error
* Format of argv:
* Generated API PATH FORMAT (print-like for variables)
* * List of static variables that can be used as values for api_path_fmt
@@ -471,7 +491,7 @@ cli_auto_findpt(cg_obj *co,
* api_path: /a/b=42,99/c
* @see cli_auto_edit
*/
-int
+int
cli_auto_sub_enter(clicon_handle h,
cvec *cvv,
cvec *argv)
@@ -486,7 +506,7 @@ cli_auto_sub_enter(clicon_handle h,
cg_var *cv = NULL;
pt_head *ph;
struct findpt_arg fa = {0,};
-
+
if (cvec_len(argv) < 2){
clicon_err(OE_PLUGIN, EINVAL, "Usage: %s( (,vars)*)", __FUNCTION__);
goto done;
@@ -506,7 +526,7 @@ cli_auto_sub_enter(clicon_handle h,
* argv, but this can be done differently
*/
/* Create a cvv with variables to add to api-path */
- if ((cvv1 = cvec_new(0)) == NULL){
+ if ((cvv1 = cvec_new(0)) == NULL){
clicon_err(OE_UNIX, errno, "cvec_new");
goto done;
}
diff --git a/apps/cli/cli_autocli.c b/apps/cli/cli_autocli.c
index d83cc73a..6e4f45bf 100644
--- a/apps/cli/cli_autocli.c
+++ b/apps/cli/cli_autocli.c
@@ -106,8 +106,8 @@ autocli_listkw_int2str(int listkw)
* @param[in] h Clixon handle
* @param[in] modname Name of YANG module, or NULL for ANY module (eg default)
* @param[out] enablep Include this module in autocli
- * @retval -1 Error
* @retval 0 OK, and enablep set
+ * @retval -1 Error
*/
int
autocli_module(clicon_handle h,
@@ -171,7 +171,7 @@ autocli_module(clicon_handle h,
}
ok:
*enablep = enable;
- retval = 0;
+ retval = 0;
done:
return retval;
}
@@ -190,7 +190,7 @@ autocli_compress_extension(yang_stmt *ys,
char *ns = NULL;
int exist = 0;
int ret;
-
+
if (nodeid_split(body, &prefix, &id) < 0)
goto done;
if (prefix != NULL){
@@ -228,9 +228,8 @@ autocli_compress_extension(yang_stmt *ys,
*
* @param[in] h Clixon handle
* @param[out] compress
- * @retval -1 Error
* @retval 0 OK, and compress set
-
+ * @retval -1 Error
* Canonical examples:
The config and state containers are "compressed" out of the schema.
+ op=COMPRESS
@@ -261,7 +260,7 @@ autocli_compress(clicon_handle h,
char *keywstr;
int match = 0;
char *body;
-
+
if (compress == NULL){
clicon_err(OE_YANG, EINVAL, "Argument is NULL");
goto done;
@@ -346,8 +345,8 @@ autocli_compress(clicon_handle h,
* Currently only returns list-keyword-default, could be extended to rules
* @param[in] h Clixon handle
* @param[out] completion Completion enabled
- * @retval -1 Error
* @retval 0 OK
+ * @retval -1 Error
*/
int
autocli_completion(clicon_handle h,
@@ -359,7 +358,7 @@ autocli_completion(clicon_handle h,
char *reason = NULL;
int ret;
cxobj *xautocli;
-
+
if (completion == NULL){
clicon_err(OE_YANG, EINVAL, "Argument is NULL");
goto done;
@@ -377,7 +376,7 @@ autocli_completion(clicon_handle h,
goto done;
}
*completion = val;
- retval = 0;
+ retval = 0;
done:
if (reason)
free(reason);
@@ -389,8 +388,8 @@ autocli_completion(clicon_handle h,
* When false replaces uses with grouping, when true use tree reference
* @param[in] h Clixon handle
* @param[out] treeref grouping using treerefs enabled
- * @retval -1 Error
* @retval 0 OK
+ * @retval -1 Error
*/
int
autocli_grouping_treeref(clicon_handle h,
@@ -402,7 +401,7 @@ autocli_grouping_treeref(clicon_handle h,
char *reason = NULL;
int ret;
cxobj *xautocli;
-
+
if (treeref == NULL){
clicon_err(OE_YANG, EINVAL, "Argument is NULL");
goto done;
@@ -420,7 +419,7 @@ autocli_grouping_treeref(clicon_handle h,
goto done;
}
*treeref = val;
- retval = 0;
+ retval = 0;
done:
if (reason)
free(reason);
@@ -432,8 +431,8 @@ autocli_grouping_treeref(clicon_handle h,
* Currently only returns list-keyword-default, could be extended to rules
* @param[in] h Clixon handle
* @param[out] listkw List keyword setting
- * @retval -1 Error
* @retval 0 OK
+ * @retval -1 Error
*/
int
autocli_list_keyword(clicon_handle h,
@@ -442,7 +441,7 @@ autocli_list_keyword(clicon_handle h,
int retval = -1;
char *str;
cxobj *xautocli = NULL;
-
+
if (listkw == NULL){
clicon_err(OE_YANG, EINVAL, "Argument is NULL");
goto done;
@@ -456,7 +455,7 @@ autocli_list_keyword(clicon_handle h,
goto done;
}
*listkw = autocli_listkw_str2int(str);
- retval = 0;
+ retval = 0;
done:
return retval;
}
@@ -465,8 +464,8 @@ autocli_list_keyword(clicon_handle h,
*
* @param[in] h Clixon handle
* @param[out] treeref_state If true, generate CLI from state
- * @retval -1 Error
* @retval 0 OK
+ * @retval -1 Error
*/
int
autocli_treeref_state(clicon_handle h,
@@ -478,7 +477,7 @@ autocli_treeref_state(clicon_handle h,
char *reason = NULL;
int ret;
cxobj *xautocli;
-
+
if (treeref_state == NULL){
clicon_err(OE_YANG, EINVAL, "Argument is NULL");
goto done;
@@ -496,7 +495,7 @@ autocli_treeref_state(clicon_handle h,
goto done;
}
*treeref_state = val;
- retval = 0;
+ retval = 0;
done:
if (reason)
free(reason);
@@ -508,8 +507,8 @@ autocli_treeref_state(clicon_handle h,
* @param[in] h Clixon handle
* @param[in] keyw YANG keyword
* @param[out] flag If 0 keyw is not a part of default edit-mode, if 1 it is.
- * @retval -1 Error
* @retval 0 OK, see result in keyw
+ * @retval -1 Error
* @note keyw is a sub/superset of RFC 6020, see clixon-autocli.yang on which are defined
*/
int
@@ -524,7 +523,7 @@ autocli_edit_mode(clicon_handle h,
int nvec;
char *v;
int i;
-
+
if (flag == NULL){
clicon_err(OE_YANG, EINVAL, "Argument is NULL");
goto done;
@@ -547,7 +546,7 @@ autocli_edit_mode(clicon_handle h,
break;
}
}
- retval = 0;
+ retval = 0;
done:
if (vec)
free(vec);
diff --git a/apps/cli/cli_common.c b/apps/cli/cli_common.c
index 0c1d2f94..81535b1b 100644
--- a/apps/cli/cli_common.c
+++ b/apps/cli/cli_common.c
@@ -72,20 +72,23 @@
#include "cli_common.h"
/*! Register log notification stream
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] stream Event stream. CLICON is predefined, others are application-defined
* @param[in] filter Filter. For xml notification ie xpath: .[name="kalle"]
* @param[in] status 0 for stop, 1 to start
* @param[in] fn Callback function called when notification occurs
* @param[in] arg Argument to function note
- * Note this calls cligen_regfd which may callback on cli command interpretator
+ * @retval 0 OK
+ * @retval -1 Error
+ * @note this calls cligen_regfd which may callback on cli command interpretator
*/
int
-cli_notification_register(clicon_handle h,
- char *stream,
+cli_notification_register(clicon_handle h,
+ char *stream,
enum format_enum format,
- char *filter,
- int status,
+ char *filter,
+ int status,
int (*fn)(int, void*),
void *arg)
{
@@ -101,7 +104,7 @@ cli_notification_register(clicon_handle h,
if ((logname = malloc(len)) == NULL){
clicon_err(OE_UNIX, errno, "malloc");
goto done;
- }
+ }
snprintf(logname, len, "log_socket_%s", stream);
if ((p = clicon_hash_value(cdat, logname, &len)) != NULL)
s_exist = *(int*)p;
@@ -183,6 +186,11 @@ cli_signal_flush(clicon_handle h)
}
/*! Create body and add last CLI variable vector as value
+ *
+ * @param[in] xbot
+ * @param[in] cvv
+ * @retval 0 OK
+ * @retval -1 Error
* Create and add an XML body as child of XML node xbot. Set its value to the last
* CLI variable vector element.
*/
@@ -197,13 +205,13 @@ dbxml_body(cxobj *xbot,
int len;
len = cvec_len(cvv);
- cval = cvec_i(cvv, len-1);
+ cval = cvec_i(cvv, len-1);
if ((str = cv2str_dup(cval)) == NULL){
clicon_err(OE_UNIX, errno, "cv2str_dup");
goto done;
}
if ((xb = xml_new("body", xbot, CX_BODY)) == NULL)
- goto done;
+ goto done;
if (xml_value_set(xb, str) < 0)
goto done;
retval = 0;
@@ -214,7 +222,12 @@ dbxml_body(cxobj *xbot,
}
/*! Special handling of identityref:s whose body may be: :
+ *
* Ensure the namespace is declared if it exists in YANG
+ * @param[in] x
+ * @param[in] arg
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
identityref_add_ns(cxobj *x,
@@ -234,7 +247,7 @@ identityref_add_ns(cxobj *x,
yang_keyword_get(y) == Y_LEAF){
if (yang_type_get(y, &origtype, &yrestype, NULL, NULL, NULL, NULL, NULL) < 0)
goto done;
- restype = yrestype?yang_argument_get(yrestype):NULL;
+ restype = yrestype?yang_argument_get(yrestype):NULL;
if (strcmp(restype, "identityref") == 0){
if (nodeid_split(xml_body(x), &pf, NULL) < 0)
goto done;
@@ -249,7 +262,7 @@ identityref_add_ns(cxobj *x,
goto done;
}
}
- }
+ }
}
retval = 0;
done:
@@ -273,6 +286,8 @@ identityref_add_ns(cxobj *x,
* @param[in] mtpoint Mount-point, generic: if there are several with same yang, any will do
* @param[in] api_path_fmt1 Second part of api-path-fmt
* @param[out] api_path_fmt01 Combined api-path-fmt
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
mtpoint_paths(yang_stmt *yspec0,
@@ -290,7 +305,7 @@ mtpoint_paths(yang_stmt *yspec0,
cxobj *xbot0 = NULL;
cxobj *xtop0 = NULL;
yang_stmt *yspec1;
-
+
if (api_path_fmt01 == NULL){
clicon_err(OE_FATAL, EINVAL, "arg is NULL");
goto done;
@@ -317,7 +332,7 @@ mtpoint_paths(yang_stmt *yspec0,
if (xml_nsctx_yangspec(yspec0, &nsc0) < 0)
goto done;
if ((ret = xpath2xml(mtpoint, nsc0, xtop0, yspec0, &xbot0, &ybot0, NULL)) < 0)
- goto done;
+ goto done;
if (xbot0 == NULL){
clicon_err(OE_YANG, 0, "No xbot");
goto done;
@@ -346,7 +361,7 @@ mtpoint_paths(yang_stmt *yspec0,
/*! Modify xml datastore from a callback using xml key format strings
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Arguments given at the callback:
* Generated API PATH (this is added implicitly, not actually given in the cvv)
@@ -354,6 +369,8 @@ mtpoint_paths(yang_stmt *yspec0,
* [] Optional YANG path-arg/xpath from mount-point
* @param[in] op Operation to perform on database
* @param[in] nsctx Namespace context for last value added
+ * @retval 0 OK
+ * @retval -1 Error
* cvv first contains the complete cli string, and then a set of optional
* instantiated variables.
* If the last node is a leaf, the last cvv element is added as a value. This value
@@ -369,9 +386,9 @@ mtpoint_paths(yang_stmt *yspec0,
* generated by a function such as clixon_instance_id_bind() or other programmatically.
*/
int
-cli_dbxml(clicon_handle h,
- cvec *cvv,
- cvec *argv,
+cli_dbxml(clicon_handle h,
+ cvec *cvv,
+ cvec *argv,
enum operation_type op,
cvec *nsctx)
{
@@ -379,7 +396,7 @@ cli_dbxml(clicon_handle h,
cbuf *api_path_fmt_cb = NULL; /* xml key format */
char *api_path_fmt;
char *api_path_fmt01 = NULL;
- char *api_path = NULL;
+ char *api_path = NULL;
cbuf *cb = NULL;
cxobj *xbot = NULL; /* xpath, NULL if datastore */
yang_stmt *y = NULL; /* yang spec of xpath */
@@ -407,7 +424,7 @@ cli_dbxml(clicon_handle h,
goto done;
api_path_fmt = cbuf_get(api_path_fmt_cb);
argc = cvec_len(argv);
- if (cvec_len(argv) > argc){
+ if (cvec_len(argv) > argc){
cv = cvec_i(argv, argc++);
str = cv_string_get(cv);
if (strncmp(str, "mtpoint:", strlen("mtpoint:")) != 0){
@@ -419,7 +436,7 @@ cli_dbxml(clicon_handle h,
/* Remove all keywords */
if (cvec_exclude_keys(cvv) < 0)
goto done;
- if (mtpoint){
+ if (mtpoint){
/* Get and combined api-path01 */
if (mtpoint_paths(yspec0, mtpoint, api_path_fmt, &api_path_fmt01) < 0)
goto done;
@@ -505,18 +522,21 @@ cli_dbxml(clicon_handle h,
if (cb)
cbuf_free(cb);
if (api_path)
- free(api_path);
+ free(api_path);
if (xtop)
xml_free(xtop);
return retval;
}
/*! Set datastore xml entry
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector. First element xml key format string, eg "/aaa/%s"
+ * @retval 0 OK
+ * @retval -1 Error
*/
-int
+int
cli_set(clicon_handle h,
cvec *cvv,
cvec *argv)
@@ -531,11 +551,14 @@ cli_set(clicon_handle h,
}
/*! Merge datastore xml entry
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector. First element xml key format string, eg "/aaa/%s"
+ * @retval 0 OK
+ * @retval -1 Error
*/
-int
+int
cli_merge(clicon_handle h,
cvec *cvv,
cvec *argv)
@@ -550,11 +573,14 @@ cli_merge(clicon_handle h,
}
/*! Create datastore xml entry
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector. First element xml key format string, eg "/aaa/%s"
+ * @retval 0 OK
+ * @retval -1 Error
*/
-int
+int
cli_create(clicon_handle h,
cvec *cvv,
cvec *argv)
@@ -567,13 +593,17 @@ cli_create(clicon_handle h,
done:
return retval;
}
+
/*! Remove datastore xml entry
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector. First element xml key format string, eg "/aaa/%s"
+ * @retval 0 OK
+ * @retval -1 Error
* @see cli_del
*/
-int
+int
cli_remove(clicon_handle h,
cvec *cvv,
cvec *argv)
@@ -588,11 +618,14 @@ cli_remove(clicon_handle h,
}
/*! Delete datastore xml
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv Vector. First element xml key format string, eg "/aaa/%s"
+ * @retval 0 OK
+ * @retval -1 Error
*/
-int
+int
cli_del(clicon_handle h,
cvec *cvv,
cvec *argv)
@@ -607,22 +640,25 @@ cli_del(clicon_handle h,
}
/*! Set debug level on CLI client (not backend daemon)
- * @param[in] h Clicon handle
- * @param[in] vars If variable "level" exists, its integer value is used
+ *
+ * @param[in] h Clixon handle
+ * @param[in] cvv If variable "level" exists, its integer value is used
* @param[in] arg Else use the integer value of argument
+ * @retval 0 OK
+ * @retval -1 Error
* @note The level is either what is specified in arg as int argument.
- * _or_ if a 'level' variable is present in vars use that value instead.
+ * _or_ if a 'level' variable is present in cvv use that value instead.
*/
int
-cli_debug_cli(clicon_handle h,
- cvec *vars,
+cli_debug_cli(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
int retval = -1;
cg_var *cv;
int level;
- if ((cv = cvec_find_var(vars, "level")) == NULL){
+ if ((cv = cvec_find_var(cvv, "level")) == NULL){
if (cvec_len(argv) != 1){
clicon_err(OE_PLUGIN, EINVAL, "Requires either label var or single arg: 0|1");
goto done;
@@ -631,29 +667,32 @@ cli_debug_cli(clicon_handle h,
}
level = cv_int32_get(cv);
/* cli */
- clicon_debug_init(level, NULL); /* 0: dont debug, 1:debug */
+ clixon_debug_init(level, NULL); /* 0: dont debug, 1:debug */
retval = 0;
done:
return retval;
}
/*! Set debug level on backend daemon (not CLI)
- * @param[in] h Clicon handle
- * @param[in] vars If variable "level" exists, its integer value is used
+ *
+ * @param[in] h Clixon handle
+ * @param[in] cvv If variable "level" exists, its integer value is used
* @param[in] arg Else use the integer value of argument
+ * @retval 0 OK
+ * @retval -1 Error
* @note The level is either what is specified in arg as int argument.
- * _or_ if a 'level' variable is present in vars use that value instead.
+ * _or_ if a 'level' variable is present in cvv use that value instead.
*/
int
-cli_debug_backend(clicon_handle h,
- cvec *vars,
+cli_debug_backend(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
int retval = -1;
cg_var *cv;
int level;
- if ((cv = cvec_find_var(vars, "level")) == NULL){
+ if ((cv = cvec_find_var(cvv, "level")) == NULL){
if (cvec_len(argv) != 1){
clicon_err(OE_PLUGIN, EINVAL, "Requires either label var or single arg: 0|1");
goto done;
@@ -668,26 +707,29 @@ cli_debug_backend(clicon_handle h,
}
/*! Set debug level on restconf daemon
- * @param[in] h Clicon handle
- * @param[in] vars If variable "level" exists, its integer value is used
+ *
+ * @param[in] h Clixon handle
+ * @param[in] cvv If variable "level" exists, its integer value is used
* @param[in] arg Else use the integer value of argument
+ * @retval 0 OK
+ * @retval -1 Error
* @note The level is either what is specified in arg as int argument.
- * _or_ if a 'level' variable is present in vars use that value instead.
+ * _or_ if a 'level' variable is present in cvv use that value instead.
* @notes
* 1. clixon-restconf.yang is used (so that debug config can be set)
* 2. AND the XML is in running db not in clixon-config (so that restconf read the new config from backend)
* 3 CLICON_BACKEND_RESTCONF_PROCESS is true (so that backend restarts restconf)
*/
int
-cli_debug_restconf(clicon_handle h,
- cvec *vars,
+cli_debug_restconf(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
int retval = -1;
cg_var *cv;
int level;
- if ((cv = cvec_find_var(vars, "level")) == NULL){
+ if ((cv = cvec_find_var(cvv, "level")) == NULL){
if (cvec_len(argv) != 1){
clicon_err(OE_PLUGIN, EINVAL, "Requires either label var or single arg: 0|1");
goto done;
@@ -703,10 +745,16 @@ cli_debug_restconf(clicon_handle h,
/*! Set syntax mode
+ *
+ * @param[in] h Clixon handle
+ * @param[in] cvv
+ * @param[in] argv
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
-cli_set_mode(clicon_handle h,
- cvec *vars,
+cli_set_mode(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
int retval = -1;
@@ -724,25 +772,28 @@ cli_set_mode(clicon_handle h,
}
/*! Start bash from cli callback
+ *
* Typical usage: shell("System Bash") , cli_start_shell();
* @param[in] h Clixon handle
* @param[in] cvv Vector of command variables
* @param[in] argv [], defaults to "sh"
- */
+ * @retval 0 OK
+ * @retval -1 Error
+ */
int
-cli_start_shell(clicon_handle h,
- cvec *vars,
+cli_start_shell(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
+ int retval = -1;
char *cmd;
char *shcmd = "sh";
struct passwd *pw;
- int retval = -1;
char bcmd[128];
- cg_var *cv1 = cvec_i(vars, 1);
+ cg_var *cv1 = cvec_i(cvv, 1);
sigset_t oldsigset;
struct sigaction oldsigaction[32] = {{{0,},},};
-
+
if (cvec_len(argv) > 1){
clicon_err(OE_PLUGIN, EINVAL, "Received %d arguments. Expected: []",
cvec_len(argv));
@@ -751,7 +802,7 @@ cli_start_shell(clicon_handle h,
if (cvec_len(argv) == 1){
shcmd = cv_string_get(cvec_i(argv, 0));
}
- cmd = (cvec_len(vars)>1 ? cv_string_get(cv1) : NULL);
+ cmd = (cvec_len(cvv)>1 ? cv_string_get(cv1) : NULL);
if ((pw = getpwuid(getuid())) == NULL){
clicon_err(OE_UNIX, errno, "getpwuid");
goto done;
@@ -798,10 +849,16 @@ cli_start_shell(clicon_handle h,
}
/*! Generic quit callback
+ *
+ * @param[in] h Clixon handle
+ * @param[in] cvv Vector of command variables
+ * @param[in] argv None expected
+ * @retval 0 OK
+ * @retval -1 Error
*/
-int
-cli_quit(clicon_handle h,
- cvec *vars,
+int
+cli_quit(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
cligen_exiting_set(cli_cligen(h), 1);
@@ -809,12 +866,17 @@ cli_quit(clicon_handle h,
}
/*! Generic commit callback
+ *
+ * @param[in] h Clixon handle
+ * @param[in] cvv Vector of command variables
* @param[in] argv No arguments expected
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
-cli_commit(clicon_handle h,
- cvec *vars,
- cvec *argv)
+cli_commit(clicon_handle h,
+ cvec *cvv,
+ cvec *argv)
{
int retval = -1;
uint32_t timeout = 0; /* any non-zero value means "confirmed-commit" */
@@ -824,14 +886,14 @@ cli_commit(clicon_handle h,
int confirmed;
int cancel;
- confirmed = (cvec_find_str(vars, "confirmed") != NULL);
- cancel = (cvec_find_str(vars, "cancel") != NULL);
- if ((timeout_var = cvec_find(vars, "timeout")) != NULL) {
+ confirmed = (cvec_find_str(cvv, "confirmed") != NULL);
+ cancel = (cvec_find_str(cvv, "cancel") != NULL);
+ if ((timeout_var = cvec_find(cvv, "timeout")) != NULL) {
timeout = cv_uint32_get(timeout_var);
- clicon_debug(1, "commit confirmed with timeout %ul", timeout);
+ clixon_debug(CLIXON_DBG_DEFAULT, "commit confirmed with timeout %ul", timeout);
}
- persist = cvec_find_str(vars, "persist-val");
- persist_id = cvec_find_str(vars, "persist-id-val");
+ persist = cvec_find_str(cvv, "persist-val");
+ persist_id = cvec_find_str(cvv, "persist-id-val");
if (clicon_rpc_commit(h, confirmed, cancel, timeout, persist, persist_id) < 1)
goto done;
retval = 0;
@@ -840,10 +902,15 @@ cli_commit(clicon_handle h,
}
/*! Generic validate callback
+ * @param[in] h Clixon handle
+ * @param[in] cvv Vector of command variables
+ * @param[in] argv
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
-cli_validate(clicon_handle h,
- cvec *vars,
+cli_validate(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
int retval = -1;
@@ -861,9 +928,11 @@ cli_validate(clicon_handle h,
* @param[in] format Output format
* @param[in] db1 Name of first datastrore
* @param[in] db2 Name of second datastrore
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
-compare_db_names(clicon_handle h,
+compare_db_names(clicon_handle h,
enum format_enum format,
char *db1,
char *db2)
@@ -911,7 +980,7 @@ compare_db_names(clicon_handle h,
case FORMAT_JSON:
case FORMAT_CLI:
if (clixon_compare_xmls(xc1, xc2, format) < 0) /* astext? */
- goto done;
+ goto done;
default:
break;
}
@@ -920,20 +989,23 @@ compare_db_names(clicon_handle h,
if (cb)
cbuf_free(cb);
if (xc1)
- xml_free(xc1);
+ xml_free(xc1);
if (xc2)
xml_free(xc2);
return retval;
}
/*! Compare two dbs using XML. Write to file and run diff
- * @param[in] h Clicon handle
+ *
+ * @param[in] h Clixon handle
* @param[in] cvv
* @param[in] argv
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
-compare_dbs(clicon_handle h,
- cvec *cvv,
+compare_dbs(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
int retval = -1;
@@ -961,14 +1033,17 @@ compare_dbs(clicon_handle h,
}
/*! Load a configuration file to candidate database
+ *
* Utility function used by cligen spec file
* Note that the CLI function makes no Validation of the XML sent to the backend
- * @param[in] h CLICON handle
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of variables (where is found)
* @param[in] argv A string: " []"
* is name of a variable occuring in "cvv" containing filename
* : merge or replace
* "text"|"xml"|"json"|"cli"|"netconf" (see format_enum)
+ * @retval 0 OK
+ * @retval -1 Error
*
* @note that "filename" is local on client filesystem not backend.
* @note file is assumed to have a dummy top-tag, eg
@@ -978,9 +1053,9 @@ compare_dbs(clicon_handle h,
* @endcode
* @see save_config_file
*/
-int
-load_config_file(clicon_handle h,
- cvec *cvv,
+int
+load_config_file(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
int ret = -1;
@@ -997,7 +1072,7 @@ load_config_file(clicon_handle h,
char *formatstr = NULL;
enum format_enum format = FORMAT_XML;
yang_stmt *yspec;
- cxobj *xerr = NULL;
+ cxobj *xerr = NULL;
char *lineptr = NULL;
if (cvec_len(argv) < 2 || cvec_len(argv) > 4){
@@ -1018,16 +1093,16 @@ load_config_file(clicon_handle h,
}
varstr = cv_string_get(cvec_i(argv, 0));
opstr = cv_string_get(cvec_i(argv, 1));
- if (strcmp(opstr, "merge") == 0)
+ if (strcmp(opstr, "merge") == 0)
replace = 0;
- else if (strcmp(opstr, "replace") == 0)
+ else if (strcmp(opstr, "replace") == 0)
replace = 1;
else{
- clicon_err(OE_PLUGIN, 0, "No such op: %s, expected merge or replace", opstr);
+ clicon_err(OE_PLUGIN, 0, "No such op: %s, expected merge or replace", opstr);
goto done;
}
if ((cv = cvec_find(cvv, varstr)) == NULL){
- clicon_err(OE_PLUGIN, 0, "No such var name: %s", varstr);
+ clicon_err(OE_PLUGIN, 0, "No such var name: %s", varstr);
goto done;
}
filename = cv_string_get(cv);
@@ -1085,7 +1160,7 @@ load_config_file(clicon_handle h,
goto ok; /* eof, skip backend rpc since this is done by cli code */
}
if (clicon_parse(h, lineptr, &mode, &result, &evalresult) < 0)
- goto done;
+ goto done;
if (result != 1) /* Not unique match */
goto done;
if (evalresult < 0)
@@ -1114,7 +1189,7 @@ load_config_file(clicon_handle h,
if (clixon_xml2cbuf(cbxml, xt, 0, 0, NULL, -1, 1) < 0)
goto done;
if (clicon_rpc_edit_config(h, "candidate",
- replace?OP_REPLACE:OP_MERGE,
+ replace?OP_REPLACE:OP_MERGE,
cbuf_get(cbxml)) < 0)
goto done;
ok:
@@ -1123,7 +1198,7 @@ load_config_file(clicon_handle h,
if (cbxml)
cbuf_free(cbxml);
if (lineptr)
- free(lineptr);
+ free(lineptr);
if (xerr)
xml_free(xerr);
if (xt)
@@ -1136,12 +1211,14 @@ load_config_file(clicon_handle h,
/*! Copy database to local file as XMLn
*
* Utility function used by cligen spec file
- * @param[in] h CLICON handle
- * @param[in] cvv variable vector (containing )
- * @param[in] argv a string: " []"
+ * @param[in] h Clixon handle
+ * @param[in] cvv Variable vector (containing )
+ * @param[in] argv A string: " []"
* is running, candidate, or startup
* is name of cligen variable in the "cvv" vector containing file name
* "text"|"xml"|"json"|"cli"|"netconf" (see format_enum)
+ * @retval 0 OK
+ * @retval -1 Error
* Note that "filename" is local on client filesystem not backend.
* The function can run without a local database
* @note The file is saved with dummy top-tag: clicon:
@@ -1151,8 +1228,8 @@ load_config_file(clicon_handle h,
* @see load_config_file
*/
int
-save_config_file(clicon_handle h,
- cvec *cvv,
+save_config_file(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
int retval = -1;
@@ -1181,15 +1258,15 @@ save_config_file(clicon_handle h,
}
}
dbstr = cv_string_get(cvec_i(argv, 0));
- if (strcmp(dbstr, "running") != 0 &&
+ if (strcmp(dbstr, "running") != 0 &&
strcmp(dbstr, "candidate") != 0 &&
strcmp(dbstr, "startup") != 0) {
- clicon_err(OE_PLUGIN, 0, "No such db name: %s", dbstr);
+ clicon_err(OE_PLUGIN, 0, "No such db name: %s", dbstr);
goto done;
}
varstr = cv_string_get(cvec_i(argv, 1));
if ((cv = cvec_find(cvv, varstr)) == NULL){
- clicon_err(OE_PLUGIN, 0, "No such var name: %s", varstr);
+ clicon_err(OE_PLUGIN, 0, "No such var name: %s", varstr);
goto done;
}
filename = cv_string_get(cv);
@@ -1211,7 +1288,7 @@ save_config_file(clicon_handle h,
if ((f = fopen(filename, "w")) == NULL){
clicon_err(OE_CFG, errno, "Creating file %s", filename);
goto done;
- }
+ }
switch (format){
case FORMAT_XML:
if (clixon_xml2file(f, xt, 0, pretty, NULL, fprintf, 0, 1) < 0)
@@ -1249,11 +1326,17 @@ save_config_file(clicon_handle h,
}
/*! Delete all elements in a database
+ *
* Utility function used by cligen spec file
+ * @param[in] h Clixon handle
+ * @param[in] cvv Vector of command variables
+ * @param[in] argv
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
-delete_all(clicon_handle h,
- cvec *cvv,
+delete_all(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
char *dbstr;
@@ -1264,10 +1347,10 @@ delete_all(clicon_handle h,
goto done;
}
dbstr = cv_string_get(cvec_i(argv, 0));
- if (strcmp(dbstr, "running") != 0 &&
+ if (strcmp(dbstr, "running") != 0 &&
strcmp(dbstr, "candidate") != 0 &&
strcmp(dbstr, "startup") != 0){
- clicon_err(OE_PLUGIN, 0, "No such db name: %s", dbstr);
+ clicon_err(OE_PLUGIN, 0, "No such db name: %s", dbstr);
goto done;
}
if (clicon_rpc_delete_config(h, dbstr) < 0)
@@ -1280,19 +1363,22 @@ delete_all(clicon_handle h,
/*! Discard all changes in candidate and replace with running
*/
int
-discard_changes(clicon_handle h,
- cvec *cvv,
+discard_changes(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
return clicon_rpc_discard_changes(h);
}
/*! Copy from one database to another, eg running->startup
+ *
* @param[in] argv a string: " " Copy from db1 to db2
+ * @retval 0 OK
+ * @retval -1 Error and logged to syslog
*/
int
-db_copy(clicon_handle h,
- cvec *cvv,
+db_copy(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
char *db1;
@@ -1304,11 +1390,14 @@ db_copy(clicon_handle h,
}
/*! This is the callback used by cli_setlog to print log message in CLI
+ *
* param[in] s UNIX socket from backend where message should be read
* param[in] arg format: txt, xml, xml2txt, xml2json
+ * @retval 0 OK
+ * @retval -1 Error
*/
static int
-cli_notification_cb(int s,
+cli_notification_cb(int s,
void *arg)
{
int retval = -1;
@@ -1317,7 +1406,7 @@ cli_notification_cb(int s,
cxobj *xt = NULL;
enum format_enum format = (enum format_enum)(uintptr_t)arg;
int ret;
-
+
/* get msg (this is the reason this function is called) */
if (clicon_msg_rcv(s, NULL, 0, &reply, &eof) < 0)
goto done;
@@ -1329,7 +1418,7 @@ cli_notification_cb(int s,
goto done;
}
/* XXX pass yang_spec and use xerr*/
- if ((ret = clicon_msg_decode(reply, NULL, NULL, &xt, NULL)) < 0)
+ if ((ret = clicon_msg_decode(reply, NULL, NULL, &xt, NULL)) < 0)
goto done;
if (ret == 0){ /* will not happen since no yspec ^*/
clicon_err(OE_NETCONF, EFAULT, "Notification malformed");
@@ -1361,11 +1450,13 @@ cli_notification_cb(int s,
/*! Make a notify subscription to backend and un/register callback for return messages.
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] cvv Not used
* @param[in] arg A string with []
* where is "0" or "1"
* and is XXX
+ * @retval 0 OK
+ * @retval -1 Error
* Example code: Start logging of mystream and show logs as xml
* @code
* cmd("comment"), cli_notify("mystream","1","xml");
@@ -1373,12 +1464,12 @@ cli_notification_cb(int s,
* XXX: format is a memory leak
*/
int
-cli_notify(clicon_handle h,
- cvec *cvv,
+cli_notify(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
- char *stream = NULL;
int retval = -1;
+ char *stream = NULL;
int status;
char *formatstr = NULL;
enum format_enum format = FORMAT_TEXT;
@@ -1393,12 +1484,12 @@ cli_notify(clicon_handle h,
formatstr = cv_string_get(cvec_i(argv, 2));
format = format_str2int(formatstr);
}
- if (cli_notification_register(h,
- stream,
+ if (cli_notification_register(h,
+ stream,
format,
- "",
- status,
- cli_notification_cb,
+ "",
+ status,
+ cli_notification_cb,
(void*)format) < 0)
goto done;
@@ -1409,28 +1500,30 @@ cli_notify(clicon_handle h,
/*! Lock database
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] cvv Not used
* @param[in] arg A string with
+ * @retval 0 OK
+ * @retval -1 Error
* @code
* lock("comment"), cli_lock("running");
* @endcode
* XXX: format is a memory leak
*/
int
-cli_lock(clicon_handle h,
- cvec *cvv,
+cli_lock(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
- char *db;
int retval = -1;
+ char *db;
if (cvec_len(argv) != 1){
clicon_err(OE_PLUGIN, EINVAL, "Requires arguments: ");
goto done;
}
db = cv_string_get(cvec_i(argv, 0));
- if (clicon_rpc_lock(h, db) < 0)
+ if (clicon_rpc_lock(h, db) < 0)
goto done;
retval = 0;
done:
@@ -1439,28 +1532,30 @@ cli_lock(clicon_handle h,
/*! Unlock database
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] cvv Not used
* @param[in] arg A string with
+ * @retval 0 OK
+ * @retval -1 Error
* @code
* lock("comment"), cli_lock("running");
* @endcode
* XXX: format is a memory leak
*/
int
-cli_unlock(clicon_handle h,
- cvec *cvv,
+cli_unlock(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
- char *db;
int retval = -1;
+ char *db;
if (cvec_len(argv) != 1){
clicon_err(OE_PLUGIN, EINVAL, "Requires arguments: ");
goto done;
}
db = cv_string_get(cvec_i(argv, 0));
- if (clicon_rpc_unlock(h, db) < 0)
+ if (clicon_rpc_unlock(h, db) < 0)
goto done;
retval = 0;
done:
@@ -1474,13 +1569,15 @@ cli_unlock(clicon_handle h,
* key name;
* leaf name{...
*
- * @param[in] h CLICON handle
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of variables from CLIgen command-line
* @param[in] argv Vector: , , , ,
+ * @retval 0 OK
+ * @retval -1 Error
* Explanation of argv fields:
* db: Database name, eg candidate|tmp|startup
- * xpath: XPATH expression with exactly two %s pointing to field and from name
- * namespace: XPATH default namespace
+ * xpath: XPath expression with exactly two %s pointing to field and from name
+ * namespace: XPath default namespace
* field: Name of list key, eg name
* fromvar: Name of variable containing name of object to copy from (given by xpath)
* tovar: Name of variable containing name of object to copy to.
@@ -1492,14 +1589,14 @@ cli_unlock(clicon_handle h,
* @endcode
*/
int
-cli_copy_config(clicon_handle h,
- cvec *cvv,
+cli_copy_config(clicon_handle h,
+ cvec *cvv,
cvec *argv)
{
int retval = -1;
char *db;
- cxobj *x1 = NULL;
- cxobj *x2 = NULL;
+ cxobj *x1 = NULL;
+ cxobj *x2 = NULL;
cxobj *x;
char *xpath;
char *namespace;
@@ -1533,17 +1630,17 @@ cli_copy_config(clicon_handle h,
fromvar = cv_string_get(cvec_i(argv, 4));
/* Fifth argv argument: to variable */
tovar = cv_string_get(cvec_i(argv, 5));
-
+
/* Get from variable -> cv -> from name */
if ((fromcv = cvec_find(cvv, fromvar)) == NULL){
- clicon_err(OE_PLUGIN, 0, "fromvar '%s' not found in cligen var list", fromvar);
+ clicon_err(OE_PLUGIN, 0, "fromvar '%s' not found in cligen var list", fromvar);
goto done;
}
/* Get from name from cv */
fromname = cv_string_get(fromcv);
/* Create xpath */
if ((cb = cbuf_new()) == NULL){
- clicon_err(OE_PLUGIN, errno, "cbuf_new");
+ clicon_err(OE_PLUGIN, errno, "cbuf_new");
goto done;
}
/* Sanity check that xpath contains exactly two %s, ie [%s='%s'] */
@@ -1554,10 +1651,10 @@ cli_copy_config(clicon_handle h,
j++;
}
if (j != 2){
- clicon_err(OE_PLUGIN, 0, "xpath '%s' does not have two '%%'", xpath);
+ clicon_err(OE_PLUGIN, 0, "xpath '%s' does not have two '%%'", xpath);
goto done;
}
- cprintf(cb, xpath, keyname, fromname);
+ cprintf(cb, xpath, keyname, fromname);
if ((nsc = xml_nsctx_init(NULL, namespace)) == NULL)
goto done;
/* Get from object configuration and store in x1 */
@@ -1581,7 +1678,6 @@ cli_copy_config(clicon_handle h,
goto done;
xml_name_set(x2, NETCONF_INPUT_CONFIG);
cprintf(cb, "/%s", keyname);
-
if ((x = xpath_first(x2, nsc, "%s", cbuf_get(cb))) == NULL){
clicon_err(OE_PLUGIN, 0, "Field %s not found in copy tree", keyname);
goto done;
@@ -1608,8 +1704,18 @@ cli_copy_config(clicon_handle h,
return retval;
}
+/*! CLI support function for printing comment/help string
+ *
+ * @param[in] h Clixon handle
+ * @param[in] cvv Not used
+ * @param[in] arg A string with
+ * @retval 0 OK
+ * @retval -1 Error
+ */
int
-cli_help(clicon_handle h, cvec *vars, cvec *argv)
+cli_help(clicon_handle h,
+ cvec *cvv,
+ cvec *argv)
{
cligen_handle ch = cli_cligen(h);
parse_tree *pt;
@@ -1620,17 +1726,19 @@ cli_help(clicon_handle h, cvec *vars, cvec *argv)
/*! CLI support function for restarting a plugin
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] cvv Not used
* @param[in] arg A string with
+ * @retval 0 OK
+ * @retval -1 Error
* @code
* restart("comment") , cli_restart_plugin("myplugin", "restart");
* @endcode
*/
-int
+int
cli_restart_plugin(clicon_handle h,
cvec *cvv,
- cvec *argv)
+ cvec *argv)
{
int retval = -1;
cg_var *cv;
@@ -1644,7 +1752,7 @@ cli_restart_plugin(clicon_handle h,
cv = cvec_i(argv, 0);
}
plugin = cv_string_get(cv);
- retval = clicon_rpc_restart_plugin(h, plugin);
+ retval = clicon_rpc_restart_plugin(h, plugin);
done:
return retval;
}
@@ -1659,7 +1767,7 @@ cvec_append(cvec *cvv0,
{
cvec *cvv2 = NULL;
cg_var *cv;
-
+
if (cvv0 == NULL){
if ((cvv2 = cvec_dup(cvv1)) == NULL){
clicon_err(OE_UNIX, errno, "cvec_dup");
@@ -1682,6 +1790,8 @@ cvec_append(cvec *cvv0,
*
* @param[in] cvv Input vector
* @param[out] appstr Concatenated string as existing cbuf
+ * @retval 0 OK
+ * @retval -1 Error
*/
int
cvec_concat_cb(cvec *cvv,
@@ -1692,7 +1802,7 @@ cvec_concat_cb(cvec *cvv,
cg_var *cv;
char *str;
int i;
-
+
if (cb == NULL){
clicon_err(OE_PLUGIN, EINVAL, "cb is NULL");
goto done;
@@ -1717,15 +1827,17 @@ cvec_concat_cb(cvec *cvv,
/*! Process control as defined by clixon-lib API
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] cvv Not used
* @param[in] arg Two strings:
+ * @retval 0 OK
+ * @retval -1 Error
* @code
* actions-daemon("Actions daemon operations") start,
* cli_process_control("Action process", "start");
* @endcode
*/
-int
+int
cli_process_control(clicon_handle h,
cvec *cvv,
cvec *argv)
@@ -1736,7 +1848,7 @@ cli_process_control(clicon_handle h,
cbuf *cb = NULL;
cxobj *xret = NULL;
cxobj *xerr;
-
+
if (cvec_len(argv) != 2){
clicon_err(OE_PLUGIN, EINVAL, "Requires two element: process name and operation");
goto done;
diff --git a/apps/cli/cli_generate.c b/apps/cli/cli_generate.c
index 6d94ee12..4f665c45 100644
--- a/apps/cli/cli_generate.c
+++ b/apps/cli/cli_generate.c
@@ -122,8 +122,8 @@ You can see which CLISPEC it generates via clixon_cli -D 2:
* @note XXX only fraction_digits handled,should also have mincv, maxcv, pattern
*/
static int
-cli_expand_var_generate(clicon_handle h,
- yang_stmt *ys,
+cli_expand_var_generate(clicon_handle h,
+ yang_stmt *ys,
const char *cvtypestr,
int options,
uint8_t fraction_digits,
@@ -135,12 +135,12 @@ cli_expand_var_generate(clicon_handle h,
int extvalue = 0;
yang_stmt *yspec;
cg_var *cv = NULL;
-
+
if ((yspec = ys_spec(ys)) != NULL)
cv = yang_cv_get(yspec);
if (yang_extension_value(ys, "hide", CLIXON_AUTOCLI_NS, &extvalue, NULL) < 0)
goto done;
- if (extvalue || yang_find(ys, Y_STATUS, "deprecated") != NULL)
+ if (extvalue || yang_find(ys, Y_STATUS, "deprecated") != NULL)
goto hide;
if (yang2api_path_fmt(ys, 1, &api_path_fmt) < 0)
goto done;
@@ -167,15 +167,18 @@ cli_expand_var_generate(clicon_handle h,
}
/*! Create callback with api_path format string as argument
+ *
* @param[in] h Clixon handle
* @param[in] ys yang_stmt of the node at hand
* @param[out] cb The string where the result format string is inserted.
+ * @retval 0 OK
+ * @retval -1 Error
* @see cli_dbxml This is where the xmlkeyfmt string is used
* @see pt_callback_reference in CLIgen where the actual callback overwrites the template
*/
static int
-cli_callback_generate(clicon_handle h,
- yang_stmt *ys,
+cli_callback_generate(clicon_handle h,
+ yang_stmt *ys,
cbuf *cb)
{
int retval = -1;
@@ -200,6 +203,7 @@ cli_callback_generate(clicon_handle h,
}
/*! Print cligen help string as ("")
+ *
* @param[in] cb CLIgen buf holding generated CLIspec
* @param[in] helptext Help text
*/
@@ -243,10 +247,13 @@ yang2cli_print_alias(cbuf *cb,
}
/*! Generate identityref statements for CLI variables
+ *
* @param[in] ys Yang statement
* @param[in] ytype Resolved yang type.
* @param[in] helptext CLI help text
* @param[out] cb Buffer where cligen code is written
+ * @retval 0 OK
+ * @retval -1 Error
* @see yang2cli_var_sub Its sub-function
*/
static int
@@ -267,7 +274,7 @@ yang2cli_var_identityref(yang_stmt *ys,
yang_stmt *ymod;
yang_stmt *yprefix;
yang_stmt *yspec;
-
+
if ((ybaseref = yang_find(ytype, Y_BASE, NULL)) == NULL)
goto ok;
if ((ybaseid = yang_find_identity(ytype, yang_argument_get(ybaseref))) == NULL)
@@ -316,10 +323,13 @@ yang2cli_var_identityref(yang_stmt *ys,
}
/*! Generate range check statements for CLI variables
+ *
* @param[in] ys Yang statement
* @param[in] options Flags field of optional values, eg YANG_OPTIONS_RANGE
* @param[in] cvv Cvec with array of range_min/range_max cv:s (if YANG_OPTIONS_RANGE is set in options)
* @param[out] cb Buffer where cligen code is written
+ * @retval 0 OK
+ * @retval -1 Error
* @see yang2cli_var_sub which is the main function
* In yang ranges are given as range 1 or range 1 .. 16, encoded in a cvv
* 0 : range_min = x
@@ -349,7 +359,7 @@ yang2cli_var_range(yang_stmt *ys,
int i;
cg_var *cv1; /* lower limit */
cg_var *cv2; /* upper limit */
-
+
/* Loop through range_min and range_min..range_max */
i = 0;
while (i \"
*/
@@ -387,14 +400,14 @@ yang2cli_var_pattern(clicon_handle h,
cvec *patterns,
cbuf *cb)
{
- int retval = -1;
+ int retval = -1;
enum regexp_mode mode;
- cg_var *cvp;
- char *pattern;
- int invert;
- char *posix = NULL;
- int i;
-
+ cg_var *cvp;
+ char *pattern;
+ int invert;
+ char *posix = NULL;
+ int i;
+
mode = clicon_yang_regexp(h);
cvp = NULL; /* Loop over compiled regexps */
while ((cvp = cvec_each(patterns, cvp)) != NULL){
@@ -439,6 +452,7 @@ static int yang2cli_var_union(clicon_handle h, yang_stmt *ys, char *origtype,
yang_stmt *ytype, char *helptext, cbuf *cb);
/*! Generate CLI code for Yang leaf state ment to CLIgen variable of specific type
+ *
* Check for completion (of already existent values), ranges (eg range[min:max]) and
* patterns, (eg regexp:"[0.9]*").
* @param[in] h Clixon handle
@@ -451,11 +465,13 @@ static int yang2cli_var_union(clicon_handle h, yang_stmt *ys, char *origtype,
* @param[in] patterns Cvec of regexp patterns
* @param[in] fraction for decimal64, how many digits after period
* @param[out] cb Buffer where cligen code is written
+ * @retval 0 OK
+ * @retval -1 Error
* @see yang_type_resolve for options and other arguments
*/
static int
yang2cli_var_sub(clicon_handle h,
- yang_stmt *ys,
+ yang_stmt *ys,
yang_stmt *ytype, /* resolved type */
char *helptext,
enum cv_type cvtype,
@@ -481,7 +497,6 @@ yang2cli_var_sub(clicon_handle h,
}
type = ytype?yang_argument_get(ytype):NULL;
cvtypestr = cv_type2str(cvtype);
-
if (type && strcmp(type, "identityref") == 0)
cprintf(cb, "(");
cprintf(cb, "<%s:%s", yang_argument_get(ys), cvtypestr);
@@ -533,17 +548,20 @@ yang2cli_var_sub(clicon_handle h,
}
/*! Resolve a single Yang union and generate code
+ *
* Part of generating CLI code for Yang leaf statement to CLIgen variable
- * @param[in] h Clixon handle
- * @param[in] ys Yang statement (caller of type)
- * @param[in] origtype Name of original type in the call
- * @param[in] ytsub Yang type invocation, a sub-type of a resolved union type
- * @param[in] cb Buffer where cligen code is written
+ * @param[in] h Clixon handle
+ * @param[in] ys Yang statement (caller of type)
+ * @param[in] origtype Name of original type in the call
+ * @param[in] ytsub Yang type invocation, a sub-type of a resolved union type
+ * @param[in] cb Buffer where cligen code is written
* @param[in] helptext CLI help text
+ * @retval 0 OK
+ * @retval -1 Error
*/
static int
yang2cli_var_union_one(clicon_handle h,
- yang_stmt *ys,
+ yang_stmt *ys,
char *origtype,
yang_stmt *ytsub,
char *helptext,
@@ -581,7 +599,7 @@ yang2cli_var_union_one(clicon_handle h,
else {
if (clicon_type2cv(origtype, restype, ys, &cvtype) < 0)
goto done;
- if ((retval = yang2cli_var_sub(h, ys, ytype, helptext, cvtype,
+ if ((retval = yang2cli_var_sub(h, ys, ytype, helptext, cvtype,
options, cvv, patterns, fraction_digits, cb)) < 0)
goto done;
}
@@ -593,17 +611,20 @@ yang2cli_var_union_one(clicon_handle h,
}
/*! Loop over all sub-types of a Yang union
+ *
* Part of generating CLI code for Yang leaf statement to CLIgen variable
- * @param[in] h Clixon handle
- * @param[in] ys Yang statement (caller)
+ * @param[in] h Clixon handle
+ * @param[in] ys Yang statement (caller)
* @param[in] origtype Name of original type in the call
- * @param[in] ytype Yang resolved type (a union in this case)
- * @param[in] helptext CLI help text
- * @param[out] cb Buffer where cligen code is written
+ * @param[in] ytype Yang resolved type (a union in this case)
+ * @param[in] helptext CLI help text
+ * @param[out] cb Buffer where cligen code is written
+ * @retval 0 OK
+ * @retval -1 Error
*/
static int
yang2cli_var_union(clicon_handle h,
- yang_stmt *ys,
+ yang_stmt *ys,
char *origtype,
yang_stmt *ytype,
char *helptext,
@@ -633,7 +654,7 @@ yang2cli_var_union(clicon_handle h,
static int
yang2cli_var_leafref(clicon_handle h,
- yang_stmt *ys,
+ yang_stmt *ys,
yang_stmt *yrestype,
char *helptext,
enum cv_type cvtype,
@@ -669,11 +690,11 @@ yang2cli_var_leafref(clicon_handle h,
if (completionp && regular_value)
cprintf(cb, "(");
if (regular_value)
- if (yang2cli_var_sub(h, ys, yrestype, helptext, cvtype,
+ if (yang2cli_var_sub(h, ys, yrestype, helptext, cvtype,
options, cvv, patterns, fraction_digits, cb) < 0)
goto done;
if (completionp){
- if ((ret = cli_expand_var_generate(h, ys, cvtypestr,
+ if ((ret = cli_expand_var_generate(h, ys, cvtypestr,
options, fraction_digits, regular_value,
cb)) < 0)
goto done;
@@ -688,11 +709,14 @@ yang2cli_var_leafref(clicon_handle h,
}
/*! Generate CLI code for Yang leaf statement to CLIgen variable
+ *
* @param[in] h Clixon handle
* @param[in] ys Yang statement of original leaf
* @param[in] yreferred Yang statement of referred node for type (leafref)
* @param[in] helptext CLI help text
* @param[out] cb Buffer where cligen code is written
+ * @retval 0 OK
+ * @retval -1 Error
*
* Make a type lookup and complete a cligen variable expression such as .
* One complication is yang union, that needs a recursion since it consists of
@@ -707,7 +731,7 @@ yang2cli_var_leafref(clicon_handle h,
static int
yang2cli_var(clicon_handle h,
yang_stmt *ys,
- yang_stmt *yreferred,
+ yang_stmt *yreferred,
char *helptext,
cbuf *cb)
{
@@ -723,12 +747,12 @@ yang2cli_var(clicon_handle h,
int options = 0;
int completionp;
int ret;
-
+
if ((patterns = cvec_new(0)) == NULL){
clicon_err(OE_UNIX, errno, "cvec_new");
goto done;
}
- if (yang_type_get(yreferred, &origtype, &yrestype,
+ if (yang_type_get(yreferred, &origtype, &yrestype,
&options, &cvv, patterns, NULL, &fraction_digits) < 0)
goto done;
restype = yang_argument_get(yrestype);
@@ -739,7 +763,7 @@ yang2cli_var(clicon_handle h,
cvtypestr = cv_type2str(cvtype);
/* Note restype can be NULL here for example with unresolved hardcoded uuid */
- if (strcmp(restype, "union") == 0){
+ if (strcmp(restype, "union") == 0){
/* Union: loop over resolved type's sub-types (can also be recursive unions) */
cprintf(cb, "(");
if (yang2cli_var_union(h, ys, origtype, yrestype, helptext, cb) < 0)
@@ -747,7 +771,7 @@ yang2cli_var(clicon_handle h,
if (autocli_completion(h, &completionp) < 0)
goto done;
if (completionp){
- if ((ret = cli_expand_var_generate(h, ys, cvtypestr,
+ if ((ret = cli_expand_var_generate(h, ys, cvtypestr,
options, fraction_digits, 1, cb)) < 0)
goto done;
if (ret == 1)
@@ -770,15 +794,15 @@ yang2cli_var(clicon_handle h,
}
if (yang_path_arg(yreferred, path_arg, &yref) < 0)
goto done;
- if (yref == NULL){
+ if (yref == NULL){
/* Give up: use yreferred
*/
- if (yang2cli_var_leafref(h, ys, yrestype, helptext, cvtype, options,
+ if (yang2cli_var_leafref(h, ys, yrestype, helptext, cvtype, options,
cvv, patterns, fraction_digits, cb) < 0)
goto done;
}
else {
- if (yreferred == yref){
+ if (yreferred == yref){
clicon_err(OE_YANG, 0, "Referred YANG node for leafref path %s points to self", path_arg);
goto done;
}
@@ -803,26 +827,29 @@ yang2cli_var(clicon_handle h,
}
/*! Generate CLI code for Yang leaf statement
+ *
* @param[in] h Clixon handle
* @param[in] ys Yang statement
* @param[in] level Indentation level
- * @param[in] callback If set, include a "; cli_set()" callback, otherwise not
+ * @param[in] callback If set, include a "; cli_set()" callback, otherwise not
* @param[in] key_leaf 0: ordinary leaf, 1:prekey, 2: lastkey
* @param[out] cb Buffer where cligen code is written
+ * @retval 0 OK
+ * @retval -1 Error
* Some complexity in callback, key_leaf and extralevel logic.
* If extralevel -> add extra { } level
* + if callbacks add: cb();{}
*/
static int
-yang2cli_leaf(clicon_handle h,
- yang_stmt *ys,
+yang2cli_leaf(clicon_handle h,
+ yang_stmt *ys,
int level,
int callback,
int key_leaf,
cbuf *cb)
{
- yang_stmt *yd; /* description */
int retval = -1;
+ yang_stmt *yd; /* description */
char *helptext = NULL;
char *s;
autocli_listkw_t listkw;
@@ -841,7 +868,7 @@ yang2cli_leaf(clicon_handle h,
}
cprintf(cb, "%*s", level*3, "");
/* Called a second time in yang2cli_var, room for optimization */
- if (yang_type_get(ys, NULL, &yrestype,
+ if (yang_type_get(ys, NULL, &yrestype,
NULL, NULL, NULL, NULL, NULL) < 0)
goto done;
if (key_leaf == 0 && strcmp(yang_argument_get(yrestype), "empty") != 0)
@@ -905,27 +932,30 @@ yang2cli_leaf(clicon_handle h,
}
/*! Generate CLI code for Yang container statement
+ *
* @param[in] h Clixon handle
* @param[in] ys Yang statement
* @param[in] level Indentation level
- * @param[out] cb Buffer where cligen code is written
+ * @param[out] cb Buffer where cligen code is written
+ * @retval 0 OK
+ * @retval -1 Error
*/
static int
-yang2cli_container(clicon_handle h,
- yang_stmt *ys,
+yang2cli_container(clicon_handle h,
+ yang_stmt *ys,
int level,
cbuf *cb)
{
+ int retval = -1;
yang_stmt *yc;
yang_stmt *yd;
- int retval = -1;
char *helptext = NULL;
char *s;
int compress = 0;
yang_stmt *ymod = NULL;
int extvalue = 0;
int ret;
-
+
if (ys_real_module(ys, &ymod) < 0)
goto done;
/* If non-presence container && HIDE mode && only child is
@@ -964,7 +994,7 @@ yang2cli_container(clicon_handle h,
}
}
yc = NULL;
- while ((yc = yn_each(ys, yc)) != NULL)
+ while ((yc = yn_each(ys, yc)) != NULL)
if (yang2cli_stmt(h, yc, level+1, cb) < 0)
goto done;
if (!compress)
@@ -977,24 +1007,27 @@ yang2cli_container(clicon_handle h,
}
/*! Generate CLI code for Yang list statement
+ *
* @param[in] h Clixon handle
* @param[in] ys Yang statement
* @param[in] level Indentation level
* @param[out] cb Buffer where cligen code is written
+ * @retval 0 OK
+ * @retval -1 Error
*/
static int
yang2cli_list(clicon_handle h,
- yang_stmt *ys,
+ yang_stmt *ys,
int level,
cbuf *cb)
{
+ int retval = -1;
yang_stmt *yc;
yang_stmt *yd;
yang_stmt *yleaf;
cg_var *cvi;
char *keyname;
cvec *cvk = NULL; /* vector of index keys */
- int retval = -1;
char *helptext = NULL;
char *s;
int last_key = 0;
@@ -1023,7 +1056,7 @@ yang2cli_list(clicon_handle h,
while ((cvi = cvec_each(cvk, cvi)) != NULL) {
keyname = cv_string_get(cvi);
if ((yleaf = yang_find(ys, Y_LEAF, keyname)) == NULL){
- clicon_err(OE_XML, 0, "List statement \"%s\" has no key leaf \"%s\"",
+ clicon_err(OE_XML, 0, "List statement \"%s\" has no key leaf \"%s\"",
yang_argument_get(ys), keyname);
goto done;
}
@@ -1066,7 +1099,7 @@ yang2cli_list(clicon_handle h,
}
cprintf(cb, "%*s}\n", level*3, "");
/* Close with } for each key */
- while (keynr--)
+ while (keynr--)
cprintf(cb, "%*s}\n", level*3, "");
retval = 0;
done:
@@ -1081,18 +1114,20 @@ yang2cli_list(clicon_handle h,
* @param[in] ys Yang statement
* @param[in] level Indentation level
* @param[out] cb Buffer where cligen code is written
-@example
+ * @retval 0 OK
+ * @retval -1 Error
+ * @code
choice interface-type {
container ethernet { ... }
container fddi { ... }
}
-@example.end
- @Note Removes 'meta-syntax' from cli syntax. They are not shown when xml is
+ * @code.end
+ @note Removes 'meta-syntax' from cli syntax. They are not shown when xml is
translated to cli. and therefore input-syntax != output syntax. Which is bad
*/
static int
-yang2cli_choice(clicon_handle h,
- yang_stmt *ys,
+yang2cli_choice(clicon_handle h,
+ yang_stmt *ys,
int level,
cbuf *cb)
{
@@ -1206,6 +1241,7 @@ yang2cli_uses(clicon_handle h,
}
/*! Generate CLI code for Yang statement
+ *
* @param[in] h Clixon handle
* @param[in] ys Yang statement
* @param[in] level Indentation level
@@ -1214,9 +1250,9 @@ yang2cli_uses(clicon_handle h,
* @retval -1 Error
*/
static int
-yang2cli_stmt(clicon_handle h,
- yang_stmt *ys,
- int level,
+yang2cli_stmt(clicon_handle h,
+ yang_stmt *ys,
+ int level,
cbuf *cb)
{
int retval = -1;
@@ -1230,11 +1266,11 @@ yang2cli_stmt(clicon_handle h,
goto done;
}
if (yang_find(ys, Y_STATUS, "obsolete") != NULL){
- clicon_debug(4, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
+ clixon_debug(CLIXON_DBG_DETAIL, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
goto ok;
}
if (yang_find(ys, Y_STATUS, "deprecated") != NULL){
- clicon_debug(4, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
+ clixon_debug(CLIXON_DBG_DETAIL, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
}
/* Check if autocli skip */
if (yang_extension_value(ys, "skip", CLIXON_AUTOCLI_NS, &extvalue, NULL) < 0)
@@ -1252,7 +1288,7 @@ yang2cli_stmt(clicon_handle h,
#ifdef AUTOCLI_GROUPING_TOPLEVEL_SKIP
cornercase = yang_keyword_get(yang_parent_get(ys)) == Y_MODULE || yang_keyword_get(yang_parent_get(ys)) == Y_SUBMODULE;
#endif
- if (yang_keyword_get(ys) != Y_USES && yang_flag_get(ys, YANG_FLAG_GROUPING)
+ if (yang_keyword_get(ys) != Y_USES && yang_flag_get(ys, YANG_FLAG_GROUPING)
&& !cornercase
)
goto ok;
@@ -1301,6 +1337,7 @@ yang2cli_stmt(clicon_handle h,
}
/*! Add cv with name to cvec
+ *
* @param[in] cvv Either existing or NULL
* @param[in] name Name of cv to add
* @retval cvv Either same as in cvv parameter or new
@@ -1310,7 +1347,7 @@ cvec_add_name(cvec *cvv,
char *name)
{
cg_var *cv= NULL;
-
+
if (cvv == NULL &&
(cvv = cvec_new(0)) == NULL){
clicon_err(OE_UNIX, errno, "cvec_new");
@@ -1382,7 +1419,7 @@ yang2cli_post(clicon_handle h,
char *name;
cg_var *cv = NULL;
int j=0;
-
+
cv = NULL;
while ((cv = cvec_each(cop->co_cvec, cv)) != NULL){
name = cv_name_get(cv);
@@ -1480,7 +1517,7 @@ yang2cli_post(clicon_handle h,
* XXX merge with yang2cli_yspec
*/
static int
-yang2cli_grouping(clicon_handle h,
+yang2cli_grouping(clicon_handle h,
yang_stmt *ys,
char *treename)
{
@@ -1495,7 +1532,7 @@ yang2cli_grouping(clicon_handle h,
cg_obj *co;
int config;
int i;
-
+
if ((pt0 = pt_new()) == NULL){
clicon_err(OE_UNIX, errno, "pt_new");
goto done;
@@ -1506,11 +1543,11 @@ yang2cli_grouping(clicon_handle h,
}
/* Traverse YANG, loop through all modules and generate CLI, inline of yang2cli_stmt */
if (yang_find(ys, Y_STATUS, "obsolete") != NULL){
- clicon_debug(4, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
+ clixon_debug(CLIXON_DBG_DETAIL, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
goto empty;
}
if (yang_find(ys, Y_STATUS, "deprecated") != NULL){
- clicon_debug(4, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
+ clixon_debug(CLIXON_DBG_DETAIL, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
}
/* Only produce autocli for YANG non-config only if autocli-treeref-state is true */
if (autocli_treeref_state(h, &treeref_state) < 0)
@@ -1539,12 +1576,12 @@ yang2cli_grouping(clicon_handle h,
fprintf(stderr, "%s\n", cbuf_get(cb));
goto done;
}
- clicon_debug(CLIXON_DBG_DEFAULT, "%s Generated auto-cli for grouping:%s",
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s Generated auto-cli for grouping:%s",
__FUNCTION__, yang_argument_get(ys));
/* Add prefix: assume new are appended */
for (i=0; ico_command);
co_prefix_set(co, prefix);
}
@@ -1562,7 +1599,7 @@ yang2cli_grouping(clicon_handle h,
clicon_log(LOG_NOTICE, "%s: Top-level cli-spec %s:\n%s",
__FUNCTION__, treename, cbuf_get(cb));
else
- clicon_debug(CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s",
+ clixon_debug(CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s",
__FUNCTION__, treename, cbuf_get(cb));
if (cligen_parsetree_merge(pt0, NULL, pt) < 0){
clicon_err(OE_YANG, errno, "cligen_parsetree_merge");
@@ -1614,7 +1651,7 @@ yang2cli_grouping(clicon_handle h,
* @note Tie-break of same top-level symbol: prefix is NYI
*/
int
-yang2cli_yspec(clicon_handle h,
+yang2cli_yspec(clicon_handle h,
yang_stmt *yspec,
char *treename)
{
@@ -1629,7 +1666,7 @@ yang2cli_yspec(clicon_handle h,
cg_obj *co;
int i;
int config;
-
+
if ((pt0 = pt_new()) == NULL){
clicon_err(OE_UNIX, errno, "pt_new");
goto done;
@@ -1669,12 +1706,12 @@ 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",
+ clixon_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; ico_command);
co_prefix_set(co, prefix);
}
@@ -1693,7 +1730,7 @@ yang2cli_yspec(clicon_handle h,
clicon_log(LOG_NOTICE, "%s: Top-level cli-spec %s:\n%s",
__FUNCTION__, treename, cbuf_get(cb));
else
- clicon_debug(CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s",
+ clixon_debug(CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s",
__FUNCTION__, treename, cbuf_get(cb));
if (cligen_parsetree_merge(pt0, NULL, pt) < 0){
clicon_err(OE_YANG, errno, "cligen_parsetree_merge");
diff --git a/apps/cli/cli_handle.c b/apps/cli/cli_handle.c
index b8f2a3cf..e2e38c42 100644
--- a/apps/cli/cli_handle.c
+++ b/apps/cli/cli_handle.c
@@ -72,7 +72,8 @@
#define handle(h) (assert(clicon_handle_check(h)==0),(struct cli_handle *)(h))
#define cligen(h) (handle(h)->cl_cligen)
-/*! CLI specific handle added to header CLICON handle
+/*! CLI specific handle added to header Clixon handle
+ *
* This file should only contain access functions for the _specific_
* entries in the struct below.
* @note The top part must be equivalent to struct clicon_handle in clixon_handle.c
@@ -115,6 +116,8 @@ cli_handle_init(void)
}
/*! Free clicon handle
+ *
+ * @param[in] h Clixon handle
*/
int
cli_handle_exit(clicon_handle h)
@@ -130,7 +133,10 @@ cli_handle_exit(clicon_handle h)
* cli-specific handle access functions
*----------------------------------------------------------*/
-/*! Return clicon handle */
+/*! Return clicon handle
+ *
+ * @param[in] h Clixon handle
+ */
cligen_handle
cli_cligen(clicon_handle h)
{
@@ -156,8 +162,9 @@ cli_susp_hook(clicon_handle h,
cligen_handle ch = cligen(h);
/* This assume first arg of fn can be treated as void* */
- return cligen_susp_hook(ch, fn);
+ return cligen_susp_hook(ch, fn);
}
+
int
cli_interrupt_hook(clicon_handle h,
cligen_interrupt_cb_t *fn)
@@ -165,7 +172,7 @@ cli_interrupt_hook(clicon_handle h,
cligen_handle ch = cligen(h);
/* This assume first arg of fn can be treated as void* */
- return cligen_interrupt_hook(ch, fn);
+ return cligen_interrupt_hook(ch, fn);
}
int
diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c
index 6d109d1a..1dadc023 100644
--- a/apps/cli/cli_main.c
+++ b/apps/cli/cli_main.c
@@ -76,8 +76,11 @@
#define CLI_OPTS "+hD:f:E:l:C:F:1a:u:d:m:qp:GLy:c:U:o:"
/*! Check if there is a CLI history file and if so dump the CLI histiry to it
+ *
* Just log if file does not exist or is not readable
- * @param[in] h CLICON handle
+ * @param[in] h Clixon handle
+ * @retval 0 OK
+ * @retval -1 Error
*/
static int
cli_history_load(clicon_handle h)
@@ -121,8 +124,11 @@ cli_history_load(clicon_handle h)
}
/*! Start CLI history and load from file
+ *
* Just log if file does not exist or is not readable
- * @param[in] h CLICON handle
+ * @param[in] h Clixon handle
+ * @retval 0 OK
+ * @retval -1 Error
*/
static int
cli_history_save(clicon_handle h)
@@ -157,6 +163,7 @@ cli_history_save(clicon_handle h)
}
/*! Clean and close all state of cli process (but dont exit).
+ *
* Cannot use h after this
* @param[in] h Clixon handle
*/
@@ -170,7 +177,7 @@ cli_terminate(clicon_handle h)
if (clixon_exit_get() == 0)
clixon_exit_set(1);
if (clicon_data_get(h, "session-transport", NULL) == 0)
- clicon_rpc_close_session(h);
+ clicon_rpc_close_session(h);
if ((yspec = clicon_dbspec_yang(h)) != NULL)
ys_free(yspec);
if ((yspec = clicon_config_yang(h)) != NULL)
@@ -195,11 +202,11 @@ cli_terminate(clicon_handle h)
}
/*! Unlink pidfile and quit
-*/
+ */
static void
cli_sig_term(int arg)
{
- clicon_log(LOG_NOTICE, "%s: %u Terminated (killed by sig %d)",
+ clicon_log(LOG_NOTICE, "%s: %u Terminated (killed by sig %d)",
__PROGRAM__, getpid(), arg);
exit(1);
}
@@ -226,7 +233,8 @@ cli_signal_init (clicon_handle h)
}
/*! Interactive CLI command loop
- * @param[in] h CLICON handle
+ *
+ * @param[in] h Clixon handle
* @retval 0
* @retval -1
* @see cligen_loop
@@ -269,6 +277,7 @@ cli_interactive(clicon_handle h)
}
/*! Create pre-5.5 tree-refs for backward compatibility
+ *
* should probably be moved to clispec default
*/
static int
@@ -382,8 +391,8 @@ autocli_start(clicon_handle h)
int retval = -1;
yang_stmt *yspec;
int enable = 0;
-
- clicon_debug(1, "%s", __FUNCTION__);
+
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
/* There is no single "enable-autocli" flag,
* but set
* false
@@ -394,7 +403,7 @@ autocli_start(clicon_handle h)
if (autocli_module(h, NULL, &enable) < 0)
goto done;
if (!enable){
- clicon_debug(1, "%s Autocli not enabled (clixon-autocli)", __FUNCTION__);
+ clixon_debug(CLIXON_DBG_DEFAULT, "%s Autocli not enabled (clixon-autocli)", __FUNCTION__);
goto ok;
}
/* Init yang2cli */
@@ -404,7 +413,7 @@ autocli_start(clicon_handle h)
/* The actual generating call from yang to clispec for the complete yang spec, @basemodel */
if (yang2cli_yspec(h, yspec, AUTOCLI_TREENAME) < 0)
goto done;
- /* XXX Create pre-5.5 tree-refs for backward compatibility */
+ /* XXX Create pre-5.5 tree-refs for backward compatibility */
if (autocli_trees_default(h) < 0)
goto done;
ok:
@@ -469,7 +478,7 @@ usage(clicon_handle h,
fprintf(stderr, "usage:%s [options] [commands] [-- extra-options]\n"
"where commands is a CLI command\n"
- "and extra-options are app-dependent and passed to the plugin init function\n"
+ "and extra-options are app-dependent and passed to the plugin init function\n"
"where options are\n"
"\t-h \t\tHelp\n"
"\t-D \tDebug level\n"
@@ -525,7 +534,7 @@ main(int argc,
int nr;
int config_dump;
enum format_enum config_dump_format = FORMAT_XML;
-
+
/* Defaults */
once = 0;
config_dump = 0;
@@ -533,7 +542,7 @@ main(int argc,
/* In the startup, logs to stderr & debug flag set later */
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
- /* Initiate CLICON handle. CLIgen is also initialized */
+ /* Initiate Clixon handle. CLIgen is also initialized */
if ((h = cli_handle_init()) == NULL)
goto done;
@@ -549,7 +558,7 @@ main(int argc,
cligen_comment_set(cli_cligen(h), '#'); /* Default to handle #! clicon_cli scripts */
cligen_lexicalorder_set(cli_cligen(h), 1);
-
+
/*
* First-step command-line options for help, debug, config-file and log,
*/
@@ -588,11 +597,11 @@ main(int argc,
goto done;
break;
}
- /*
+ /*
* Logs, error and debug to stderr or syslog, set debug level
*/
clicon_log_init(__PROGRAM__, dbg?LOG_DEBUG:LOG_INFO, logdst);
- clicon_debug_init(dbg, NULL);
+ clixon_debug_init(dbg, NULL);
yang_init(h);
/* Find, read and parse configfile */
@@ -601,7 +610,7 @@ main(int argc,
usage(h, argv[0]);
goto done;
}
- /* Now rest of options */
+ /* Now rest of options */
opterr = 0;
optind = 1;
while ((c = getopt(argc, argv, CLI_OPTS)) != -1){
@@ -698,7 +707,7 @@ main(int argc,
/* Defer: Wait to the last minute to print help message */
if (help)
usage(h, argv[0]);
-
+
/* Split remaining argv/argc into and */
if (options_split(h, argv0, argc, argv, &restarg) < 0)
goto done;
@@ -713,7 +722,7 @@ main(int argc,
nr = clicon_option_int(h, "CLICON_CLI_LINES_DEFAULT");
cligen_terminal_rows_set(cli_cligen(h), nr);
}
-
+
if (clicon_yang_regexp(h) == REGEXP_LIBXML2){
#ifdef HAVE_LIBXML2
/* Enable XSD libxml2 regex engine */
@@ -732,7 +741,7 @@ main(int argc,
if ((nr = clicon_option_int(h, "CLICON_LOG_STRING_LIMIT")) != 0)
clicon_log_string_limit_set(nr);
-
+
/* Setup signal handlers */
if (cli_signal_init(h) < 0)
goto done;
@@ -757,7 +766,7 @@ main(int argc,
goto done;
}
#endif
-
+
/* Add (hardcoded) netconf features in case ietf-netconf loaded here
* Otherwise it is loaded in netconf_module_load below
*/
@@ -772,7 +781,7 @@ main(int argc,
if ((yspec = yspec_new()) == NULL)
goto done;
clicon_dbspec_yang_set(h, yspec);
-
+
/* Load Yang modules
* 1. Load a yang module as a specific absolute filename */
if ((str = clicon_yang_main_file(h)) != NULL){
@@ -802,7 +811,6 @@ main(int argc,
/* Add netconf yang spec, used as internal protocol */
if (netconf_module_load(h) < 0)
goto done;
-
/* Here all modules are loaded
* Compute and set canonical namespace context
*/
@@ -868,7 +876,7 @@ main(int argc,
clicon_option_dump(h, 1);
cligen_line_scrolling_set(cli_cligen(h), clicon_option_int(h,"CLICON_CLI_LINESCROLLING"));
- /*! Start CLI history and load from file */
+ /* Start CLI history and load from file */
if (cli_history_load(h) < 0)
goto done;
/* Experimental utf8 mode */
@@ -893,7 +901,7 @@ main(int argc,
if (evalresult < 0)
goto done;
}
-
+
/* Go into event-loop unless -1 command-line */
if (!once){
retval = cli_interactive(h);
diff --git a/apps/cli/cli_pipe.c b/apps/cli/cli_pipe.c
index 8b7a689c..07cfed19 100644
--- a/apps/cli/cli_pipe.c
+++ b/apps/cli/cli_pipe.c
@@ -92,7 +92,7 @@ pipe_arg_fn(clicon_handle h,
struct stat fstat;
char **argv = NULL;
int i;
-
+
if (cmd == NULL || strlen(cmd) == 0){
clicon_err(OE_PLUGIN, EINVAL, "cmd '%s' NULL or empty", cmd);
goto done;
@@ -123,7 +123,7 @@ pipe_arg_fn(clicon_handle h,
/* Grep pipe output function
*
- * @param[in] h Clicon handle
+ * @param[in] h Clixon handle
* @param[in] cvv Vector of cli string and instantiated variables
* @param[in] argv String vector of options. Format: