version 1.5.2.6, 2011/11/03 13:35:39
|
version 1.5.2.7, 2011/11/03 14:28:48
|
Line 328 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
Line 328 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
|
|
if (io_arraySize(in_vars)) { |
if (io_arraySize(in_vars)) { |
/* marshaling variables */ |
/* marshaling variables */ |
ret = io_vals2buffer(buf + Limit, cli->cli_netbuf - Limit, in_vars); | ret = io_vars2buffer(buf + Limit, cli->cli_netbuf - Limit, in_vars); |
if (ret == -1) { |
if (ret == -1) { |
rpc_SetErr(EBADRPC, "Error:: in prepare RPC packet values (-7) ...\n"); |
rpc_SetErr(EBADRPC, "Error:: in prepare RPC packet values (-7) ...\n"); |
free(buf); |
free(buf); |
Line 404 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
Line 404 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
|
|
/* RPC is OK! Go de-marshaling variables ... */ |
/* RPC is OK! Go de-marshaling variables ... */ |
if (ntohs(rrpc->ret_argc)) { |
if (ntohs(rrpc->ret_argc)) { |
*out_vars = io_buffer2vals(buf + Limit, cli->cli_netbuf - Limit, | *out_vars = io_buffer2vars(buf + Limit, cli->cli_netbuf - Limit, |
ntohs(rrpc->ret_argc), 0); |
ntohs(rrpc->ret_argc), 0); |
if (!*out_vars) { |
if (!*out_vars) { |
free(buf); |
free(buf); |
Line 415 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
Line 415 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
ret = ntohl(rrpc->ret_retcode); |
ret = ntohl(rrpc->ret_retcode); |
free(buf); |
free(buf); |
return ret; |
return ret; |
} |
|
|
|
/* |
|
* rpc_cli_freeVars() Free ait_val_t array returned from RPC call |
|
* @vars = Variable array |
|
* return: none |
|
*/ |
|
inline void |
|
rpc_cli_freeVars(array_t ** __restrict vars) |
|
{ |
|
register int i; |
|
|
|
if (!vars || !*vars) |
|
return; |
|
|
|
for (i = 0; i < io_arraySize(*vars); i++) |
|
if (io_arrayGet(*vars, i)) |
|
AIT_FREE_VAL(io_array(*vars, i, ait_val_t*)); |
|
|
|
io_arrayFree(*vars); |
|
io_arrayDestroy(vars); |
|
} |
|
|
|
/* |
|
* rpc_cli_allocVars() Allocate ait_val_t array for RPC call |
|
* @args = Number of arguments |
|
* return: =NULL error or !=NULL allocated array |
|
*/ |
|
inline array_t * |
|
rpc_cli_allocVars(u_short args) |
|
{ |
|
array_t *arr; |
|
register int i; |
|
ait_val_t *v; |
|
|
|
if (!args) |
|
return NULL; |
|
|
|
if (!(arr = io_arrayInit(args))) |
|
return NULL; |
|
|
|
for (i = 0; i < io_arraySize(arr); i++) { |
|
v = malloc(sizeof(ait_val_t)); |
|
if (!v) { |
|
LOGERR; |
|
rpc_cli_freeVars(&arr); |
|
return NULL; |
|
} else { |
|
memset(v, 0, sizeof(ait_val_t)); |
|
io_arraySet(arr, i, v); |
|
} |
|
} |
|
|
|
return arr; |
|
} |
} |