summaryrefslogtreecommitdiffstats
path: root/cpukit/librpc
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2005-01-08 06:01:35 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2005-01-08 06:01:35 +0000
commitdab2d6ebae0b1f7d7b72ccafe42b729081409ff2 (patch)
tree4d55fef27d00236c0ca8f9510c161c54fb8f3eff /cpukit/librpc
parentc9795bd69d5b636ecab41f4abf049ba8d7a4567a (diff)
downloadrtems-dab2d6ebae0b1f7d7b72ccafe42b729081409ff2.tar.bz2
2005-01-07 Ralf Corsepius <ralf.corsepius@rtems.org>
* librpc/include/rpc/auth_des.h, librpc/include/rpc/xdr.h, librpc/src/rpc/auth_des.c, librpc/src/rpc/auth_unix.c, librpc/src/rpc/rpc_prot.c, librpc/src/xdr/xdr.c: Misc. ansi-fications, misc. updates from FreeBSD.
Diffstat (limited to 'cpukit/librpc')
-rw-r--r--cpukit/librpc/include/rpc/auth_des.h2
-rw-r--r--cpukit/librpc/include/rpc/xdr.h104
-rw-r--r--cpukit/librpc/src/rpc/auth_des.c47
-rw-r--r--cpukit/librpc/src/rpc/auth_unix.c48
-rw-r--r--cpukit/librpc/src/rpc/rpc_prot.c72
-rw-r--r--cpukit/librpc/src/xdr/xdr.c257
6 files changed, 311 insertions, 219 deletions
diff --git a/cpukit/librpc/include/rpc/auth_des.h b/cpukit/librpc/include/rpc/auth_des.h
index a7635f87e1..634f0ec636 100644
--- a/cpukit/librpc/include/rpc/auth_des.h
+++ b/cpukit/librpc/include/rpc/auth_des.h
@@ -103,7 +103,7 @@ struct authdes_verf {
#define adv_nickname adv_int_u
__BEGIN_DECLS
-extern int authdes_getucred __P(( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * ));
+extern int authdes_getucred ( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * );
__END_DECLS
#endif /* ndef _AUTH_DES_ */
diff --git a/cpukit/librpc/include/rpc/xdr.h b/cpukit/librpc/include/rpc/xdr.h
index 78385bdee2..13867875a7 100644
--- a/cpukit/librpc/include/rpc/xdr.h
+++ b/cpukit/librpc/include/rpc/xdr.h
@@ -1,3 +1,5 @@
+/* $NetBSD: xdr.h,v 1.19 2000/07/17 05:00:45 matt Exp $ */
+
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -28,7 +30,7 @@
*
* from: @(#)xdr.h 1.19 87/04/22 SMI
* from: @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC
- * $FreeBSD: src/include/rpc/xdr.h,v 1.14 1999/12/29 05:00:44 peter Exp $
+ * $FreeBSD: src/include/rpc/xdr.h,v 1.23 2003/03/07 13:19:40 nectar Exp $
*/
/*
@@ -99,26 +101,26 @@ typedef struct __rpc_xdr {
enum xdr_op x_op; /* operation; fast additional param */
struct xdr_ops {
/* get a long from underlying stream */
- bool_t (*x_getlong) (struct __rpc_xdr *, long *);
+ bool_t (*x_getlong)(struct __rpc_xdr *, long *);
/* put a long to underlying stream */
- bool_t (*x_putlong) (struct __rpc_xdr *, long *);
+ bool_t (*x_putlong)(struct __rpc_xdr *, const long *);
/* get some bytes from underlying stream */
- bool_t (*x_getbytes) (struct __rpc_xdr *, caddr_t, u_int);
+ bool_t (*x_getbytes)(struct __rpc_xdr *, char *, u_int);
/* put some bytes to underlying stream */
- bool_t (*x_putbytes) (struct __rpc_xdr *, caddr_t, u_int);
+ bool_t (*x_putbytes)(struct __rpc_xdr *, const char *, u_int);
/* returns bytes off from beginning */
- u_int (*x_getpostn) (struct __rpc_xdr *);
+ u_int (*x_getpostn)(struct __rpc_xdr *);
/* lets you reposition the stream */
- bool_t (*x_setpostn) (struct __rpc_xdr *, u_int);
+ bool_t (*x_setpostn)(struct __rpc_xdr *, u_int);
/* buf quick ptr to buffered data */
- int32_t *(*x_inline) (struct __rpc_xdr *, u_int);
+ int32_t *(*x_inline)(struct __rpc_xdr *, u_int);
/* free privates of this xdr_stream */
- void (*x_destroy) (struct __rpc_xdr *);
+ void (*x_destroy)(struct __rpc_xdr *);
} *x_ops;
- caddr_t x_public; /* users' data */
- caddr_t x_private; /* pointer to private data */
- caddr_t x_base; /* private used for position info */
- int x_handy; /* extra private word */
+ char * x_public; /* users' data */
+ void * x_private; /* pointer to private data */
+ char * x_base; /* private used for position info */
+ u_int x_handy; /* extra private word */
} XDR;
/*
@@ -185,7 +187,7 @@ typedef bool_t (*xdrproc_t) (XDR *, void *, ...);
/*
* Support struct for discriminated unions.
* You create an array of xdrdiscrim structures, terminated with
- * a entry with a null procedure pointer. The xdr_union routine gets
+ * an entry with a null procedure pointer. The xdr_union routine gets
* the discriminant value and then searches the array of structures
* for a matching value. If a match is found the associated xdr routine
* is called to handle that part of the union. If there is
@@ -232,36 +234,36 @@ struct xdr_discrim {
* These are the "generic" xdr routines.
*/
__BEGIN_DECLS
-extern bool_t xdr_void (void);
-extern bool_t xdr_int (XDR *, int *);
-extern bool_t xdr_u_int (XDR *, u_int *);
-extern bool_t xdr_long (XDR *, long *);
-extern bool_t xdr_u_long (XDR *, u_long *);
-extern bool_t xdr_short (XDR *, short *);
-extern bool_t xdr_u_short (XDR *, u_short *);
-extern bool_t xdr_int16_t (XDR *, int16_t *);
-extern bool_t xdr_u_int16_t (XDR *, u_int16_t *);
-extern bool_t xdr_int32_t (XDR *, int32_t *);
-extern bool_t xdr_u_int32_t (XDR *, u_int32_t *);
-extern bool_t xdr_int64_t (XDR *, int64_t *);
-extern bool_t xdr_u_int64_t (XDR *, u_int64_t *);
-extern bool_t xdr_bool (XDR *, bool_t *);
-extern bool_t xdr_enum (XDR *, enum_t *);
-extern bool_t xdr_array (XDR *, char **, u_int *, u_int, u_int, xdrproc_t);
-extern bool_t xdr_bytes (XDR *, char **, u_int *, u_int);
-extern bool_t xdr_opaque (XDR *, caddr_t, u_int);
-extern bool_t xdr_string (XDR *, char **, u_int);
-extern bool_t xdr_union (XDR *, enum_t *, char *, struct xdr_discrim *, xdrproc_t);
+extern bool_t xdr_void(void);
+extern bool_t xdr_int(XDR *, int *);
+extern bool_t xdr_u_int(XDR *, u_int *);
+extern bool_t xdr_long(XDR *, long *);
+extern bool_t xdr_u_long(XDR *, u_long *);
+extern bool_t xdr_short(XDR *, short *);
+extern bool_t xdr_u_short(XDR *, u_short *);
+extern bool_t xdr_int16_t(XDR *, int16_t *);
+extern bool_t xdr_u_int16_t(XDR *, u_int16_t *);
+extern bool_t xdr_int32_t(XDR *, int32_t *);
+extern bool_t xdr_u_int32_t(XDR *, u_int32_t *);
+extern bool_t xdr_int64_t(XDR *, int64_t *);
+extern bool_t xdr_u_int64_t(XDR *, u_int64_t *);
+extern bool_t xdr_bool(XDR *, bool_t *);
+extern bool_t xdr_enum(XDR *, enum_t *);
+extern bool_t xdr_array(XDR *, char **, u_int *, u_int, u_int, xdrproc_t);
+extern bool_t xdr_bytes(XDR *, char **, u_int *, u_int);
+extern bool_t xdr_opaque(XDR *, caddr_t, u_int);
+extern bool_t xdr_string(XDR *, char **, u_int);
+extern bool_t xdr_union(XDR *, enum_t *, char *, const struct xdr_discrim *, xdrproc_t);
extern unsigned long xdr_sizeof (xdrproc_t, void *);
-extern bool_t xdr_char (XDR *, char *);
-extern bool_t xdr_u_char (XDR *, u_char *);
-extern bool_t xdr_vector (XDR *, char *, u_int, u_int, xdrproc_t);
-extern bool_t xdr_float (XDR *, float *);
-extern bool_t xdr_double (XDR *, double *);
-extern bool_t xdr_reference (XDR *, caddr_t *, u_int, xdrproc_t);
-extern bool_t xdr_pointer (XDR *, caddr_t *, u_int, xdrproc_t);
-extern bool_t xdr_wrapstring (XDR *, char **);
-extern void xdr_free (xdrproc_t, char *);
+extern bool_t xdr_char(XDR *, char *);
+extern bool_t xdr_u_char(XDR *, u_char *);
+extern bool_t xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t);
+extern bool_t xdr_float(XDR *, float *);
+extern bool_t xdr_double(XDR *, double *);
+extern bool_t xdr_reference(XDR *, caddr_t *, u_int, xdrproc_t);
+extern bool_t xdr_pointer(XDR *, caddr_t *, u_int, xdrproc_t);
+extern bool_t xdr_wrapstring(XDR *, char **);
+extern void xdr_free(xdrproc_t, char *);
__END_DECLS
/*
@@ -274,7 +276,7 @@ struct netobj {
char *n_bytes;
};
typedef struct netobj netobj;
-extern bool_t xdr_netobj (XDR *, struct netobj *);
+extern bool_t xdr_netobj(XDR *, struct netobj *);
/*
* These are the public routines for the various implementations of
@@ -282,26 +284,26 @@ extern bool_t xdr_netobj (XDR *, struct netobj *);
*/
__BEGIN_DECLS
/* XDR using memory buffers */
-extern void xdrmem_create (XDR *, char *, u_int, enum xdr_op);
+extern void xdrmem_create(XDR *, char *, u_int, enum xdr_op);
-#ifdef _STDIO_H_
/* XDR using stdio library */
-extern void xdrstdio_create (XDR *, FILE *, enum xdr_op);
+#ifdef _STDIO_H_
+extern void xdrstdio_create(XDR *, FILE *, enum xdr_op);
#endif
/* XDR pseudo records for tcp */
-extern void xdrrec_create (XDR *, u_int, u_int, char *,
+extern void xdrrec_create(XDR *, u_int, u_int, char *,
int (*) (caddr_t, caddr_t, int),
int (*) (caddr_t, caddr_t, int));
/* make end of xdr record */
-extern bool_t xdrrec_endofrecord (XDR *, bool_t);
+extern bool_t xdrrec_endofrecord(XDR *, bool_t);
/* move to beginning of next record */
-extern bool_t xdrrec_skiprecord (XDR *);
+extern bool_t xdrrec_skiprecord(XDR *);
/* true if no more input */
-extern bool_t xdrrec_eof (XDR *);
+extern bool_t xdrrec_eof(XDR *);
__END_DECLS
#endif /* !_RPC_XDR_H */
diff --git a/cpukit/librpc/src/rpc/auth_des.c b/cpukit/librpc/src/rpc/auth_des.c
index 87d55b67e7..bb64b835b8 100644
--- a/cpukit/librpc/src/rpc/auth_des.c
+++ b/cpukit/librpc/src/rpc/auth_des.c
@@ -51,13 +51,7 @@
static const char rcsid[] = "$FreeBSD: src/lib/libc/rpc/auth_des.c,v 1.3 1999/08/28 00:00:32 peter Exp $";
#endif
-extern bool_t __rpc_get_time_offset __P(( struct timeval *, nis_server *,
- char *, char **, struct sockaddr_in * ));
-extern int rtime __P(( struct sockaddr_in *, struct timeval *, struct timeval *));
-extern bool_t xdr_authdes_cred __P(( XDR *, struct authdes_cred * ));
-extern bool_t xdr_authdes_verf __P(( XDR *, struct authdes_verf * ));
-
-#define MILLION 1000000L
+#define USEC_PER_SEC 1000000L
#define RTIME_TIMEOUT 5 /* seconds to wait for sync */
#define AUTH_PRIVATE(auth) (struct ad_private *) auth->ah_private
@@ -65,16 +59,22 @@ extern bool_t xdr_authdes_verf __P(( XDR *, struct authdes_verf * ));
#define FREE(ptr, size) mem_free((char *)(ptr), (int) size)
#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)
+extern int rtime( struct sockaddr_in *, struct timeval *, struct timeval *);
+extern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *);
+extern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *);
+
+extern bool_t __rpc_get_time_offset( struct timeval *, nis_server *, char *,
+ char **, struct sockaddr_in * );
#define debug(msg) /*printf("%s\n", msg) */
/*
* DES authenticator operations vector
*/
-static void authdes_nextverf();
-static bool_t authdes_marshal();
-static bool_t authdes_validate();
-static bool_t authdes_refresh();
-static void authdes_destroy();
+static void authdes_nextverf(AUTH *);
+static bool_t authdes_marshal(AUTH *, XDR *);
+static bool_t authdes_validate(AUTH *, struct opaque_auth *);
+static bool_t authdes_refresh(AUTH *);
+static void authdes_destroy(AUTH *);
static struct auth_ops authdes_ops = {
authdes_nextverf,
authdes_marshal,
@@ -313,8 +313,7 @@ failed:
*/
/*ARGSUSED*/
static void
-authdes_nextverf(auth)
- AUTH *auth;
+authdes_nextverf(AUTH *auth)
{
/* what the heck am I supposed to do??? */
}
@@ -325,9 +324,7 @@ authdes_nextverf(auth)
* 2. Marshal
*/
static bool_t
-authdes_marshal(auth, xdrs)
- AUTH *auth;
- XDR *xdrs;
+authdes_marshal(AUTH *auth, XDR *xdrs)
{
struct ad_private *ad = AUTH_PRIVATE(auth);
struct authdes_cred *cred = &ad->ad_cred;
@@ -345,8 +342,8 @@ authdes_marshal(auth, xdrs)
(void) gettimeofday(&ad->ad_timestamp, (struct timezone *)NULL);
ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec;
ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec;
- if (ad->ad_timestamp.tv_usec >= MILLION) {
- ad->ad_timestamp.tv_usec -= MILLION;
+ if (ad->ad_timestamp.tv_usec >= USEC_PER_SEC) {
+ ad->ad_timestamp.tv_usec -= USEC_PER_SEC;
ad->ad_timestamp.tv_sec += 1;
}
@@ -416,9 +413,7 @@ authdes_marshal(auth, xdrs)
* 3. Validate
*/
static bool_t
-authdes_validate(auth, rverf)
- AUTH *auth;
- struct opaque_auth *rverf;
+authdes_validate(AUTH *auth, struct opaque_auth *rverf)
{
struct ad_private *ad = AUTH_PRIVATE(auth);
struct authdes_verf verf;
@@ -472,8 +467,7 @@ authdes_validate(auth, rverf)
* 4. Refresh
*/
static bool_t
-authdes_refresh(auth)
- AUTH *auth;
+authdes_refresh(AUTH *auth)
{
struct ad_private *ad = AUTH_PRIVATE(auth);
struct authdes_cred *cred = &ad->ad_cred;
@@ -512,8 +506,7 @@ authdes_refresh(auth)
* 5. Destroy
*/
static void
-authdes_destroy(auth)
- AUTH *auth;
+authdes_destroy(AUTH *auth)
{
struct ad_private *ad = AUTH_PRIVATE(auth);
@@ -546,7 +539,7 @@ synchronize(syncaddr, timep)
timep->tv_sec -= mytime.tv_sec;
if (mytime.tv_usec > timep->tv_usec) {
timep->tv_sec -= 1;
- timep->tv_usec += MILLION;
+ timep->tv_usec += USEC_PER_SEC;
}
timep->tv_usec -= mytime.tv_usec;
return (TRUE);
diff --git a/cpukit/librpc/src/rpc/auth_unix.c b/cpukit/librpc/src/rpc/auth_unix.c
index 885c92a206..279822942a 100644
--- a/cpukit/librpc/src/rpc/auth_unix.c
+++ b/cpukit/librpc/src/rpc/auth_unix.c
@@ -59,11 +59,11 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/auth_unix.c,v 1.12 1999/12/29 0
/*
* Unix authenticator operations vector
*/
-static void authunix_nextverf();
-static bool_t authunix_marshal();
-static bool_t authunix_validate();
-static bool_t authunix_refresh();
-static void authunix_destroy();
+static void authunix_nextverf(AUTH*);
+static bool_t authunix_marshal(AUTH*, XDR*);
+static bool_t authunix_validate(AUTH*, struct opaque_auth *);
+static bool_t authunix_refresh(AUTH*);
+static void authunix_destroy(AUTH*);
static struct auth_ops auth_unix_ops = {
authunix_nextverf,
@@ -109,7 +109,7 @@ authunix_create(machname, uid, gid, len, aup_gids)
char *machname;
int uid;
int gid;
- register int len;
+ int len;
int *aup_gids;
{
struct authunix_parms aup;
@@ -218,33 +218,28 @@ authunix_create_default()
*/
static void
-authunix_nextverf(auth)
- AUTH *auth;
+authunix_nextverf(AUTH *auth)
{
/* no action necessary */
}
static bool_t
-authunix_marshal(auth, xdrs)
- AUTH *auth;
- XDR *xdrs;
+authunix_marshal(AUTH *auth, XDR *xdrs)
{
- register struct audata *au = AUTH_PRIVATE(auth);
+ struct audata *au = AUTH_PRIVATE(auth);
return (XDR_PUTBYTES(xdrs, au->au_marshed, au->au_mpos));
}
static bool_t
-authunix_validate(auth, verf)
- register AUTH *auth;
- struct opaque_auth verf;
+authunix_validate( AUTH *auth, struct opaque_auth *verf )
{
register struct audata *au;
XDR xdrs;
- if (verf.oa_flavor == AUTH_SHORT) {
+ if (verf->oa_flavor == AUTH_SHORT) {
au = AUTH_PRIVATE(auth);
- xdrmem_create(&xdrs, verf.oa_base, verf.oa_length, XDR_DECODE);
+ xdrmem_create(&xdrs, verf->oa_base, verf->oa_length, XDR_DECODE);
if (au->au_shcred.oa_base != NULL) {
mem_free(au->au_shcred.oa_base,
@@ -265,14 +260,13 @@ authunix_validate(auth, verf)
}
static bool_t
-authunix_refresh(auth)
- register AUTH *auth;
+authunix_refresh(AUTH *auth)
{
- register struct audata *au = AUTH_PRIVATE(auth);
+ struct audata *au = AUTH_PRIVATE(auth);
struct authunix_parms aup;
struct timeval now;
XDR xdrs;
- register int stat;
+ int stat;
if (auth->ah_cred.oa_base == au->au_origcred.oa_base) {
/* there is no hope. Punt */
@@ -308,10 +302,9 @@ done:
}
static void
-authunix_destroy(auth)
- register AUTH *auth;
+authunix_destroy(AUTH *auth)
{
- register struct audata *au = AUTH_PRIVATE(auth);
+ struct audata *au = AUTH_PRIVATE(auth);
mem_free(au->au_origcred.oa_base, au->au_origcred.oa_length);
@@ -331,12 +324,11 @@ authunix_destroy(auth)
* sets private data, au_marshed and au_mpos
*/
static void
-marshal_new_auth(auth)
- register AUTH *auth;
+marshal_new_auth(AUTH *auth)
{
XDR xdr_stream;
- register XDR *xdrs = &xdr_stream;
- register struct audata *au = AUTH_PRIVATE(auth);
+ XDR *xdrs = &xdr_stream;
+ struct audata *au = AUTH_PRIVATE(auth);
xdrmem_create(xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
if ((! xdr_opaque_auth(xdrs, &(auth->ah_cred))) ||
diff --git a/cpukit/librpc/src/rpc/rpc_prot.c b/cpukit/librpc/src/rpc/rpc_prot.c
index 14a2524c70..11a1ad2dcd 100644
--- a/cpukit/librpc/src/rpc/rpc_prot.c
+++ b/cpukit/librpc/src/rpc/rpc_prot.c
@@ -50,9 +50,12 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/rpc_prot.c,v 1.8 1999/08/28 00:
#include <rpc/rpc.h>
+static void accepted(enum accept_stat, struct rpc_err *);
+static void rejected(enum reject_stat, struct rpc_err *);
+
/* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */
-struct opaque_auth _null_auth;
+extern struct opaque_auth _null_auth;
/*
* XDR an opaque authentication struct
@@ -60,8 +63,8 @@ struct opaque_auth _null_auth;
*/
bool_t
xdr_opaque_auth(xdrs, ap)
- register XDR *xdrs;
- register struct opaque_auth *ap;
+ XDR *xdrs;
+ struct opaque_auth *ap;
{
if (xdr_enum(xdrs, &(ap->oa_flavor)))
@@ -75,8 +78,8 @@ xdr_opaque_auth(xdrs, ap)
*/
bool_t
xdr_des_block(xdrs, blkp)
- register XDR *xdrs;
- register des_block *blkp;
+ XDR *xdrs;
+ des_block *blkp;
{
return (xdr_opaque(xdrs, (caddr_t)blkp, sizeof(des_block)));
}
@@ -88,8 +91,8 @@ xdr_des_block(xdrs, blkp)
*/
bool_t
xdr_accepted_reply(xdrs, ar)
- register XDR *xdrs;
- register struct accepted_reply *ar;
+ XDR *xdrs;
+ struct accepted_reply *ar;
{
/* personalized union, rather than calling xdr_union */
@@ -106,7 +109,12 @@ xdr_accepted_reply(xdrs, ar)
if (! xdr_u_int32_t(xdrs, &(ar->ar_vers.low)))
return (FALSE);
return (xdr_u_int32_t(xdrs, &(ar->ar_vers.high)));
- default:
+
+ case GARBAGE_ARGS:
+ case SYSTEM_ERR:
+ case PROC_UNAVAIL:
+ case PROG_UNAVAIL:
+/* default: */
break;
}
return (TRUE); /* TRUE => open ended set of problems */
@@ -117,8 +125,8 @@ xdr_accepted_reply(xdrs, ar)
*/
bool_t
xdr_rejected_reply(xdrs, rr)
- register XDR *xdrs;
- register struct rejected_reply *rr;
+ XDR *xdrs;
+ struct rejected_reply *rr;
{
/* personalized union, rather than calling xdr_union */
@@ -137,9 +145,9 @@ xdr_rejected_reply(xdrs, rr)
return (FALSE);
}
-static struct xdr_discrim reply_dscrm[3] = {
- { (int)MSG_ACCEPTED, xdr_accepted_reply },
- { (int)MSG_DENIED, xdr_rejected_reply },
+static const struct xdr_discrim reply_dscrm[3] = {
+ { (int)MSG_ACCEPTED, (xdrproc_t)xdr_accepted_reply },
+ { (int)MSG_DENIED, (xdrproc_t)xdr_rejected_reply },
{ __dontcare__, NULL_xdrproc_t } };
/*
@@ -147,8 +155,8 @@ static struct xdr_discrim reply_dscrm[3] = {
*/
bool_t
xdr_replymsg(xdrs, rmsg)
- register XDR *xdrs;
- register struct rpc_msg *rmsg;
+ XDR *xdrs;
+ struct rpc_msg *rmsg;
{
if (
xdr_u_int32_t(xdrs, &(rmsg->rm_xid)) &&
@@ -167,8 +175,8 @@ xdr_replymsg(xdrs, rmsg)
*/
bool_t
xdr_callhdr(xdrs, cmsg)
- register XDR *xdrs;
- register struct rpc_msg *cmsg;
+ XDR *xdrs;
+ struct rpc_msg *cmsg;
{
cmsg->rm_direction = CALL;
@@ -187,8 +195,8 @@ xdr_callhdr(xdrs, cmsg)
static void
accepted(acpt_stat, error)
- register enum accept_stat acpt_stat;
- register struct rpc_err *error;
+ enum accept_stat acpt_stat;
+ struct rpc_err *error;
{
switch (acpt_stat) {
@@ -225,8 +233,8 @@ accepted(acpt_stat, error)
static void
rejected(rjct_stat, error)
- register enum reject_stat rjct_stat;
- register struct rpc_err *error;
+ enum reject_stat rjct_stat;
+ struct rpc_err *error;
{
switch (rjct_stat) {
@@ -252,8 +260,8 @@ rejected(rjct_stat, error)
*/
void
_seterr_reply(msg, error)
- register struct rpc_msg *msg;
- register struct rpc_err *error;
+ struct rpc_msg *msg;
+ struct rpc_err *error;
{
/* optimized for normal, SUCCESSful case */
@@ -263,7 +271,7 @@ _seterr_reply(msg, error)
if (msg->acpted_rply.ar_stat == SUCCESS) {
error->re_status = RPC_SUCCESS;
return;
- };
+ }
accepted(msg->acpted_rply.ar_stat, error);
break;
@@ -291,6 +299,22 @@ _seterr_reply(msg, error)
error->re_vers.low = msg->acpted_rply.ar_vers.low;
error->re_vers.high = msg->acpted_rply.ar_vers.high;
break;
+
+ case RPC_FAILED:
+ case RPC_SUCCESS:
+ case RPC_PROGNOTREGISTERED:
+ case RPC_PMAPFAILURE:
+ case RPC_UNKNOWNPROTO:
+ case RPC_UNKNOWNHOST:
+ case RPC_SYSTEMERROR:
+ case RPC_CANTDECODEARGS:
+ case RPC_PROCUNAVAIL:
+ case RPC_PROGUNAVAIL:
+ case RPC_TIMEDOUT:
+ case RPC_CANTRECV:
+ case RPC_CANTSEND:
+ case RPC_CANTDECODERES:
+ case RPC_CANTENCODEARGS:
default:
break;
}
diff --git a/cpukit/librpc/src/xdr/xdr.c b/cpukit/librpc/src/xdr/xdr.c
index e608e46501..5b8b8ced7c 100644
--- a/cpukit/librpc/src/xdr/xdr.c
+++ b/cpukit/librpc/src/xdr/xdr.c
@@ -50,6 +50,10 @@ static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr.c,v 1.9 1999/08/28 00:02:55
#include <rpc/types.h>
#include <rpc/xdr.h>
+#if defined(__rtems__)
+#define warnx(msg) fprintf(stderr, msg "\n");
+#endif
+
/*
* constants specific to the xdr "protocol"
*/
@@ -60,7 +64,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr.c,v 1.9 1999/08/28 00:02:55
/*
* for unit alignment
*/
-static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
+static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
/*
* Free a data structure using XDR
@@ -116,6 +120,7 @@ xdr_int(xdrs, ip)
case XDR_FREE:
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -145,6 +150,7 @@ xdr_u_int(xdrs, up)
case XDR_FREE:
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -155,7 +161,7 @@ xdr_u_int(xdrs, up)
*/
bool_t
xdr_long(xdrs, lp)
- register XDR *xdrs;
+ XDR *xdrs;
long *lp;
{
switch (xdrs->x_op) {
@@ -166,7 +172,7 @@ xdr_long(xdrs, lp)
case XDR_FREE:
return (TRUE);
}
-
+ /* NOTREACHED */
return (FALSE);
}
@@ -176,7 +182,7 @@ xdr_long(xdrs, lp)
*/
bool_t
xdr_u_long(xdrs, ulp)
- register XDR *xdrs;
+ XDR *xdrs;
u_long *ulp;
{
switch (xdrs->x_op) {
@@ -187,6 +193,7 @@ xdr_u_long(xdrs, ulp)
case XDR_FREE:
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -197,7 +204,7 @@ xdr_u_long(xdrs, ulp)
*/
bool_t
xdr_int32_t(xdrs, int32_p)
- register XDR *xdrs;
+ XDR *xdrs;
int32_t *int32_p;
{
long l;
@@ -218,6 +225,7 @@ xdr_int32_t(xdrs, int32_p)
case XDR_FREE:
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -227,7 +235,7 @@ xdr_int32_t(xdrs, int32_p)
*/
bool_t
xdr_u_int32_t(xdrs, u_int32_p)
- register XDR *xdrs;
+ XDR *xdrs;
u_int32_t *u_int32_p;
{
u_long l;
@@ -252,68 +260,11 @@ xdr_u_int32_t(xdrs, u_int32_p)
}
/*
- * XDR 64-bit integers
- */
-bool_t
-xdr_int64_t(xdrs, int64_p)
- register XDR *xdrs;
- int64_t *int64_p;
-{
- int64_t x;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- return (xdr_opaque(xdrs, (caddr_t)int64_p, sizeof(int64_t)));
-
- case XDR_DECODE:
- if (!xdr_opaque(xdrs, (caddr_t)&x, sizeof x)) {
- return (FALSE);
- }
- *int64_p = x;
- return (TRUE);
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * XDR unsigned 64-bit integers
- */
-bool_t
-xdr_u_int64_t(xdrs, uint64_p)
- register XDR *xdrs;
- u_int64_t *uint64_p;
-{
- u_int64_t x;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- return (xdr_opaque(xdrs, (caddr_t)uint64_p, sizeof(u_int64_t)));
-
- case XDR_DECODE:
- if (!xdr_opaque(xdrs, (caddr_t)&x, sizeof x)) {
- return (FALSE);
- }
- *uint64_p = x;
- return (TRUE);
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-
-/*
* XDR short integers
*/
bool_t
xdr_short(xdrs, sp)
- register XDR *xdrs;
+ XDR *xdrs;
short *sp;
{
long l;
@@ -334,6 +285,7 @@ xdr_short(xdrs, sp)
case XDR_FREE:
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -342,7 +294,7 @@ xdr_short(xdrs, sp)
*/
bool_t
xdr_u_short(xdrs, usp)
- register XDR *xdrs;
+ XDR *xdrs;
u_short *usp;
{
u_long l;
@@ -363,6 +315,7 @@ xdr_u_short(xdrs, usp)
case XDR_FREE:
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -372,7 +325,7 @@ xdr_u_short(xdrs, usp)
*/
bool_t
xdr_int16_t(xdrs, int16_p)
- register XDR *xdrs;
+ XDR *xdrs;
int16_t *int16_p;
{
long l;
@@ -393,6 +346,7 @@ xdr_int16_t(xdrs, int16_p)
case XDR_FREE:
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -401,7 +355,7 @@ xdr_int16_t(xdrs, int16_p)
*/
bool_t
xdr_u_int16_t(xdrs, u_int16_p)
- register XDR *xdrs;
+ XDR *xdrs;
u_int16_t *u_int16_p;
{
u_long l;
@@ -422,6 +376,7 @@ xdr_u_int16_t(xdrs, u_int16_p)
case XDR_FREE:
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -467,7 +422,7 @@ xdr_u_char(xdrs, cp)
*/
bool_t
xdr_bool(xdrs, bp)
- register XDR *xdrs;
+ XDR *xdrs;
bool_t *bp;
{
long lb;
@@ -488,6 +443,7 @@ xdr_bool(xdrs, bp)
case XDR_FREE:
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -528,11 +484,11 @@ xdr_enum(xdrs, ep)
*/
bool_t
xdr_opaque(xdrs, cp, cnt)
- register XDR *xdrs;
+ XDR *xdrs;
caddr_t cp;
- register u_int cnt;
+ u_int cnt;
{
- register u_int rndup;
+ u_int rndup;
static int crud[BYTES_PER_XDR_UNIT];
/*
@@ -580,13 +536,13 @@ xdr_opaque(xdrs, cp, cnt)
*/
bool_t
xdr_bytes(xdrs, cpp, sizep, maxsize)
- register XDR *xdrs;
+ XDR *xdrs;
char **cpp;
- register u_int *sizep;
+ u_int *sizep;
u_int maxsize;
{
- register char *sp = *cpp; /* sp is the actual string pointer */
- register u_int nodesize;
+ char *sp = *cpp; /* sp is the actual string pointer */
+ u_int nodesize;
/*
* first deal with the length since xdr bytes are counted
@@ -609,13 +565,13 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
return (TRUE);
}
if (sp == NULL) {
- *cpp = sp = (char *)mem_alloc(nodesize);
+ *cpp = sp = mem_alloc(nodesize);
}
if (sp == NULL) {
- (void) fprintf(stderr, "xdr_bytes: out of memory\n");
+ warnx("xdr_bytes: out of memory");
return (FALSE);
}
- /* fall into ... */
+ /* FALLTHROUGH */
case XDR_ENCODE:
return (xdr_opaque(xdrs, sp, nodesize));
@@ -627,6 +583,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
}
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -655,13 +612,13 @@ xdr_netobj(xdrs, np)
*/
bool_t
xdr_union(xdrs, dscmp, unp, choices, dfault)
- register XDR *xdrs;
+ XDR *xdrs;
enum_t *dscmp; /* enum to decide which arm to work on */
char *unp; /* the union itself */
- struct xdr_discrim *choices; /* [value, xdr proc] for each arm */
+ const struct xdr_discrim *choices; /* [value, xdr proc] for each arm */
xdrproc_t dfault; /* default xdr routine */
{
- register enum_t dscm;
+ enum_t dscm;
/*
* we deal with the discriminator; it's an enum
@@ -704,11 +661,11 @@ xdr_union(xdrs, dscmp, unp, choices, dfault)
*/
bool_t
xdr_string(xdrs, cpp, maxsize)
- register XDR *xdrs;
+ XDR *xdrs;
char **cpp;
u_int maxsize;
{
- register char *sp = *cpp; /* sp is the actual string pointer */
+ char *sp = *cpp; /* sp is the actual string pointer */
u_int size;
u_int nodesize;
@@ -720,11 +677,11 @@ xdr_string(xdrs, cpp, maxsize)
if (sp == NULL) {
return(TRUE); /* already free */
}
- /* fall through... */
+ /* FALLTHROUGH */
case XDR_ENCODE:
size = strlen(sp);
break;
- case XDR_DECODE: /* to avoid warning */
+ case XDR_DECODE:
break;
}
if (! xdr_u_int(xdrs, &size)) {
@@ -745,13 +702,13 @@ xdr_string(xdrs, cpp, maxsize)
return (TRUE);
}
if (sp == NULL)
- *cpp = sp = (char *)mem_alloc(nodesize);
+ *cpp = sp = mem_alloc(nodesize);
if (sp == NULL) {
- (void) fprintf(stderr, "xdr_string: out of memory\n");
+ warnx("xdr_string: out of memory");
return (FALSE);
}
sp[size] = 0;
- /* fall into ... */
+ /* FALLTHROUGH */
case XDR_ENCODE:
return (xdr_opaque(xdrs, sp, size));
@@ -761,6 +718,7 @@ xdr_string(xdrs, cpp, maxsize)
*cpp = NULL;
return (TRUE);
}
+ /* NOTREACHED */
return (FALSE);
}
@@ -775,3 +733,126 @@ xdr_wrapstring(xdrs, cpp)
{
return xdr_string(xdrs, cpp, LASTUNSIGNED);
}
+
+/*
+ * XDR 64-bit integers
+ */
+bool_t
+xdr_int64_t(xdrs, int64_p)
+ XDR *xdrs;
+ int64_t *int64_p;
+{
+ int64_t x;
+
+ switch (xdrs->x_op) {
+ case XDR_ENCODE:
+ return (xdr_opaque(xdrs, (caddr_t)int64_p, sizeof(int64_t)));
+ case XDR_DECODE:
+ if (!xdr_opaque(xdrs, (caddr_t)&x, sizeof x)) {
+ return (FALSE);
+ }
+ *int64_p = x;
+ return (TRUE);
+ case XDR_FREE:
+ return (TRUE);
+ }
+ /* NOTREACHED */
+ return (FALSE);
+}
+
+
+/*
+ * XDR unsigned 64-bit integers
+ */
+bool_t
+xdr_u_int64_t(xdrs, uint64_p)
+ XDR *xdrs;
+ u_int64_t *uint64_p;
+{
+ u_int64_t x;
+
+ switch (xdrs->x_op) {
+ case XDR_ENCODE:
+ return (xdr_opaque(xdrs, (caddr_t)uint64_p, sizeof(u_int64_t)));
+ case XDR_DECODE:
+ if (!xdr_opaque(xdrs, (caddr_t)&x, sizeof x)) {
+ return (FALSE);
+ }
+ *uint64_p = x;
+ return (TRUE);
+ case XDR_FREE:
+ return (TRUE);
+ }
+ /* NOTREACHED */
+ return (FALSE);
+}
+
+/* FIXME: RTEMS does not support u_longlong_t and longlong_t, yet */
+#if !defined(__rtems__)
+/*
+ * XDR hypers
+ */
+bool_t
+xdr_hyper(xdrs, llp)
+ XDR *xdrs;
+ longlong_t *llp;
+{
+
+ /*
+ * Don't bother open-coding this; it's a fair amount of code. Just
+ * call xdr_int64_t().
+ */
+ return (xdr_int64_t(xdrs, (int64_t *)llp));
+}
+
+
+/*
+ * XDR unsigned hypers
+ */
+bool_t
+xdr_u_hyper(xdrs, ullp)
+ XDR *xdrs;
+ u_longlong_t *ullp;
+{
+
+ /*
+ * Don't bother open-coding this; it's a fair amount of code. Just
+ * call xdr_u_int64_t().
+ */
+ return (xdr_u_int64_t(xdrs, (u_int64_t *)ullp));
+}
+
+
+/*
+ * XDR longlong_t's
+ */
+bool_t
+xdr_longlong_t(xdrs, llp)
+ XDR *xdrs;
+ longlong_t *llp;
+{
+
+ /*
+ * Don't bother open-coding this; it's a fair amount of code. Just
+ * call xdr_int64_t().
+ */
+ return (xdr_int64_t(xdrs, (int64_t *)llp));
+}
+
+
+/*
+ * XDR u_longlong_t's
+ */
+bool_t
+xdr_u_longlong_t(xdrs, ullp)
+ XDR *xdrs;
+ u_longlong_t *ullp;
+{
+
+ /*
+ * Don't bother open-coding this; it's a fair amount of code. Just
+ * call xdr_u_int64_t().
+ */
+ return (xdr_u_int64_t(xdrs, (u_int64_t *)ullp));
+}
+#endif