change some of the rpc "on-the-wire" structures' fields to be explicitly-sized
types. add xdr_{,u_}int{16,32}_t() functions to convert them. This is necessary, because things like BPF use the RPC headers to look at the on-the-wire data, so the headers must accurately represent what's on the wire, too.
This commit is contained in:
parent
d2e405e546
commit
2583d406f9
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: auth.h,v 1.6 1994/12/04 01:12:39 cgd Exp $ */
|
/* $NetBSD: auth.h,v 1.7 1995/04/29 05:27:55 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
@ -69,7 +69,7 @@ enum auth_stat {
|
||||||
AUTH_FAILED=7 /* some unknown reason */
|
AUTH_FAILED=7 /* some unknown reason */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef u_long u_int32; /* 32-bit unsigned integers */
|
typedef u_int32_t u_int32; /* 32-bit unsigned integers */
|
||||||
|
|
||||||
union des_block {
|
union des_block {
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: clnt.h,v 1.5 1994/12/04 01:12:40 cgd Exp $ */
|
/* $NetBSD: clnt.h,v 1.6 1995/04/29 05:27:58 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
@ -95,12 +95,12 @@ struct rpc_err {
|
||||||
int RE_errno; /* realated system error */
|
int RE_errno; /* realated system error */
|
||||||
enum auth_stat RE_why; /* why the auth error occurred */
|
enum auth_stat RE_why; /* why the auth error occurred */
|
||||||
struct {
|
struct {
|
||||||
u_long low; /* lowest verion supported */
|
u_int32_t low; /* lowest verion supported */
|
||||||
u_long high; /* highest verion supported */
|
u_int32_t high; /* highest verion supported */
|
||||||
} RE_vers;
|
} RE_vers;
|
||||||
struct { /* maybe meaningful if RPC_FAILED */
|
struct { /* maybe meaningful if RPC_FAILED */
|
||||||
long s1;
|
int32_t s1;
|
||||||
long s2;
|
int32_t s2;
|
||||||
} RE_lb; /* life boot & debugging only */
|
} RE_lb; /* life boot & debugging only */
|
||||||
} ru;
|
} ru;
|
||||||
#define re_errno ru.RE_errno
|
#define re_errno ru.RE_errno
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: rpc_msg.h,v 1.4 1994/10/26 00:57:03 cgd Exp $ */
|
/* $NetBSD: rpc_msg.h,v 1.5 1995/04/29 05:28:00 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
@ -89,8 +89,8 @@ struct accepted_reply {
|
||||||
enum accept_stat ar_stat;
|
enum accept_stat ar_stat;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
u_long low;
|
u_int32_t low;
|
||||||
u_long high;
|
u_int32_t high;
|
||||||
} AR_versions;
|
} AR_versions;
|
||||||
struct {
|
struct {
|
||||||
caddr_t where;
|
caddr_t where;
|
||||||
|
@ -109,8 +109,8 @@ struct rejected_reply {
|
||||||
enum reject_stat rj_stat;
|
enum reject_stat rj_stat;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
u_long low;
|
u_int32_t low;
|
||||||
u_long high;
|
u_int32_t high;
|
||||||
} RJ_versions;
|
} RJ_versions;
|
||||||
enum auth_stat RJ_why; /* why authentication did not work */
|
enum auth_stat RJ_why; /* why authentication did not work */
|
||||||
} ru;
|
} ru;
|
||||||
|
@ -135,10 +135,10 @@ struct reply_body {
|
||||||
* Body of an rpc request call.
|
* Body of an rpc request call.
|
||||||
*/
|
*/
|
||||||
struct call_body {
|
struct call_body {
|
||||||
u_long cb_rpcvers; /* must be equal to two */
|
u_int32_t cb_rpcvers; /* must be equal to two */
|
||||||
u_long cb_prog;
|
u_int32_t cb_prog;
|
||||||
u_long cb_vers;
|
u_int32_t cb_vers;
|
||||||
u_long cb_proc;
|
u_int32_t cb_proc;
|
||||||
struct opaque_auth cb_cred;
|
struct opaque_auth cb_cred;
|
||||||
struct opaque_auth cb_verf; /* protocol specific - provided by client */
|
struct opaque_auth cb_verf; /* protocol specific - provided by client */
|
||||||
};
|
};
|
||||||
|
@ -147,7 +147,7 @@ struct call_body {
|
||||||
* The rpc message
|
* The rpc message
|
||||||
*/
|
*/
|
||||||
struct rpc_msg {
|
struct rpc_msg {
|
||||||
u_long rm_xid;
|
u_int32_t rm_xid;
|
||||||
enum msg_type rm_direction;
|
enum msg_type rm_direction;
|
||||||
union {
|
union {
|
||||||
struct call_body RM_cmb;
|
struct call_body RM_cmb;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: svc.h,v 1.8 1995/01/06 09:55:52 pk Exp $ */
|
/* $NetBSD: svc.h,v 1.9 1995/04/29 05:28:01 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
@ -149,9 +149,9 @@ typedef struct __rpc_svcxprt {
|
||||||
* Service request
|
* Service request
|
||||||
*/
|
*/
|
||||||
struct svc_req {
|
struct svc_req {
|
||||||
u_long rq_prog; /* service program number */
|
u_int32_t rq_prog; /* service program number */
|
||||||
u_long rq_vers; /* service protocol version */
|
u_int32_t rq_vers; /* service protocol version */
|
||||||
u_long rq_proc; /* the desired procedure */
|
u_int32_t rq_proc; /* the desired procedure */
|
||||||
struct opaque_auth rq_cred; /* raw creds from the wire */
|
struct opaque_auth rq_cred; /* raw creds from the wire */
|
||||||
caddr_t rq_clntcred; /* read only cooked cred */
|
caddr_t rq_clntcred; /* read only cooked cred */
|
||||||
SVCXPRT *rq_xprt; /* associated transport */
|
SVCXPRT *rq_xprt; /* associated transport */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: types.h,v 1.7 1994/10/26 00:57:07 cgd Exp $ */
|
/* $NetBSD: types.h,v 1.8 1995/04/29 05:28:05 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
@ -38,8 +38,8 @@
|
||||||
#ifndef _RPC_TYPES_H
|
#ifndef _RPC_TYPES_H
|
||||||
#define _RPC_TYPES_H
|
#define _RPC_TYPES_H
|
||||||
|
|
||||||
#define bool_t int
|
#define bool_t int32_t
|
||||||
#define enum_t int
|
#define enum_t int32_t
|
||||||
#define __dontcare__ -1
|
#define __dontcare__ -1
|
||||||
|
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: xdr.h,v 1.6 1994/12/04 01:12:44 cgd Exp $ */
|
/* $NetBSD: xdr.h,v 1.7 1995/04/29 05:28:06 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
@ -242,6 +242,10 @@ extern bool_t xdr_long __P((XDR *, long *));
|
||||||
extern bool_t xdr_u_long __P((XDR *, u_long *));
|
extern bool_t xdr_u_long __P((XDR *, u_long *));
|
||||||
extern bool_t xdr_short __P((XDR *, short *));
|
extern bool_t xdr_short __P((XDR *, short *));
|
||||||
extern bool_t xdr_u_short __P((XDR *, u_short *));
|
extern bool_t xdr_u_short __P((XDR *, u_short *));
|
||||||
|
extern bool_t xdr_int16_t __P((XDR *, int16_t *));
|
||||||
|
extern bool_t xdr_u_int16_t __P((XDR *, u_int16_t *));
|
||||||
|
extern bool_t xdr_int32_t __P((XDR *, int32_t *));
|
||||||
|
extern bool_t xdr_u_int32_t __P((XDR *, u_int32_t *));
|
||||||
extern bool_t xdr_bool __P((XDR *, bool_t *));
|
extern bool_t xdr_bool __P((XDR *, bool_t *));
|
||||||
extern bool_t xdr_enum __P((XDR *, enum_t *));
|
extern bool_t xdr_enum __P((XDR *, enum_t *));
|
||||||
extern bool_t xdr_array __P((XDR *, char **, u_int *, u_int, u_int, xdrproc_t));
|
extern bool_t xdr_array __P((XDR *, char **, u_int *, u_int, u_int, xdrproc_t));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: rpc_callmsg.c,v 1.3 1995/02/25 03:01:54 cgd Exp $ */
|
/* $NetBSD: rpc_callmsg.c,v 1.4 1995/04/29 05:26:31 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#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 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 *sccsid = "from: @(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$NetBSD: rpc_callmsg.c,v 1.3 1995/02/25 03:01:54 cgd Exp $";
|
static char *rcsid = "$NetBSD: rpc_callmsg.c,v 1.4 1995/04/29 05:26:31 cgd Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -180,14 +180,14 @@ xdr_callmsg(xdrs, cmsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
xdr_u_long(xdrs, &(cmsg->rm_xid)) &&
|
xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
|
||||||
xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
|
xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
|
||||||
(cmsg->rm_direction == CALL) &&
|
(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) &&
|
(cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
|
||||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) &&
|
xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) &&
|
||||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)) &&
|
xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)) &&
|
||||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_proc)) &&
|
xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_proc)) &&
|
||||||
xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) )
|
xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) )
|
||||||
return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));
|
return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: rpc_prot.c,v 1.2 1995/02/25 03:01:56 cgd Exp $ */
|
/* $NetBSD: rpc_prot.c,v 1.3 1995/04/29 05:26:35 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";*/
|
/*static char *sccsid = "from: @(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";*/
|
||||||
/*static char *sccsid = "from: @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$NetBSD: rpc_prot.c,v 1.2 1995/02/25 03:01:56 cgd Exp $";
|
static char *rcsid = "$NetBSD: rpc_prot.c,v 1.3 1995/04/29 05:26:35 cgd Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -105,9 +105,9 @@ xdr_accepted_reply(xdrs, ar)
|
||||||
return ((*(ar->ar_results.proc))(xdrs, ar->ar_results.where));
|
return ((*(ar->ar_results.proc))(xdrs, ar->ar_results.where));
|
||||||
|
|
||||||
case PROG_MISMATCH:
|
case PROG_MISMATCH:
|
||||||
if (! xdr_u_long(xdrs, &(ar->ar_vers.low)))
|
if (! xdr_u_int32_t(xdrs, &(ar->ar_vers.low)))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
return (xdr_u_long(xdrs, &(ar->ar_vers.high)));
|
return (xdr_u_int32_t(xdrs, &(ar->ar_vers.high)));
|
||||||
}
|
}
|
||||||
return (TRUE); /* TRUE => open ended set of problems */
|
return (TRUE); /* TRUE => open ended set of problems */
|
||||||
}
|
}
|
||||||
|
@ -127,9 +127,9 @@ xdr_rejected_reply(xdrs, rr)
|
||||||
switch (rr->rj_stat) {
|
switch (rr->rj_stat) {
|
||||||
|
|
||||||
case RPC_MISMATCH:
|
case RPC_MISMATCH:
|
||||||
if (! xdr_u_long(xdrs, &(rr->rj_vers.low)))
|
if (! xdr_u_int32_t(xdrs, &(rr->rj_vers.low)))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
return (xdr_u_long(xdrs, &(rr->rj_vers.high)));
|
return (xdr_u_int32_t(xdrs, &(rr->rj_vers.high)));
|
||||||
|
|
||||||
case AUTH_ERROR:
|
case AUTH_ERROR:
|
||||||
return (xdr_enum(xdrs, (enum_t *)&(rr->rj_why)));
|
return (xdr_enum(xdrs, (enum_t *)&(rr->rj_why)));
|
||||||
|
@ -151,7 +151,7 @@ xdr_replymsg(xdrs, rmsg)
|
||||||
register struct rpc_msg *rmsg;
|
register struct rpc_msg *rmsg;
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
xdr_u_long(xdrs, &(rmsg->rm_xid)) &&
|
xdr_u_int32_t(xdrs, &(rmsg->rm_xid)) &&
|
||||||
xdr_enum(xdrs, (enum_t *)&(rmsg->rm_direction)) &&
|
xdr_enum(xdrs, (enum_t *)&(rmsg->rm_direction)) &&
|
||||||
(rmsg->rm_direction == REPLY) )
|
(rmsg->rm_direction == REPLY) )
|
||||||
return (xdr_union(xdrs, (enum_t *)&(rmsg->rm_reply.rp_stat),
|
return (xdr_union(xdrs, (enum_t *)&(rmsg->rm_reply.rp_stat),
|
||||||
|
@ -175,11 +175,11 @@ xdr_callhdr(xdrs, cmsg)
|
||||||
cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION;
|
cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION;
|
||||||
if (
|
if (
|
||||||
(xdrs->x_op == XDR_ENCODE) &&
|
(xdrs->x_op == XDR_ENCODE) &&
|
||||||
xdr_u_long(xdrs, &(cmsg->rm_xid)) &&
|
xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
|
||||||
xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
|
xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
|
||||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
|
xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
|
||||||
xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) )
|
xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) )
|
||||||
return (xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)));
|
return (xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)));
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: xdr.c,v 1.7 1995/04/25 21:41:48 christos Exp $ */
|
/* $NetBSD: xdr.c,v 1.8 1995/04/29 05:26:38 cgd Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char *sccsid = "from: @(#)xdr.c 1.35 87/08/12";*/
|
/*static char *sccsid = "from: @(#)xdr.c 1.35 87/08/12";*/
|
||||||
/*static char *sccsid = "from: @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";*/
|
/*static char *sccsid = "from: @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";*/
|
||||||
static char *rcsid = "$NetBSD: xdr.c,v 1.7 1995/04/25 21:41:48 christos Exp $";
|
static char *rcsid = "$NetBSD: xdr.c,v 1.8 1995/04/29 05:26:38 cgd Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -91,6 +91,7 @@ xdr_void(/* xdrs, addr */)
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XDR integers
|
* XDR integers
|
||||||
*/
|
*/
|
||||||
|
@ -149,6 +150,7 @@ xdr_u_int(xdrs, up)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XDR long integers
|
* XDR long integers
|
||||||
* same as xdr_u_long - open coded to save a proc call!
|
* same as xdr_u_long - open coded to save a proc call!
|
||||||
|
@ -190,6 +192,68 @@ xdr_u_long(xdrs, ulp)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XDR 32-bit integers
|
||||||
|
* same as xdr_u_int32_t - open coded to save a proc call!
|
||||||
|
*/
|
||||||
|
bool_t
|
||||||
|
xdr_int32_t(xdrs, int32_p)
|
||||||
|
register XDR *xdrs;
|
||||||
|
int32_t *int32_p;
|
||||||
|
{
|
||||||
|
long l;
|
||||||
|
|
||||||
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
|
case XDR_ENCODE:
|
||||||
|
l = (long) *int32_p;
|
||||||
|
return (XDR_PUTLONG(xdrs, &l));
|
||||||
|
|
||||||
|
case XDR_DECODE:
|
||||||
|
if (!XDR_GETLONG(xdrs, &l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*int32_p = (int32_t) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XDR unsigned 32-bit integers
|
||||||
|
* same as xdr_int32_t - open coded to save a proc call!
|
||||||
|
*/
|
||||||
|
bool_t
|
||||||
|
xdr_u_int32_t(xdrs, u_int32_p)
|
||||||
|
register XDR *xdrs;
|
||||||
|
u_int32_t *u_int32_p;
|
||||||
|
{
|
||||||
|
u_long l;
|
||||||
|
|
||||||
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
|
case XDR_ENCODE:
|
||||||
|
l = (u_long) *u_int32_p;
|
||||||
|
return (XDR_PUTLONG(xdrs, &l));
|
||||||
|
|
||||||
|
case XDR_DECODE:
|
||||||
|
if (!XDR_GETLONG(xdrs, &l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*u_int32_p = (u_int32_t) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XDR short integers
|
* XDR short integers
|
||||||
*/
|
*/
|
||||||
|
@ -249,6 +313,65 @@ xdr_u_short(xdrs, usp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XDR 16-bit integers
|
||||||
|
*/
|
||||||
|
bool_t
|
||||||
|
xdr_int16_t(xdrs, int16_p)
|
||||||
|
register XDR *xdrs;
|
||||||
|
int16_t *int16_p;
|
||||||
|
{
|
||||||
|
long l;
|
||||||
|
|
||||||
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
|
case XDR_ENCODE:
|
||||||
|
l = (long) *int16_p;
|
||||||
|
return (XDR_PUTLONG(xdrs, &l));
|
||||||
|
|
||||||
|
case XDR_DECODE:
|
||||||
|
if (!XDR_GETLONG(xdrs, &l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*int16_p = (int16_t) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XDR unsigned 16-bit integers
|
||||||
|
*/
|
||||||
|
bool_t
|
||||||
|
xdr_u_int16_t(xdrs, u_int16_p)
|
||||||
|
register XDR *xdrs;
|
||||||
|
u_int16_t *u_int16_p;
|
||||||
|
{
|
||||||
|
u_long l;
|
||||||
|
|
||||||
|
switch (xdrs->x_op) {
|
||||||
|
|
||||||
|
case XDR_ENCODE:
|
||||||
|
l = (u_long) *u_int16_p;
|
||||||
|
return (XDR_PUTLONG(xdrs, &l));
|
||||||
|
|
||||||
|
case XDR_DECODE:
|
||||||
|
if (!XDR_GETLONG(xdrs, &l)) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
*u_int16_p = (u_int16_t) l;
|
||||||
|
return (TRUE);
|
||||||
|
|
||||||
|
case XDR_FREE:
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XDR a char
|
* XDR a char
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue