--- libaitrpc/src/cli.c 2012/03/15 01:55:33 1.7 +++ libaitrpc/src/cli.c 2012/03/29 00:46:17 1.7.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: cli.c,v 1.7 2012/03/15 01:55:33 misho Exp $ +* $Id: cli.c,v 1.7.2.2 2012/03/29 00:46:17 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -288,6 +288,7 @@ rpc_cli_closeClient(rpc_cli_t * __restrict cli) * rpc_cli_execCall() - Execute RPC call * * @cli = RPC Client session + * @noreply = We not want RPC reply * @csModule = Module name, if NULL self binary * @csFunc = Function name for execute * @in_vars = IN RPC call array of rpc values @@ -295,7 +296,7 @@ rpc_cli_closeClient(rpc_cli_t * __restrict cli) * return: -1 error or != -1 ok result */ int -rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, const char *csFunc, +rpc_cli_execCall(rpc_cli_t *cli, int noreply, const char *csModule, const char *csFunc, array_t * __restrict in_vars, array_t ** __restrict out_vars) { fd_set fds; @@ -338,6 +339,9 @@ rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, rpc->call_tag = tag; rpc->call_hash = hash; + /* set reply */ + rpc->call_req.flags = noreply ? RPC_NOREPLY : RPC_REPLY; + if (io_arraySize(in_vars)) { /* marshaling variables */ ret = io_vars2buffer(buf + wlen, cli->cli_netbuf - wlen, in_vars); @@ -349,6 +353,8 @@ rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, wlen += ret; } + rpc->call_len = htons(wlen); + /* calculate CRC */ rpc->call_crc ^= rpc->call_crc; rpc->call_crc = htons(crcFletcher16((u_short*) buf, io_align(wlen, 1) / 2)); @@ -362,6 +368,12 @@ rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, "really sended %d bytes", wlen, ret); free(buf); return -1; + } + + if (noreply) { + /* we not want reply */ + free(buf); + return 0; } /* reply from RPC server */