--- libaitrpc/src/srv.c 2013/03/07 23:10:50 1.14 +++ libaitrpc/src/srv.c 2013/04/02 09:17:06 1.14.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: srv.c,v 1.14 2013/03/07 23:10:50 misho Exp $ +* $Id: srv.c,v 1.14.2.1 2013/04/02 09:17:06 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -556,13 +556,8 @@ txBLOB(sched_task_t *task) { rpc_cli_t *c = TASK_ARG(task); u_char *buf = AIT_GET_BUF(&c->cli_buf); - struct tagBLOBHdr *blob = (struct tagBLOBHdr *) buf; int wlen = sizeof(struct tagBLOBHdr); - /* calculate CRC */ - blob->hdr_crc ^= blob->hdr_crc; - blob->hdr_crc = htons(crcFletcher16((u_short*) buf, wlen / 2)); - /* send reply */ wlen = send(TASK_FD(task), buf, wlen, MSG_NOSIGNAL); if (wlen == -1 || wlen != sizeof(struct tagBLOBHdr)) { @@ -599,16 +594,6 @@ rxBLOB(sched_task_t *task) return NULL; } - /* check integrity of packet */ - crc = ntohs(blob.hdr_crc); - blob.hdr_crc ^= blob.hdr_crc; - if (crc != crcFletcher16((u_short*) &blob, rlen / 2)) { - rpc_SetErr(ERPCMISMATCH, "Bad CRC BLOB packet"); - - schedReadSelf(task); - return NULL; - } - /* check RPC packet session info */ if ((crc = rpc_chkPktSession(&blob.hdr_session, &s->srv_session))) { rpc_SetErr(ERPCMISMATCH, "Get invalid RPC session"); @@ -911,8 +896,7 @@ rpc_srv_loopBLOBServer(rpc_srv_t * __restrict srv) /* * rpc_srv_initServer() - Init & create RPC Server * - * @regProgID = ProgramID for authentication & recognition - * @regProcID = ProcessID for authentication & recognition + * @InstID = Instance for authentication & recognition * @concurentClients = Concurent clients at same time to this server * @netBuf = Network buffer length (min:512 bytes), if =0 == BUFSIZ (also meaning max RPC packet) * @csHost = Host name or address for bind server, if NULL any address @@ -921,14 +905,14 @@ rpc_srv_loopBLOBServer(rpc_srv_t * __restrict srv) * return: NULL == error or !=NULL bind and created RPC server instance */ rpc_srv_t * -rpc_srv_initServer(u_int regProgID, u_char regProcID, int concurentClients, - int netBuf, const char *csHost, u_short Port, int proto) +rpc_srv_initServer(u_char InstID, int concurentClients, int netBuf, + const char *csHost, u_short Port, int proto) { int n = 1; rpc_srv_t *srv = NULL; sockaddr_t sa = E_SOCKADDR_INIT; - if (!concurentClients || !regProgID || (proto < 0 || proto > SOCK_DGRAM)) { + if (!concurentClients || (proto < 0 || proto > SOCK_DGRAM)) { rpc_SetErr(EINVAL, "Invalid parameters can`t init RPC server"); return NULL; } @@ -961,8 +945,7 @@ rpc_srv_initServer(u_int regProgID, u_char regProcID, srv->srv_proto = proto; srv->srv_netbuf = netBuf; srv->srv_session.sess_version = RPC_VERSION; - srv->srv_session.sess_program = regProgID; - srv->srv_session.sess_process = regProcID; + srv->srv_session.sess_instance = InstID; srv->srv_server.cli_parent = srv; memcpy(&srv->srv_server.cli_sa, &sa, sizeof srv->srv_server.cli_sa);