Drop __FUNCTION__ from clixon_debug() calls
This commit is contained in:
parent
d5a8d6b6e1
commit
cf2e27b43d
74 changed files with 619 additions and 578 deletions
|
|
@ -146,7 +146,7 @@ ce_event_cb(clixon_handle h,
|
|||
struct client_entry *ce = (struct client_entry *)arg;
|
||||
cbuf *cbce = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s op:%d", __FUNCTION__, op);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "op:%d", op);
|
||||
switch (op){
|
||||
case 1:
|
||||
/* Risk of recursion here */
|
||||
|
|
@ -282,7 +282,7 @@ backend_monitoring_state_get(clixon_handle h,
|
|||
goto fail;
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
|
|
@ -336,7 +336,7 @@ backend_client_rm(clixon_handle h,
|
|||
}
|
||||
}
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* 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);
|
||||
|
|
@ -378,7 +378,7 @@ clixon_stats_datastore_get(clixon_handle h,
|
|||
size_t sz = 0;
|
||||
cxobj *xn = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, dbname);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", 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) */
|
||||
|
|
@ -655,7 +655,7 @@ from_client_edit_config(clixon_handle h,
|
|||
xml_free(xret);
|
||||
if (cbx)
|
||||
cbuf_free(cbx);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s done cbret:%s", __FUNCTION__, cbuf_get(cbret));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "done cbret:%s", cbuf_get(cbret));
|
||||
return retval;
|
||||
} /* from_client_edit_config */
|
||||
|
||||
|
|
@ -1584,7 +1584,7 @@ from_client_msg(clixon_handle h,
|
|||
int nr = 0;
|
||||
cbuf *cbce = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
yspec = clicon_dbspec_yang(h);
|
||||
/* Return netconf message. Should be filled in by the dispatch(sub) functions
|
||||
* as wither rpc-error or by positive response.
|
||||
|
|
@ -1633,7 +1633,7 @@ from_client_msg(clixon_handle h,
|
|||
if (op_id != 0 && ce->ce_id != op_id && strcmp(rpcname, "create-subscription")){
|
||||
client_entry *ce0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%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_CLIENT, "Warning: incoming session-id:%u does not match ce_id:%u on socket: %d", op_id, ce->ce_id, ce->ce_s);
|
||||
/* Copy transport from orig client-entry */
|
||||
if (ce->ce_transport == NULL &&
|
||||
(ce0 = ce_find_byid(backend_client_list(h), op_id)) != NULL &&
|
||||
|
|
@ -1720,7 +1720,7 @@ from_client_msg(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
module = yang_argument_get(ymod);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s module:%s rpc:%s ce_id:%u s:%d", __FUNCTION__, module,
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "module:%s rpc:%s ce_id:%u s:%d", module,
|
||||
rpc, ce->ce_id, ce->ce_s);
|
||||
/* Pre-NACM access step */
|
||||
xnacm = NULL;
|
||||
|
|
@ -1812,7 +1812,7 @@ from_client_msg(clixon_handle h,
|
|||
// ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
if (xnacm){
|
||||
xml_free(xnacm);
|
||||
if (clicon_nacm_cache_set(h, NULL) < 0)
|
||||
|
|
@ -1830,7 +1830,7 @@ from_client_msg(clixon_handle h,
|
|||
if (retval < 0 && clixon_err_category() < 0)
|
||||
clixon_log(h, LOG_NOTICE, "%s: Internal error: No clixon_err call on RPC error (message: %s)",
|
||||
__FUNCTION__, rpc?rpc:"");
|
||||
// clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
// clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
return retval;// -1 here terminates backend
|
||||
}
|
||||
|
||||
|
|
@ -1853,7 +1853,7 @@ from_client(int s,
|
|||
int eof = 0;
|
||||
cbuf *cbce = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
if (s != ce->ce_s){
|
||||
clixon_err(OE_NETCONF, EINVAL, "Internal error: s != ce->ce_s");
|
||||
goto done;
|
||||
|
|
@ -1871,7 +1871,7 @@ from_client(int s,
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s retval=%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "retval=%d", retval);
|
||||
if (cbce)
|
||||
cbuf_free(cbce);
|
||||
if (msg)
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ candidate_validate(clixon_handle h,
|
|||
cxobj *xret = NULL;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (db == NULL || cbret == NULL){
|
||||
clixon_err(OE_CFG, EINVAL, "db or cbret is NULL");
|
||||
goto done;
|
||||
|
|
@ -913,7 +913,7 @@ from_client_validate(clixon_handle h,
|
|||
int ret;
|
||||
char *db;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((db = netconf_db_find(xe, "source")) == NULL){
|
||||
if (netconf_missing_element(cbret, "protocol", "source", NULL) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ get_statedata(clixon_handle h,
|
|||
cbuf *cb = NULL;
|
||||
cxobj *xerr = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_YANG, ENOENT, "No yang spec");
|
||||
goto done;
|
||||
|
|
@ -373,7 +373,7 @@ get_statedata(clixon_handle h,
|
|||
} /* switch wdef */
|
||||
retval = 1; /* OK */
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
if (xerr)
|
||||
xml_free(xerr);
|
||||
if (x1)
|
||||
|
|
@ -872,7 +872,7 @@ get_common(clixon_handle h,
|
|||
char *wdefstr;
|
||||
|
||||
wdef = WITHDEFAULTS_EXPLICIT;
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
username = clicon_username_get(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_YANG, ENOENT, "No yang spec9");
|
||||
|
|
@ -1049,7 +1049,7 @@ get_common(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
if (xvec)
|
||||
free(xvec);
|
||||
if (xret)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ backend_terminate(clixon_handle h)
|
|||
int ss;
|
||||
cvec *nsctx;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((ss = clicon_socket_get(h)) != -1)
|
||||
close(ss);
|
||||
/* Disconnect datastore */
|
||||
|
|
@ -142,7 +142,7 @@ backend_terminate(clixon_handle h)
|
|||
if (sockfamily==AF_UNIX && lstat(sockpath, &st) == 0)
|
||||
unlink(sockpath);
|
||||
clixon_event_exit();
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s done", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "done");
|
||||
clixon_err_exit();
|
||||
clixon_log_exit();
|
||||
backend_handle_exit(h); /* Also deletes streams. Cannot use h after this. */
|
||||
|
|
@ -172,7 +172,7 @@ backend_sig_term(int arg)
|
|||
static void
|
||||
backend_sig_child(int arg)
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clicon_sig_child_set(1);
|
||||
}
|
||||
|
||||
|
|
@ -428,7 +428,7 @@ backend_timer_setup(int fd,
|
|||
struct timeval t;
|
||||
struct timeval t1 = {10, 0};
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
backend_client_print(h, stderr);
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ clixon_plugin_reset_all(clixon_handle h,
|
|||
int retval = -1;
|
||||
clixon_plugin_t *cp = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
/* Loop through all plugins, call callbacks in each */
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (clixon_plugin_reset_one(cp, h, db) < 0)
|
||||
|
|
@ -179,7 +179,7 @@ clixon_plugin_pre_daemon_all(clixon_handle h)
|
|||
int retval = -1;
|
||||
clixon_plugin_t *cp = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
/* Loop through all plugins, call callbacks in each */
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (clixon_plugin_pre_daemon_one(cp, h) < 0)
|
||||
|
|
@ -242,7 +242,7 @@ clixon_plugin_daemon_all(clixon_handle h)
|
|||
int retval = -1;
|
||||
clixon_plugin_t *cp = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
/* Loop through all plugins, call callbacks in each */
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (clixon_plugin_daemon_one(cp, h) < 0)
|
||||
|
|
@ -347,7 +347,7 @@ clixon_plugin_statedata_all(clixon_handle h,
|
|||
cbuf *cberr = NULL;
|
||||
cxobj *xerr = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
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(clixon_handle h,
|
|||
x = NULL;
|
||||
continue;
|
||||
}
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp));
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, x, "%s STATE:", 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;
|
||||
|
|
@ -473,7 +473,7 @@ clixon_plugin_lockdb_all(clixon_handle h,
|
|||
int retval = -1;
|
||||
clixon_plugin_t *cp = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (clixon_plugin_lockdb_one(cp, h, db, lock, id) < 0)
|
||||
goto done;
|
||||
|
|
@ -657,7 +657,7 @@ plugin_transaction_begin_all(clixon_handle h,
|
|||
int retval = -1;
|
||||
clixon_plugin_t *cp = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (plugin_transaction_begin_one(cp, h, td) < 0)
|
||||
goto done;
|
||||
|
|
@ -1003,7 +1003,7 @@ plugin_transaction_end_all(clixon_handle h,
|
|||
int retval = -1;
|
||||
clixon_plugin_t *cp = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (plugin_transaction_end_one(cp, h, td) < 0)
|
||||
goto done;
|
||||
|
|
@ -1056,7 +1056,7 @@ plugin_transaction_abort_all(clixon_handle h,
|
|||
int retval = -1;
|
||||
clixon_plugin_t *cp = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (plugin_transaction_abort_one(cp, h, td) < 0)
|
||||
; /* dont abort on error */
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ restconf_pseudo_set_inline(clixon_handle h,
|
|||
cxobj *xrestconf;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (clixon_process_argv_get(h, RESTCONF_PROCESS, &argv, &argc) < 0)
|
||||
goto done;
|
||||
if ((xrestconf = xpath_first(xt, NULL, "restconf")) != NULL)
|
||||
|
|
@ -174,7 +174,7 @@ restconf_pseudo_set_inline(clixon_handle h,
|
|||
clixon_err(OE_XML, errno, "stdup");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s str:%s", __FUNCTION__, str);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "str:%s", str);
|
||||
if (argv[i+1])
|
||||
free(argv[i+1]);
|
||||
argv[i+1] = str;
|
||||
|
|
@ -203,7 +203,7 @@ restconf_rpc_wrapper(clixon_handle h,
|
|||
int retval = -1;
|
||||
cxobj *xt = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
switch (*operation){
|
||||
case PROC_OP_STOP:
|
||||
/* if RPC op is stop, stop the service */
|
||||
|
|
@ -349,7 +349,7 @@ restconf_pseudo_process_validate(clixon_handle h,
|
|||
int retval = -1;
|
||||
cxobj *xtarget;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
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 */
|
||||
|
|
@ -381,7 +381,7 @@ restconf_pseudo_process_commit(clixon_handle h,
|
|||
cxobj *cx;
|
||||
int enabled = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
xtarget = transaction_target(td);
|
||||
xsource = transaction_src(td);
|
||||
if (xpath_first(xtarget, NULL, "/restconf[enable='true']") != NULL)
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ backend_accept_client(int fd,
|
|||
uid_t guid;
|
||||
#endif
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
len = sizeof(from);
|
||||
if ((s = accept(fd, &from, &len)) < 0){
|
||||
clixon_err(OE_UNIX, errno, "accept");
|
||||
|
|
|
|||
|
|
@ -279,8 +279,8 @@ transaction_dbg(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
if (i)
|
||||
clixon_debug(dbglevel, "%s %" PRIu64 " %s del: %s",
|
||||
__FUNCTION__, td->td_id, msg, cbuf_get(cb));
|
||||
clixon_debug(dbglevel, "%" PRIu64 " %s del: %s",
|
||||
td->td_id, msg, cbuf_get(cb));
|
||||
cbuf_reset(cb);
|
||||
for (i=0; i<td->td_alen; i++){
|
||||
xn = td->td_avec[i];
|
||||
|
|
@ -288,8 +288,8 @@ transaction_dbg(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
if (i)
|
||||
clixon_debug(dbglevel, "%s %" PRIu64 " %s add: %s",
|
||||
__FUNCTION__, td->td_id, msg, cbuf_get(cb));
|
||||
clixon_debug(dbglevel, "%" PRIu64 " %s add: %s",
|
||||
td->td_id, msg, cbuf_get(cb));
|
||||
cbuf_reset(cb);
|
||||
for (i=0; i<td->td_clen; i++){
|
||||
if (td->td_scvec){
|
||||
|
|
@ -302,8 +302,8 @@ transaction_dbg(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
if (i)
|
||||
clixon_debug(dbglevel, "%s %" PRIu64 " %s change: %s",
|
||||
__FUNCTION__, td->td_id, msg, cbuf_get(cb));
|
||||
clixon_debug(dbglevel, "%" PRIu64 " %s change: %s",
|
||||
td->td_id, msg, cbuf_get(cb));
|
||||
done:
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ cli_auto_edit(clixon_handle h,
|
|||
str = cv_string_get(cvec_i(argv, argc++));
|
||||
if (str && strncmp(str, "mtpoint:", strlen("mtpoint:")) == 0){
|
||||
mtpoint = str + strlen("mtpoint:");
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s mtpoint:%s", __FUNCTION__, mtpoint);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "mtpoint:%s", mtpoint);
|
||||
treename = cv_string_get(cvec_i(argv, argc++));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1266,11 +1266,11 @@ yang2cli_stmt(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
if (yang_find(ys, Y_STATUS, "obsolete") != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "obsolete: %s %s, skipped", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
goto ok;
|
||||
}
|
||||
if (yang_find(ys, Y_STATUS, "deprecated") != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "deprecated: %s %s", 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)
|
||||
|
|
@ -1543,11 +1543,11 @@ yang2cli_grouping(clixon_handle h,
|
|||
}
|
||||
/* Traverse YANG, loop through all modules and generate CLI, inline of yang2cli_stmt */
|
||||
if (yang_find(ys, Y_STATUS, "obsolete") != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s obsolete: %s %s, skipped", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "obsolete: %s %s, skipped", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
goto empty;
|
||||
}
|
||||
if (yang_find(ys, Y_STATUS, "deprecated") != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s deprecated: %s %s", __FUNCTION__, yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "deprecated: %s %s", 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)
|
||||
|
|
@ -1576,8 +1576,8 @@ yang2cli_grouping(clixon_handle h,
|
|||
fprintf(stderr, "%s\n", cbuf_get(cb));
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Generated auto-cli for grouping:%s",
|
||||
__FUNCTION__, yang_argument_get(ys));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Generated auto-cli for grouping:%s",
|
||||
yang_argument_get(ys));
|
||||
/* Add prefix: assume new are appended */
|
||||
for (i=0; i<pt_len_get(pt); i++){
|
||||
if ((co = pt_vec_i_get(pt, i)) != NULL){
|
||||
|
|
@ -1599,8 +1599,8 @@ yang2cli_grouping(clixon_handle h,
|
|||
clixon_log(h, LOG_NOTICE, "%s: Top-level cli-spec %s:\n%s",
|
||||
__FUNCTION__, treename, cbuf_get(cb));
|
||||
else
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s",
|
||||
__FUNCTION__, treename, cbuf_get(cb));
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "Top-level cli-spec %s:\n%s",
|
||||
treename, cbuf_get(cb));
|
||||
if (cligen_parsetree_merge(pt0, NULL, pt) < 0){
|
||||
clixon_err(OE_YANG, errno, "cligen_parsetree_merge");
|
||||
goto done;
|
||||
|
|
@ -1706,13 +1706,13 @@ yang2cli_yspec(clixon_handle h,
|
|||
fprintf(stderr, "%s\n", cbuf_get(cb));
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Generated auto-cli for module:%s",
|
||||
__FUNCTION__, yang_argument_get(ymod));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Generated auto-cli for module:%s",
|
||||
yang_argument_get(ymod));
|
||||
/* Add prefix: assume new are appended */
|
||||
for (i=0; i<pt_len_get(pt); i++){
|
||||
if ((co = pt_vec_i_get(pt, i)) != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s command: %s",
|
||||
__FUNCTION__, co->co_command);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "command: %s",
|
||||
co->co_command);
|
||||
co_prefix_set(co, prefix);
|
||||
}
|
||||
}
|
||||
|
|
@ -1730,8 +1730,8 @@ yang2cli_yspec(clixon_handle h,
|
|||
clixon_log(h, LOG_NOTICE, "%s: Top-level cli-spec %s:\n%s",
|
||||
__FUNCTION__, treename, cbuf_get(cb));
|
||||
else
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s: Top-level cli-spec %s:\n%s",
|
||||
__FUNCTION__, treename, cbuf_get(cb));
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "Top-level cli-spec %s:\n%s",
|
||||
treename, cbuf_get(cb));
|
||||
if (cligen_parsetree_merge(pt0, NULL, pt) < 0){
|
||||
clixon_err(OE_YANG, errno, "cligen_parsetree_merge");
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ autocli_start(clixon_handle h)
|
|||
yang_stmt *yspec;
|
||||
int enable = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* There is no single "enable-autocli" flag,
|
||||
* but set
|
||||
* <module-default>false</module-default>
|
||||
|
|
@ -402,7 +402,7 @@ autocli_start(clixon_handle h)
|
|||
if (autocli_module(h, NULL, &enable) < 0)
|
||||
goto done;
|
||||
if (!enable){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Autocli not enabled (clixon-autocli)", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Autocli not enabled (clixon-autocli)");
|
||||
goto ok;
|
||||
}
|
||||
/* Init yang2cli */
|
||||
|
|
|
|||
|
|
@ -555,7 +555,7 @@ clicon_parse(clixon_handle h,
|
|||
if (cliread_parse(ch, cmd, pt, &match_obj, &cvv, result, &reason) < 0)
|
||||
goto done;
|
||||
/* Debug command and result code */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s result:%d command: \"%s\"", __FUNCTION__, *result, cmd);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "result:%d command: \"%s\"", *result, cmd);
|
||||
switch (*result) {
|
||||
case CG_EOF: /* eof */
|
||||
case CG_ERROR:
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ netconf_hello_msg(clixon_handle h,
|
|||
int foundbase_11 = 0;
|
||||
char *body;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
_netconf_hello_nr++;
|
||||
if (xml_find_type(xn, NULL, "session-id", CX_ELMNT) != NULL) {
|
||||
clixon_err(OE_XML, errno, "Server received hello with session-id from client, terminating (see RFC 6241 Sec 8.1");
|
||||
|
|
@ -179,12 +179,12 @@ netconf_hello_msg(clixon_handle h,
|
|||
* event any parameters are encoded at the end of the URI string. */
|
||||
if (strncmp(body, NETCONF_BASE_CAPABILITY_1_0, strlen(NETCONF_BASE_CAPABILITY_1_0)) == 0){ /* RFC 4741 */
|
||||
foundbase_10++;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s foundbase10", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "foundbase10");
|
||||
}
|
||||
else if (strncmp(body, NETCONF_BASE_CAPABILITY_1_1, strlen(NETCONF_BASE_CAPABILITY_1_1)) == 0 &&
|
||||
clicon_option_int(h, "CLICON_NETCONF_BASE_CAPABILITY") > 0){ /* RFC 6241 */
|
||||
foundbase_11++;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s foundbase11", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "foundbase11");
|
||||
clicon_data_int_set(h, NETCONF_FRAMING_TYPE, NETCONF_SSH_CHUNKED); /* enable chunked enc */
|
||||
}
|
||||
}
|
||||
|
|
@ -334,8 +334,8 @@ netconf_input_packet(clixon_handle h,
|
|||
cxobj *xret = NULL;
|
||||
netconf_framing_type framing;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xreq, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xreq, "");
|
||||
rpcname = xml_name(xreq);
|
||||
rpcprefix = xml_prefix(xreq);
|
||||
framing = clicon_data_int_get(h, NETCONF_FRAMING_TYPE);
|
||||
|
|
@ -469,7 +469,7 @@ netconf_input_cb(int s,
|
|||
&eom) < 0)
|
||||
goto done;
|
||||
if (eom == 0){ /* frame not complete */
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s: frame: %lu", __FUNCTION__, cbuf_len(cbmsg));
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "frame: %lu", cbuf_len(cbmsg));
|
||||
/* Extra data to read, save data and continue on next round */
|
||||
if (clicon_hash_add(cdat, NETCONF_FRAME_MSG, &cbmsg, sizeof(cbmsg)) == NULL)
|
||||
goto done;
|
||||
|
|
@ -511,7 +511,7 @@ netconf_input_cb(int s,
|
|||
}
|
||||
}
|
||||
if (eof){ /* socket closed / read returns 0 */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s len==0, closing", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "len==0, closing");
|
||||
clixon_event_unreg_fd(s, netconf_input_cb);
|
||||
close(s);
|
||||
clixon_exit_set(1);
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ netconf_notification_cb(int s,
|
|||
int ret;
|
||||
cxobj *xerr = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* get msg (this is the reason this function is called) */
|
||||
if (clicon_msg_rcv(s, NULL, 0, &reply, &eof) < 0)
|
||||
goto done;
|
||||
|
|
@ -504,7 +504,7 @@ netconf_notification_cb(int s,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
if (nsc)
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ api_http_data_err(clixon_handle h,
|
|||
int retval = -1;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "cbuf_new");
|
||||
goto done;
|
||||
|
|
@ -153,7 +153,7 @@ api_http_data_err(clixon_handle h,
|
|||
// ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
|
|
@ -192,7 +192,7 @@ http_data_check_file_path(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
p = cbuf_get(cbpath);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, p);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", p);
|
||||
if (strncmp(prefix, p, strlen(prefix)) != 0){
|
||||
clixon_err(OE_UNIX, EINVAL, "prefix is not prefix of cbpath");
|
||||
goto done;
|
||||
|
|
@ -202,31 +202,31 @@ http_data_check_file_path(clixon_handle h,
|
|||
p[i] = '\0';
|
||||
/* Ensure not soft link */
|
||||
if (lstat(p, &fstat) < 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s):%s", __FUNCTION__, p, strerror(errno));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error lstat(%s):%s", p, strerror(errno));
|
||||
code = 404;
|
||||
goto invalid;
|
||||
}
|
||||
if (!S_ISDIR(fstat.st_mode)){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s): Not dir", __FUNCTION__, p);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error lstat(%s): Not dir", p);
|
||||
code = 403;
|
||||
goto invalid;
|
||||
}
|
||||
p[i] = '/';
|
||||
}
|
||||
else if (p[i] == '~'){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s): ~ not allowed in file path", __FUNCTION__, p);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error lstat(%s): ~ not allowed in file path", p);
|
||||
code = 403;
|
||||
goto invalid;
|
||||
}
|
||||
else if (p[i] == '.' && i>strlen(prefix) && p[i-1] == '.'){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s): .. not allowed in file path", __FUNCTION__, p);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error lstat(%s): .. not allowed in file path", p);
|
||||
code = 403;
|
||||
goto invalid;
|
||||
}
|
||||
}
|
||||
/* Resulting file (ensure not soft link) */
|
||||
if (lstat(p, &fstat) < 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s):%s", __FUNCTION__, p, strerror(errno));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error lstat(%s):%s", p, strerror(errno));
|
||||
code = 404;
|
||||
goto invalid;
|
||||
}
|
||||
|
|
@ -235,22 +235,22 @@ http_data_check_file_path(clixon_handle h,
|
|||
if (S_ISDIR(fstat.st_mode)){
|
||||
cprintf(cbpath, "/%s", HTTP_DATA_INTERNAL_REDIRECT);
|
||||
p = cbuf_get(cbpath);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s internal redirect: %s", __FUNCTION__, p);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "internal redirect: %s", p);
|
||||
if (lstat(p, &fstat) < 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s):%s", __FUNCTION__, p, strerror(errno));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error lstat(%s):%s", p, strerror(errno));
|
||||
code = 404;
|
||||
goto invalid;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!S_ISREG(fstat.st_mode)){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error lstat(%s): Not regular file", __FUNCTION__, p);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error lstat(%s): Not regular file", p);
|
||||
code = 403;
|
||||
goto invalid;
|
||||
}
|
||||
*fsz = fstat.st_size;
|
||||
if ((f = fopen(p, "rb")) == NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error fopen(%s) %s", __FUNCTION__, p, strerror(errno));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error fopen(%s) %s", p, strerror(errno));
|
||||
code = 403;
|
||||
goto invalid;
|
||||
}
|
||||
|
|
@ -296,7 +296,7 @@ api_http_data_file(clixon_handle h,
|
|||
char *buf = NULL;
|
||||
size_t sz;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((cbfile = cbuf_new()) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "cbuf_new");
|
||||
goto done;
|
||||
|
|
@ -309,8 +309,8 @@ api_http_data_file(clixon_handle h,
|
|||
cprintf(cbfile, "%s", www_data_root);
|
||||
if (pathname){
|
||||
if (strlen(pathname) && pathname[0] != '/'){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error fopen(%s) pathname not prefixed with /",
|
||||
__FUNCTION__, pathname);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error fopen(%s) pathname not prefixed with /",
|
||||
pathname);
|
||||
if (api_http_data_err(h, req, 404) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
|
|
@ -338,8 +338,8 @@ api_http_data_file(clixon_handle h,
|
|||
fsize = ftell(f);
|
||||
/* Extra sanity check, had some problems with wrong file types */
|
||||
if (fsz != fsize){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error file %s size mismatch sz:%zu vs %li",
|
||||
__FUNCTION__, filename, (size_t)fsz, fsize);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error file %s size mismatch sz:%zu vs %li",
|
||||
filename, (size_t)fsz, fsize);
|
||||
if (api_http_data_err(h, req, 500) < 0) /* Internal error? */
|
||||
goto done;
|
||||
goto ok;
|
||||
|
|
@ -362,7 +362,7 @@ api_http_data_file(clixon_handle h,
|
|||
}
|
||||
sz = (size_t)ret;
|
||||
if (sz != 1){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error fread(%s) sz:%zu", __FUNCTION__, filename, sz);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error fread(%s) sz:%zu", filename, sz);
|
||||
if (api_http_data_err(h, req, 500) < 0) /* Internal error? */
|
||||
goto done;
|
||||
goto ok;
|
||||
|
|
@ -376,7 +376,7 @@ api_http_data_file(clixon_handle h,
|
|||
if (restconf_reply_send(req, 200, cbdata, head) < 0)
|
||||
goto done;
|
||||
cbdata = NULL; /* consumed by reply-send */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Read %s OK", __FUNCTION__, filename);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Read %s OK", filename);
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
@ -423,7 +423,7 @@ api_http_data(clixon_handle h,
|
|||
cbuf *indata = NULL;
|
||||
char *path = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (req == NULL){
|
||||
errno = EINVAL;
|
||||
goto done;
|
||||
|
|
@ -498,6 +498,6 @@ api_http_data(clixon_handle h,
|
|||
done:
|
||||
if (path)
|
||||
free(path);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ restconf_reply_header(void *req0,
|
|||
char *value = NULL;
|
||||
va_list ap;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, name);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", name);
|
||||
if (sd == NULL || name == NULL || vfmt == NULL){
|
||||
clixon_err(OE_CFG, EINVAL, "sd, name or value is NULL");
|
||||
goto done;
|
||||
|
|
@ -142,7 +142,7 @@ restconf_reply_send(void *req0,
|
|||
int retval = -1;
|
||||
restconf_stream_data *sd = (restconf_stream_data *)req0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s code:%d", __FUNCTION__, code);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "code:%d", code);
|
||||
if (sd == NULL){
|
||||
clixon_err(OE_CFG, EINVAL, "sd is NULL");
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ api_return_err(clixon_handle h,
|
|||
cxobj *xmsg;
|
||||
char *mb;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "cbuf_new");
|
||||
goto done;
|
||||
|
|
@ -249,7 +249,7 @@ api_return_err(clixon_handle h,
|
|||
}
|
||||
}
|
||||
#if 1
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xerr, "%s Send error:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xerr, "Send error:");
|
||||
#endif
|
||||
if (xml_name_set(xerr, "error") < 0)
|
||||
goto done;
|
||||
|
|
@ -286,7 +286,7 @@ api_return_err(clixon_handle h,
|
|||
case YANG_DATA_XML:
|
||||
case YANG_PATCH_XML:
|
||||
case YANG_PAGINATION_XML:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s code:%d", __FUNCTION__, code);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "code:%d", code);
|
||||
if (pretty){
|
||||
cprintf(cb, " <errors xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\">\n");
|
||||
if (clixon_xml2cbuf(cb, xerr, 2, pretty, NULL, -1, 0) < 0)
|
||||
|
|
@ -302,7 +302,7 @@ api_return_err(clixon_handle h,
|
|||
break;
|
||||
case YANG_DATA_JSON:
|
||||
case YANG_PATCH_JSON:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s code:%d", __FUNCTION__, code);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "code:%d", code);
|
||||
if (pretty){
|
||||
cprintf(cb, "{\n\"ietf-restconf:errors\" : ");
|
||||
if (clixon_json2cbuf(cb, xerr, pretty, 0, 0) < 0)
|
||||
|
|
@ -329,7 +329,7 @@ api_return_err(clixon_handle h,
|
|||
// ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
if (cberr)
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ restconf_param_set(clixon_handle h,
|
|||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s: %s=%s", __FUNCTION__, param, val);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s=%s", param, val);
|
||||
if (rh->rh_params == NULL)
|
||||
if ((rh->rh_params = clicon_hash_init()) == NULL)
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ _http1_parse(clixon_handle h,
|
|||
clixon_http1_yacc hy = {0,};
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s:\n%s", __FUNCTION__, str);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\n%s", str);
|
||||
if (strlen(str) == 0)
|
||||
goto ok;
|
||||
hy.hy_parse_string = str;
|
||||
|
|
@ -119,7 +119,7 @@ _http1_parse(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ clixon_http1_parse_file(clixon_handle h,
|
|||
int len = 0;
|
||||
int oldbuflen;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, filename);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", filename);
|
||||
if (f == NULL){
|
||||
clixon_err(OE_RESTCONF, EINVAL, "f is NULL");
|
||||
goto done;
|
||||
|
|
@ -302,7 +302,7 @@ restconf_http1_reply(restconf_conn *rc,
|
|||
int retval = -1;
|
||||
cg_var *cv;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* If body, add a content-length header
|
||||
* A server MUST NOT send a Content-Length header field in any response
|
||||
* with a status code of 1xx (Informational) or 204 (No Content). A
|
||||
|
|
@ -463,7 +463,7 @@ restconf_http1_path_root(clixon_handle h,
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
if (subject)
|
||||
free(subject);
|
||||
if (xerr)
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ restconf_terminate(clixon_handle h)
|
|||
cxobj *x;
|
||||
int fs; /* fgcx socket */
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((fs = clicon_socket_get(h)) != -1)
|
||||
close(fs);
|
||||
/* Delete all plugins, and RPC callbacks */
|
||||
|
|
@ -378,7 +378,7 @@ restconf_terminate(clixon_handle h)
|
|||
xpath_optimize_exit();
|
||||
restconf_handle_exit(h);
|
||||
clixon_err_exit();
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s pid:%u done", __FUNCTION__, getpid());
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "pid:%u done", getpid());
|
||||
clixon_log_exit(); /* Must be after last clixon_debug */
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -524,7 +524,7 @@ restconf_main_extension_cb(clixon_handle h,
|
|||
extname = yang_argument_get(yext);
|
||||
if (strcmp(modname, "ietf-restconf") != 0 || strcmp(extname, "yang-data") != 0)
|
||||
goto ok;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Enabled extension:%s:%s", __FUNCTION__, modname, extname);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Enabled extension:%s:%s", modname, extname);
|
||||
if ((yc = yang_find(ys, 0, NULL)) == NULL)
|
||||
goto ok;
|
||||
if ((yn = ys_dup(yc)) == NULL)
|
||||
|
|
@ -584,7 +584,7 @@ restconf_drop_privileges(clixon_handle h)
|
|||
char *user;
|
||||
enum priv_mode_t priv_mode = PM_NONE;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* Sanity check: backend group exists */
|
||||
if ((group = clicon_sock_group(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "clicon_sock_group option not set");
|
||||
|
|
@ -639,8 +639,8 @@ restconf_drop_privileges(clixon_handle h)
|
|||
case PM_NONE:
|
||||
break; /* catched above */
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s dropped privileges from root to %s(%d)",
|
||||
__FUNCTION__, user, newuid);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "dropped privileges from root to %s(%d)",
|
||||
user, newuid);
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
@ -673,7 +673,7 @@ restconf_authentication_cb(clixon_handle h,
|
|||
char *anonymous = NULL;
|
||||
|
||||
auth_type = restconf_auth_type_get(h);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s auth-type:%s", __FUNCTION__, clixon_auth_type_int2str(auth_type));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "auth-type:%s", clixon_auth_type_int2str(auth_type));
|
||||
ret = 0;
|
||||
authenticated = 0;
|
||||
/* ret: -1 Error, 0: Ignore/not handled, 1: OK see authenticated parameter */
|
||||
|
|
@ -725,8 +725,8 @@ restconf_authentication_cb(clixon_handle h,
|
|||
/* If set but no user, set a dummy user */
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d authenticated:%d user:%s",
|
||||
__FUNCTION__, retval, authenticated, clicon_username_get(h));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d authenticated:%d user:%s",
|
||||
retval, authenticated, clicon_username_get(h));
|
||||
if (username)
|
||||
free(username);
|
||||
if (xret)
|
||||
|
|
@ -768,7 +768,7 @@ restconf_config_init(clixon_handle h,
|
|||
if ((x = xpath_first(xrestconf, nsc, "enable")) != NULL &&
|
||||
(enable = xml_body(x)) != NULL){
|
||||
if (strcmp(enable, "false") == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s restconf disabled", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "restconf disabled");
|
||||
goto disable;
|
||||
}
|
||||
}
|
||||
|
|
@ -848,7 +848,7 @@ restconf_socket_init(const char *netns0,
|
|||
size_t sa_len;
|
||||
const char *netns;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s %s %s %hu", __FUNCTION__, netns0, addrtype, addrstr, port);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s %s %hu", netns0, addrtype, addrstr, port);
|
||||
/* netns default -> NULL */
|
||||
if (netns0 != NULL && strcmp(netns0, RESTCONF_NETNS_DEFAULT)==0)
|
||||
netns = NULL;
|
||||
|
|
@ -858,10 +858,10 @@ restconf_socket_init(const char *netns0,
|
|||
goto done;
|
||||
if (clixon_netns_socket(netns, sa, sa_len, backlog, flags, addrstr, ss) < 0)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s ss=%d", __FUNCTION__, *ss);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "ss=%d", *ss);
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ fcgi_params_set(clixon_handle h,
|
|||
char *param = NULL;
|
||||
char *val = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
for (i = 0; envp[i] != NULL; i++){ /* on the form <param>=<value> */
|
||||
if (clixon_strsplit(envp[i], '=', ¶m, &val) < 0)
|
||||
goto done;
|
||||
|
|
@ -124,7 +124,7 @@ fcgi_params_set(clixon_handle h,
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -228,12 +228,12 @@ restconf_sig_term(int arg)
|
|||
{
|
||||
static int i=0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (i++ == 0)
|
||||
clixon_log(NULL, LOG_NOTICE, "%s: %s: pid: %u Signal %d",
|
||||
__PROGRAM__, __FUNCTION__, getpid(), arg);
|
||||
else{
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s done", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "done");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ clixon_openssl_log_cb(void *handle,
|
|||
int suberr,
|
||||
cbuf *cb)
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
ERR_print_errors_cb(print_cb, cb);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -266,17 +266,17 @@ restconf_verify_certs(int preverify_ok,
|
|||
depth = X509_STORE_CTX_get_error_depth(store);
|
||||
// ssl = X509_STORE_CTX_get_ex_data(store, SSL_get_ex_data_X509_STORE_CTX_idx());
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s preverify_ok:%d err:%d depth:%d", __FUNCTION__, preverify_ok, err, depth);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "preverify_ok:%d err:%d depth:%d", preverify_ok, err, depth);
|
||||
X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256);
|
||||
switch (err){
|
||||
case X509_V_ERR_HOSTNAME_MISMATCH:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s X509_V_ERR_HOSTNAME_MISMATCH", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "X509_V_ERR_HOSTNAME_MISMATCH");
|
||||
break;
|
||||
case X509_V_ERR_CERT_HAS_EXPIRED:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s X509_V_ERR_CERT_HAS_EXPIRED", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "X509_V_ERR_CERT_HAS_EXPIRED");
|
||||
break;
|
||||
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT");
|
||||
break;
|
||||
}
|
||||
/* Catch a too long certificate chain. should be +1 in SSL_CTX_set_verify_depth() */
|
||||
|
|
@ -327,7 +327,7 @@ alpn_select_proto_cb(SSL *ssl,
|
|||
unsigned char len;
|
||||
int pref = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* select http/1.1 */
|
||||
inp = (unsigned char*)in;
|
||||
while ((inp-in) < inlen) {
|
||||
|
|
@ -456,7 +456,7 @@ restconf_listcerts(SSL *ssl)
|
|||
X509 *cert;
|
||||
char *line;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s get peer certificates:", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "get peer certificates:");
|
||||
if ((cert = SSL_get_peer_certificate(ssl)) != NULL) { /* Get certificates (if available) */
|
||||
if ((line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0)) != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Subject: %s", line);
|
||||
|
|
@ -534,7 +534,7 @@ restconf_accept_client(int fd,
|
|||
char *name = NULL;
|
||||
void *addr;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, fd);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", fd);
|
||||
if ((rsock = (restconf_socket *)arg) == NULL){
|
||||
clixon_err(OE_YANG, EINVAL, "rsock is NULL");
|
||||
goto done;
|
||||
|
|
@ -570,7 +570,7 @@ restconf_accept_client(int fd,
|
|||
}
|
||||
if (inet_ntop(from.sa_family, addr, rsock->rs_from_addr, INET6_ADDRSTRLEN) < 0)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s type:%s from:%s, dest:%s port:%hu", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "type:%s from:%s, dest:%s port:%hu",
|
||||
rsock->rs_addrtype,
|
||||
rsock->rs_from_addr,
|
||||
rsock->rs_addrstr,
|
||||
|
|
@ -581,7 +581,7 @@ restconf_accept_client(int fd,
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval %d", retval);
|
||||
if (name)
|
||||
free(name);
|
||||
return retval;
|
||||
|
|
@ -596,7 +596,7 @@ restconf_native_terminate(clixon_handle h)
|
|||
restconf_socket *rsock;
|
||||
restconf_conn *rc;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((rn = restconf_native_handle_get(h)) != NULL){
|
||||
while ((rsock = rn->rn_sockets) != NULL){
|
||||
while ((rc = rsock->rs_conns) != NULL){
|
||||
|
|
@ -728,7 +728,7 @@ openssl_init_socket(clixon_handle h,
|
|||
restconf_socket *rsock = NULL; /* openssl per socket struct */
|
||||
struct timeval now;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/*
|
||||
* Create per-socket openssl handle
|
||||
* See restconf_native_terminate for freeing
|
||||
|
|
@ -825,7 +825,7 @@ restconf_openssl_init(clixon_handle h,
|
|||
size_t veclen;
|
||||
int i;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* flag used for sanity of certs */
|
||||
ssl_enable = xpath_first(xrestconf, nsc, "socket[ssl='true']") != NULL;
|
||||
/* Auth type set in config */
|
||||
|
|
@ -1022,7 +1022,7 @@ restconf_clixon_init(clixon_handle h,
|
|||
if (clicon_nsctx_global_set(h, nsctx_global) < 0)
|
||||
goto done;
|
||||
if (inline_config != NULL && strlen(inline_config)){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s reading from inline config", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "reading from inline config");
|
||||
if ((ret = clixon_xml_parse_string(inline_config, YB_MODULE, yspec, &xrestconf, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
|
|
@ -1044,7 +1044,7 @@ restconf_clixon_init(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
else if (clicon_option_bool(h, "CLICON_BACKEND_RESTCONF_PROCESS") == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s reading from clixon config", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "reading from clixon config");
|
||||
/* If not read from backend, try to get restconf config from local config-file */
|
||||
if ((xrestconf = clicon_conf_restconf(h)) != NULL){
|
||||
/* Basic config init, set auth-type, pretty, etc ret 0 means disabled */
|
||||
|
|
@ -1062,7 +1062,7 @@ restconf_clixon_init(clixon_handle h,
|
|||
/* If no local config, or it is disabled, try to query backend of config.
|
||||
*/
|
||||
else {
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s reading from backend datastore config", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "reading from backend datastore config");
|
||||
if ((ret = restconf_clixon_backend(h, xrestconfp)) < 0)
|
||||
goto done;
|
||||
if (ret == 0)
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ api_data_options(clixon_handle h,
|
|||
{
|
||||
int retval = -1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (restconf_reply_header(req, "Allow", "OPTIONS,HEAD,GET,POST,PUT,PATCH,DELETE") < 0)
|
||||
goto done;
|
||||
if (restconf_reply_header(req, "Accept-Patch", "application/yang-data+xml,application/yang-data+json") < 0)
|
||||
|
|
@ -142,7 +142,7 @@ match_list_keys(yang_stmt *y,
|
|||
char *key1;
|
||||
char *key2;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
switch (yang_keyword_get(y)){
|
||||
case Y_LIST:
|
||||
if ((cvk = yang_cvec_get(y)) == NULL) /* Use Y_LIST cache, see ys_populate_list() */
|
||||
|
|
@ -176,7 +176,7 @@ match_list_keys(yang_stmt *y,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -236,8 +236,8 @@ api_data_write(clixon_handle h,
|
|||
char *xpath = NULL;
|
||||
char *attr;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s api_path:\"%s\"", __FUNCTION__, api_path0);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s data:\"%s\"", __FUNCTION__, data);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "api_path:\"%s\"", api_path0);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "data:\"%s\"", data);
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
goto done;
|
||||
|
|
@ -427,7 +427,7 @@ api_data_write(clixon_handle h,
|
|||
/* There is an api-path that defines an element in the datastore tree.
|
||||
* Not top-of-tree.
|
||||
*/
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Comparing bottom-of api-path (%s) with top-of-data (%s)",__FUNCTION__, xml_name(xbot), dname);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Comparing bottom-of api-path (%s) with top-of-data (%s)", xml_name(xbot), dname);
|
||||
|
||||
/* Check same symbol in api-path as data */
|
||||
if (strcmp(dname, xml_name(xbot))){
|
||||
|
|
@ -492,11 +492,11 @@ api_data_write(clixon_handle h,
|
|||
/* If we already have that default namespace, remove it in child */
|
||||
if ((xa = xml_find_type(xdata, NULL, "xmlns", CX_ATTR)) != NULL){
|
||||
if (xml2ns(xparent, NULL, &namespace) < 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s G done", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "G done");
|
||||
goto done;
|
||||
}
|
||||
if (namespace == NULL){
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xparent, "%s xparent:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xparent, "xparent:");
|
||||
/* XXX */
|
||||
}
|
||||
/* Set xmlns="" default namespace attribute (if diff from default) */
|
||||
|
|
@ -540,7 +540,7 @@ api_data_write(clixon_handle h,
|
|||
if (clixon_xml2cbuf(cbx, xtop, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cbx, "</edit-config></rpc>");
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "xml: %s api_path:%s", cbuf_get(cbx), api_path);
|
||||
if (clicon_rpc_netconf(h, cbuf_get(cbx), &xret, NULL) < 0)
|
||||
goto done;
|
||||
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
|
||||
|
|
@ -560,7 +560,7 @@ api_data_write(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (xpath)
|
||||
free(xpath);
|
||||
if (nsc)
|
||||
|
|
@ -737,7 +737,7 @@ api_data_delete(clixon_handle h,
|
|||
int ret;
|
||||
cxobj *xe; /* xml error, no free */
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s api_path:%s", __FUNCTION__, api_path);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "api_path:%s", api_path);
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
goto done;
|
||||
|
|
@ -821,7 +821,7 @@ api_data_delete(clixon_handle h,
|
|||
xml_free(xretdis);
|
||||
if (xtop)
|
||||
xml_free(xtop);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ api_data_get2(clixon_handle h,
|
|||
char *defaults = NULL;
|
||||
cvec *nscd = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
goto done;
|
||||
|
|
@ -168,7 +168,7 @@ api_data_get2(clixon_handle h,
|
|||
}
|
||||
/* Check for content attribute */
|
||||
if ((attr = cvec_find_str(qvec, "content")) != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s content=%s", __FUNCTION__, attr);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "content=%s", attr);
|
||||
if ((int)(content = netconf_content_str2int(attr)) == -1){
|
||||
if (netconf_bad_attribute_xml(&xerr, "application",
|
||||
"content", "Unrecognized value of content attribute") < 0)
|
||||
|
|
@ -180,7 +180,7 @@ api_data_get2(clixon_handle h,
|
|||
}
|
||||
/* Check for depth attribute */
|
||||
if ((attr = cvec_find_str(qvec, "depth")) != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s depth=%s", __FUNCTION__, attr);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "depth=%s", attr);
|
||||
if (strcmp(attr, "unbounded") != 0){
|
||||
char *reason = NULL;
|
||||
if ((ret = parse_int32(attr, &depth, &reason)) < 0){
|
||||
|
|
@ -198,11 +198,11 @@ api_data_get2(clixon_handle h,
|
|||
}
|
||||
}
|
||||
if ((attr = cvec_find_str(qvec, "with-defaults")) != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s with_defaults=%s", __FUNCTION__, attr);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "with_defaults=%s", attr);
|
||||
defaults = attr;
|
||||
}
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s path:%s", __FUNCTION__, xpath);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "path:%s", xpath);
|
||||
ret = clicon_rpc_get(h, xpath, nsc, content, depth, defaults, &xret);
|
||||
|
||||
if (ret < 0){
|
||||
|
|
@ -217,7 +217,7 @@ api_data_get2(clixon_handle h,
|
|||
*/
|
||||
#if 0 /* DEBUG */
|
||||
if (clixon_debug_get())
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "%s xret:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "xret:");
|
||||
#endif
|
||||
/* Check if error return */
|
||||
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
|
||||
|
|
@ -292,7 +292,7 @@ api_data_get2(clixon_handle h,
|
|||
break;
|
||||
}
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s cbuf:%s", __FUNCTION__, cbuf_get(cbx));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "cbuf:%s", cbuf_get(cbx));
|
||||
if (restconf_reply_header(req, "Content-Type", "%s", restconf_media_int2str(media_out)) < 0)
|
||||
goto done;
|
||||
if (restconf_reply_header(req, "Cache-Control", "no-cache") < 0)
|
||||
|
|
@ -303,7 +303,7 @@ api_data_get2(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (xpath)
|
||||
free(xpath);
|
||||
if (nscd)
|
||||
|
|
@ -380,7 +380,7 @@ api_data_pagination(clixon_handle h,
|
|||
char *where;
|
||||
char *ns;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
goto done;
|
||||
|
|
@ -429,7 +429,7 @@ api_data_pagination(clixon_handle h,
|
|||
|
||||
/* Check for content attribute */
|
||||
if ((attr = cvec_find_str(qvec, "content")) != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s content=%s", __FUNCTION__, attr);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "content=%s", attr);
|
||||
if ((int)(content = netconf_content_str2int(attr)) == -1){
|
||||
if (netconf_bad_attribute_xml(&xerr, "application",
|
||||
"content", "Unrecognized value of content attribute") < 0)
|
||||
|
|
@ -443,7 +443,7 @@ api_data_pagination(clixon_handle h,
|
|||
goto ok;
|
||||
}
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s path:%s", __FUNCTION__, xpath);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "path:%s", xpath);
|
||||
if (content != CONTENT_CONFIG && content != CONTENT_NONCONFIG && content != CONTENT_ALL){
|
||||
clixon_err(OE_XML, EINVAL, "Invalid content attribute %d", content);
|
||||
goto done;
|
||||
|
|
@ -451,7 +451,7 @@ api_data_pagination(clixon_handle h,
|
|||
/* Clixon extensions and collection attributes */
|
||||
/* Check for depth attribute */
|
||||
if ((attr = cvec_find_str(qvec, "depth")) != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s depth=%s", __FUNCTION__, attr);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "depth=%s", attr);
|
||||
if (strcmp(attr, "unbounded") != 0){
|
||||
char *reason = NULL;
|
||||
if ((ret = parse_int32(attr, &depth, &reason)) < 0){
|
||||
|
|
@ -506,7 +506,7 @@ api_data_pagination(clixon_handle h,
|
|||
* We need to cut that tree to only the object.
|
||||
*/
|
||||
#if 0 /* DEBUG */
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "%s xret:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "xret:");
|
||||
#endif
|
||||
/* Check if error return */
|
||||
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
|
||||
|
|
@ -555,7 +555,7 @@ api_data_pagination(clixon_handle h,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s cbuf:%s", __FUNCTION__, cbuf_get(cbx));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "cbuf:%s", cbuf_get(cbx));
|
||||
if (restconf_reply_header(req, "Content-Type", "%s", restconf_media_int2str(media_out)) < 0)
|
||||
goto done;
|
||||
if (restconf_reply_header(req, "Cache-Control", "no-cache") < 0)
|
||||
|
|
@ -566,7 +566,7 @@ api_data_pagination(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (xpath)
|
||||
free(xpath);
|
||||
if (nsc)
|
||||
|
|
@ -718,7 +718,7 @@ api_operations_get(clixon_handle h,
|
|||
cxobj *xt = NULL;
|
||||
int i;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
yspec = clicon_dbspec_yang(h);
|
||||
if ((cbx = cbuf_new()) == NULL)
|
||||
goto done;
|
||||
|
|
@ -786,7 +786,7 @@ api_operations_get(clixon_handle h,
|
|||
// ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (cbx)
|
||||
cbuf_free(cbx);
|
||||
if (xt)
|
||||
|
|
|
|||
|
|
@ -635,7 +635,7 @@ yang_patch_do_edit(clixon_handle h,
|
|||
yang_stmt *ybot = NULL;
|
||||
yang_stmt *ymod;
|
||||
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xn, "%s %d xn:", __FUNCTION__, __LINE__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xn, "%d xn:", __LINE__);
|
||||
/* Create cbufs:s */
|
||||
if ((simple_patch_request_uri = cbuf_new()) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "cbuf_new");
|
||||
|
|
@ -778,7 +778,7 @@ api_data_yang_patch(clixon_handle h,
|
|||
size_t veclen;
|
||||
cxobj **vec = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s api_path:\"%s\"", __FUNCTION__, api_path0);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "api_path:\"%s\"", api_path0);
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -189,8 +189,8 @@ api_data_post(clixon_handle h,
|
|||
int nrchildren0 = 0;
|
||||
yang_bind yb;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s api_path:\"%s\"", __FUNCTION__, api_path);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s data:\"%s\"", __FUNCTION__, data);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "api_path:\"%s\"", api_path);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "data:\"%s\"", data);
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
goto done;
|
||||
|
|
@ -276,7 +276,7 @@ api_data_post(clixon_handle h,
|
|||
/* RFC 8040 4.4.1: The message-body MUST contain exactly one instance of the
|
||||
* expected data resource.
|
||||
*/
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s nrchildren0: %d", __FUNCTION__, nrchildren0);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "nrchildren0: %d", nrchildren0);
|
||||
if (xml_child_nr_type(xbot, CX_ELMNT) - nrchildren0 != 1){
|
||||
if (netconf_malformed_message_xml(&xerr, "The message-body MUST contain exactly one instance of the expected data resource") < 0)
|
||||
goto done;
|
||||
|
|
@ -330,7 +330,7 @@ api_data_post(clixon_handle h,
|
|||
if (restconf_insert_attributes(xdata, qvec) < 0)
|
||||
goto done;
|
||||
#if 1
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xdata, "%s xdata:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xdata, "xdata:");
|
||||
#endif
|
||||
|
||||
/* Create text buffer for transfer to backend */
|
||||
|
|
@ -369,7 +369,7 @@ api_data_post(clixon_handle h,
|
|||
if (clixon_xml2cbuf(cbx, xtop, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cbx, "</edit-config></rpc>");
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "xml: %s api_path:%s", cbuf_get(cbx), api_path);
|
||||
if (clicon_rpc_netconf(h, cbuf_get(cbx), &xret, NULL) < 0)
|
||||
goto done;
|
||||
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
|
||||
|
|
@ -384,7 +384,7 @@ api_data_post(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (xret)
|
||||
xml_free(xret);
|
||||
if (xerr)
|
||||
|
|
@ -441,7 +441,7 @@ api_operations_post_input(clixon_handle h,
|
|||
int ret;
|
||||
restconf_media media_in;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, data);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", data);
|
||||
if ((cbret = cbuf_new()) == NULL){
|
||||
clixon_err(OE_UNIX, 0, "cbuf_new");
|
||||
goto done;
|
||||
|
|
@ -491,7 +491,7 @@ api_operations_post_input(clixon_handle h,
|
|||
* <data><input xmlns="urn:example:clixon">...</input></data>
|
||||
*/
|
||||
#if 1
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xdata, "%s xdata:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xdata, "xdata:");
|
||||
#endif
|
||||
/* Validate that exactly only <input> tag */
|
||||
if ((xinput = xml_child_i_type(xdata, 0, CX_ELMNT)) == NULL ||
|
||||
|
|
@ -509,7 +509,7 @@ api_operations_post_input(clixon_handle h,
|
|||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
// clixon_debug(CLIXON_DBG_CLIENT, "%s input validation passed", __FUNCTION__);
|
||||
// clixon_debug(CLIXON_DBG_CLIENT, "input validation passed");
|
||||
/* Add all input under <rpc>path */
|
||||
x = NULL;
|
||||
while ((x = xml_child_i_type(xinput, 0, CX_ELMNT)) != NULL)
|
||||
|
|
@ -520,7 +520,7 @@ api_operations_post_input(clixon_handle h,
|
|||
// ok:
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval: %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval: %d", retval);
|
||||
if (cbret)
|
||||
cbuf_free(cbret);
|
||||
if (xerr)
|
||||
|
|
@ -567,7 +567,7 @@ api_operations_post_output(clixon_handle h,
|
|||
cxobj *xok;
|
||||
int isempty;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* Validate that exactly only <rpc-reply> tag with exactly one element child */
|
||||
if ((xoutput = xml_child_i_type(xret, 0, CX_ELMNT)) == NULL ||
|
||||
strcmp(xml_name(xoutput),"rpc-reply") != 0
|
||||
|
|
@ -588,7 +588,7 @@ api_operations_post_output(clixon_handle h,
|
|||
xml_name_set(xoutput, "output");
|
||||
/* xoutput should now look: <output><x xmlns="uri">0</x></output> */
|
||||
#if 1
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xoutput, "%s xoutput:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xoutput, "xoutput:");
|
||||
#endif
|
||||
/* Remove original netconf default namespace. Somewhat unsure what "output" belongs to? */
|
||||
if ((xa = xml_find_type(xoutput, NULL, "xmlns", CX_ATTR)) != NULL)
|
||||
|
|
@ -649,7 +649,7 @@ api_operations_post_output(clixon_handle h,
|
|||
*xoutputp = xoutput;
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval: %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval: %d", retval);
|
||||
if (xerr)
|
||||
xml_free(xerr);
|
||||
return retval;
|
||||
|
|
@ -722,7 +722,7 @@ api_operations_post(clixon_handle h,
|
|||
char *namespace = NULL;
|
||||
int nr = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s json:\"%s\" path:\"%s\"", __FUNCTION__, data, api_path);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "json:\"%s\" path:\"%s\"", data, api_path);
|
||||
/* 1. Initialize */
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
|
|
@ -792,7 +792,7 @@ api_operations_post(clixon_handle h,
|
|||
* XML: <input xmlns="uri"><x>0</x></input>
|
||||
*/
|
||||
namespace = xml_find_type_value(xbot, NULL, "xmlns", CX_ATTR);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s : 4. Parse input data: %s", __FUNCTION__, data);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "4. Parse input data: %s", data);
|
||||
if (data && strlen(data)){
|
||||
if ((ret = api_operations_post_input(h, req, data, yspec, yrpc, xbot,
|
||||
pretty, media_out)) < 0)
|
||||
|
|
@ -803,7 +803,7 @@ api_operations_post(clixon_handle h,
|
|||
/* Here xtop is:
|
||||
<rpc username="foo"><myfn xmlns="uri"><x>42</x></myfn></rpc> */
|
||||
#if 1
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xtop, "%s 5. Translate input args:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xtop, ". Translate input args:");
|
||||
#endif
|
||||
/* 6. Validate outgoing RPC and fill in defaults */
|
||||
if ((ret = xml_bind_yang_rpc(h, xtop, yspec, &xerr)) < 0) /* */
|
||||
|
|
@ -824,7 +824,7 @@ api_operations_post(clixon_handle h,
|
|||
* <rpc username="foo"><myfn xmlns="uri"><x>42</x><y>99</y></myfn></rpc>
|
||||
*/
|
||||
#if 0
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xtop, "%s 6. Validate and defaults:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xtop, "6. Validate and defaults:");
|
||||
#endif
|
||||
/* 7. Send to RPC handler, either local or backend
|
||||
* Note (1) xtop is <rpc><method> xbot is <method>
|
||||
|
|
@ -865,7 +865,7 @@ api_operations_post(clixon_handle h,
|
|||
* <rpc-reply><x xmlns="uri">0</x></rpc-reply>
|
||||
*/
|
||||
#if 1
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "%s Receive reply:", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "Receive reply:");
|
||||
#endif
|
||||
youtput = yang_find(yrpc, Y_OUTPUT, NULL);
|
||||
if ((ret = api_operations_post_output(h, req, xret, yspec, youtput, namespace,
|
||||
|
|
@ -897,7 +897,7 @@ api_operations_post(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (prefix)
|
||||
free(prefix);
|
||||
if (id)
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ restconf_conn_new(clixon_handle h,
|
|||
rc->rc_callhome = rsock->rs_callhome;
|
||||
rc->rc_socket = rsock;
|
||||
INSQ(rc, rsock->rs_conns);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %p", __FUNCTION__, rc);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%p", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ restconf_conn_free(restconf_conn *rc)
|
|||
restconf_socket *rsock;
|
||||
restconf_conn *rc1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (rc == NULL){
|
||||
clixon_err(OE_RESTCONF, EINVAL, "rc is NULL");
|
||||
goto done;
|
||||
|
|
@ -416,7 +416,7 @@ native_buf_write(clixon_handle h,
|
|||
}
|
||||
memcpy(dbgstr, buf, sz);
|
||||
dbgstr[sz] = '\0';
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s buflen:%zu buf:\n%s", __FUNCTION__, callfn, buflen, dbgstr);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s buflen:%zu buf:\n%s", callfn, buflen, dbgstr);
|
||||
free(dbgstr);
|
||||
}
|
||||
while (totlen < buflen){
|
||||
|
|
@ -430,7 +430,7 @@ native_buf_write(clixon_handle h,
|
|||
goto closed; /* Close socket and ssl */
|
||||
}
|
||||
else if (er == EAGAIN){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s write EAGAIN", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "write EAGAIN");
|
||||
usleep(10000);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -451,7 +451,7 @@ native_buf_write(clixon_handle h,
|
|||
if ((len = write(rc->rc_s, buf+totlen, buflen-totlen)) < 0){
|
||||
switch (errno){
|
||||
case EAGAIN: /* Operation would block */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s write EAGAIN", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "write EAGAIN");
|
||||
usleep(10000);
|
||||
continue;
|
||||
break;
|
||||
|
|
@ -471,7 +471,7 @@ native_buf_write(clixon_handle h,
|
|||
} /* while */
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
return retval;
|
||||
closed:
|
||||
retval = 0;
|
||||
|
|
@ -498,7 +498,7 @@ native_send_badrequest(clixon_handle h,
|
|||
int retval = -1;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "cbuf_new");
|
||||
goto done;
|
||||
|
|
@ -570,7 +570,7 @@ read_ssl(restconf_conn *rc,
|
|||
|
||||
if ((*np = SSL_read(rc->rc_ssl, buf, sz)) <= 0){
|
||||
sslerr = SSL_get_error(rc->rc_ssl, *np);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_read() n:%zd errno:%d sslerr:%d", __FUNCTION__, *np, errno, sslerr);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "SSL_read() n:%zd errno:%d sslerr:%d", *np, errno, sslerr);
|
||||
switch (sslerr){
|
||||
case SSL_ERROR_WANT_READ: /* 2 */
|
||||
/* SSL_ERROR_WANT_READ is returned when the last operation was a read operation
|
||||
|
|
@ -578,7 +578,7 @@ read_ssl(restconf_conn *rc,
|
|||
* That is, it can happen if restconf_socket_init() below is called
|
||||
* with SOCK_NONBLOCK
|
||||
*/
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_read SSL_ERROR_WANT_READ", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "SSL_read SSL_ERROR_WANT_READ");
|
||||
usleep(1000);
|
||||
*again = 1;
|
||||
break;
|
||||
|
|
@ -593,7 +593,7 @@ read_ssl(restconf_conn *rc,
|
|||
}
|
||||
retval = 0;
|
||||
// done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -623,14 +623,14 @@ read_regular(restconf_conn *rc,
|
|||
if ((*np = read(rc->rc_s, buf, sz)) < 0){ /* XXX atomicio ? */
|
||||
switch(errno){
|
||||
case ECONNRESET:/* Connection reset by peer */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d Connection reset by peer", __FUNCTION__, rc->rc_s);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d Connection reset by peer", rc->rc_s);
|
||||
if (restconf_close_ssl_socket(rc, __FUNCTION__, 0) < 0)
|
||||
goto done;
|
||||
retval = 0; /* Close socket and ssl */
|
||||
goto done;
|
||||
break;
|
||||
case EAGAIN:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s read EAGAIN", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "read EAGAIN");
|
||||
usleep(1000);
|
||||
*again = 1;
|
||||
break;
|
||||
|
|
@ -886,7 +886,7 @@ restconf_http2_process(restconf_conn *rc,
|
|||
int ret;
|
||||
nghttp2_error ngerr;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (rc->rc_exit){ /* Server-initiated exit for http/2 */
|
||||
if ((ngerr = nghttp2_session_terminate_session(rc->rc_ngsession, 0)) < 0){
|
||||
clixon_err(OE_NGHTTP2, ngerr, "nghttp2_session_terminate_session %d", ngerr);
|
||||
|
|
@ -913,7 +913,7 @@ restconf_http2_process(restconf_conn *rc,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
#endif /* HAVE_LIBNGHTTP2 */
|
||||
|
|
@ -961,7 +961,7 @@ restconf_connection(int s,
|
|||
int readmore = 1;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, s);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", s);
|
||||
if ((rc = (restconf_conn*)arg) == NULL){
|
||||
clixon_err(OE_RESTCONF, EINVAL, "arg is NULL");
|
||||
goto done;
|
||||
|
|
@ -972,7 +972,7 @@ restconf_connection(int s,
|
|||
}
|
||||
gettimeofday(&rc->rc_t, NULL); /* activity timer */
|
||||
while (readmore) {
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s readmore", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "readmore");
|
||||
readmore = 0;
|
||||
/* Example: curl -Ssik -u wilma:bar -X GET https://localhost/restconf/data/example:x */
|
||||
if (rc->rc_ssl){
|
||||
|
|
@ -985,11 +985,11 @@ restconf_connection(int s,
|
|||
if (ret == 0)
|
||||
goto ok; /* abort here */
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s read:%zd", __FUNCTION__, n);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "read:%zd", n);
|
||||
if (readmore)
|
||||
continue;
|
||||
if (n == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s n=0 closing socket", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "n=0 closing socket");
|
||||
if (restconf_close_ssl_socket(rc, __FUNCTION__, 0) < 0)
|
||||
goto done;
|
||||
rc = NULL;
|
||||
|
|
@ -1029,7 +1029,7 @@ restconf_connection(int s,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval %d", retval);
|
||||
return retval;
|
||||
} /* restconf_connection */
|
||||
|
||||
|
|
@ -1053,7 +1053,7 @@ restconf_connection_close1(restconf_conn *rc)
|
|||
goto done;
|
||||
}
|
||||
rsock = rc->rc_socket;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\"%s\"", rsock->rs_description);
|
||||
if (close(rc->rc_s) < 0){
|
||||
clixon_err(OE_UNIX, errno, "close");
|
||||
goto done;
|
||||
|
|
@ -1068,7 +1068,7 @@ restconf_connection_close1(restconf_conn *rc)
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -1092,13 +1092,13 @@ restconf_close_ssl_socket(restconf_conn *rc,
|
|||
int sslerr;
|
||||
int er;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, callfn);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", callfn);
|
||||
if (rc->rc_ssl != NULL){
|
||||
if (!dontshutdown &&
|
||||
(ret = SSL_shutdown(rc->rc_ssl)) < 0){
|
||||
er = errno;
|
||||
sslerr = SSL_get_error(rc->rc_ssl, ret);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s errno:%s(%d) sslerr:%d", __FUNCTION__, strerror(er), er, sslerr);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "errno:%s(%d) sslerr:%d", strerror(er), er, sslerr);
|
||||
if (sslerr == SSL_ERROR_SSL || /* 1 */
|
||||
sslerr == SSL_ERROR_ZERO_RETURN){ /* 6 */
|
||||
}
|
||||
|
|
@ -1126,7 +1126,7 @@ restconf_close_ssl_socket(restconf_conn *rc,
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -1150,7 +1150,7 @@ ssl_alpn_check(clixon_handle h,
|
|||
int retval = -1;
|
||||
cbuf *cberr = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* Alternatively, call restconf_str2proto but alpn is not a proper string */
|
||||
if (alpn && alpnlen == 8 && memcmp("http/1.1", alpn, 8) == 0){
|
||||
*proto = HTTP_11;
|
||||
|
|
@ -1202,7 +1202,7 @@ ssl_alpn_check(clixon_handle h,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (cberr)
|
||||
cbuf_free(cberr);
|
||||
return retval;
|
||||
|
|
@ -1240,7 +1240,7 @@ restconf_ssl_accept_client(clixon_handle h,
|
|||
unsigned int alpnlen = 0;
|
||||
restconf_http_proto proto = HTTP_11; /* Non-SSL negotiation NYI */
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
#ifdef HAVE_LIBNGHTTP2
|
||||
#ifndef HAVE_HTTP1
|
||||
proto = HTTP_2; /* If nghttp2 only let default be 2.0 */
|
||||
|
|
@ -1255,13 +1255,13 @@ restconf_ssl_accept_client(clixon_handle h,
|
|||
*/
|
||||
if ((rc = restconf_conn_new(h, s, rsock)) == NULL)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s s:%d", __FUNCTION__, rc->rc_s);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "s:%d", rc->rc_s);
|
||||
if (rsock->rs_ssl){
|
||||
if ((rc->rc_ssl = SSL_new(rn->rn_ctx)) == NULL){
|
||||
clixon_err(OE_SSL, 0, "SSL_new");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_new(%p)", __FUNCTION__, rc->rc_ssl);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "SSL_new(%p)", rc->rc_ssl);
|
||||
/* CCL_CTX_set_verify already set, need not call SSL_set_verify again for this server
|
||||
*/
|
||||
/* X509_CHECK_FLAG_NO_WILDCARDS disables wildcard expansion */
|
||||
|
|
@ -1298,11 +1298,11 @@ restconf_ssl_accept_client(clixon_handle h,
|
|||
* Both error cases: Call SSL_get_error() with the return value ret
|
||||
*/
|
||||
if ((ret = SSL_accept(rc->rc_ssl)) != 1) {
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_accept() ret:%d errno:%d", __FUNCTION__, ret, er=errno);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "SSL_accept() ret:%d errno:%d", ret, er=errno);
|
||||
e = SSL_get_error(rc->rc_ssl, ret);
|
||||
switch (e){
|
||||
case SSL_ERROR_SSL: /* 1 */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_ERROR_SSL (non-ssl message on ssl socket)", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "SSL_ERROR_SSL (non-ssl message on ssl socket)");
|
||||
#ifdef HTTP_ON_HTTPS_REPLY
|
||||
SSL_free(rc->rc_ssl);
|
||||
rc->rc_ssl = NULL;
|
||||
|
|
@ -1320,7 +1320,7 @@ restconf_ssl_accept_client(clixon_handle h,
|
|||
consult errno for details. If this error occurs then no further I/O
|
||||
operations should be performed on the connection and SSL_shutdown() must
|
||||
not be called.*/
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_accept() SSL_ERROR_SYSCALL %d", __FUNCTION__, er);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "SSL_accept() SSL_ERROR_SYSCALL %d", er);
|
||||
if (restconf_close_ssl_socket(rc, __FUNCTION__, 1) < 0)
|
||||
goto done;
|
||||
rc = NULL;
|
||||
|
|
@ -1333,7 +1333,7 @@ restconf_ssl_accept_client(clixon_handle h,
|
|||
* That is, it can happen if restconf_socket_init() below is called
|
||||
* with SOCK_NONBLOCK
|
||||
*/
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s write SSL_ERROR_WANT_READ", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "write SSL_ERROR_WANT_READ");
|
||||
usleep(10000);
|
||||
readmore = 1;
|
||||
break;
|
||||
|
|
@ -1367,7 +1367,7 @@ restconf_ssl_accept_client(clixon_handle h,
|
|||
if (ret == 0){
|
||||
goto closed;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s proto:%s", __FUNCTION__, restconf_proto2str(proto));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "proto:%s", restconf_proto2str(proto));
|
||||
|
||||
#if 0 /* Seems too early to fail here, instead let authentication callback deal with this */
|
||||
/* For client-cert authentication, check if any certs are present,
|
||||
|
|
@ -1404,7 +1404,7 @@ restconf_ssl_accept_client(clixon_handle h,
|
|||
const char *peername = SSL_get0_peername(rc->rc_ssl);
|
||||
if (peername != NULL) {
|
||||
/* Name checks were in scope and matched the peername */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s peername:%s", __FUNCTION__, peername);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "peername:%s", peername);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
|
|
@ -1457,7 +1457,7 @@ restconf_ssl_accept_client(clixon_handle h,
|
|||
*rcp = rc;
|
||||
retval = 1; /* OK, up */
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval %d", retval);
|
||||
if (name)
|
||||
free(name);
|
||||
return retval;
|
||||
|
|
@ -1528,7 +1528,7 @@ restconf_idle_cb(int fd,
|
|||
clixon_err(OE_YANG, EINVAL, "rsock is NULL");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\"%s\"", rsock->rs_description);
|
||||
if (rc->rc_callhome && rsock->rs_periodic && rc->rc_s > 0 && rsock->rs_idle_timeout){
|
||||
gettimeofday(&now, NULL);
|
||||
timersub(&now, &rc->rc_t, &td); /* Last packet timestamp */
|
||||
|
|
@ -1539,7 +1539,7 @@ restconf_idle_cb(int fd,
|
|||
else{
|
||||
to.tv_sec = rsock->rs_idle_timeout;
|
||||
timeradd(&now, &to, &tn);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s now:%lu timeout:%lu.%lu", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "now:%lu timeout:%lu.%lu",
|
||||
now.tv_sec, tn.tv_sec, tn.tv_usec);
|
||||
if (restconf_idle_timer_set(tn, rc, rsock->rs_description) < 0)
|
||||
goto done;
|
||||
|
|
@ -1585,7 +1585,7 @@ restconf_idle_timer(restconf_conn *rc)
|
|||
clixon_err(OE_YANG, EINVAL, "rsock is NULL or not periodic");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\" register", __FUNCTION__, rsock->rs_description);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\"%s\" register", rsock->rs_description);
|
||||
gettimeofday(&now, NULL);
|
||||
to.tv_sec = rsock->rs_idle_timeout;
|
||||
timeradd(&now, &to, &t);
|
||||
|
|
@ -1623,7 +1623,7 @@ restconf_callhome_cb(int fd,
|
|||
clixon_err(OE_YANG, EINVAL, "rsock is NULL");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\"%s\"", rsock->rs_description);
|
||||
h = rsock->rs_h;
|
||||
/* Already computed in restconf_socket_init, could be saved in rsock? */
|
||||
if (clixon_inet2sin(rsock->rs_addrtype, rsock->rs_addrstr, rsock->rs_port, sa, &sa_len) < 0)
|
||||
|
|
@ -1633,7 +1633,7 @@ restconf_callhome_cb(int fd,
|
|||
goto done;
|
||||
}
|
||||
if (connect(s, sa, sa_len) < 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s connect %hu fail:%d %s", __FUNCTION__, rsock->rs_port, errno, strerror(errno));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "connect %hu fail:%d %s", rsock->rs_port, errno, strerror(errno));
|
||||
close(s);
|
||||
rsock->rs_attempts++;
|
||||
/* Fail: Initiate new timer */
|
||||
|
|
@ -1641,7 +1641,7 @@ restconf_callhome_cb(int fd,
|
|||
goto done;
|
||||
}
|
||||
else {
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s connect %hu OK", __FUNCTION__, rsock->rs_port);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "connect %hu OK", rsock->rs_port);
|
||||
rsock->rs_attempts = 0;
|
||||
if ((ret = restconf_ssl_accept_client(h, s, rsock, &rc)) < 0)
|
||||
goto done;
|
||||
|
|
@ -1686,7 +1686,7 @@ restconf_callhome_timer(restconf_socket *rsock,
|
|||
clixon_err(OE_YANG, EINVAL, "rsock is NULL or not callhome");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\"", __FUNCTION__, rsock->rs_description);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\"%s\"", rsock->rs_description);
|
||||
if (!rsock->rs_callhome)
|
||||
goto ok; /* shouldnt happen */
|
||||
gettimeofday(&now, NULL);
|
||||
|
|
@ -1714,9 +1714,9 @@ restconf_callhome_timer(restconf_socket *rsock,
|
|||
}
|
||||
cprintf(cb, "restconf callhome timer %s", rsock->rs_description);
|
||||
if (rsock->rs_description)
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s registering \"%s\": +%lu", __FUNCTION__, rsock->rs_description, t.tv_sec-now.tv_sec);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "registering \"%s\": +%lu", rsock->rs_description, t.tv_sec-now.tv_sec);
|
||||
else
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s: %lu", __FUNCTION__, t.tv_sec);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%lu", t.tv_sec);
|
||||
/* Should be only place restconf_callhome_cb is registered */
|
||||
if (clixon_event_reg_timeout(t,
|
||||
restconf_callhome_cb,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ clixon_nghttp2_log_cb(void *handle,
|
|||
int suberr,
|
||||
cbuf *cb)
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
cprintf(cb, "Fatal error: %s", nghttp2_strerror(suberr));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -178,20 +178,20 @@ session_send_callback(nghttp2_session *session,
|
|||
int s;
|
||||
int sslerr;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s buflen:%zu", __FUNCTION__, buflen);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "buflen:%zu", buflen);
|
||||
s = rc->rc_s;
|
||||
while (totlen < buflen){
|
||||
if (rc->rc_ssl){
|
||||
if ((len = SSL_write(rc->rc_ssl, buf+totlen, buflen-totlen)) <= 0){
|
||||
er = errno;
|
||||
sslerr = SSL_get_error(rc->rc_ssl, len);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s SSL_write: errno:%s(%d) sslerr:%d", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "SSL_write: errno:%s(%d) sslerr:%d",
|
||||
strerror(er),
|
||||
er,
|
||||
sslerr);
|
||||
switch (sslerr){
|
||||
case SSL_ERROR_WANT_WRITE: /* 3 */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s write SSL_ERROR_WANT_WRITE", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "write SSL_ERROR_WANT_WRITE");
|
||||
usleep(1000);
|
||||
continue;
|
||||
break;
|
||||
|
|
@ -205,7 +205,7 @@ session_send_callback(nghttp2_session *session,
|
|||
* platforms, linux here, freebsd want_write, or possibly differnt
|
||||
* ssl lib versions?
|
||||
*/
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s write EAGAIN", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "write EAGAIN");
|
||||
usleep(1000);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ session_send_callback(nghttp2_session *session,
|
|||
else{
|
||||
if ((len = write(s, buf+totlen, buflen-totlen)) < 0){
|
||||
if (errno == EAGAIN){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s write EAGAIN", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "write EAGAIN");
|
||||
usleep(10000);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -252,10 +252,10 @@ session_send_callback(nghttp2_session *session,
|
|||
retval = 0;
|
||||
done:
|
||||
if (retval < 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%zd", __FUNCTION__, totlen);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%zd", totlen);
|
||||
return retval == 0 ? totlen : retval;
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ recv_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -346,7 +346,7 @@ restconf_nghttp2_path(restconf_stream_data *sd)
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
if (cvv)
|
||||
cvec_free(cvv);
|
||||
if (oneline)
|
||||
|
|
@ -390,8 +390,7 @@ restconf_sd_read(nghttp2_session *session,
|
|||
#endif
|
||||
assert(cbuf_len(cb) > sd->sd_body_offset);
|
||||
remain = cbuf_len(cb) - sd->sd_body_offset;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s length:%zu totlen:%zu, offset:%zu remain:%zu",
|
||||
__FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "length:%zu totlen:%zu, offset:%zu remain:%zu",
|
||||
length,
|
||||
cbuf_len(cb),
|
||||
sd->sd_body_offset,
|
||||
|
|
@ -406,7 +405,7 @@ restconf_sd_read(nghttp2_session *session,
|
|||
}
|
||||
memcpy(buf, cbuf_get(cb) + sd->sd_body_offset, len);
|
||||
sd->sd_body_offset += len;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%zu", __FUNCTION__, len);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%zu", len);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
@ -434,7 +433,7 @@ restconf_submit_response(nghttp2_session *session,
|
|||
hdr = &hdrs[i++];
|
||||
hdr->name = (uint8_t*)":status";
|
||||
snprintf(valstr, 15, "%u", sd->sd_code);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s status %d", __FUNCTION__, sd->sd_code);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "status %d", sd->sd_code);
|
||||
hdr->value = (uint8_t*)valstr;
|
||||
hdr->namelen = strlen(":status");
|
||||
hdr->valuelen = strlen(valstr);
|
||||
|
|
@ -444,7 +443,7 @@ restconf_submit_response(nghttp2_session *session,
|
|||
while ((cv = cvec_each(sd->sd_outp_hdrs, cv)) != NULL){
|
||||
hdr = &hdrs[i++];
|
||||
hdr->name = (uint8_t*)cv_name_get(cv);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s hdr: %s", __FUNCTION__, hdr->name);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "hdr: %s", hdr->name);
|
||||
hdr->value = (uint8_t*)cv_string_get(cv);
|
||||
hdr->namelen = strlen(cv_name_get(cv));
|
||||
hdr->valuelen = strlen(cv_string_get(cv));
|
||||
|
|
@ -459,7 +458,7 @@ restconf_submit_response(nghttp2_session *session,
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (hdrs)
|
||||
free(hdrs);
|
||||
return retval;
|
||||
|
|
@ -475,7 +474,7 @@ http2_exec(restconf_conn *rc,
|
|||
{
|
||||
int retval = -1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (sd->sd_path){
|
||||
free(sd->sd_path);
|
||||
sd->sd_path = NULL;
|
||||
|
|
@ -514,7 +513,7 @@ http2_exec(restconf_conn *rc,
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -530,7 +529,7 @@ on_frame_recv_callback(nghttp2_session *session,
|
|||
restconf_stream_data *sd = NULL;
|
||||
char *query;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s %d", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d",
|
||||
clicon_int2str(nghttp2_frame_type_map, frame->hd.type),
|
||||
frame->hd.stream_id);
|
||||
switch (frame->hd.type) {
|
||||
|
|
@ -572,7 +571,7 @@ on_invalid_frame_recv_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -594,7 +593,7 @@ on_data_chunk_recv_callback(nghttp2_session *session,
|
|||
restconf_conn *rc = (restconf_conn *)user_data;
|
||||
restconf_stream_data *sd;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, stream_id);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", stream_id);
|
||||
if ((sd = restconf_stream_find(rc, stream_id)) != NULL){
|
||||
cbuf_append_buf(sd->sd_indata, (void*)data, len);
|
||||
}
|
||||
|
|
@ -609,7 +608,7 @@ before_frame_send_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -621,7 +620,7 @@ on_frame_send_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -634,7 +633,7 @@ on_frame_not_send_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -648,7 +647,7 @@ on_stream_close_callback(nghttp2_session *session,
|
|||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d %s", __FUNCTION__, error_code, nghttp2_strerror(error_code));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d %s", error_code, nghttp2_strerror(error_code));
|
||||
#if 0 // NOTNEEDED /* XXX think this is not necessary? */
|
||||
if (error_code){
|
||||
if (restconf_close_ssl_socket(rc, __FUNCTION__, 0) < 0)
|
||||
|
|
@ -668,7 +667,7 @@ on_begin_headers_callback(nghttp2_session *session,
|
|||
restconf_conn *rc = (restconf_conn *)user_data;
|
||||
restconf_stream_data *sd;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, clicon_int2str(nghttp2_frame_type_map, frame->hd.type));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", clicon_int2str(nghttp2_frame_type_map, frame->hd.type));
|
||||
if (frame->hd.type == NGHTTP2_HEADERS &&
|
||||
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
|
||||
sd = restconf_stream_data_new(rc, frame->hd.stream_id);
|
||||
|
|
@ -736,12 +735,12 @@ on_header_callback(nghttp2_session *session,
|
|||
switch (frame->hd.type){
|
||||
case NGHTTP2_HEADERS:
|
||||
assert (frame->headers.cat == NGHTTP2_HCAT_REQUEST);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s HEADERS %s %s", __FUNCTION__, name, value);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "HEADERS %s %s", name, value);
|
||||
if (nghttp2_hdr2clixon(rc->rc_h, (char*)name, (char*)value) < 0)
|
||||
goto done;
|
||||
break;
|
||||
default:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s %s", __FUNCTION__, clicon_int2str(nghttp2_frame_type_map, frame->hd.type), name);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", clicon_int2str(nghttp2_frame_type_map, frame->hd.type), name);
|
||||
break;
|
||||
}
|
||||
retval = 0;
|
||||
|
|
@ -759,7 +758,7 @@ select_padding_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return frame->hd.length;
|
||||
}
|
||||
|
||||
|
|
@ -775,7 +774,7 @@ data_source_read_length_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
#endif /* NOTUSED */
|
||||
|
|
@ -791,7 +790,7 @@ on_begin_frame_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, clicon_int2str(nghttp2_frame_type_map, hd->type));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", clicon_int2str(nghttp2_frame_type_map, hd->type));
|
||||
if (hd->type == NGHTTP2_CONTINUATION)
|
||||
assert(0);
|
||||
return 0;
|
||||
|
|
@ -811,7 +810,7 @@ send_data_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -825,7 +824,7 @@ pack_extension_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -838,7 +837,7 @@ unpack_extension_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
#endif /* NOTUSED */
|
||||
|
|
@ -853,7 +852,7 @@ on_extension_chunk_recv_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -866,7 +865,7 @@ error_callback(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -881,7 +880,7 @@ error_callback2(nghttp2_session *session,
|
|||
void *user_data)
|
||||
{
|
||||
// restconf_conn *rc = (restconf_conn *)user_data;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_err(OE_NGHTTP2, lib_error_code, "%s", msg);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -904,7 +903,7 @@ http2_recv(restconf_conn *rc,
|
|||
int retval = -1;
|
||||
nghttp2_error ngerr;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (rc->rc_ngsession == NULL){
|
||||
/* http2_session_init not called */
|
||||
clixon_err(OE_RESTCONF, EINVAL, "No nghttp2 session");
|
||||
|
|
@ -941,7 +940,7 @@ http2_recv(restconf_conn *rc,
|
|||
}
|
||||
retval = 1; /* OK */
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
return retval;
|
||||
fail:
|
||||
retval = 0;
|
||||
|
|
@ -958,7 +957,7 @@ http2_send_server_connection(restconf_conn *rc)
|
|||
,{NGHTTP2_SETTINGS_ENABLE_PUSH, 0}};
|
||||
nghttp2_error ngerr;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((ngerr = nghttp2_submit_settings(rc->rc_ngsession,
|
||||
NGHTTP2_FLAG_NONE,
|
||||
iv,
|
||||
|
|
@ -972,7 +971,7 @@ http2_send_server_connection(restconf_conn *rc)
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ api_well_known(clixon_handle h,
|
|||
cbuf *cb = NULL;
|
||||
int head;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (req == NULL){
|
||||
errno = EINVAL;
|
||||
goto done;
|
||||
|
|
@ -179,7 +179,7 @@ api_root_restconf_exact(clixon_handle h,
|
|||
cbuf *cb = NULL;
|
||||
int head;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
head = strcmp(request_method, "HEAD") == 0;
|
||||
if (!head && strcmp(request_method, "GET") != 0){
|
||||
if (restconf_method_notallowed(h, req, "GET", pretty, media_out) < 0)
|
||||
|
|
@ -248,7 +248,7 @@ api_operational_state(clixon_handle h,
|
|||
restconf_media media_out)
|
||||
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s request method:%s", __FUNCTION__, request_method);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "request method:%s", request_method);
|
||||
|
||||
/* We are not implementing this method at this time, 20201105 despite it
|
||||
* being mandatory https://tools.ietf.org/html/rfc8527#section-3.1 */
|
||||
|
|
@ -274,7 +274,7 @@ api_yang_library_version(clixon_handle h,
|
|||
cbuf *cb = NULL;
|
||||
yang_stmt *yspec;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (restconf_reply_header(req, "Content-Type", "%s", restconf_media_int2str(media_out)) < 0)
|
||||
goto done;
|
||||
if (restconf_reply_header(req, "Cache-Control", "no-cache") < 0)
|
||||
|
|
@ -349,9 +349,9 @@ api_data(clixon_handle h,
|
|||
char *request_method;
|
||||
cxobj *xerr = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
request_method = restconf_param_get(h, "REQUEST_METHOD");
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s method:%s", __FUNCTION__, request_method);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "method:%s", request_method);
|
||||
|
||||
/* https://tools.ietf.org/html/rfc8527#section-3.2 */
|
||||
/* We assume that dynamic datastores are read only at this time 20201105 */
|
||||
|
|
@ -399,7 +399,7 @@ api_data(clixon_handle h,
|
|||
goto done;
|
||||
retval = api_return_err0(h, req, xerr, pretty, media_out, 0);
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
done:
|
||||
if (xerr)
|
||||
xml_free(xerr);
|
||||
|
|
@ -435,7 +435,7 @@ api_operations(clixon_handle h,
|
|||
int retval = -1;
|
||||
cxobj *xerr = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (strcmp(request_method, "GET")==0)
|
||||
retval = api_operations_get(h, req, path, pi, qvec, data, pretty, media_out);
|
||||
else if (strcmp(request_method, "POST")==0)
|
||||
|
|
@ -482,7 +482,7 @@ api_root_restconf(clixon_handle h,
|
|||
int ret;
|
||||
cxobj *xerr = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (req == NULL){
|
||||
errno = EINVAL;
|
||||
goto done;
|
||||
|
|
@ -512,7 +512,7 @@ api_root_restconf(clixon_handle h,
|
|||
goto ok;
|
||||
}
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s ACCEPT: %s %s", __FUNCTION__, media_str, restconf_media_int2str(media_out));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "ACCEPT: %s %s", media_str, restconf_media_int2str(media_out));
|
||||
|
||||
if ((pvec = clicon_strsep(path, "/", &pn)) == NULL)
|
||||
goto done;
|
||||
|
|
@ -543,14 +543,14 @@ api_root_restconf(clixon_handle h,
|
|||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s: api_resource=%s", __FUNCTION__, api_resource);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "api_resource=%s", api_resource);
|
||||
if (uri_str2cvec(path, '/', '=', 1, &pcvec) < 0) /* rest url eg /album=ricky/foo */
|
||||
goto done;
|
||||
/* data */
|
||||
if ((cb = restconf_get_indata(req)) == NULL) /* XXX NYI ACTUALLY not always needed, do this later? */
|
||||
goto done;
|
||||
indata = cbuf_get(cb);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s DATA=%s", __FUNCTION__, indata);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "DATA=%s", indata);
|
||||
|
||||
/* If present, check credentials. See "plugin_credentials" in plugin
|
||||
* retvals:
|
||||
|
|
@ -627,7 +627,7 @@ api_root_restconf(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
#ifdef WITH_RESTCONF_FCGI
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
|
|
|
|||
|
|
@ -215,16 +215,16 @@ restconf_stream_cb(int s,
|
|||
int pretty = 0; /* XXX should be via arg */
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* get msg (this is the reason this function is called) */
|
||||
if (clicon_msg_rcv(s, NULL, 0, &reply, &eof) < 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s msg_rcv error", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "msg_rcv error");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s msg: %s", __FUNCTION__, reply?reply->op_body:"null");
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "msg: %s", reply?reply->op_body:"null");
|
||||
/* handle close from remote end: this will exit the client */
|
||||
if (eof){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s eof", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "eof");
|
||||
clixon_err(OE_PROTO, ESHUTDOWN, "Socket unexpected close");
|
||||
errno = ESHUTDOWN;
|
||||
FCGX_FPrintF(r->out, "SHUTDOWN\r\n");
|
||||
|
|
@ -266,7 +266,7 @@ restconf_stream_cb(int s,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval: %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval: %d", retval);
|
||||
if (xtop != NULL)
|
||||
xml_free(xtop);
|
||||
if (reply)
|
||||
|
|
@ -306,7 +306,7 @@ restconf_stream(clixon_handle h,
|
|||
cg_var *cv;
|
||||
char *vname;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
*sp = -1;
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clixon_err(OE_XML, errno, "cbuf_new");
|
||||
|
|
@ -353,7 +353,7 @@ restconf_stream(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval: %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval: %d", retval);
|
||||
if (xret)
|
||||
xml_free(xret);
|
||||
if (cb)
|
||||
|
|
@ -376,9 +376,9 @@ stream_checkuplink(int s,
|
|||
{
|
||||
FCGX_Request *r = (FCGX_Request *)arg;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (FCGX_GetError(r->out) != 0){ /* break loop */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s FCGX_GetError upstream", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "FCGX_GetError upstream");
|
||||
clixon_exit_set(1);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -392,9 +392,9 @@ stream_timeout(int s,
|
|||
struct timeval t1;
|
||||
FCGX_Request *r = (FCGX_Request *)arg;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (FCGX_GetError(r->out) != 0){ /* break loop */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s FCGX_GetError upstream", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "FCGX_GetError upstream");
|
||||
clixon_exit_set(1);
|
||||
}
|
||||
else{
|
||||
|
|
@ -442,7 +442,7 @@ api_stream(clixon_handle h,
|
|||
struct stream_child *sc;
|
||||
#endif
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
streampath = clicon_option_str(h, "CLICON_STREAM_PATH");
|
||||
if ((path = restconf_uripath(h)) == NULL)
|
||||
goto done;
|
||||
|
|
@ -478,7 +478,7 @@ api_stream(clixon_handle h,
|
|||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s: method=%s", __FUNCTION__, method);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "method=%s", method);
|
||||
|
||||
if (uri_str2cvec(path, '/', '=', 1, &pcvec) < 0) /* rest url eg /album=ricky/foo */
|
||||
goto done;
|
||||
|
|
@ -486,7 +486,7 @@ api_stream(clixon_handle h,
|
|||
if ((cb = restconf_get_indata(req)) == NULL)
|
||||
goto done;
|
||||
indata = cbuf_get(cb);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s DATA=%s", __FUNCTION__, indata);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "DATA=%s", indata);
|
||||
|
||||
/* If present, check credentials. See "plugin_credentials" in plugin
|
||||
* See RFC 8040 section 2.5
|
||||
|
|
@ -522,12 +522,12 @@ api_stream(clixon_handle h,
|
|||
req,
|
||||
"stream socket") < 0)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s before loop", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "before loop");
|
||||
/* Poll upstream errors */
|
||||
stream_timeout(0, req);
|
||||
/* Start loop */
|
||||
clixon_event_loop(h);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s after loop", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "after loop");
|
||||
clicon_rpc_close_session(h);
|
||||
clixon_event_unreg_fd(s, restconf_stream_cb);
|
||||
close(s);
|
||||
|
|
@ -562,7 +562,7 @@ api_stream(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
if (xerr)
|
||||
xml_free(xerr);
|
||||
if (pvec)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ snmp_common_handler(netsnmp_mib_handler *handler,
|
|||
oid_cbuf(cb, (*shp)->sh_oid, (*shp)->sh_oidlen);
|
||||
if (oid_eq(requestvb->name, requestvb->name_length,
|
||||
(*shp)->sh_oid, (*shp)->sh_oidlen) == 0){ /* equal */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\" %s inclusive:%d %s", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\"%s\" %s inclusive:%d %s",
|
||||
cbuf_get(cb),
|
||||
snmp_msg_int2str(reqinfo->mode),
|
||||
request->inclusive, tablehandler?"table":"scalar");
|
||||
|
|
@ -110,7 +110,7 @@ snmp_common_handler(netsnmp_mib_handler *handler,
|
|||
oid_cbuf(cb, requestvb->name, requestvb->name_length);
|
||||
cprintf(cb, ")");
|
||||
// nhreg->rootoid same as shp
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s \"%s\" %s inclusive:%d %s", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\"%s\" %s inclusive:%d %s",
|
||||
cbuf_get(cb),
|
||||
snmp_msg_int2str(reqinfo->mode),
|
||||
request->inclusive, tablehandler?"table":"scalar");
|
||||
|
|
@ -181,7 +181,7 @@ snmp_scalar_return(cxobj *xs,
|
|||
if ((ret = type_xml2snmp(xmlstr, &asn1type, &snmpval, &snmplen, &reason)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, reason);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", reason);
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE)) != SNMPERR_SUCCESS){
|
||||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
|
|
@ -246,7 +246,7 @@ snmp_scalar_get(clixon_handle h,
|
|||
cxobj *xcache = NULL;
|
||||
char *body = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* Prepare backend call by constructing namespace context */
|
||||
if (xml_nsctx_yang(ys, &nsc) < 0)
|
||||
goto done;
|
||||
|
|
@ -301,7 +301,7 @@ snmp_scalar_get(clixon_handle h,
|
|||
if ((ret = type_xml2snmp(xmlstr, &asn1type, &snmpval, &snmplen, &reason)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, reason);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", reason);
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE)) != SNMPERR_SUCCESS){
|
||||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
|
|
@ -408,7 +408,7 @@ snmp_scalar_set(clixon_handle h,
|
|||
int asn1_type;
|
||||
enum operation_type op = OP_MERGE;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((xtop = xml_new(NETCONF_INPUT_CONFIG, NULL, CX_ELMNT)) == NULL)
|
||||
goto done;
|
||||
if (snmp_yang2xml(xtop, ys, cvk, &xbot) < 0)
|
||||
|
|
@ -557,7 +557,7 @@ snmp_cache_set(clixon_handle h,
|
|||
int isrowstatus = 0;
|
||||
cxobj *xcache = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
goto done;
|
||||
|
|
@ -601,8 +601,8 @@ snmp_cache_set(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
else if (strcmp(valstr, "destroy") == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, rowstatus);
|
||||
/* Dont send delete to backend if notInService(2) */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", rowstatus);
|
||||
/* Don't send delete to backend if notInService(2) */
|
||||
if (snmp_cache_row_op(h, yang_parent_get(ys), cvk, "delete", rowstatus!=2) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -663,7 +663,7 @@ snmp_table_rowstatus_get(clixon_handle h,
|
|||
char *intstr;
|
||||
char *reason = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
/* Prepare backend call by constructing namespace context */
|
||||
if (xml_nsctx_yang(ys, &nsc) < 0)
|
||||
goto done;
|
||||
|
|
@ -676,14 +676,14 @@ snmp_table_rowstatus_get(clixon_handle h,
|
|||
if ((ret = yang_enum2valstr(yrestype, body, &intstr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s invalid or not found", __FUNCTION__, body);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s invalid or not found", body);
|
||||
*rowstatus = 0;
|
||||
}
|
||||
else {
|
||||
if ((ret = parse_int32(intstr, rowstatus, &reason)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s parse_int32: %s", __FUNCTION__, reason);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "parse_int32: %s", reason);
|
||||
*rowstatus = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -722,7 +722,7 @@ clixon_snmp_scalar_handler1(netsnmp_mib_handler *handler,
|
|||
netsnmp_variable_list *requestvb = request->requestvb;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
if (snmp_common_handler(handler, nhreg, reqinfo, request, 0, &sh) < 0)
|
||||
goto done;
|
||||
/* see net-snmp/agent/snmp_agent.h / net-snmp/library/snmp.h */
|
||||
|
|
@ -744,7 +744,7 @@ clixon_snmp_scalar_handler1(netsnmp_mib_handler *handler,
|
|||
if (type_yang2asn1(sh->sh_ys, &asn1_type, 0) < 0)
|
||||
goto done;
|
||||
if (requestvb->type != asn1_type){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Expected type:%d, got: %d", __FUNCTION__, requestvb->type, asn1_type);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Expected type:%d, got: %d", requestvb->type, asn1_type);
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE)) != SNMPERR_SUCCESS){
|
||||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto ok;
|
||||
|
|
@ -791,7 +791,7 @@ clixon_snmp_scalar_handler1(netsnmp_mib_handler *handler,
|
|||
ok:
|
||||
retval = SNMP_ERR_NOERROR;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -815,7 +815,7 @@ clixon_snmp_scalar_handler(netsnmp_mib_handler *handler,
|
|||
netsnmp_request_info *req;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
for (req = requests; req; req = req->next){
|
||||
ret = clixon_snmp_scalar_handler1(handler, nhreg, reqinfo, req);
|
||||
if (ret != SNMP_ERR_NOERROR){
|
||||
|
|
@ -1054,7 +1054,7 @@ snmp_table_set(clixon_handle h,
|
|||
goto done;
|
||||
requestvb = request->requestvb;
|
||||
if (requestvb->type != asn1_type){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Expected type:%d, got: %d", __FUNCTION__, requestvb->type, asn1_type);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Expected type:%d, got: %d", requestvb->type, asn1_type);
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE)) != SNMPERR_SUCCESS){
|
||||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto ok;
|
||||
|
|
@ -1202,7 +1202,7 @@ snmp_table_getnext(clixon_handle h,
|
|||
yang_stmt *ynext = NULL;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((ys = yang_parent_get(ylist)) == NULL ||
|
||||
yang_keyword_get(ys) != Y_CONTAINER){
|
||||
clixon_err(OE_YANG, EINVAL, "ylist parent is not list");
|
||||
|
|
@ -1264,7 +1264,7 @@ snmp_table_getnext(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
oid_cbuf(cb, oidnext, oidnextlen);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s next: %s", __FUNCTION__, cbuf_get(cb));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "next: %s", cbuf_get(cb));
|
||||
}
|
||||
retval = found;
|
||||
done:
|
||||
|
|
@ -1303,11 +1303,11 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler,
|
|||
netsnmp_variable_list *requestvb;
|
||||
int err = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
if ((ret = snmp_common_handler(handler, nhreg, reqinfo, request, 1, &sh)) < 0)
|
||||
goto done;
|
||||
if (sh->sh_ys == NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Error table not registered", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error table not registered");
|
||||
goto ok;
|
||||
}
|
||||
requestvb = request->requestvb;
|
||||
|
|
@ -1325,7 +1325,7 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler,
|
|||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Nosuchinstance", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Nosuchinstance");
|
||||
}
|
||||
break;
|
||||
case MODE_GETNEXT: // 161
|
||||
|
|
@ -1340,7 +1340,7 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler,
|
|||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s No such object", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "No such object");
|
||||
}
|
||||
break;
|
||||
case MODE_SET_RESERVE1: // 0
|
||||
|
|
@ -1362,7 +1362,7 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler,
|
|||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s Nosuchinstance", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Nosuchinstance");
|
||||
}
|
||||
/*
|
||||
* There does not seem to be a separate validation action and commit does not
|
||||
|
|
@ -1425,7 +1425,7 @@ clixon_snmp_table_handler(netsnmp_mib_handler *handler,
|
|||
netsnmp_request_info *req;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
for (req = requests; req; req = req->next){
|
||||
ret = clixon_snmp_table_handler1(handler, nhreg, reqinfo, req);
|
||||
if (ret != SNMP_ERR_NOERROR){
|
||||
|
|
|
|||
|
|
@ -649,7 +649,7 @@ type_snmp2xml(yang_stmt *ys,
|
|||
yang_stmt *yrestype = NULL;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (valstr == NULL){
|
||||
clixon_err(OE_UNIX, EINVAL, "valstr is NULL");
|
||||
goto done;
|
||||
|
|
@ -733,7 +733,7 @@ type_snmp2xml(yang_stmt *ys,
|
|||
}
|
||||
default:
|
||||
assert(0); // XXX
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s not supported", __FUNCTION__, cv_type2str(cvtype));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s not supported", cv_type2str(cvtype));
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE)) != SNMPERR_SUCCESS){
|
||||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
|
|
@ -747,7 +747,7 @@ type_snmp2xml(yang_stmt *ys,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%d", retval);
|
||||
if (origtype)
|
||||
free(origtype);
|
||||
if (cv)
|
||||
|
|
@ -836,7 +836,7 @@ type_xml2snmp_pre(char *xmlstr0,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%d", retval);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
|
|
@ -981,7 +981,7 @@ type_xml2snmp(char *snmpstr,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%d", retval);
|
||||
return retval;
|
||||
fail:
|
||||
retval = 0;
|
||||
|
|
@ -1232,7 +1232,7 @@ clixon_snmp_err_cb(void *handle,
|
|||
{
|
||||
const char *errstr;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (suberr < 0){
|
||||
if (suberr < -CLIXON_ERR_SNMP_MIB){
|
||||
switch (suberr+CLIXON_ERR_SNMP_MIB){
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ clixon_snmp_fdset_register(clixon_handle h,
|
|||
/* eg 4, 6, 8 */
|
||||
for (s=0; s<numfds; s++){
|
||||
if (FD_ISSET(s, &readfds)){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %d", __FUNCTION__, s);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", s);
|
||||
if (regfd){
|
||||
if (clixon_event_reg_fd(s, clixon_snmp_input_cb, h, "snmp socket") < 0)
|
||||
goto done;
|
||||
|
|
@ -205,7 +205,7 @@ clixon_snmp_input_cb(int s,
|
|||
clixon_handle h = (clixon_handle)arg;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, s);
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "%d", s);
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(s, &readfds);
|
||||
(void)snmp_read(&readfds);
|
||||
|
|
@ -253,7 +253,7 @@ clixon_snmp_init_subagent(clixon_handle h,
|
|||
int retval = -1;
|
||||
char *sockpath = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if (logdst == CLIXON_LOG_SYSLOG)
|
||||
snmp_enable_calllog();
|
||||
else
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ mibyang_leaf_register(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
oid_cbuf(cboid, oid1, oid1len);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s register: %s %s", __FUNCTION__, name, cbuf_get(cboid));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "register: %s %s", name, cbuf_get(cboid));
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
@ -327,7 +327,7 @@ mibyang_table_register(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
sh->sh_table_info = table_info; /* Keep to free at exit */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s register: %s %s", __FUNCTION__, name, oidstr);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "register: %s %s", name, oidstr);
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
@ -478,7 +478,7 @@ mibyang_table_poll(clixon_handle h,
|
|||
oid oidk[MAX_OID_LEN] = {0,};
|
||||
size_t oidklen = MAX_OID_LEN;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
if ((ys = yang_parent_get(ylist)) == NULL ||
|
||||
yang_keyword_get(ys) != Y_CONTAINER){
|
||||
clixon_err(OE_YANG, EINVAL, "ylist parent is not list");
|
||||
|
|
@ -559,7 +559,7 @@ mibyang_traverse(clixon_handle h,
|
|||
int ret;
|
||||
static oid zero_oid = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s", __FUNCTION__, yang_argument_get(yn));
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", yang_argument_get(yn));
|
||||
switch(yang_keyword_get(yn)){
|
||||
case Y_AUGMENT:
|
||||
if (mibyang_augment_register(h, yn) < 0)
|
||||
|
|
@ -632,7 +632,7 @@ clixon_snmp_traverse_mibyangs(clixon_handle h)
|
|||
continue;
|
||||
if ((modname = xml_body(x)) == NULL)
|
||||
continue;
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s %s: \"%s\"", __FUNCTION__, xml_name(x), modname);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s: \"%s\"", xml_name(x), modname);
|
||||
/* Note, here we assume the Yang is loaded by some other mechanism and
|
||||
* error if it not found.
|
||||
* Alternatively, that YANG could be loaded.
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ example_lockdb(clixon_handle h,
|
|||
{
|
||||
int retval = -1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Lock callback: db%s: locked:%d", __FUNCTION__, db, lock);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Lock callback: db%s: locked:%d", db, lock);
|
||||
/* Part of cached pagination example
|
||||
*/
|
||||
if (strcmp(db, "running") == 0 && lock == 0 &&
|
||||
|
|
@ -793,7 +793,7 @@ example_extension(clixon_handle h,
|
|||
extname = yang_argument_get(yext);
|
||||
if (strcmp(modname, "example") != 0 || strcmp(extname, "e4") != 0)
|
||||
goto ok;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Enabled extension:%s:%s", __FUNCTION__, modname, extname);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Enabled extension:%s:%s", modname, extname);
|
||||
if ((yc = yang_find(ys, 0, NULL)) == NULL)
|
||||
goto ok;
|
||||
if ((yn = ys_dup(yc)) == NULL)
|
||||
|
|
@ -1020,7 +1020,7 @@ upgrade_2014_to_2016(clixon_handle h,
|
|||
int i;
|
||||
char *name;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s from:%d to:%d", __FUNCTION__, from, to);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "from:%d to:%d", from, to);
|
||||
if (op != XML_FLAG_CHANGE) /* Only treat fully present modules */
|
||||
goto ok;
|
||||
/* Get Yang module for this namespace. Note it may not exist (if obsolete) */
|
||||
|
|
@ -1123,14 +1123,14 @@ upgrade_2016_to_2018(clixon_handle h,
|
|||
size_t vlen;
|
||||
int i;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s from:%d to:%d", __FUNCTION__, from, to);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "from:%d to:%d", from, to);
|
||||
if (op != XML_FLAG_CHANGE) /* Only treat fully present modules */
|
||||
goto ok;
|
||||
/* Get Yang module for this namespace. Note it may not exist (if obsolete) */
|
||||
yspec = clicon_dbspec_yang(h);
|
||||
if ((ym = yang_find_module_by_namespace(yspec, ns)) == NULL)
|
||||
goto ok; /* shouldnt happen */
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s module %s", __FUNCTION__, ym?yang_argument_get(ym):"none");
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "module %s", ym?yang_argument_get(ym):"none");
|
||||
/* Get all XML nodes with that namespace */
|
||||
if (xml_namespace_vec(h, xt, ns, &vec, &vlen) < 0)
|
||||
goto done;
|
||||
|
|
@ -1432,7 +1432,7 @@ clixon_plugin_init(clixon_handle h)
|
|||
char **argv;
|
||||
int c;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s backend", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "backend");
|
||||
|
||||
/* Get user command-line options (after --) */
|
||||
if (clicon_argv_get(h, &argc, &argv) < 0)
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ clixon_plugin_init(clixon_handle h)
|
|||
char **argv;
|
||||
int c;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s backend nacm", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "backend nacm");
|
||||
/* Get user command-line options (after --) */
|
||||
if (clicon_argv_get(h, &argc, &argv) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ static struct clixon_plugin_api api = {
|
|||
clixon_plugin_api *
|
||||
clixon_plugin_init(clixon_handle h)
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s restconf", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "restconf");
|
||||
/* Register local netconf rpc client (note not backend rpc client) */
|
||||
if (rpc_callback_register(h, netconf_client_rpc, NULL,
|
||||
"urn:example:clixon", "client-rpc") < 0)
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ example_basic_auth(clixon_handle h,
|
|||
size_t authlen;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (authp == NULL){
|
||||
clixon_err(OE_PLUGIN, EINVAL, "Authp output parameter is NULL");
|
||||
goto done;
|
||||
|
|
@ -246,7 +246,7 @@ example_basic_auth(clixon_handle h,
|
|||
goto fail;
|
||||
*passwd = '\0';
|
||||
passwd++;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s http user:%s passwd:%s", __FUNCTION__, user, passwd);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "http user:%s passwd:%s", user, passwd);
|
||||
/* Here get auth sub-tree where all the users are */
|
||||
if ((cb = cbuf_new()) == NULL)
|
||||
goto done;
|
||||
|
|
@ -261,7 +261,7 @@ example_basic_auth(clixon_handle h,
|
|||
user=NULL; /* to avoid free below */
|
||||
retval = 1;
|
||||
done: /* error */
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d authp:%s", __FUNCTION__, retval, authp?"":*authp);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d authp:%s", retval, authp?"":*authp);
|
||||
if (user)
|
||||
free(user);
|
||||
if (cb)
|
||||
|
|
@ -296,7 +296,7 @@ example_restconf_credentials(clixon_handle h,
|
|||
{
|
||||
int retval = -1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s auth:%s", __FUNCTION__, clixon_auth_type_int2str(auth_type));
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "auth:%s", clixon_auth_type_int2str(auth_type));
|
||||
switch (auth_type){
|
||||
case CLIXON_AUTH_NONE: /* FEATURE clixon-restconf:allow-auth-none must be enabled */
|
||||
retval = 0;
|
||||
|
|
@ -310,7 +310,7 @@ example_restconf_credentials(clixon_handle h,
|
|||
break;
|
||||
}
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d authp:%s", __FUNCTION__, retval, *authp);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d authp:%s", retval, *authp);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -354,7 +354,7 @@ restconf_client_rpc(clixon_handle h,
|
|||
int
|
||||
example_restconf_start(clixon_handle h)
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -439,7 +439,7 @@ clixon_plugin_init(clixon_handle h)
|
|||
char **argv = NULL;
|
||||
int c;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s restconf", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "restconf");
|
||||
/* Get user command-line options (after --) */
|
||||
if (clicon_argv_get(h, &argc, &argv) < 0)
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -65,15 +65,53 @@
|
|||
/*
|
||||
* Macros
|
||||
*/
|
||||
#define clixon_debug(l, _fmt, args...) clixon_debug_fn(NULL, (l), NULL, _fmt , ##args)
|
||||
#define clixon_debug_xml(l, x, _fmt, args...) clixon_debug_fn(NULL, (l), (x), _fmt , ##args)
|
||||
#if defined(__GNUC__)
|
||||
#define clixon_debug(l, _fmt, args...) \
|
||||
do { \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat-zero-length\"") \
|
||||
clixon_debug_fn(NULL, __FUNCTION__, __LINE__, (l), NULL, _fmt, ##args); \
|
||||
_Pragma("GCC diagnostic pop") \
|
||||
} while (0)
|
||||
|
||||
#define clixon_debug_xml(l, x, _fmt, args...) \
|
||||
do { \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat-zero-length\"") \
|
||||
clixon_debug_fn(NULL, __FUNCTION__, __LINE__, (l), (x), _fmt, ##args); \
|
||||
_Pragma("GCC diagnostic pop") \
|
||||
} while (0)
|
||||
|
||||
#elif defined(__clang__)
|
||||
#define clixon_debug(l, _fmt, args...) \
|
||||
do { \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clangGCC diagnostic ignored \"-Wformat-zero-length\"") \
|
||||
clixon_debug_fn(NULL, __FUNCTION__, __LINE__, (l), NULL, _fmt, ##args); \
|
||||
_Pragma("clangGCC diagnostic pop") \
|
||||
} while (0)
|
||||
|
||||
#define clixon_debug_xml(l, x, _fmt, args...) \
|
||||
do { \
|
||||
_Pragma("clangGCC diagnostic push") \
|
||||
_Pragma("clangGCC diagnostic ignored \"-Wformat-zero-length\"") \
|
||||
clixon_debug_fn(NULL, __FUNCTION__, __LINE__, (l), (x), _fmt, ##args); \
|
||||
_Pragma("clangGCC diagnostic pop") \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#define clixon_debug(l, _fmt, args...) \
|
||||
clixon_debug_fn(NULL, __FUNCTION__, __LINE__, (l), NULL, _fmt, ##args)
|
||||
#define clixon_debug_xml(l, x, _fmt, args...) \
|
||||
clixon_debug_fn(NULL, __FUNCTION__, __LINE__, (l), (x), _fmt, ##args)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int clixon_debug_init(clixon_handle h, int dbglevel);
|
||||
int clixon_debug_get(void);
|
||||
int clixon_debug_fn(clixon_handle h, int dbglevel, cxobj *x, const char *format, ...) __attribute__ ((format (printf, 4, 5)));
|
||||
int clixon_debug_fn(clixon_handle h, const char *fn, const int line, int dbglevel, cxobj *x, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
|
||||
|
||||
static inline int clixon_debug_isset(unsigned n)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ clixon_client_init(const char *config_file)
|
|||
{
|
||||
clixon_handle h;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
/* Initiate CLICON handle. CLIgen is also initialized */
|
||||
if ((h = clixon_handle_init()) == NULL)
|
||||
return NULL;
|
||||
|
|
@ -141,7 +141,7 @@ clixon_client_init(const char *config_file)
|
|||
int
|
||||
clixon_client_terminate(clixon_handle h)
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
clixon_handle_exit(h);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ clixon_client_lock(clixon_handle h,
|
|||
cbuf *msgret = NULL;
|
||||
int eof = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (db == NULL){
|
||||
clixon_err(OE_XML, EINVAL, "Expected db");
|
||||
goto done;
|
||||
|
|
@ -204,7 +204,7 @@ clixon_client_lock(clixon_handle h,
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
if (xret)
|
||||
xml_free(xret);
|
||||
if (msg)
|
||||
|
|
@ -230,7 +230,7 @@ clixon_client_hello(int sock,
|
|||
int retval = -1;
|
||||
cbuf *msg = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if ((msg = cbuf_new()) == NULL){
|
||||
clixon_err(OE_PLUGIN, errno, "cbuf_new");
|
||||
goto done;
|
||||
|
|
@ -246,7 +246,7 @@ clixon_client_hello(int sock,
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
if (msg)
|
||||
cbuf_free(msg);
|
||||
return retval;
|
||||
|
|
@ -316,7 +316,7 @@ clixon_client_connect_ssh(clixon_handle h,
|
|||
char *ssh_bin = SSH_BIN;
|
||||
struct stat st = {0,};
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
nr = 5;
|
||||
if ((argv = calloc(nr, sizeof(char *))) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "calloc");
|
||||
|
|
@ -334,7 +334,7 @@ clixon_client_connect_ssh(clixon_handle h,
|
|||
argv[i++] = NULL;
|
||||
assert(i==nr);
|
||||
for (i=0;i<nr;i++)
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s: argv[%d]:%s", __FUNCTION__, i, argv[i]);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "argv[%d]:%s", i, argv[i]);
|
||||
if (clixon_proc_socket(h, argv, SOCK_STREAM, &cch->cch_pid, &cch->cch_socket) < 0){
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -360,7 +360,7 @@ clixon_client_connect(clixon_handle h,
|
|||
struct clixon_client_handle *cch = NULL;
|
||||
size_t sz = sizeof(struct clixon_client_handle);
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if ((cch = malloc(sz)) == NULL){
|
||||
clixon_err(OE_NETCONF, errno, "malloc");
|
||||
goto done;
|
||||
|
|
@ -389,7 +389,7 @@ clixon_client_connect(clixon_handle h,
|
|||
break;
|
||||
} /* switch */
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%p", __FUNCTION__, cch);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%p", cch);
|
||||
return cch;
|
||||
err:
|
||||
if (cch)
|
||||
|
|
@ -412,7 +412,7 @@ clixon_client_disconnect(clixon_client_handle ch)
|
|||
int retval = -1;
|
||||
struct clixon_client_handle *cch = chandle(ch);
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (cch == NULL){
|
||||
clixon_err(OE_XML, EINVAL, "Expected cch handle");
|
||||
goto done;
|
||||
|
|
@ -501,7 +501,7 @@ clixon_client_get_xdata(clixon_handle h,
|
|||
cvec *nsc = NULL;
|
||||
int eof = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if ((msg = cbuf_new()) == NULL){
|
||||
clixon_err(OE_PLUGIN, errno, "cbuf_new");
|
||||
goto done;
|
||||
|
|
@ -556,7 +556,7 @@ clixon_client_get_xdata(clixon_handle h,
|
|||
*xdata = xd;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
if (xret)
|
||||
xml_free(xret);
|
||||
if (msg)
|
||||
|
|
@ -589,7 +589,7 @@ clixon_client_get_body_val(clixon_handle h,
|
|||
cxobj *xdata = NULL;
|
||||
cxobj *xobj = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (val == NULL){
|
||||
clixon_err(OE_XML, EINVAL, "Expected val");
|
||||
goto done;
|
||||
|
|
@ -614,7 +614,7 @@ clixon_client_get_body_val(clixon_handle h,
|
|||
*val = xml_body(xobj);
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -640,7 +640,7 @@ clixon_client_get_bool(clixon_client_handle ch,
|
|||
int ret;
|
||||
uint8_t val0=0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (clixon_client_get_body_val(cch->cch_h, cch->cch_socket, cch->cch_descr,
|
||||
namespace, xpath, &val) < 0)
|
||||
goto done;
|
||||
|
|
@ -681,7 +681,7 @@ clixon_client_get_str(clixon_client_handle ch,
|
|||
struct clixon_client_handle *cch = chandle(ch);
|
||||
char *val = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (clixon_client_get_body_val(cch->cch_h, cch->cch_socket, cch->cch_descr,
|
||||
namespace, xpath, &val) < 0)
|
||||
goto done;
|
||||
|
|
@ -713,7 +713,7 @@ clixon_client_get_uint8(clixon_client_handle ch,
|
|||
char *reason = NULL;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (clixon_client_get_body_val(cch->cch_h, cch->cch_socket, cch->cch_descr,
|
||||
namespace, xpath, &val) < 0)
|
||||
goto done;
|
||||
|
|
@ -753,7 +753,7 @@ clixon_client_get_uint16(clixon_client_handle ch,
|
|||
char *reason = NULL;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (clixon_client_get_body_val(cch->cch_h, cch->cch_socket, cch->cch_descr,
|
||||
namespace, xpath, &val) < 0)
|
||||
goto done;
|
||||
|
|
@ -793,7 +793,7 @@ clixon_client_get_uint32(clixon_client_handle ch,
|
|||
char *reason = NULL;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (clixon_client_get_body_val(cch->cch_h, cch->cch_socket, cch->cch_descr,
|
||||
namespace, xpath, &val) < 0)
|
||||
goto done;
|
||||
|
|
@ -811,7 +811,7 @@ clixon_client_get_uint32(clixon_client_handle ch,
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
if (reason)
|
||||
free(reason);
|
||||
return retval;
|
||||
|
|
@ -838,7 +838,7 @@ clixon_client_get_uint64(clixon_client_handle ch,
|
|||
char *reason = NULL;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (clixon_client_get_body_val(cch->cch_h, cch->cch_socket, cch->cch_descr,
|
||||
namespace, xpath, &val) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ xmldb_copy(clixon_handle h,
|
|||
cxobj *x1 = NULL; /* from */
|
||||
cxobj *x2 = NULL; /* to */
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s %s", __FUNCTION__, from, to);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", from, to);
|
||||
/* XXX lock */
|
||||
if (clicon_datastore_cache(h) != DATASTORE_NOCACHE){
|
||||
/* Copy in-memory cache */
|
||||
|
|
@ -384,7 +384,7 @@ xmldb_exists(clixon_handle h,
|
|||
char *filename = NULL;
|
||||
struct stat sb;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", db);
|
||||
if (xmldb_db2file(h, db, &filename) < 0)
|
||||
goto done;
|
||||
if (lstat(filename, &sb) < 0)
|
||||
|
|
@ -442,7 +442,7 @@ xmldb_delete(clixon_handle h,
|
|||
char *filename = NULL;
|
||||
struct stat sb;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", db);
|
||||
if (xmldb_clear(h, db) < 0)
|
||||
goto done;
|
||||
if (xmldb_db2file(h, db, &filename) < 0)
|
||||
|
|
@ -476,7 +476,7 @@ xmldb_create(clixon_handle h,
|
|||
db_elmnt *de = NULL;
|
||||
cxobj *xt = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", db);
|
||||
if ((de = clicon_db_elmnt_get(h, db)) != NULL){
|
||||
if ((xt = de->de_xml) != NULL){
|
||||
xml_free(xt);
|
||||
|
|
|
|||
|
|
@ -1054,11 +1054,11 @@ xmldb_get_cache(clixon_handle h,
|
|||
if (disable_nacm_on_empty(x1t, yspec) < 0)
|
||||
goto done;
|
||||
}
|
||||
clixon_debug_xml(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, x1t, "%s", __FUNCTION__);
|
||||
clixon_debug_xml(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, x1t, "");
|
||||
*xtop = x1t;
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
if (xvec)
|
||||
free(xvec);
|
||||
return retval;
|
||||
|
|
@ -1209,7 +1209,7 @@ xmldb_get_zerocopy(clixon_handle h,
|
|||
*xtop = x0t;
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
if (xvec)
|
||||
free(xvec);
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -127,6 +127,8 @@ clixon_debug_get(void)
|
|||
* The message is sent to clixon_log. EIther to syslog, stderr or both, depending on
|
||||
* clixon_log_init() setting
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] fn Inline function name (when called from clixon_debug() macro)
|
||||
* @param[in] line Inline file line number (when called from clixon_debug() macro)
|
||||
* @param[in] dbglevel Mask of CLIXON_DBG_DEFAULT and other masks
|
||||
* @param[in] x XML tree logged without prettyprint
|
||||
* @param[in] format Message to print as argv.
|
||||
|
|
@ -136,6 +138,8 @@ clixon_debug_get(void)
|
|||
*/
|
||||
int
|
||||
clixon_debug_fn(clixon_handle h,
|
||||
const char *fn,
|
||||
const int line,
|
||||
int dbglevel,
|
||||
cxobj *x,
|
||||
const char *format, ...)
|
||||
|
|
@ -151,7 +155,7 @@ clixon_debug_fn(clixon_handle h,
|
|||
if (h == NULL) /* Accept NULL, use saved clixon handle */
|
||||
h = _debug_clixon_h;
|
||||
va_start(ap, format);
|
||||
if (clixon_plugin_errmsg_all(h, NULL, 0, LOG_TYPE_DEBUG,
|
||||
if (clixon_plugin_errmsg_all(h, fn, line, LOG_TYPE_DEBUG,
|
||||
NULL, NULL, x, format, ap, &cb) < 0)
|
||||
goto done;
|
||||
va_end(ap);
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ clixon_event_reg_fd(int fd,
|
|||
e->e_type = EVENT_FD;
|
||||
e->e_next = ee;
|
||||
ee = e;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s, registering %s", __FUNCTION__, e->e_string);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "registering %s", e->e_string);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ clixon_event_reg_timeout(struct timeval t,
|
|||
}
|
||||
e->e_next = e1;
|
||||
*e_prev = e;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: %s", __FUNCTION__, str);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", str);
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
|
|
@ -409,7 +409,7 @@ clixon_event_loop(clixon_handle h)
|
|||
* New select loop is called
|
||||
* (3) Other signals result in an error and return -1.
|
||||
*/
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s select: %s", __FUNCTION__, strerror(errno));
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "select: %s", strerror(errno));
|
||||
if (clixon_exit_get() == 1){
|
||||
clixon_err(OE_EVENTS, errno, "select");
|
||||
retval = 0;
|
||||
|
|
@ -435,7 +435,7 @@ clixon_event_loop(clixon_handle h)
|
|||
if (n==0){ /* Timeout */
|
||||
e = ee_timers;
|
||||
ee_timers = ee_timers->e_next;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s timeout: %s", __FUNCTION__, e->e_string);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "timeout: %s", e->e_string);
|
||||
if ((*e->e_fn)(0, e->e_arg) < 0){
|
||||
free(e);
|
||||
goto err;
|
||||
|
|
@ -449,9 +449,9 @@ clixon_event_loop(clixon_handle h)
|
|||
}
|
||||
e_next = e->e_next;
|
||||
if(e->e_type == EVENT_FD && FD_ISSET(e->e_fd, &fdset)){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: FD_ISSET: %s", __FUNCTION__, e->e_string);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "FD_ISSET: %s", e->e_string);
|
||||
if ((*e->e_fn)(e->e_fd, e->e_arg) < 0){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error in: %s", __FUNCTION__, e->e_string);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Error in: %s", e->e_string);
|
||||
goto err;
|
||||
}
|
||||
if (_ee_unreg){
|
||||
|
|
@ -463,12 +463,12 @@ clixon_event_loop(clixon_handle h)
|
|||
clixon_exit_decr(); /* If exit is set and > 1, decrement it (and exit when 1) */
|
||||
continue;
|
||||
err:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s err", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "err");
|
||||
break;
|
||||
}
|
||||
if (clixon_exit_get() == 1)
|
||||
retval = 0;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s done:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "done:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ clicon_files_recursive(const char *dir,
|
|||
int res = 0;
|
||||
char errbuf[128];
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s dir:%s", __FUNCTION__, dir);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "dir:%s", dir);
|
||||
if (regexp && (res = regcomp(&re, regexp, REG_EXTENDED)) != 0) {
|
||||
regerror(res, &re, errbuf, sizeof(errbuf));
|
||||
clixon_err(OE_DB, 0, "regcomp: %s", errbuf);
|
||||
|
|
@ -243,7 +243,7 @@ clicon_file_dirent(const char *dir,
|
|||
clixon_err(OE_UNIX, errno, "realloc");
|
||||
goto quit;
|
||||
} /* realloc */
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s memcpy(%p %p %u", __FUNCTION__, &new[nent], dent, direntStructSize);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "memcpy(%p %p %u", &new[nent], dent, direntStructSize);
|
||||
/* man (3) readdir:
|
||||
* By implication, the use sizeof(struct dirent) to capture the size of the record including
|
||||
* the size of d_name is also incorrect. */
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ json2xml_decode_identityref(cxobj *x,
|
|||
char *prefix2 = NULL;
|
||||
cbuf *cbv = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
yspec = ys_spec(y);
|
||||
if ((xb = xml_body_get(x)) == NULL)
|
||||
goto ok;
|
||||
|
|
@ -336,8 +336,8 @@ json2xml_decode_identityref(cxobj *x,
|
|||
*/
|
||||
if (xml_nsctx_node(x, &nsc) < 0)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s prefix:%s body:%s namespace:%s",
|
||||
__FUNCTION__, prefix, body, ns);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "prefix:%s body:%s namespace:%s",
|
||||
prefix, body, ns);
|
||||
if (!xml_nsctx_get_prefix(nsc, ns, &prefix2)){
|
||||
/* (no) insert a xmlns:<prefix> statement
|
||||
* Get yang prefix from import statement of my mod
|
||||
|
|
@ -472,7 +472,7 @@ xml2json_encode_identityref(cxobj *xb,
|
|||
yang_stmt *yspec;
|
||||
yang_stmt *my_ymod;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, body);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", body);
|
||||
my_ymod = ys_module(yp);
|
||||
yspec = ys_spec(yp);
|
||||
if (nodeid_split(body, &prefix, &id) < 0)
|
||||
|
|
@ -481,7 +481,7 @@ xml2json_encode_identityref(cxobj *xb,
|
|||
if (xml2ns(xb, prefix, &namespace) < 0)
|
||||
goto done;
|
||||
/* We got the namespace, now get the module */
|
||||
// clixon_debug(CLIXON_DBG_DEFAULT, "%s body:%s prefix:%s namespace:%s", __FUNCTION__, body, prefix, namespace);
|
||||
// clixon_debug(CLIXON_DBG_DEFAULT, "body:%s prefix:%s namespace:%s", body, prefix, namespace);
|
||||
#ifdef IDENTITYREF_KLUDGE
|
||||
if (namespace == NULL){
|
||||
/* If we dont find namespace here, we assume it is because of a missing
|
||||
|
|
@ -1451,7 +1451,7 @@ _json_parse(char *str,
|
|||
int i;
|
||||
int failed = 0; /* yang assignment */
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d %s", __FUNCTION__, yb, str);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%d %s", yb, str);
|
||||
jy.jy_parse_string = str;
|
||||
jy.jy_linenum = 1;
|
||||
jy.jy_current = xt;
|
||||
|
|
@ -1537,7 +1537,7 @@ _json_parse(char *str,
|
|||
goto done;
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
if (cberr)
|
||||
cbuf_free(cberr);
|
||||
json_parse_exit(&jy);
|
||||
|
|
@ -1580,7 +1580,7 @@ clixon_json_parse_string(char *str,
|
|||
cxobj **xt,
|
||||
cxobj **xerr)
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (xt==NULL){
|
||||
clixon_err(OE_JSON, EINVAL, "xt is NULL");
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ nacm_rpc(char *rpc,
|
|||
permit:
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d (0:deny 1:permit)", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d (0:deny 1:permit)", retval);
|
||||
if (nsc)
|
||||
xml_nsctx_free(nsc);
|
||||
if (gvec)
|
||||
|
|
@ -770,7 +770,7 @@ nacm_datanode_write(clixon_handle h,
|
|||
permit:
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d (0:deny 1:permit)", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d (0:deny 1:permit)", retval);
|
||||
if (pv_list)
|
||||
prepvec_free(pv_list);
|
||||
if (nsc)
|
||||
|
|
@ -1075,7 +1075,7 @@ nacm_datanode_read(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
if (pv_list)
|
||||
prepvec_free(pv_list);
|
||||
if (nsc)
|
||||
|
|
@ -1128,7 +1128,7 @@ nacm_access_check(clixon_handle h,
|
|||
char *wwwuser;
|
||||
#endif
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if ((nsc = xml_nsctx_init(NULL, NACM_NS)) == NULL)
|
||||
goto done;
|
||||
/* Do initial nacm processing common to all access validation in
|
||||
|
|
@ -1181,7 +1181,7 @@ nacm_access_check(clixon_handle h,
|
|||
done:
|
||||
if (nsc)
|
||||
xml_nsctx_free(nsc);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d (0:deny 1:permit)", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d (0:deny 1:permit)", retval);
|
||||
return retval;
|
||||
permit:
|
||||
retval = 1;
|
||||
|
|
|
|||
|
|
@ -103,14 +103,14 @@ netconf_input_read2(int s,
|
|||
goto done;
|
||||
}
|
||||
} /* read */
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s len:%ld", __FUNCTION__, len);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "len:%ld", len);
|
||||
if (len == 0){ /* EOF */
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s len==0, closing", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "len==0, closing");
|
||||
*eof = 1;
|
||||
}
|
||||
retval = len;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ netconf_input_msg2(unsigned char **bufp,
|
|||
size_t len;
|
||||
char ch;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
len = *lenp;
|
||||
for (i=0; i<len; i++){
|
||||
if ((ch = (*bufp)[i]) == 0)
|
||||
|
|
@ -190,7 +190,7 @@ netconf_input_msg2(unsigned char **bufp,
|
|||
*eom = found;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ netconf_input_frame2(cbuf *cb,
|
|||
cxobj *xtop = NULL; /* Request (in) */
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
if (xrecv == NULL){
|
||||
clixon_err(OE_PLUGIN, EINVAL, "xrecv is NULL");
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -2163,7 +2163,7 @@ netconf_output(int s,
|
|||
#endif
|
||||
if (write(s, buf, len) < 0){
|
||||
if (errno == EPIPE)
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s write err SIGPIPE", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "write err SIGPIPE");
|
||||
else
|
||||
clixon_log(NULL, LOG_ERR, "%s: write: %s", __FUNCTION__, strerror(errno));
|
||||
goto done;
|
||||
|
|
@ -2245,7 +2245,7 @@ netconf_input_chunked_framing(char ch,
|
|||
{
|
||||
int retval = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s ch:%c(%d) state:%d size:%zu", __FUNCTION__, ch, ch, *state, *size);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "ch:%c(%d) state:%d size:%zu", ch, ch, *state, *size);
|
||||
switch (*state){
|
||||
case 0:
|
||||
if (ch == '\n'){
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ netconf_monitoring_state_get(clixon_handle h,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%d", retval);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ create_socket(struct sockaddr *sa,
|
|||
int s = -1;
|
||||
int on = 1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (sock == NULL){
|
||||
clixon_err(OE_PROTO, EINVAL, "Requires socket output parameter");
|
||||
goto done;
|
||||
|
|
@ -191,7 +191,7 @@ create_socket(struct sockaddr *sa,
|
|||
*sock = s;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%d", retval);
|
||||
if (retval != 0 && s != -1)
|
||||
close(s);
|
||||
return retval;
|
||||
|
|
@ -232,7 +232,7 @@ fork_netns_socket(const char *netns,
|
|||
int sock_flags = SOCK_DGRAM | SOCK_CLOEXEC;
|
||||
#endif
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, netns);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", netns);
|
||||
if (socketpair(AF_UNIX, sock_flags, 0, sp) < 0){
|
||||
clixon_err(OE_UNIX, errno, "socketpair");
|
||||
goto done;
|
||||
|
|
@ -299,14 +299,14 @@ fork_netns_socket(const char *netns,
|
|||
if(waitpid(child, &wstatus, 0) == child)
|
||||
; // retval = WEXITSTATUS(status); /* Dont know what to do with status */
|
||||
if (WEXITSTATUS(wstatus)){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s wstatus:%d", __FUNCTION__, WEXITSTATUS(wstatus));
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "wstatus:%d", WEXITSTATUS(wstatus));
|
||||
*sock = -1;
|
||||
clixon_err(OE_UNIX, EADDRNOTAVAIL, "bind(%s)", addrstr);
|
||||
goto done;
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
#endif /* HAVE_SETNS */
|
||||
|
|
@ -334,7 +334,7 @@ clixon_netns_socket(const char *netns,
|
|||
{
|
||||
int retval = -1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (netns == NULL){
|
||||
if (create_socket(sa, sin_len, backlog, flags, addrstr, sock) < 0)
|
||||
goto done;
|
||||
|
|
@ -352,6 +352,6 @@ clixon_netns_socket(const char *netns,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ parse_configfile_one(clixon_handle h,
|
|||
clixon_err(OE_UNIX, errno, "open configure file: %s", filename);
|
||||
return -1;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Reading config file %s", __FUNCTION__, filename);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "Reading config file %s", filename);
|
||||
if ((ret = clixon_xml_parse_file(fp, yspec?YB_MODULE:YB_NONE, yspec, &xt, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
|
|
@ -293,7 +293,7 @@ parse_configfile_one(clixon_handle h,
|
|||
xt = NULL;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Done w/ config file %s returning %d", __FUNCTION__, filename, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "Done w/ config file %s returning %d", filename, retval);
|
||||
if (xt)
|
||||
xml_free(xt);
|
||||
if (fp)
|
||||
|
|
@ -416,7 +416,7 @@ parse_configfile(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Reading config file %s", __FUNCTION__, filename);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "Reading config file %s", filename);
|
||||
/* Parse main config file */
|
||||
if (parse_configfile_one(h, filename, yspec, &xt) < 0)
|
||||
goto done;
|
||||
|
|
@ -504,7 +504,7 @@ parse_configfile(clixon_handle h,
|
|||
*xconfig = xt;
|
||||
xt = NULL;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Done w/ config file %s returning %d", __FUNCTION__, filename, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "Done w/ config file %s returning %d", filename, retval);
|
||||
if (dp)
|
||||
free(dp);
|
||||
if (nsc)
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ api_path_parse(char *api_path,
|
|||
int retval = -1;
|
||||
clixon_api_path_yacc ay = {0,};
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s api_path:%s", __FUNCTION__, api_path);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "api_path:%s", api_path);
|
||||
ay.ay_parse_string = api_path;
|
||||
ay.ay_name = "api-path parser";
|
||||
ay.ay_linenum = 1;
|
||||
|
|
@ -177,7 +177,7 @@ instance_id_parse(char *path,
|
|||
int retval = -1;
|
||||
clixon_instance_id_yacc iy = {0,};
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s path:%s", __FUNCTION__, path);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "path:%s", path);
|
||||
iy.iy_parse_string = path;
|
||||
iy.iy_name = "instance-id parser";
|
||||
iy.iy_linenum = 1;
|
||||
|
|
@ -698,8 +698,8 @@ api_path2xpath_cvv(cvec *api_path,
|
|||
/* api-path: prefix points to module */
|
||||
if (nodeid_split(nodeid, &prefix, &name) < 0)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s [%d] cvname: %s:%s",
|
||||
__FUNCTION__, i, prefix?prefix:"", name);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "[%d] cvname: %s:%s",
|
||||
i, prefix?prefix:"", name);
|
||||
/* top-node must have prefix */
|
||||
if (i == 0 && prefix == NULL){
|
||||
cprintf(cberr, "'%s': Expected prefix:name", nodeid);
|
||||
|
|
@ -762,7 +762,7 @@ api_path2xpath_cvv(cvec *api_path,
|
|||
*/
|
||||
if (xml_nsctx_get_prefix(nsc, namespace, &xprefix) == 0){
|
||||
xprefix = yang_find_myprefix(y);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s prefix not found add it %s", __FUNCTION__, xprefix);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "prefix not found add it %s", xprefix);
|
||||
/* not found, add it to nsc
|
||||
* XXX: do we always have to add it? It could be default?
|
||||
*/
|
||||
|
|
@ -837,7 +837,7 @@ api_path2xpath_cvv(cvec *api_path,
|
|||
nsc = NULL;
|
||||
}
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
if (cberr)
|
||||
cbuf_free(cberr);
|
||||
if (valvec)
|
||||
|
|
@ -1183,7 +1183,7 @@ api_path2xml_vec(char **vec,
|
|||
ok:
|
||||
retval = 1; /* OK */
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
if (xpath)
|
||||
free(xpath);
|
||||
if (nsc)
|
||||
|
|
@ -1252,7 +1252,7 @@ api_path2xml(char *api_path,
|
|||
cxobj *xroot;
|
||||
cbuf *cberr = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL, "%s api_path:%s", __FUNCTION__, api_path);
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL, "api_path:%s", api_path);
|
||||
if ((cberr = cbuf_new()) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "cbuf_new");
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ plugin_load_one(clixon_handle h,
|
|||
char *p;
|
||||
void *wh = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s file:%s function:%s", __FUNCTION__, file, function);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "file:%s function:%s", file, function);
|
||||
dlerror(); /* Clear any existing error */
|
||||
if ((handle = dlopen(file, dlflags)) == NULL) {
|
||||
error = (char*)dlerror();
|
||||
|
|
@ -383,7 +383,7 @@ plugin_load_one(clixon_handle h,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
if (wh != NULL)
|
||||
free(wh);
|
||||
if (retval != 1 && handle)
|
||||
|
|
@ -418,7 +418,7 @@ clixon_plugins_load(clixon_handle h,
|
|||
plugin_module_struct *ms = plugin_module_struct_get(h);
|
||||
int dlflags;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
if (ms == NULL){
|
||||
clixon_err(OE_PLUGIN, EINVAL, "plugin module not initialized");
|
||||
goto done;
|
||||
|
|
@ -471,7 +471,7 @@ clixon_pseudo_plugin(clixon_handle h,
|
|||
clixon_plugin_t *cp = NULL;
|
||||
plugin_module_struct *ms = plugin_module_struct_get(h);
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, name);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", name);
|
||||
if (ms == NULL){
|
||||
clixon_err(OE_PLUGIN, EINVAL, "plugin module not initialized");
|
||||
goto done;
|
||||
|
|
@ -644,7 +644,7 @@ clixon_plugin_auth_one(clixon_plugin_t *cp,
|
|||
plgauth_t *fn; /* Plugin auth */
|
||||
void *wh = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if ((fn = cp->cp_api.ca_auth) != NULL){
|
||||
wh = NULL;
|
||||
if (clixon_resource_check(h, &wh, cp->cp_name, __FUNCTION__) < 0)
|
||||
|
|
@ -662,7 +662,7 @@ clixon_plugin_auth_one(clixon_plugin_t *cp,
|
|||
else
|
||||
retval = 0; /* Ignored / no callback */
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d auth:%s", __FUNCTION__, retval, *authp);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d auth:%s", retval, *authp);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +691,7 @@ clixon_plugin_auth_all(clixon_handle h,
|
|||
clixon_plugin_t *cp = NULL;
|
||||
int ret = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (authp == NULL){
|
||||
clixon_err(OE_PLUGIN, EINVAL, "Authp output parameter is NULL");
|
||||
goto done;
|
||||
|
|
@ -707,7 +707,7 @@ clixon_plugin_auth_all(clixon_handle h,
|
|||
}
|
||||
retval = ret;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -1151,10 +1151,10 @@ rpc_callback_dump(clixon_handle h)
|
|||
rpc_callback_t *rc;
|
||||
plugin_module_struct *ms = plugin_module_struct_get(h);
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s--------------", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "--------------");
|
||||
if ((rc = ms->ms_rpc_callbacks) != NULL)
|
||||
do {
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, rc->rc_name);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", rc->rc_name);
|
||||
rc = NEXTQ(rpc_callback_t *, rc);
|
||||
} while (rc != ms->ms_rpc_callbacks);
|
||||
return 0;
|
||||
|
|
@ -1182,7 +1182,7 @@ rpc_callback_register(clixon_handle h,
|
|||
rpc_callback_t *rc = NULL;
|
||||
plugin_module_struct *ms = plugin_module_struct_get(h);
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, name);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", name);
|
||||
if (ms == NULL){
|
||||
clixon_err(OE_PLUGIN, EINVAL, "plugin module not initialized");
|
||||
goto done;
|
||||
|
|
@ -1281,7 +1281,7 @@ rpc_callback_call(clixon_handle h,
|
|||
if (clixon_resource_check(h, &wh, rc->rc_name, __FUNCTION__) < 0)
|
||||
goto done;
|
||||
if (rc->rc_callback(h, xe, cbret, arg, rc->rc_arg) < 0){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error in: %s", __FUNCTION__, rc->rc_name);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Error in: %s", rc->rc_name);
|
||||
clixon_resource_check(h, &wh, rc->rc_name, __FUNCTION__);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -1302,7 +1302,7 @@ rpc_callback_call(clixon_handle h,
|
|||
*nrp = nr;
|
||||
retval = 1; /* 0: none found, >0 nr of handlers called */
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
return retval;
|
||||
fail:
|
||||
retval = 0;
|
||||
|
|
@ -1334,7 +1334,7 @@ action_callback_register(clixon_handle h,
|
|||
rpc_callback_t *rc = NULL;
|
||||
char *name;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (ya == NULL){
|
||||
clixon_err(OE_DB, EINVAL, "yang node is NULL");
|
||||
goto done;
|
||||
|
|
@ -1386,7 +1386,7 @@ action_callback_call(clixon_handle h,
|
|||
void *wh = NULL;
|
||||
rpc_callback_t *rc;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (xml_find_action(xe, 1, &xa) < 0)
|
||||
goto done;
|
||||
if (xa == NULL){
|
||||
|
|
@ -1408,7 +1408,7 @@ action_callback_call(clixon_handle h,
|
|||
if (clixon_resource_check(h, &wh, rc->rc_name, __FUNCTION__) < 0)
|
||||
goto done;
|
||||
if (rc->rc_callback(h, xa, cbret, arg, rc->rc_arg) < 0){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error in: %s", __FUNCTION__, rc->rc_name);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Error in: %s", rc->rc_name);
|
||||
clixon_resource_check(h, &wh, rc->rc_name, __FUNCTION__);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -1546,7 +1546,7 @@ upgrade_callback_call(clixon_handle h,
|
|||
*/
|
||||
if (uc->uc_namespace == NULL || strcmp(uc->uc_namespace, ns)==0){
|
||||
if ((ret = uc->uc_callback(h, xt, ns, op, from, to, uc->uc_arg, cbret)) < 0){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error in: %s", __FUNCTION__, uc->uc_namespace);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Error in: %s", uc->uc_namespace);
|
||||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
|
|
@ -1563,7 +1563,7 @@ upgrade_callback_call(clixon_handle h,
|
|||
} while (uc != ms->ms_upgrade_callbacks);
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
return retval;
|
||||
fail:
|
||||
retval =0;
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ clixon_proc_socket(clixon_handle h,
|
|||
exit(-1); /* Shouldnt reach here */
|
||||
}
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s child %u sock %d", __FUNCTION__, child, sp[0]);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "child %u sock %d", child, sp[0]);
|
||||
/* Parent */
|
||||
close(sp[1]);
|
||||
*pid = child;
|
||||
|
|
@ -288,7 +288,7 @@ clixon_proc_socket_close(pid_t pid,
|
|||
int retval = -1;
|
||||
int status;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s pid %u sock %d", __FUNCTION__, pid, sock);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "pid %u sock %d", pid, sock);
|
||||
|
||||
if (sock != -1)
|
||||
close(sock); /* usually kills */
|
||||
|
|
@ -296,7 +296,7 @@ clixon_proc_socket_close(pid_t pid,
|
|||
// usleep(100000); /* Wait for child to finish */
|
||||
if(waitpid(pid, &status, 0) == pid){
|
||||
retval = WEXITSTATUS(status);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s waitpid status %#x", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "waitpid status %#x", retval);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
|
@ -331,7 +331,7 @@ clixon_proc_background(clixon_handle h,
|
|||
char *flattened;
|
||||
unsigned argc;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (argv == NULL){
|
||||
clixon_err(OE_UNIX, EINVAL, "argv is NULL");
|
||||
goto quit;
|
||||
|
|
@ -368,7 +368,7 @@ clixon_proc_background(clixon_handle h,
|
|||
char nsfile[PATH_MAX];
|
||||
int nsfd;
|
||||
#endif
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s child", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "child");
|
||||
clicon_signal_unblock(0);
|
||||
signal(SIGTSTP, SIG_IGN);
|
||||
if (chdir("/") < 0){
|
||||
|
|
@ -388,7 +388,7 @@ clixon_proc_background(clixon_handle h,
|
|||
*/
|
||||
if (netns != NULL) {
|
||||
snprintf(nsfile, PATH_MAX, "/var/run/netns/%s", netns); /* see man setns / ip netns */
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s nsfile:%s", __FUNCTION__, nsfile);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "nsfile:%s", nsfile);
|
||||
/* Change network namespace */
|
||||
if ((nsfd = open(nsfile, O_RDONLY | O_CLOEXEC)) < 0){
|
||||
clixon_err(OE_UNIX, errno, "open");
|
||||
|
|
@ -427,7 +427,7 @@ clixon_proc_background(clixon_handle h,
|
|||
*pid0 = child;
|
||||
retval = 0;
|
||||
quit:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d child:%u", __FUNCTION__, retval, child);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d child:%u", retval, child);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ clixon_process_register(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s name:%s (%s)", __FUNCTION__, name, argv[0]);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "name:%s (%s)", name, argv[0]);
|
||||
|
||||
if ((pe = malloc(sizeof(process_entry_t))) == NULL) {
|
||||
clixon_err(OE_DB, errno, "malloc");
|
||||
|
|
@ -572,7 +572,7 @@ clixon_process_register(clixon_handle h,
|
|||
}
|
||||
}
|
||||
pe->pe_callback = callback;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s ----> %s", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s ----> %s",
|
||||
pe->pe_name,
|
||||
clicon_int2str(proc_state_map, PROC_STATE_STOPPED)
|
||||
);
|
||||
|
|
@ -711,7 +711,7 @@ clixon_process_operation(clixon_handle h,
|
|||
int isrunning = 0;
|
||||
int delay = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s name:%s op:%s", __FUNCTION__, name, clicon_int2str(proc_operation_map, op0));
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "name:%s op:%s", name, clicon_int2str(proc_operation_map, op0));
|
||||
if (_proc_entry_list == NULL)
|
||||
goto ok;
|
||||
if ((pe = _proc_entry_list) != NULL)
|
||||
|
|
@ -724,7 +724,7 @@ clixon_process_operation(clixon_handle h,
|
|||
goto done;
|
||||
if (op == PROC_OP_START || op == PROC_OP_STOP || op == PROC_OP_RESTART){
|
||||
pe->pe_operation = op;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s scheduling name: %s pid:%d op: %s", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "scheduling name: %s pid:%d op: %s",
|
||||
name, pe->pe_pid,
|
||||
clicon_int2str(proc_operation_map, pe->pe_operation));
|
||||
if (pe->pe_state==PROC_STATE_RUNNING &&
|
||||
|
|
@ -738,7 +738,7 @@ clixon_process_operation(clixon_handle h,
|
|||
kill(pe->pe_pid, SIGTERM);
|
||||
delay = 1;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s(%d) %s --%s--> %s", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s(%d) %s --%s--> %s",
|
||||
pe->pe_name, pe->pe_pid,
|
||||
clicon_int2str(proc_state_map, pe->pe_state),
|
||||
clicon_int2str(proc_operation_map, pe->pe_operation),
|
||||
|
|
@ -749,7 +749,7 @@ clixon_process_operation(clixon_handle h,
|
|||
sched++;/* start: immediate stop/restart: not immediate: wait timeout */
|
||||
}
|
||||
else{
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s name:%s op %s cancelled by wrap", __FUNCTION__, name, clicon_int2str(proc_operation_map, op0));
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "name:%s op %s cancelled by wrap", name, clicon_int2str(proc_operation_map, op0));
|
||||
}
|
||||
break; /* hit break here */
|
||||
}
|
||||
|
|
@ -760,7 +760,7 @@ clixon_process_operation(clixon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -785,13 +785,13 @@ clixon_process_status(clixon_handle h,
|
|||
char timestr[28];
|
||||
int match = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s name:%s", __FUNCTION__, name);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "name:%s", name);
|
||||
|
||||
if (_proc_entry_list != NULL){
|
||||
pe = _proc_entry_list;
|
||||
do {
|
||||
if (strcmp(pe->pe_name, name) == 0){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s found %s pid:%d", __FUNCTION__, name, pe->pe_pid);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "found %s pid:%d", name, pe->pe_pid);
|
||||
/* Check if running */
|
||||
run = 0;
|
||||
if (pe->pe_pid && proc_op_run(pe->pe_pid, &run) < 0)
|
||||
|
|
@ -835,7 +835,7 @@ clixon_process_status(clixon_handle h,
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -855,7 +855,7 @@ clixon_process_start_all(clixon_handle h)
|
|||
proc_operation op;
|
||||
int sched = 0; /* If set, process action should be scheduled, register a timeout */
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (_proc_entry_list == NULL)
|
||||
goto ok;
|
||||
pe = _proc_entry_list;
|
||||
|
|
@ -866,7 +866,7 @@ clixon_process_start_all(clixon_handle h)
|
|||
if (pe->pe_callback(h, pe, &op) < 0)
|
||||
goto done;
|
||||
if (op == PROC_OP_START){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s name:%s start", __FUNCTION__, pe->pe_name);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "name:%s start", pe->pe_name);
|
||||
pe->pe_operation = op;
|
||||
sched++; /* Immediate dont delay for start */
|
||||
}
|
||||
|
|
@ -877,7 +877,7 @@ clixon_process_start_all(clixon_handle h)
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -902,12 +902,12 @@ clixon_process_sched(int fd,
|
|||
int isrunning; /* Process is actually running */
|
||||
int sched = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s",__FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (_proc_entry_list == NULL)
|
||||
goto ok;
|
||||
pe = _proc_entry_list;
|
||||
do {
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s name: %s pid:%d %s --op:%s-->", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "name: %s pid:%d %s --op:%s-->",
|
||||
pe->pe_name, pe->pe_pid, clicon_int2str(proc_state_map, pe->pe_state), clicon_int2str(proc_operation_map, pe->pe_operation));
|
||||
/* Execute pending operations and not already exiting */
|
||||
if (pe->pe_operation != PROC_OP_NONE){
|
||||
|
|
@ -943,7 +943,7 @@ clixon_process_sched(int fd,
|
|||
&pe->pe_pid) < 0)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT,
|
||||
"%s %s(%d) %s --%s--> %s", __FUNCTION__,
|
||||
"%s(%d) %s --%s--> %s",
|
||||
pe->pe_name, pe->pe_pid,
|
||||
clicon_int2str(proc_state_map, pe->pe_state),
|
||||
clicon_int2str(proc_operation_map, pe->pe_operation),
|
||||
|
|
@ -971,7 +971,7 @@ clixon_process_sched(int fd,
|
|||
&pe->pe_pid) < 0)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_DEFAULT,
|
||||
"%s %s(%d) %s --%s--> %s", __FUNCTION__,
|
||||
"%s(%d) %s --%s--> %s",
|
||||
pe->pe_name, pe->pe_pid,
|
||||
clicon_int2str(proc_state_map, pe->pe_state),
|
||||
clicon_int2str(proc_operation_map, pe->pe_operation),
|
||||
|
|
@ -994,7 +994,7 @@ clixon_process_sched(int fd,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -1016,7 +1016,7 @@ clixon_process_sched_register(clixon_handle h,
|
|||
struct timeval t;
|
||||
struct timeval t1 = {0, 100000}; /* 100ms */
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
gettimeofday(&t, NULL);
|
||||
if (delay)
|
||||
timeradd(&t, &t1, &t);
|
||||
|
|
@ -1024,7 +1024,7 @@ clixon_process_sched_register(clixon_handle h,
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -1045,12 +1045,12 @@ clixon_process_waitpid(clixon_handle h)
|
|||
int status = 0;
|
||||
pid_t wpid;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (_proc_entry_list == NULL)
|
||||
goto ok;
|
||||
if ((pe = _proc_entry_list) != NULL)
|
||||
do {
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s(%d) %s op:%s", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s(%d) %s op:%s",
|
||||
pe->pe_name, pe->pe_pid,
|
||||
clicon_int2str(proc_state_map, pe->pe_state),
|
||||
clicon_int2str(proc_operation_map, pe->pe_operation));
|
||||
|
|
@ -1058,16 +1058,16 @@ clixon_process_waitpid(clixon_handle h)
|
|||
&& (pe->pe_state == PROC_STATE_RUNNING || pe->pe_state == PROC_STATE_EXITING)
|
||||
// && (pe->pe_operation == PROC_OP_STOP || pe->pe_operation == PROC_OP_RESTART)
|
||||
){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s waitpid(%d)", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s waitpid(%d)",
|
||||
pe->pe_name, pe->pe_pid);
|
||||
if ((wpid = waitpid(pe->pe_pid, &status, WNOHANG)) == pe->pe_pid){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s waitpid(%d) waited", __FUNCTION__, pe->pe_pid);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "waitpid(%d) waited", pe->pe_pid);
|
||||
pe->pe_exit_status = status;
|
||||
switch (pe->pe_operation){
|
||||
case PROC_OP_NONE: /* Spontaneous / External termination */
|
||||
case PROC_OP_STOP:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT,
|
||||
"%s %s(%d) %s --%s--> %s", __FUNCTION__,
|
||||
"%s(%d) %s --%s--> %s",
|
||||
pe->pe_name, pe->pe_pid,
|
||||
clicon_int2str(proc_state_map, pe->pe_state),
|
||||
clicon_int2str(proc_operation_map, pe->pe_operation),
|
||||
|
|
@ -1085,7 +1085,7 @@ clixon_process_waitpid(clixon_handle h)
|
|||
&pe->pe_pid) < 0)
|
||||
goto done;
|
||||
gettimeofday(&pe->pe_starttime, NULL);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s(%d) %s --%s--> %s", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s(%d) %s --%s--> %s",
|
||||
pe->pe_name, pe->pe_pid,
|
||||
clicon_int2str(proc_state_map, pe->pe_state),
|
||||
clicon_int2str(proc_operation_map, pe->pe_operation),
|
||||
|
|
@ -1101,7 +1101,7 @@ clixon_process_waitpid(clixon_handle h)
|
|||
break; /* pid is unique */
|
||||
}
|
||||
else
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s waitpid(%d) nomatch:%d", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "waitpid(%d) nomatch:%d",
|
||||
pe->pe_pid, wpid);
|
||||
}
|
||||
pe = NEXTQ(process_entry_t *, pe);
|
||||
|
|
@ -1109,7 +1109,7 @@ clixon_process_waitpid(clixon_handle h)
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ clicon_msg_decode(struct clicon_msg *msg,
|
|||
char *xmlstr;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "");
|
||||
/* hdr */
|
||||
if (id)
|
||||
*id = ntohl(msg->op_id);
|
||||
|
|
@ -239,7 +239,7 @@ clicon_connect_unix(clixon_handle h,
|
|||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, sockpath, sizeof(addr.sun_path)-1);
|
||||
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s: connecting to %s", __FUNCTION__, addr.sun_path);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "connecting to %s", addr.sun_path);
|
||||
if (connect(s, (struct sockaddr *)&addr, SUN_LEN(&addr)) < 0){
|
||||
if (errno == EACCES)
|
||||
clixon_err(OE_CFG, errno, "connecting unix socket: %s. "
|
||||
|
|
@ -366,7 +366,7 @@ clicon_msg_send(int s,
|
|||
int retval = -1;
|
||||
int e;
|
||||
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s: send msg len=%d", __FUNCTION__, ntohl(msg->op_len));
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "send msg len=%d", ntohl(msg->op_len));
|
||||
if (descr)
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Send [%s]: %s", descr, msg->op_body);
|
||||
else{
|
||||
|
|
@ -422,7 +422,7 @@ clicon_msg_rcv(int s,
|
|||
sigset_t oldsigset;
|
||||
struct sigaction oldsigaction[32] = {{{0,},},};
|
||||
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "");
|
||||
*eof = 0;
|
||||
if (intr){
|
||||
if (clixon_signal_save(&oldsigset, oldsigaction) < 0)
|
||||
|
|
@ -450,8 +450,8 @@ clicon_msg_rcv(int s,
|
|||
mlen = ntohl(hdr.op_len);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL2, "op-len:%u op-id:%u",
|
||||
mlen, ntohl(hdr.op_id));
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s: rcv msg len=%d",
|
||||
__FUNCTION__, mlen);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "rcv msg len=%d",
|
||||
mlen);
|
||||
if (mlen <= sizeof(hdr)){
|
||||
clixon_err(OE_PROTO, 0, "op_len:%u too short", mlen);
|
||||
*eof = 1;
|
||||
|
|
@ -485,7 +485,7 @@ clicon_msg_rcv(int s,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
if (intr){
|
||||
if (clixon_signal_restore(&oldsigset, oldsigaction) < 0)
|
||||
goto done;
|
||||
|
|
@ -518,7 +518,7 @@ clicon_msg_rcv1(int s,
|
|||
int xml_state = 0;
|
||||
int poll;
|
||||
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "");
|
||||
*eof = 0;
|
||||
memset(buf, 0, sizeof(buf));
|
||||
while (1){
|
||||
|
|
@ -561,7 +561,7 @@ clicon_msg_rcv1(int s,
|
|||
clixon_debug(CLIXON_DBG_MSG, "Recv: %s", cbuf_get(cb));
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s done", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "done");
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -581,7 +581,7 @@ clicon_msg_send1(int s,
|
|||
{
|
||||
int retval = -1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "");
|
||||
if (descr)
|
||||
clixon_debug(CLIXON_DBG_MSG, "Send [%s]: %s", descr, cbuf_get(cb));
|
||||
else
|
||||
|
|
@ -713,7 +713,7 @@ clicon_rpc(int sock,
|
|||
struct clicon_msg *reply = NULL;
|
||||
char *data = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "");
|
||||
if (clicon_msg_send(sock, descr, msg) < 0)
|
||||
goto done;
|
||||
if (clicon_msg_rcv(sock, descr, 0, &reply, eof) < 0)
|
||||
|
|
@ -729,7 +729,7 @@ clicon_rpc(int sock,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
if (reply)
|
||||
free(reply);
|
||||
return retval;
|
||||
|
|
@ -756,7 +756,7 @@ clicon_rpc1(int sock,
|
|||
{
|
||||
int retval = -1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "");
|
||||
if (netconf_framing_preamble(NETCONF_SSH_CHUNKED, msg) < 0)
|
||||
goto done;
|
||||
if (netconf_framing_postamble(NETCONF_SSH_CHUNKED, msg) < 0)
|
||||
|
|
@ -767,7 +767,7 @@ clicon_rpc1(int sock,
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -864,7 +864,7 @@ send_msg_notify_xml(clixon_handle h,
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "%d", retval);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ clicon_rpc_msg(clixon_handle h,
|
|||
int s = -1;
|
||||
int eof = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
#ifdef RPC_USERNAME_ASSERT
|
||||
assert(strstr(msg->op_body, "username")!=NULL); /* XXX */
|
||||
#endif
|
||||
|
|
@ -253,7 +253,7 @@ clicon_rpc_msg(clixon_handle h,
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%d", retval);
|
||||
if (retdata)
|
||||
free(retdata);
|
||||
if (xret)
|
||||
|
|
@ -291,7 +291,7 @@ clicon_rpc_msg_persistent(clixon_handle h,
|
|||
#ifdef RPC_USERNAME_ASSERT
|
||||
assert(strstr(msg->op_body, "username")!=NULL); /* XXX */
|
||||
#endif
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s request:%s", __FUNCTION__, msg->op_body);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "request:%s", msg->op_body);
|
||||
/* Create a socket and connect to it, either UNIX, IPv4 or IPv6 per config options */
|
||||
if (clicon_rpc_msg_once(h, msg, 0, &retdata, &eof, &s) < 0)
|
||||
goto done;
|
||||
|
|
@ -306,7 +306,7 @@ clicon_rpc_msg_persistent(clixon_handle h,
|
|||
clixon_err(OE_PROTO, ESHUTDOWN, "Unexpected close of CLICON_SOCK. Clixon backend daemon may have crashed.");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retdata:%s", __FUNCTION__, retdata);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retdata:%s", retdata);
|
||||
|
||||
if (retdata){
|
||||
/* Cannot populate xret here because need to know RPC name (eg "lock") in order to associate yang
|
||||
|
|
@ -1018,7 +1018,7 @@ clicon_rpc_get2(clixon_handle h,
|
|||
yang_stmt *yspec;
|
||||
cvec *nscd = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
if (session_id_check(h, &session_id) < 0)
|
||||
goto done;
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
|
|
@ -1105,7 +1105,7 @@ clicon_rpc_get2(clixon_handle h,
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%d", retval);
|
||||
if (nscd)
|
||||
cvec_free(nscd);
|
||||
if (cb)
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ stream_timer_setup(int fd,
|
|||
struct stream_replay *r;
|
||||
struct stream_replay *r1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
/* Go thru callbacks and see if any have timed out, if so remove them
|
||||
* Could also be done by a separate timer.
|
||||
*/
|
||||
|
|
@ -348,7 +348,7 @@ stream_ss_add(clixon_handle h,
|
|||
event_stream_t *es;
|
||||
struct stream_subscription *ss = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if ((es = stream_find(h, stream)) == NULL){
|
||||
clixon_err(OE_CFG, ENOENT, "Stream %s not found", stream);
|
||||
goto done;
|
||||
|
|
@ -395,7 +395,7 @@ stream_ss_rm(clixon_handle h,
|
|||
struct stream_subscription *ss,
|
||||
int force)
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
DELQ(ss, es->es_subscription, struct stream_subscription *);
|
||||
/* Remove from upper layers - close socket etc. */
|
||||
(*ss->ss_fn)(h, 1, NULL, ss->ss_arg);
|
||||
|
|
@ -406,7 +406,7 @@ stream_ss_rm(clixon_handle h,
|
|||
free(ss->ss_xpath);
|
||||
free(ss);
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval: 0", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval: 0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -519,7 +519,7 @@ stream_notify1(clixon_handle h,
|
|||
int retval = -1;
|
||||
struct stream_subscription *ss;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
/* Go thru all subscriptions and find matches */
|
||||
if ((ss = es->es_subscription) != NULL)
|
||||
do {
|
||||
|
|
@ -575,7 +575,7 @@ stream_notify(clixon_handle h,
|
|||
struct timeval tv;
|
||||
event_stream_t *es;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
if ((es = stream_find(h, stream)) == NULL)
|
||||
goto ok;
|
||||
va_start(args, event);
|
||||
|
|
@ -652,7 +652,7 @@ stream_notify_xml(clixon_handle h,
|
|||
struct timeval tv;
|
||||
event_stream_t *es;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "");
|
||||
if ((es = stream_find(h, stream)) == NULL)
|
||||
goto ok;
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
|
|
@ -940,15 +940,15 @@ url_post(char *url,
|
|||
CURLcode errcode;
|
||||
|
||||
/* Try it with curl -X PUT -d '*/
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s: curl -X POST -d '%s' %s",
|
||||
__FUNCTION__, postfields, url);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "curl -X POST -d '%s' %s",
|
||||
postfields, url);
|
||||
/* Set up curl for doing the communication with the controller */
|
||||
if ((curl = curl_easy_init()) == NULL) {
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "curl_easy_init");
|
||||
goto done;
|
||||
}
|
||||
if ((err = malloc(CURL_ERROR_SIZE)) == NULL) {
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s: malloc", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "malloc");
|
||||
goto done;
|
||||
}
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
|
|
@ -962,7 +962,7 @@ url_post(char *url,
|
|||
if (clixon_debug_get())
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||
if ((errcode = curl_easy_perform(curl)) != CURLE_OK){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s: curl: %s(%d)", __FUNCTION__, err, errcode);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "curl: %s(%d)", err, errcode);
|
||||
retval = 0;
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -1005,7 +1005,7 @@ stream_publish_cb(clixon_handle h,
|
|||
char *result = NULL;
|
||||
char *stream = (char*)arg;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (op != 0)
|
||||
goto ok;
|
||||
/* Create pub url */
|
||||
|
|
@ -1030,7 +1030,7 @@ stream_publish_cb(clixon_handle h,
|
|||
&result) < 0) /* result as xml */
|
||||
goto done;
|
||||
if (result)
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s: %s", __FUNCTION__, result);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", result);
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
|
|||
|
|
@ -973,7 +973,7 @@ _text_syntax_parse(char *str,
|
|||
int failed = 0; /* yang assignment */
|
||||
cxobj *xc;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d %s", __FUNCTION__, yb, str);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%d %s", yb, str);
|
||||
if (yb != YB_MODULE && yb != YB_MODULE_NEXT){
|
||||
clixon_err(OE_YANG, EINVAL, "yb must be YB_MODULE or YB_MODULE_NEXT");
|
||||
return -1;
|
||||
|
|
@ -1030,7 +1030,7 @@ _text_syntax_parse(char *str,
|
|||
goto done;
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
|
||||
if (cberr)
|
||||
cbuf_free(cberr);
|
||||
clixon_text_syntax_parsel_exit(&ts);
|
||||
|
|
@ -1066,7 +1066,7 @@ clixon_text_syntax_parse_string(char *str,
|
|||
cxobj **xt,
|
||||
cxobj **xerr)
|
||||
{
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
if (xt==NULL){
|
||||
clixon_err(OE_XML, EINVAL, "xt is NULL");
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ drop_priv_temp(uid_t new_uid)
|
|||
#ifdef HAVE_GETRESUID
|
||||
int retval = -1;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s uid:%u", __FUNCTION__, new_uid);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "uid:%u", new_uid);
|
||||
/* XXX: implicit declaration of function 'setresuid' on travis */
|
||||
if (setresuid(-1, new_uid, geteuid()) < 0){
|
||||
clixon_err(OE_UNIX, errno, "setresuid");
|
||||
|
|
@ -199,7 +199,7 @@ drop_priv_temp(uid_t new_uid)
|
|||
done:
|
||||
return retval;
|
||||
#else
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Drop privileges not implemented on this platform since getresuid is not available", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Drop privileges not implemented on this platform since getresuid is not available");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ drop_priv_perm(uid_t new_uid)
|
|||
uid_t euid;
|
||||
uid_t suid;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s uid:%u", __FUNCTION__, new_uid);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "uid:%u", new_uid);
|
||||
|
||||
if (setresuid(new_uid, new_uid, new_uid) < 0){
|
||||
clixon_err(OE_UNIX, errno, "setresuid");
|
||||
|
|
@ -239,7 +239,7 @@ drop_priv_perm(uid_t new_uid)
|
|||
done:
|
||||
return retval;
|
||||
#else
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Drop privileges not implemented on this platform since getresuid is not available", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Drop privileges not implemented on this platform since getresuid is not available");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -254,7 +254,7 @@ restore_priv(void)
|
|||
uid_t euid;
|
||||
uid_t suid;
|
||||
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "");
|
||||
|
||||
if (getresuid(&ruid, &euid, &suid) < 0){
|
||||
clixon_err(OE_UNIX, errno, "setresuid");
|
||||
|
|
@ -272,7 +272,7 @@ restore_priv(void)
|
|||
done:
|
||||
return retval;
|
||||
#else
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Drop privileges not implemented on this platform since getresuid is not available", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Drop privileges not implemented on this platform since getresuid is not available");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ validate_leafref(cxobj *xt,
|
|||
|
||||
/* require instance */
|
||||
if ((yreqi = yang_find(ytype, Y_REQUIRE_INSTANCE, NULL)) != NULL){
|
||||
if ((cv = yang_cv_get(yreqi)) != NULL) /* shouldnt happen */
|
||||
if ((cv = yang_cv_get(yreqi)) != NULL) /* shouldn't happen */
|
||||
require_instance = cv_bool_get(cv);
|
||||
}
|
||||
/* Find referred XML instances */
|
||||
|
|
@ -836,7 +836,7 @@ check_mandatory_case(cxobj *xt,
|
|||
goto done;
|
||||
if (ret == 1){
|
||||
if (yang_flag_get(ym, YANG_FLAG_MARK) != 0){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s Already marked, shouldnt happen", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "Already marked, shouldn't happen");
|
||||
}
|
||||
yang_flag_set(ym, YANG_FLAG_MARK);
|
||||
}
|
||||
|
|
@ -1465,7 +1465,7 @@ rpc_reply_check(clixon_handle h,
|
|||
if ((ret = xml_bind_yang_rpc_reply(h, x, rpcname, yspec, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s failure when validating:%s", __FUNCTION__, cbuf_get(cbret));
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "failure when validating:%s", cbuf_get(cbret));
|
||||
cbuf_reset(cbret);
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
|
|
@ -1474,7 +1474,7 @@ rpc_reply_check(clixon_handle h,
|
|||
if ((ret = xml_yang_validate_rpc_reply(h, x, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "%s failure when validating:%s", __FUNCTION__, cbuf_get(cbret));
|
||||
clixon_debug(CLIXON_DBG_DEFAULT, "failure when validating:%s", cbuf_get(cbret));
|
||||
cbuf_reset(cbret);
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ changelog_op(clixon_handle h,
|
|||
return retval;
|
||||
fail:
|
||||
retval = 0;
|
||||
clixon_debug(CLIXON_DBG_XML, "%s fail op:%s", __FUNCTION__, op);
|
||||
clixon_debug(CLIXON_DBG_XML, "fail op:%s", op);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ changelog_iterate(clixon_handle h,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_XML, "%s retval: %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_XML, "retval: %d", retval);
|
||||
if (vec)
|
||||
free(vec);
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ xml_default_choice(yang_stmt *yc,
|
|||
yang_stmt *yca = NULL;
|
||||
yang_stmt *ydef;
|
||||
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL, "");
|
||||
/* 1. Is there a default case and no child under this choice?
|
||||
*/
|
||||
x = NULL;
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ _xml_parse(const char *str,
|
|||
int failed = 0; /* yang assignment */
|
||||
int i;
|
||||
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL, "");
|
||||
if (strlen(str) == 0){
|
||||
return 1; /* OK */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,8 +164,8 @@ xml2cvec(cxobj *xt,
|
|||
while ((xc = xml_child_each(xt, xc, CX_ELMNT)) != NULL){
|
||||
name = xml_name(xc);
|
||||
if ((ys = yang_find_datanode(yt, name)) == NULL){
|
||||
clixon_debug(CLIXON_DBG_ALWAYS, "%s: yang sanity problem: %s in xml but not present in yang under %s",
|
||||
__FUNCTION__, name, yang_argument_get(yt));
|
||||
clixon_debug(CLIXON_DBG_ALWAYS, "yang sanity problem: %s in xml but not present in yang under %s",
|
||||
name, yang_argument_get(yt));
|
||||
if ((body = xml_body(xc)) != NULL){
|
||||
if ((cv = cv_new(CGV_STRING)) == NULL){
|
||||
clixon_err(OE_PLUGIN, errno, "cv_new");
|
||||
|
|
@ -213,7 +213,7 @@ xml2cvec(cxobj *xt,
|
|||
}
|
||||
}
|
||||
if (clixon_debug_isset(CLIXON_DBG_XML | CLIXON_DBG_DETAIL)){
|
||||
clixon_debug(CLIXON_DBG_ALWAYS, "%s cvv:", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_ALWAYS, "cvv:");
|
||||
cvec_print(stderr, cvv);
|
||||
}
|
||||
*cvv0 = cvv;
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ xml_cmp(cxobj *x1,
|
|||
break;
|
||||
} /* switch */
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL2, "%s %s %s eq:%d nr: %d %d yi: %d %d", __FUNCTION__, xml_name(x1), xml_name(x2), equal, nr1, nr2, yi1, yi2);
|
||||
clixon_debug(CLIXON_DBG_XML | CLIXON_DBG_DETAIL2, "%s %s eq:%d nr: %d %d yi: %d %d", xml_name(x1), xml_name(x2), equal, nr1, nr2, yi1, yi2);
|
||||
return equal;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ xpath_tree_eq(xpath_tree *xt1, /* pattern */
|
|||
(xt2->xs_type == XP_PRIME_NR || xt2->xs_type == XP_PRIME_STR))
|
||||
#endif
|
||||
){
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s type %s vs %s", __FUNCTION__,
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "type %s vs %s",
|
||||
xpath_tree_int2str(xt1->xs_type),
|
||||
xpath_tree_int2str(xt2->xs_type));
|
||||
goto neq;
|
||||
|
|
@ -429,19 +429,19 @@ xpath_tree_eq(xpath_tree *xt1, /* pattern */
|
|||
goto eq;
|
||||
}
|
||||
if (xt1->xs_int != xt2->xs_int){
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s int", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "int");
|
||||
goto neq;
|
||||
}
|
||||
if (xt1->xs_double != xt2->xs_double){
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s double", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "double");
|
||||
goto neq;
|
||||
}
|
||||
if (clicon_strcmp(xt1->xs_s0, xt2->xs_s0)){
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s s0", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "s0");
|
||||
goto neq;
|
||||
}
|
||||
if (clicon_strcmp(xt1->xs_s1, xt2->xs_s1)){
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s s1", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "s1");
|
||||
goto neq;
|
||||
}
|
||||
xc1 = xt1->xs_c0;
|
||||
|
|
@ -450,7 +450,7 @@ xpath_tree_eq(xpath_tree *xt1, /* pattern */
|
|||
;
|
||||
else{
|
||||
if (xc1 == NULL || xc2 == NULL){
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s NULL", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "NULL");
|
||||
goto neq;
|
||||
}
|
||||
if ((ret = xpath_tree_eq(xc1, xc2, vec, len)) < 0)
|
||||
|
|
@ -464,7 +464,7 @@ xpath_tree_eq(xpath_tree *xt1, /* pattern */
|
|||
;
|
||||
else{
|
||||
if (xc1 == NULL || xc2 == NULL){
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s NULL", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "NULL");
|
||||
goto neq;
|
||||
}
|
||||
if ((ret = xpath_tree_eq(xc1, xc2, vec, len)) < 0)
|
||||
|
|
@ -558,7 +558,7 @@ xpath_parse(const char *xpath,
|
|||
clixon_xpath_yacc xpy = {0,};
|
||||
cbuf *cb = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s xpath %s", __FUNCTION__, xpath);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "xpath %s", xpath);
|
||||
if (xpath == NULL){
|
||||
clixon_err(OE_XML, EINVAL, "XPath is NULL");
|
||||
goto done;
|
||||
|
|
@ -630,7 +630,7 @@ xpath_vec_ctx(cxobj *xcur,
|
|||
xpath_tree *xptree = NULL;
|
||||
xp_ctx xc = {0,};
|
||||
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, xpath);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s", xpath);
|
||||
if (xpath_parse(xpath, &xptree) < 0)
|
||||
goto done;
|
||||
xc.xc_type = XT_NODESET;
|
||||
|
|
@ -1125,7 +1125,7 @@ xpath2canonical(const char *xpath0,
|
|||
cbuf *xcb = NULL;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "");
|
||||
/* Parse input xpath into an xpath-tree */
|
||||
if (xpath_parse(xpath0, &xpt) < 0)
|
||||
goto done;
|
||||
|
|
@ -1481,7 +1481,7 @@ xpath2xml_traverse(xpath_tree *xs,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "retval:%d", retval);
|
||||
return retval;
|
||||
fail:
|
||||
retval = 0;
|
||||
|
|
@ -1518,7 +1518,7 @@ xpath2xml(char *xpath,
|
|||
cbuf *cberr = NULL;
|
||||
xpath_tree *xpt = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s xpath:%s", __FUNCTION__, xpath);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "xpath:%s", xpath);
|
||||
if ((cberr = cbuf_new()) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "cbuf_new");
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ nodetest_recursive(cxobj *xn,
|
|||
xsub = NULL;
|
||||
while ((xsub = xml_child_each(xn, xsub, node_type)) != NULL) {
|
||||
if (nodetest_eval(xsub, nodetest, nsc, localonly) == 1){
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s %x %x", __FUNCTION__, flags, xml_flag(xsub, flags));
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%x %x", flags, xml_flag(xsub, flags));
|
||||
if (flags==0x0 || xml_flag(xsub, flags))
|
||||
if (cxvec_append(xsub, &vec, &veclen) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ yang_path_arg(yang_stmt *ys,
|
|||
xp_yang_ctx *xyr = NULL;
|
||||
xp_yang_ctx *xy = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "");
|
||||
if (path_arg == NULL){
|
||||
clixon_err(OE_XML, EINVAL, "path-arg is NULL");
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -1440,7 +1440,7 @@ yang_find_prefix_by_namespace(yang_stmt *ys,
|
|||
yang_stmt *yimport;
|
||||
yang_stmt *yprefix;
|
||||
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s namespace %s", __FUNCTION__, ns);
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "namespace %s", ns);
|
||||
if (prefix == NULL){
|
||||
clixon_err(OE_YANG, EINVAL, "prefix is NULL");
|
||||
goto done;
|
||||
|
|
@ -2776,7 +2776,7 @@ ys_populate_feature(clixon_handle h,
|
|||
cv_name_set(cv, feature);
|
||||
cv_bool_set(cv, found);
|
||||
if (found)
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s %s:%s", __FUNCTION__, module, feature);
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s:%s", module, feature);
|
||||
yang_cv_set(ys, cv);
|
||||
ok:
|
||||
retval = 0;
|
||||
|
|
@ -3078,7 +3078,7 @@ yang_features(clixon_handle h,
|
|||
ret = 0;
|
||||
if (yang_subparse(yang_argument_get(ys), ys, YA_IF_FEATURE, mainfile, 1, &ret, h) < 0)
|
||||
goto done;
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s %d", __FUNCTION__, yang_argument_get(ys), ret);
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %d", yang_argument_get(ys), ret);
|
||||
if (ret == 0)
|
||||
goto disabled;
|
||||
}
|
||||
|
|
@ -3276,8 +3276,8 @@ schema_nodeid_iterate(yang_stmt *yn,
|
|||
goto done;
|
||||
}
|
||||
if (ys == NULL){
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s: %s not found, last id found:%s",
|
||||
__FUNCTION__, id, yang_argument_get(yp));
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s not found, last id found:%s",
|
||||
id, yang_argument_get(yp));
|
||||
goto ok;
|
||||
}
|
||||
yp = ys; /* ys is matched */
|
||||
|
|
@ -4027,7 +4027,7 @@ yang_search_index_extension(clixon_handle h,
|
|||
extname = yang_argument_get(yext);
|
||||
if (strcmp(modname, "clixon-config") != 0 || strcmp(extname, "search_index") != 0)
|
||||
goto ok;
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s Enabled extension:%s:%s", __FUNCTION__, modname, extname);
|
||||
clixon_debug(CLIXON_DBG_YANG, "Enabled extension:%s:%s", modname, extname);
|
||||
yp = yang_parent_get(ys);
|
||||
if (yang_list_index_add(yp) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ yang_modules_state_get(clixon_handle h,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s %d", __FUNCTION__, retval);
|
||||
clixon_debug(CLIXON_DBG_YANG, "%d", retval);
|
||||
if (xvec)
|
||||
free(xvec);
|
||||
if (cb)
|
||||
|
|
@ -756,7 +756,7 @@ ietf_yang_metadata_extension_cb(clixon_handle h,
|
|||
if (strcmp(modname, "ietf-yang-metadata") != 0 || strcmp(extname, "annotation") != 0)
|
||||
goto ok;
|
||||
name = cv_string_get(yang_cv_get(ys));
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s Enabled extension:%s:%s:%s", __FUNCTION__, modname, extname, name);
|
||||
clixon_debug(CLIXON_DBG_YANG, "Enabled extension:%s:%s:%s", modname, extname, name);
|
||||
/* XXX Nothing yet - this should signal that xml attribute annotations are allowed
|
||||
* Possibly, add an "annotation" YANG node.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ yang_augment_node(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
schema_nodeid = yang_argument_get(ys);
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, schema_nodeid);
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s", schema_nodeid);
|
||||
/* Find the target */
|
||||
if (yang_abs_schema_nodeid(ys, schema_nodeid, &ytarget) < 0)
|
||||
goto done;
|
||||
|
|
@ -913,7 +913,7 @@ filename2revision(const char *filename,
|
|||
clixon_err(OE_UNIX, errno, "strdup");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, base);
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s", base);
|
||||
if ((p = rindex(base, '.')) != NULL) /* strip postfix .yang */
|
||||
*p = '\0';
|
||||
if ((p = index(base, '@')) != NULL){ /* extract revision date */
|
||||
|
|
@ -1064,7 +1064,7 @@ yang_parse_filename(clixon_handle h,
|
|||
FILE *fp = NULL;
|
||||
struct stat st;
|
||||
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s %s", __FUNCTION__, filename);
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s", filename);
|
||||
if (stat(filename, &st) < 0){
|
||||
clixon_err(OE_YANG, errno, "%s not found", filename);
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ yang_mount_get(yang_stmt *y,
|
|||
cvec *cvv;
|
||||
cg_var *cv;
|
||||
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s %p", __FUNCTION__, xpath, y);
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %p", xpath, y);
|
||||
/* Special value in yang unknown node for mount-points: mapping from xpath->mounted yspec */
|
||||
if ((cvv = yang_cvec_get(y)) != NULL &&
|
||||
(cv = cvec_find(cvv, xpath)) != NULL &&
|
||||
|
|
@ -194,7 +194,7 @@ yang_mount_set(yang_stmt *y,
|
|||
cg_var *cv;
|
||||
cg_var *cv2;
|
||||
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s %s %p", __FUNCTION__, xpath, y);
|
||||
clixon_debug(CLIXON_DBG_YANG, "%s %p", xpath, y);
|
||||
if ((cvv = yang_cvec_get(y)) != NULL &&
|
||||
(cv = cvec_find(cvv, xpath)) != NULL &&
|
||||
(yspec0 = cv_void_get(cv)) != NULL){
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ yang_subparse(char *str,
|
|||
int retval = -1;
|
||||
clixon_yang_sub_parse_yacc ife = {0,};
|
||||
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, str);
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s", str);
|
||||
ife.if_parse_string = str;
|
||||
ife.if_linenum = linenum;
|
||||
if (enabled)
|
||||
|
|
@ -125,7 +125,7 @@ yang_schema_nodeid_subparse(char *str,
|
|||
int retval = -1;
|
||||
clixon_yang_schemanode_yacc ife = {0,};
|
||||
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, str);
|
||||
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s", str);
|
||||
ife.if_parse_string = str;
|
||||
ife.if_linenum = linenum;
|
||||
ife.if_mainfile = mainfile;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue