--- libaitrpc/inc/aitrpc.h 2015/01/27 23:50:46 1.26.2.1 +++ libaitrpc/inc/aitrpc.h 2015/05/18 14:50:11 1.26.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitrpc.h,v 1.26.2.1 2015/01/27 23:50:46 misho Exp $ +* $Id: aitrpc.h,v 1.26.2.2 2015/05/18 14:50:11 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -62,7 +62,7 @@ SUCH DAMAGE. #include -#define RPC_VERSION 8 +#define RPC_VERSION 9 #define RPC_DEFPORT 2611 /* Additional ELWIX RPC supporting protocols */ @@ -146,6 +146,7 @@ struct tagRPCCall { rpc_sess_t call_session; uint32_t call_len; + uint32_t call_seq; uint16_t call_crc; union { @@ -158,8 +159,8 @@ struct tagRPCCall { } call_rep; }; - uint16_t call_tag; uint8_t call_io; + uint16_t call_tag; uint8_t call_argc; ait_val_t call_argv[0]; } __packed; /* size == 20 bytes */ @@ -291,12 +292,11 @@ void rpc_SetErr(int eno, char *estr, ...); * @type = type of socket * @flags = receive flags * @sa = check client address, if you use udp protocol - * @buf = buffer - * @blen = buffer length + * @pkt = RPC packet * return: -1 error, 0 EOF or or >0 readed bytes into buffer */ ssize_t rpc_Read(int sock, int type, int flags, sockaddr_t * __restrict sa, - unsigned char * __restrict buf, size_t blen); + ait_val_t * __restrict pkt); /* * rpc_Write() - RPC write operation * @@ -304,12 +304,12 @@ ssize_t rpc_Read(int sock, int type, int flags, sockad * @type = type of socket * @flags = send flags * @sa = send to client address, if you use udp protocol - * @buf = buffer - * @blen = buffer length + * @pkt = RPC packet + * @blen = write length * return: -1 error, 0 EOF or >0 written bytes into buffer */ ssize_t rpc_Write(int sock, int type, int flags, sockaddr_t * __restrict sa, - unsigned char * __restrict buf, size_t blen); + ait_val_t * __restrict pkt, size_t blen); /* * rpc_chkPktSession() - Check RPC session @@ -649,10 +649,11 @@ int rpc_pkt_Send(int sock, int type, sockaddr_t * __re * @type = Type of socket * @sa = Server address * @pkt = RPC packet + * @seq = Signed packet with seq.no * return: -1 error, 0 EOF or >0 received bytes */ int rpc_pkt_Receive(int sock, int type, sockaddr_t * __restrict sa, - ait_val_t * __restrict pkt); + ait_val_t * __restrict pkt, int seq); /* * rpc_pkt_Request() - Build RPC Request packet * @@ -662,10 +663,11 @@ int rpc_pkt_Receive(int sock, int type, sockaddr_t * _ * @vars = Function argument array of values, may be NULL * @noreply = We not want RPC reply * @nocrc = Without CRC calculation + * @seq = Sign packet with seq.no * return: -1 error or != -1 prepared bytes into packet */ int rpc_pkt_Request(ait_val_t * __restrict pkt, rpc_sess_t * __restrict sess, - unsigned short tag, array_t * __restrict vars, int noreply, int nocrc); + unsigned short tag, array_t * __restrict vars, int noreply, int nocrc, int seq); /* * rpc_pkt_Replay() - Decode RPC Replay packet *