version 1.5.2.1, 2011/09/07 08:56:32
|
version 1.5.2.2, 2011/09/07 09:10:55
|
Line 339 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
Line 339 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
/* prepare RPC call */ |
/* prepare RPC call */ |
rpc = (struct tagRPCCall*) buf; |
rpc = (struct tagRPCCall*) buf; |
rpc_addPktSession(&rpc->call_session, cli->cli_parent); |
rpc_addPktSession(&rpc->call_session, cli->cli_parent); |
rpc->call_argc = in_vars ? io_arraySize(in_vars) : 0; | rpc->call_argc = htons(in_vars ? io_arraySize(in_vars) : 0); |
rpc->call_tag = crcFletcher16((u_short*) str, sizeof str / 2); | rpc->call_tag = htons(crcFletcher16((u_short*) str, sizeof str / 2)); |
rpc->call_hash = hash_fnv((char*) str, sizeof str); | rpc->call_hash = htonl(hash_fnv((char*) str, sizeof str)); |
Limit = sizeof(struct tagRPCCall); |
Limit = sizeof(struct tagRPCCall); |
|
|
if (in_vars && io_arraySize(in_vars)) { |
if (in_vars && io_arraySize(in_vars)) { |
Line 402 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
Line 402 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
return -5; |
return -5; |
} else |
} else |
Limit = sizeof(struct tagRPCRet); |
Limit = sizeof(struct tagRPCRet); |
if (rrpc->ret_retcode < 0 && rrpc->ret_errno) { | if (ntohl(rrpc->ret_retcode) < 0 && ntohl(rrpc->ret_errno)) { |
rpc_SetErr(rrpc->ret_errno, "Error::Server side: retcode=%d #%d %s\n", | rpc_SetErr(ntohl(rrpc->ret_errno), "Error::Server side: retcode=%d #%d %s\n", |
rrpc->ret_retcode, rrpc->ret_errno, strerror(rrpc->ret_errno)); | ntohl(rrpc->ret_retcode), ntohl(rrpc->ret_errno), |
| strerror(ntohl(rrpc->ret_errno))); |
free(buf); |
free(buf); |
return -6; |
return -6; |
} |
} |
if (rrpc->ret_argc * sizeof(ait_val_t) > cli->cli_netbuf - Limit) { | if (ntohs(rrpc->ret_argc) * sizeof(ait_val_t) > cli->cli_netbuf - Limit) { |
rpc_SetErr(EMSGSIZE, "Error:: reply RPC packet is too long ...\n"); |
rpc_SetErr(EMSGSIZE, "Error:: reply RPC packet is too long ...\n"); |
free(buf); |
free(buf); |
return -7; |
return -7; |
} |
} |
|
|
/* RPC is OK! Go de-marshaling variables ... */ |
/* RPC is OK! Go de-marshaling variables ... */ |
if (rrpc->ret_argc) { | if (ntohs(rrpc->ret_argc)) { |
*out_vars = io_buffer2vals(buf + Limit, cli->cli_netbuf - Limit, rrpc->ret_argc, 0); | *out_vars = io_buffer2vals(buf + Limit, cli->cli_netbuf - Limit, |
| ntohs(rrpc->ret_argc), 0); |
if (!*out_vars) { |
if (!*out_vars) { |
free(buf); |
free(buf); |
return -1; |
return -1; |
} |
} |
} |
} |
|
|
ret = rrpc->ret_retcode; | ret = ntohl(rrpc->ret_retcode); |
free(buf); |
free(buf); |
return ret; |
return ret; |
} |
} |