From cc482ee970ef1abd3cabd15aa5907ad995e57cfe Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Wed, 4 Jan 2023 10:25:05 +0100 Subject: [PATCH] xhttp_rpc: updates to use the new structure from rpc_sarray --- src/modules/xhttp_rpc/xhttp_rpc.c | 18 +++++++++--------- src/modules/xhttp_rpc/xhttp_rpc_fnc.c | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/modules/xhttp_rpc/xhttp_rpc.c b/src/modules/xhttp_rpc/xhttp_rpc.c index b9269c294dc..8db886dbdcf 100644 --- a/src/modules/xhttp_rpc/xhttp_rpc.c +++ b/src/modules/xhttp_rpc/xhttp_rpc.c @@ -762,23 +762,23 @@ static int child_init(int rank) xhttp_rpc_mod_cmds_size = 1; cmds = xhttp_rpc_mod_cmds; for(i=0; iname); + len = strlen(rpc_sarray[i]->r.name); j = 0; - while (jname[j]!='.') + while (jr.name[j]!='.') j++; if (j==len) { LM_DBG("dropping invalid command format [%.*s]\n", - len, rpc_sarray[i]->name); + len, rpc_sarray[i]->r.name); } else { if (cmds->mod.len==0) { /* this is the first module */ cmds->rpc_e_index = i; - cmds->mod.s = (char*)&rpc_sarray[i]->name[0]; + cmds->mod.s = (char*)&rpc_sarray[i]->r.name[0]; cmds->mod.len = j; cmds->size++; } else if (cmds->mod.len==j && strncmp(cmds->mod.s, - (char*)&rpc_sarray[i]->name[0], + (char*)&rpc_sarray[i]->r.name[0], j)==0){ cmds->size++; } else { @@ -793,7 +793,7 @@ static int child_init(int rank) xhttp_rpc_mod_cmds = cmds; cmds = &xhttp_rpc_mod_cmds[xhttp_rpc_mod_cmds_size]; cmds->rpc_e_index = i; - cmds->mod.s = (char*)&rpc_sarray[i]->name[0]; + cmds->mod.s = (char*)&rpc_sarray[i]->r.name[0]; cmds->mod.len = j; xhttp_rpc_mod_cmds_size++; cmds->size = 1; @@ -824,7 +824,7 @@ static int child_init(int rank) static int ki_xhttp_rpc_dispatch(sip_msg_t* msg) { - rpc_export_t* rpc_e; + rpc_exportx_t* rpc_e; str arg = {NULL, 0}; int ret = 0; int i; @@ -872,7 +872,7 @@ static int ki_xhttp_rpc_dispatch(sip_msg_t* msg) } else { goto send_reply; } - + /* rpc_e=find_rpc_export((char*)rpc_sarray[xhttp_rpc_mod_cmds[ctx.mod].rpc_e_index+ctx.cmd]->name, 0); if ((rpc_e==NULL) || (rpc_e->function==NULL)){ @@ -883,7 +883,7 @@ static int ki_xhttp_rpc_dispatch(sip_msg_t* msg) } */ rpc_e=rpc_sarray[xhttp_rpc_mod_cmds[ctx.mod].rpc_e_index+ctx.cmd]; - rpc_e->function(&func_param, &ctx); + rpc_e->r.function(&func_param, &ctx); send_reply: if (!ctx.reply_sent) { diff --git a/src/modules/xhttp_rpc/xhttp_rpc_fnc.c b/src/modules/xhttp_rpc/xhttp_rpc_fnc.c index 835a14180d3..71e28aee5bc 100644 --- a/src/modules/xhttp_rpc/xhttp_rpc_fnc.c +++ b/src/modules/xhttp_rpc/xhttp_rpc_fnc.c @@ -266,10 +266,10 @@ int xhttp_rpc_parse_url(str *http_url, int* mod, int* cmd, str *arg) cmd_len = i - index; for(i=0;iname, + rpc_sarray[xhttp_rpc_mod_cmds[*mod].rpc_e_index+i]->r.name, cmd_len) == 0 && cmd_len== - strlen(rpc_sarray[xhttp_rpc_mod_cmds[*mod].rpc_e_index+i]->name)); + strlen(rpc_sarray[xhttp_rpc_mod_cmds[*mod].rpc_e_index+i]->r.name)); i++); if (i==xhttp_rpc_mod_cmds[*mod].size) { LM_ERR("Invalid cmd [%.*s] in url [%.*s]\n", @@ -373,7 +373,7 @@ int xhttp_rpc_build_header(rpc_ctx_t *ctx) if (ctx->arg_received) { /* Build an rpc reply */ name.s = - (char*)rpc_sarray[xhttp_rpc_mod_cmds[mod].rpc_e_index+cmd]->name; + (char*)rpc_sarray[xhttp_rpc_mod_cmds[mod].rpc_e_index+cmd]->r.name; name.len = strlen(name.s); /* Print comand name */ XHTTP_RPC_COPY_4(p,XHTTP_RPC_Response_Menu_Cmd_Table_1, @@ -412,7 +412,7 @@ int xhttp_rpc_build_header(rpc_ctx_t *ctx) XHTTP_RPC_CODE_2); } else { name.s = - (char*)rpc_sarray[xhttp_rpc_mod_cmds[mod].rpc_e_index]->name; + (char*)rpc_sarray[xhttp_rpc_mod_cmds[mod].rpc_e_index]->r.name; name.len = strlen(name.s); /* Build the list of comands for the selected module */ XHTTP_RPC_COPY_4(p,XHTTP_RPC_Response_Menu_Cmd_Table_1, @@ -430,7 +430,7 @@ int xhttp_rpc_build_header(rpc_ctx_t *ctx) XHTTP_RPC_Response_Menu_Cmd_td_4a); if (cmd>=0) { name.s = - (char*)rpc_sarray[xhttp_rpc_mod_cmds[mod].rpc_e_index+cmd]->name; + (char*)rpc_sarray[xhttp_rpc_mod_cmds[mod].rpc_e_index+cmd]->r.name; name.len = strlen(name.s); XHTTP_RPC_COPY_3(p,XHTTP_RPC_Response_Menu_Cmd_td_1b, name, @@ -439,7 +439,7 @@ int xhttp_rpc_build_header(rpc_ctx_t *ctx) XHTTP_RPC_COPY(p,XHTTP_RPC_Response_Menu_Cmd_tr_2); for(j=1;jname; + (char*)rpc_sarray[xhttp_rpc_mod_cmds[mod].rpc_e_index+j]->r.name; name.len = strlen(name.s); XHTTP_RPC_COPY_3(p,XHTTP_RPC_Response_Menu_Cmd_tr_1, XHTTP_RPC_Response_Menu_Cmd_td_1a,