Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RPC-specific debugging #486

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/clixon/clixon_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#define CLIXON_DBG_PROC 0x000080 /* Process handling */
#define CLIXON_DBG_DATASTORE 0x000100 /* Datastore management */
#define CLIXON_DBG_EVENT 0x000200 /* Event processing */
#define CLIXON_DBG_RPC 0x000400 /* RPC handling */
#define CLIXON_DBG_SMASK 0x00ffff /* Subject mask */

/*
Expand Down
16 changes: 8 additions & 8 deletions lib/src/clixon_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, "--------------");
clixon_debug(CLIXON_DBG_RPC, "--------------");
if ((rc = ms->ms_rpc_callbacks) != NULL)
do {
clixon_debug(CLIXON_DBG_DEFAULT, "%s", rc->rc_name);
clixon_debug(CLIXON_DBG_RPC, "%s", rc->rc_name);
rc = NEXTQ(rpc_callback_t *, rc);
} while (rc != ms->ms_rpc_callbacks);
return 0;
Expand Down Expand Up @@ -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", name);
clixon_debug(CLIXON_DBG_RPC, "%s", name);
if (ms == NULL){
clixon_err(OE_PLUGIN, EINVAL, "plugin module not initialized");
goto done;
Expand Down Expand Up @@ -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, "Error in: %s", rc->rc_name);
clixon_debug(CLIXON_DBG_RPC, "Error in: %s", rc->rc_name);
clixon_resource_check(h, &wh, rc->rc_name, __FUNCTION__);
goto done;
}
Expand All @@ -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, "retval:%d", retval);
clixon_debug(CLIXON_DBG_RPC | CLIXON_DBG_DETAIL, "retval:%d", retval);
return retval;
fail:
retval = 0;
Expand Down Expand Up @@ -1334,7 +1334,7 @@ action_callback_register(clixon_handle h,
rpc_callback_t *rc = NULL;
char *name;

clixon_debug(CLIXON_DBG_DEFAULT, "");
clixon_debug(CLIXON_DBG_RPC, "");
if (ya == NULL){
clixon_err(OE_DB, EINVAL, "yang node is NULL");
goto done;
Expand Down Expand Up @@ -1386,7 +1386,7 @@ action_callback_call(clixon_handle h,
void *wh = NULL;
rpc_callback_t *rc;

clixon_debug(CLIXON_DBG_DEFAULT, "");
clixon_debug(CLIXON_DBG_RPC, "");
if (xml_find_action(xe, 1, &xa) < 0)
goto done;
if (xa == NULL){
Expand All @@ -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, "Error in: %s", rc->rc_name);
clixon_debug(CLIXON_DBG_RPC, "Error in: %s", rc->rc_name);
clixon_resource_check(h, &wh, rc->rc_name, __FUNCTION__);
goto done;
}
Expand Down