- 64 bit type safe on-the-wire protocol

- use standard functions
- prototype now in include file

Obtained from: a diff of FreeBSD vs. OpenBSD/NetBSD rpc code.
This commit is contained in:
Peter Wemm 1996-12-30 14:55:38 +00:00
parent b93e2c954d
commit ec3ca1a2d3

View File

@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC";*/
static char *rcsid = "$Id: rpc_callmsg.c,v 1.3 1995/10/22 14:51:33 phk Exp $";
static char *rcsid = "$Id: rpc_callmsg.c,v 1.4 1996/06/08 22:54:55 jraynard Exp $";
#endif
/*
@ -45,8 +45,6 @@ static char *rcsid = "$Id: rpc_callmsg.c,v 1.3 1995/10/22 14:51:33 phk Exp $";
#include <string.h>
#include <rpc/rpc.h>
bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap);
/*
* XDR a call message
*/
@ -55,7 +53,7 @@ xdr_callmsg(xdrs, cmsg)
register XDR *xdrs;
register struct rpc_msg *cmsg;
{
register long *buf;
register int32_t *buf;
register struct opaque_auth *oa;
if (xdrs->x_op == XDR_ENCODE) {
@ -86,16 +84,16 @@ xdr_callmsg(xdrs, cmsg)
IXDR_PUT_ENUM(buf, oa->oa_flavor);
IXDR_PUT_LONG(buf, oa->oa_length);
if (oa->oa_length) {
bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
buf += RNDUP(oa->oa_length) / sizeof (long);
memcpy((caddr_t)buf, oa->oa_base, oa->oa_length);
buf += RNDUP(oa->oa_length) / sizeof (int32_t);
}
oa = &cmsg->rm_call.cb_verf;
IXDR_PUT_ENUM(buf, oa->oa_flavor);
IXDR_PUT_LONG(buf, oa->oa_length);
if (oa->oa_length) {
bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
memcpy((caddr_t)buf, oa->oa_base, oa->oa_length);
/* no real need....
buf += RNDUP(oa->oa_length) / sizeof (long);
buf += RNDUP(oa->oa_length) / sizeof (int32_t);
*/
}
return (TRUE);
@ -134,11 +132,11 @@ xdr_callmsg(xdrs, cmsg)
return (FALSE);
}
} else {
bcopy((caddr_t)buf, oa->oa_base,
memcpy(oa->oa_base, (caddr_t)buf,
oa->oa_length);
/* no real need....
buf += RNDUP(oa->oa_length) /
sizeof (long);
sizeof (int32_t);
*/
}
}
@ -168,11 +166,11 @@ xdr_callmsg(xdrs, cmsg)
return (FALSE);
}
} else {
bcopy((caddr_t)buf, oa->oa_base,
memcpy(oa->oa_base, (caddr_t)buf,
oa->oa_length);
/* no real need...
buf += RNDUP(oa->oa_length) /
sizeof (long);
sizeof (int32_t);
*/
}
}
@ -180,14 +178,14 @@ xdr_callmsg(xdrs, cmsg)
}
}
if (
xdr_u_long(xdrs, &(cmsg->rm_xid)) &&
xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
(cmsg->rm_direction == CALL) &&
xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
(cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) &&
xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)) &&
xdr_u_long(xdrs, &(cmsg->rm_call.cb_proc)) &&
xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) &&
xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)) &&
xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_proc)) &&
xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) )
return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));
return (FALSE);