about summary refs log tree commit diff
path: root/sunrpc/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc/rpc')
-rw-r--r--sunrpc/rpc/auth.h38
-rw-r--r--sunrpc/rpc/clnt.h133
-rw-r--r--sunrpc/rpc/pmap_clnt.h26
-rw-r--r--sunrpc/rpc/svc.h56
-rw-r--r--sunrpc/rpc/svc_auth.h1
-rw-r--r--sunrpc/rpc/types.h20
-rw-r--r--sunrpc/rpc/xdr.h184
7 files changed, 271 insertions, 187 deletions
diff --git a/sunrpc/rpc/auth.h b/sunrpc/rpc/auth.h
index fff60baccd..61cd351485 100644
--- a/sunrpc/rpc/auth.h
+++ b/sunrpc/rpc/auth.h
@@ -42,6 +42,7 @@
 
 #define _RPC_AUTH_H	1
 #include <features.h>
+#include <rpc/xdr.h>
 
 __BEGIN_DECLS
 
@@ -76,7 +77,7 @@ union des_block {
 	char c[8];
 };
 typedef union des_block des_block;
-extern bool_t xdr_des_block();
+extern bool_t xdr_des_block __P ((XDR *__xdrs, des_block *__blkp));
 
 /*
  * Authentication info.  Opaque to client.
@@ -90,19 +91,21 @@ struct opaque_auth {
 /*
  * Auth handle, interface to client side authenticators.
  */
-typedef struct {
-	struct	opaque_auth	ah_cred;
-	struct	opaque_auth	ah_verf;
-	union	des_block	ah_key;
-	struct auth_ops {
-		void	(*ah_nextverf)();
-		int	(*ah_marshal)();	/* nextverf & serialize */
-		int	(*ah_validate)();	/* validate verifier */
-		int	(*ah_refresh)();	/* refresh credentials */
-		void	(*ah_destroy)();	/* destroy this structure */
-	} *ah_ops;
-	caddr_t ah_private;
-} AUTH;
+typedef struct AUTH AUTH;
+struct AUTH {
+  struct opaque_auth ah_cred;
+  struct opaque_auth ah_verf;
+  union des_block ah_key;
+  struct auth_ops {
+    void (*ah_nextverf) __P ((AUTH *));
+    int  (*ah_marshal) __P ((AUTH *, XDR *));	/* nextverf & serialize */
+    int  (*ah_validate) __P ((AUTH *, struct opaque_auth *));	
+						/* validate verifier */
+    int  (*ah_refresh) __P ((AUTH *));		/* refresh credentials */
+    void (*ah_destroy) __P ((AUTH *));     	/* destroy this structure */
+  } *ah_ops;
+  caddr_t ah_private;
+};
 
 
 /*
@@ -160,14 +163,17 @@ extern AUTH *authunix_create __P ((char *__machname, __uid_t __uid,
 				   __gid_t *__aup_gids));
 extern AUTH *authunix_create_default __P ((void));
 extern AUTH *authnone_create __P ((void));
-extern AUTH *authdes_create();
+extern AUTH *authdes_create __P ((char *__servername, u_int __window, 
+				  struct sockaddr *__syncaddr,
+				  des_block *__ckey));
 
 #define AUTH_NONE	0		/* no authentication */
 #define	AUTH_NULL	0		/* backward compatibility */
-#define	AUTH_UNIX	1		/* unix style (uid, gids) */
 #define	AUTH_SYS	1		/* unix style (uid, gids) */
+#define	AUTH_UNIX	AUTH_SYS
 #define	AUTH_SHORT	2		/* short hand unix style */
 #define AUTH_DES	3		/* des style (encrypted timestamps) */
+#define AUTH_KERB       4               /* kerberos style */
 
 __END_DECLS
 
diff --git a/sunrpc/rpc/clnt.h b/sunrpc/rpc/clnt.h
index 305e26d241..2cabc00d64 100644
--- a/sunrpc/rpc/clnt.h
+++ b/sunrpc/rpc/clnt.h
@@ -66,22 +66,33 @@ enum clnt_stat {
 	RPC_PROCUNAVAIL=10,		/* procedure unavailable */
 	RPC_CANTDECODEARGS=11,		/* decode arguments error */
 	RPC_SYSTEMERROR=12,		/* generic "other problem" */
-
+	RPC_NOBROADCAST = 21,		/* Broadcasting not supported */
 	/*
 	 * callrpc & clnt_create errors
 	 */
 	RPC_UNKNOWNHOST=13,		/* unknown host name */
 	RPC_UNKNOWNPROTO=17,		/* unknown protocol */
+	RPC_UNKNOWNADDR = 19,		/* Remote address unknown */
 
 	/*
-	 * _ create errors
+	 * rpcbind errors
 	 */
-	RPC_PMAPFAILURE=14,		/* the pmapper failed in its call */
+	RPC_RPCBFAILURE=14,		/* portmapper failed in its call */
+#define RPC_PMAPFAILURE RPC_RPCBFAILURE
 	RPC_PROGNOTREGISTERED=15,	/* remote program is not registered */
+	RPC_N2AXLATEFAILURE = 22,	/* Name to addr translation failed */
 	/*
 	 * unspecified error
 	 */
-	RPC_FAILED=16
+	RPC_FAILED=16,
+	RPC_INTR=18,
+	RPC_TLIERROR=20,
+	RPC_UDERROR=23,
+        /*
+         * asynchronous errors
+         */
+        RPC_INPROGRESS = 24,
+        RPC_STALERACHANDLE = 25
 };
 
 
@@ -89,19 +100,19 @@ enum clnt_stat {
  * Error info.
  */
 struct rpc_err {
-	enum clnt_stat re_status;
-	union {
-		int RE_errno;		/* related system error */
-		enum auth_stat RE_why;	/* why the auth error occurred */
-		struct {
-			u_long low;	/* lowest verion supported */
-			u_long high;	/* highest verion supported */
-		} RE_vers;
-		struct {		/* maybe meaningful if RPC_FAILED */
-			long s1;
-			long s2;
-		} RE_lb;		/* life boot & debugging only */
-	} ru;
+  enum clnt_stat re_status;
+  union {
+    int RE_errno;		/* related system error */
+    enum auth_stat RE_why;	/* why the auth error occurred */
+    struct {
+      u_long low;		/* lowest verion supported */
+      u_long high;		/* highest verion supported */
+    } RE_vers;
+    struct {			/* maybe meaningful if RPC_FAILED */
+      long s1;
+      long s2;
+    } RE_lb;			/* life boot & debugging only */
+  } ru;
 #define	re_errno	ru.RE_errno
 #define	re_why		ru.RE_why
 #define	re_vers		ru.RE_vers
@@ -114,18 +125,25 @@ struct rpc_err {
  * Created by individual implementations, see e.g. rpc_udp.c.
  * Client is responsible for initializing auth, see e.g. auth_none.c.
  */
-typedef struct {
-	AUTH	*cl_auth;			/* authenticator */
-	struct clnt_ops {
-		enum clnt_stat	(*cl_call)();	/* call remote procedure */
-		void		(*cl_abort)();	/* abort a call */
-		void		(*cl_geterr)();	/* get specific error code */
-		bool_t		(*cl_freeres)(); /* frees results */
-		void		(*cl_destroy)();/* destroy this structure */
-		bool_t          (*cl_control)();/* the ioctl() of rpc */
-	} *cl_ops;
-	caddr_t			cl_private;	/* private stuff */
-} CLIENT;
+typedef struct CLIENT CLIENT;
+struct CLIENT {
+  AUTH	*cl_auth;		 /* authenticator */
+  struct clnt_ops {
+    enum clnt_stat (*cl_call) __P ((CLIENT *, u_long, xdrproc_t,
+				    caddr_t, xdrproc_t, 
+				    caddr_t, struct timeval));	
+			       	/* call remote procedure */
+    void (*cl_abort) __P ((void));  /* abort a call */
+    void (*cl_geterr) __P ((CLIENT *, struct rpc_err *));	
+				/* get specific error code */
+    bool_t (*cl_freeres) __P ((CLIENT *, xdrproc_t, caddr_t)); 
+				/* frees results */
+    void (*cl_destroy) __P ((CLIENT *)); /* destroy this structure */
+    bool_t (*cl_control) __P ((CLIENT *, int, char *));
+				/* the ioctl() of rpc */
+  } *cl_ops;
+  caddr_t cl_private;		/* private stuff */
+};
 
 
 /*
@@ -189,16 +207,29 @@ typedef struct {
 #define	clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
 
 /*
- * control operations that apply to both udp and tcp transports
+ * control operations that apply to all transports
  */
-#define CLSET_TIMEOUT       1   /* set timeout (timeval) */
-#define CLGET_TIMEOUT       2   /* get timeout (timeval) */
-#define CLGET_SERVER_ADDR   3   /* get server's address (sockaddr) */
+#define CLSET_TIMEOUT		1	/* set timeout (timeval) */
+#define CLGET_TIMEOUT		2	/* get timeout (timeval) */
+#define CLGET_SERVER_ADDR	3	/* get server's address (sockaddr) */
+#define CLGET_FD                6       /* get connections file descriptor */
+#define CLGET_SVC_ADDR          7       /* get server's address (netbuf) */
+#define CLSET_FD_CLOSE          8       /* close fd while clnt_destroy */
+#define CLSET_FD_NCLOSE         9       /* Do not close fd while clnt_destroy*/
+#define CLGET_XID               10      /* Get xid */
+#define CLSET_XID               11      /* Set xid */
+#define CLGET_VERS              12      /* Get version number */
+#define CLSET_VERS              13      /* Set version number */
+#define CLGET_PROG              14      /* Get program number */
+#define CLSET_PROG              15      /* Set program number */
+#define CLSET_SVC_ADDR          16      /* get server's address (netbuf) */
+#define CLSET_PUSH_TIMOD        17      /* push timod if not already present */
+#define CLSET_POP_TIMOD         18      /* pop timod */
 /*
- * udp only control operations
+ * Connectionless only control operations
  */
-#define CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */
-#define CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */
+#define CLSET_RETRY_TIMEOUT	4	/* set retry timeout (timeval) */
+#define CLGET_RETRY_TIMEOUT	5	/* get retry timeout (timeval) */
 
 /*
  * void
@@ -239,7 +270,8 @@ typedef struct {
  *	u_long prog;
  *	u_long vers;
  */
-extern CLIENT *clntraw_create __P ((u_long __prog, u_long __vers));
+extern CLIENT *clntraw_create __P ((__const u_long __prog, 
+				    __const u_long __vers));
 
 
 /*
@@ -247,12 +279,12 @@ extern CLIENT *clntraw_create __P ((u_long __prog, u_long __vers));
  * CLIENT *
  * clnt_create(host, prog, vers, prot)
  *	char *host; 	-- hostname
- *	u_int prog;	-- program number
- *	u_int vers;	-- version number
+ *	u_long prog;	-- program number
+ *	u_ong vers;	-- version number
  *	char *prot;	-- protocol
  */
-extern CLIENT *clnt_create __P ((char *__host, u_int __prog, u_int __vers,
-				 char *__prot));
+extern CLIENT *clnt_create __P ((__const char *__host, __const u_long __prog, 
+				 __const u_long __vers, __const char *__prot));
 
 
 /*
@@ -302,11 +334,17 @@ extern CLIENT *clntudp_bufcreate __P ((struct sockaddr_in *__raddr,
 				       int *__sockp, u_int __sendsz,
 				       u_int __recvsz));
 
+extern int callrpc __P ((__const char *__host, __const u_long __prognum, 
+			 __const u_long __versnum, __const u_long __procnum,
+			 __const xdrproc_t __inproc, __const char *__in,
+			 __const xdrproc_t __outproc, char *__out));
+extern int _rpc_dtablesize __P ((void));
+
 /*
  * Print why creation failed
  */
-extern void clnt_pcreateerror __P ((char *__msg));	/* stderr */
-extern char *clnt_spcreateerror __P ((char *__msg));	/* string */
+extern void clnt_pcreateerror __P ((__const char *__msg));	/* stderr */
+extern char *clnt_spcreateerror __P ((__const char *__msg));	/* string */
 
 /*
  * Like clnt_perror(), but is more verbose in its output
@@ -316,8 +354,10 @@ extern void clnt_perrno __P ((enum clnt_stat __num));	/* stderr */
 /*
  * Print an English error message, given the client error code
  */
-extern void clnt_perror __P ((CLIENT *__clnt, char *__msg)); 	/* stderr */
-extern char *clnt_sperror __P ((CLIENT *__clnt, char *__msg));	/* string */
+extern void clnt_perror __P ((CLIENT *__clnt, __const char *__msg)); 
+							/* stderr */
+extern char *clnt_sperror __P ((CLIENT *__clnt, __const char *__msg)); 
+							/* string */
 
 /*
  * If a creation fails, the following allows the user to figure out why.
@@ -336,7 +376,8 @@ extern struct rpc_createerr rpc_createerr;
  */
 extern char *clnt_sperrno __P ((enum clnt_stat __num));	/* string */
 
-
+extern int getrpcport __P ((__const char * __host, u_long __prognum,
+			   u_long __versnum, u_int proto));
 
 #define UDPMSGSIZE	8800	/* rpc imposed limit on udp msg size */
 #define RPCSMALLMSGSIZE	400	/* a more reasonable packet size */
diff --git a/sunrpc/rpc/pmap_clnt.h b/sunrpc/rpc/pmap_clnt.h
index f1a9d9be88..0b8d50f10f 100644
--- a/sunrpc/rpc/pmap_clnt.h
+++ b/sunrpc/rpc/pmap_clnt.h
@@ -41,7 +41,7 @@
 
 __BEGIN_DECLS
 
-typedef bool_t (*resultproc_t)();
+typedef bool_t (*resultproc_t) __P ((caddr_t resp, struct sockaddr_in *raddr));
 
 /*
  * Usage:
@@ -65,29 +65,29 @@ typedef bool_t (*resultproc_t)();
  *		address if the responder to the broadcast.
  */
 
-extern bool_t pmap_set __P ((u_long __program, u_long __version,
+extern bool_t pmap_set __P ((__const u_long __program, __const u_long __vers,
 			     int __protocol, u_short __port));
-
-extern bool_t pmap_unset __P ((u_long __program, u_long __version));
-
+extern bool_t pmap_unset __P ((__const u_long __program, __const u_long __vers));
 extern struct pmaplist *pmap_getmaps __P ((struct sockaddr_in *__address));
-
 extern enum clnt_stat pmap_rmtcall __P ((struct sockaddr_in *__addr,
-					 u_long __prog, u_long __vers,
-					 u_long __proc, xdrproc_t __xdrargs,
+					 __const u_long __prog, 
+					 __const u_long __vers,
+					 __const u_long __proc, 
+					 xdrproc_t __xdrargs,
 					 caddr_t __argsp, xdrproc_t __xdrres,
 					 caddr_t __resp, struct timeval __tout,
 					 u_long *__port_ptr));
-
-extern enum clnt_stat clnt_broadcast __P ((u_long __prog, u_long __vers,
-					   u_long __proc, xdrproc_t __xargs,
+extern enum clnt_stat clnt_broadcast __P ((__const u_long __prog, 
+					   __const u_long __vers,
+					   __const u_long __proc, 
+					   xdrproc_t __xargs,
 					   caddr_t __argsp,
 					   xdrproc_t __xresults,
 					   caddr_t __resultsp,
 					   resultproc_t __eachresult));
-
 extern u_short pmap_getport __P ((struct sockaddr_in *__address,
-				  u_long __program, u_long __version,
+				  __const u_long __program, 
+				  __const u_long __version,
 				  u_int __protocol));
 
 __END_DECLS
diff --git a/sunrpc/rpc/svc.h b/sunrpc/rpc/svc.h
index ff7738752f..6a36900908 100644
--- a/sunrpc/rpc/svc.h
+++ b/sunrpc/rpc/svc.h
@@ -37,6 +37,9 @@
 #ifndef __SVC_HEADER__
 #define __SVC_HEADER__
 
+#include <features.h>
+#include <rpc/rpc_msg.h>
+
 __BEGIN_DECLS
 
 /*
@@ -70,23 +73,31 @@ enum xprt_stat {
 /*
  * Server side transport handle
  */
-typedef struct {
-	int		xp_sock;
-	u_short		xp_port;	 /* associated port number */
-	struct xp_ops {
-	    bool_t	(*xp_recv)();	 /* receive incoming requests */
-	    enum xprt_stat (*xp_stat)(); /* get transport status */
-	    bool_t	(*xp_getargs)(); /* get arguments */
-	    bool_t	(*xp_reply)();	 /* send reply */
-	    bool_t	(*xp_freeargs)();/* free mem allocated for args */
-	    void	(*xp_destroy)(); /* destroy this struct */
-	} *xp_ops;
-	int		xp_addrlen;	 /* length of remote address */
-	struct sockaddr_in xp_raddr;	 /* remote address */
-	struct opaque_auth xp_verf;	 /* raw response verifier */
-	caddr_t		xp_p1;		 /* private */
-	caddr_t		xp_p2;		 /* private */
-} SVCXPRT;
+typedef struct SVCXPRT SVCXPRT;
+struct SVCXPRT {
+  int xp_sock;
+  u_short xp_port;		/* associated port number */
+  const struct xp_ops {
+    bool_t	(*xp_recv) __P ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+				/* receive incoming requests */
+    enum xprt_stat (*xp_stat) __P ((SVCXPRT *__xprt));
+				/* get transport status */
+    bool_t	(*xp_getargs) __P ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+				    caddr_t args_ptr)); /* get arguments */
+    bool_t	(*xp_reply) __P ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+				/* send reply */
+    bool_t	(*xp_freeargs) __P ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+				     caddr_t args_ptr));
+				/* free mem allocated for args */
+    void	(*xp_destroy) __P ((SVCXPRT *__xprt));
+				/* destroy this struct */
+  } *xp_ops;
+  int		xp_addrlen;	 /* length of remote address */
+  struct sockaddr_in xp_raddr;	 /* remote address */
+  struct opaque_auth xp_verf;	 /* raw response verifier */
+  caddr_t		xp_p1;		 /* private */
+  caddr_t		xp_p2;		 /* private */
+};
 
 /*
  *  Approved way of getting address of caller
@@ -153,11 +164,12 @@ struct svc_req {
  *	u_long prog;
  *	u_long vers;
  *	void (*dispatch)();
- *	int protocol;  like TCP or UDP, zero means do not register
+ *	u_long protocol;  like TCP or UDP, zero means do not register
  */
 extern bool_t	svc_register __P ((SVCXPRT *__xprt, u_long __prog,
-				   u_long __vers, void (*__dispatch) (),
-				   int __protocol));
+				   u_long __vers, void (*__dispatch)
+				   __P ((struct svc_req *, SVCXPRT *)),
+				   u_long __protocol));
 
 /*
  * Service un-registration
@@ -257,11 +269,9 @@ extern int svc_fds;
  * a small program implemented by the svc_rpc implementation itself;
  * also see clnt.h for protocol numbers.
  */
-extern void rpctest_service();
-
 extern void	svc_getreq __P ((int __rdfds));
 extern void	svc_getreqset __P ((fd_set *readfds));
-extern void	svc_run __P ((void)) __attribute__ ((noreturn));
+extern void	svc_run __P ((void)); /* __attribute__ ((noreturn)) */
 
 /*
  * Socket to use on svcxxx_create call to get default socket
diff --git a/sunrpc/rpc/svc_auth.h b/sunrpc/rpc/svc_auth.h
index 543ddb974d..320a03a3bd 100644
--- a/sunrpc/rpc/svc_auth.h
+++ b/sunrpc/rpc/svc_auth.h
@@ -39,6 +39,7 @@
 
 #define _RPC_SVC_AUTH_H	1
 #include <features.h>
+#include <rpc/svc.h>
 
 __BEGIN_DECLS
 
diff --git a/sunrpc/rpc/types.h b/sunrpc/rpc/types.h
index fc3d7d5302..fbfda1a3db 100644
--- a/sunrpc/rpc/types.h
+++ b/sunrpc/rpc/types.h
@@ -35,13 +35,21 @@
 #ifndef __TYPES_RPC_HEADER__
 #define __TYPES_RPC_HEADER__
 
-#define	bool_t	int
-#define	enum_t	int
-#define	FALSE	(0)
-#define	TRUE	(1)
-#define __dontcare__	-1
+typedef int bool_t;
+typedef int enum_t;
+
+#define        __dontcare__    -1
+
+#ifndef FALSE
+#      define  FALSE   (0)
+#endif
+
+#ifndef TRUE
+#      define  TRUE    (1)
+#endif
+
 #ifndef NULL
-#	define NULL 0
+#      define  NULL 0
 #endif
 
 #include <stdlib.h>		/* For malloc decl.  */
diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h
index e54df5a1fd..eecb1e14be 100644
--- a/sunrpc/rpc/xdr.h
+++ b/sunrpc/rpc/xdr.h
@@ -54,10 +54,10 @@ __BEGIN_DECLS
  *
  * Each data type provides a single procedure which takes two arguments:
  *
- *	bool_t
- *	xdrproc(xdrs, argresp)
- *		XDR *xdrs;
- *		<type> *argresp;
+ *      bool_t
+ *      xdrproc(xdrs, argresp)
+ *              XDR *xdrs;
+ *              <type> *argresp;
  *
  * xdrs is an instance of a XDR handle, to which or from which the data
  * type is to be converted.  argresp is a pointer to the structure to be
@@ -80,11 +80,12 @@ __BEGIN_DECLS
  * XDR_FREE can be used to release the space allocated by an XDR_DECODE
  * request.
  */
-enum xdr_op {
-	XDR_ENCODE=0,
-	XDR_DECODE=1,
-	XDR_FREE=2
-};
+enum xdr_op
+  {
+    XDR_ENCODE = 0,
+    XDR_DECODE = 1,
+    XDR_FREE = 2
+  };
 
 /*
  * This is the number of bytes per unit of external data.
@@ -99,23 +100,36 @@ enum xdr_op {
  * an operations vector for the particular implementation (e.g. see xdr_mem.c),
  * and two private fields for the use of the particular implementation.
  */
-typedef struct {
-	enum xdr_op	x_op;		/* operation; fast additional param */
-	struct xdr_ops {
-		bool_t	(*x_getlong)();	/* get a long from underlying stream */
-		bool_t	(*x_putlong)();	/* put a long to " */
-		bool_t	(*x_getbytes)();/* get some bytes from " */
-		bool_t	(*x_putbytes)();/* put some bytes to " */
-		u_int	(*x_getpostn)();/* returns bytes off from beginning */
-		bool_t  (*x_setpostn)();/* lets you reposition the stream */
-		long *	(*x_inline)();	/* buf quick ptr to buffered data */
-		void	(*x_destroy)();	/* free privates of this xdr_stream */
-	} *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 */
-} XDR;
+typedef struct XDR XDR;
+struct XDR
+  {
+    enum xdr_op x_op;		/* operation; fast additional param */
+    const struct xdr_ops
+      {
+	bool_t (*x_getlong) __P ((XDR * __xdrs, long *__lp));
+	/* get a long from underlying stream */
+	bool_t (*x_putlong) __P ((XDR * __xdrs, long *__lp));
+	/* put a long to " */
+	bool_t (*x_getbytes) __P ((XDR * __xdrs, caddr_t __addr, u_int __len));
+	/* get some bytes from " */
+	bool_t (*x_putbytes) __P ((XDR * __xdrs, __const caddr_t __addr,
+				   u_int __len));
+	/* put some bytes to " */
+	u_int (*x_getpostn) __P ((XDR * __xdrs));
+	/* returns bytes off from beginning */
+	bool_t (*x_setpostn) __P ((XDR * __xdrs, u_int pos));
+	/* lets you reposition the stream */
+	long *(*x_inline) __P ((XDR * __xdrs, int len));
+	/* buf quick ptr to buffered data */
+	void (*x_destroy) __P ((XDR * __xdrs));
+	/* free privates of this xdr_stream */
+      }
+     *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 */
+  };
 
 /*
  * A xdrproc_t exists for each data type which is to be encoded or decoded.
@@ -124,18 +138,19 @@ typedef struct {
  * The opaque pointer generally points to a structure of the data type
  * to be decoded.  If this pointer is 0, then the type routines should
  * allocate dynamic storage of the appropriate size and return it.
- * bool_t	(*xdrproc_t)(XDR *, caddr_t *);
+ * bool_t       (*xdrproc_t)(XDR *, caddr_t *);
  */
-typedef	bool_t (*xdrproc_t) __P ((XDR *, void *, ...));
+typedef
+bool_t (*xdrproc_t) __P ((XDR *, void *,...));
 
 /*
  * Operations defined on a XDR handle
  *
- * XDR		*xdrs;
- * long		*longp;
- * caddr_t	 addr;
- * u_int	 len;
- * u_int	 pos;
+ * XDR          *xdrs;
+ * long         *longp;
+ * caddr_t       addr;
+ * u_int         len;
+ * u_int         pos;
  */
 #define XDR_GETLONG(xdrs, longp)			\
 	(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
@@ -190,9 +205,10 @@ typedef	bool_t (*xdrproc_t) __P ((XDR *, void *, ...));
  * If there is no match and no default routine it is an error.
  */
 #define NULL_xdrproc_t ((xdrproc_t)0)
-struct xdr_discrim {
-	int	value;
-	xdrproc_t proc;
+struct xdr_discrim
+{
+  int value;
+  xdrproc_t proc;
 };
 
 /*
@@ -201,9 +217,9 @@ struct xdr_discrim {
  * data from the underlying buffer, and will fail to operate
  * properly if the data is not aligned.  The standard way to use these
  * is to say:
- *	if ((buf = XDR_INLINE(xdrs, count)) == NULL)
- *		return (FALSE);
- *	<<< macro calls >>>
+ *      if ((buf = XDR_INLINE(xdrs, count)) == NULL)
+ *              return (FALSE);
+ *      <<< macro calls >>>
  * where ``count'' is the number of bytes of data occupied
  * by the primitive data types.
  *
@@ -228,48 +244,49 @@ struct xdr_discrim {
 /*
  * These are the "generic" xdr routines.
  */
-extern bool_t	xdr_void ();
-extern bool_t	xdr_int __P ((XDR *__xdrs, int *__ip));
-extern bool_t	xdr_u_int __P ((XDR *__xdrs, u_int *__up));
-extern bool_t	xdr_long __P ((XDR *__xdrs, long *__lp));
-extern bool_t	xdr_u_long __P ((XDR *__xdrs, u_long *__ulp));
-extern bool_t	xdr_short __P ((XDR *__xdrs, short *__sp));
-extern bool_t	xdr_u_short __P ((XDR *__xdrs, u_short *__usp));
-extern bool_t	xdr_bool __P ((XDR *__xdrs, bool_t *__bp));
-extern bool_t	xdr_enum __P ((XDR *__xdrs, enum_t *__ep));
-extern bool_t	xdr_array __P ((XDR *_xdrs, caddr_t *__addrp, u_int *__sizep,
-				u_int __maxsize, u_int __elsize,
-				xdrproc_t __elproc));
-extern bool_t	xdr_bytes __P ((XDR *__xdrs, char **__cpp, u_int *__sizep,
-				u_int __maxsize));
-extern bool_t	xdr_opaque __P ((XDR *__xdrs, caddr_t __cp, u_int __cnt));
-extern bool_t	xdr_string __P ((XDR *__xdrs, char **__cpp, u_int __maxsize));
-extern bool_t	xdr_union __P ((XDR *__xdrs, enum_t *__dscmp, char *__unp,
-				struct xdr_discrim *__choices,
-				xdrproc_t dfault));
-extern bool_t	xdr_char __P ((XDR *__xdrs, char *__cp));
-extern bool_t	xdr_u_char __P ((XDR *__xdrs, u_char *__cp));
-extern bool_t	xdr_vector __P ((XDR *__xdrs, char *__basep, u_int __nelem,
-				 u_int __elemsize, xdrproc_t __xdr_elem));
-extern bool_t	xdr_float __P ((XDR *__xdrs, float *__fp));
-extern bool_t	xdr_double __P ((XDR *__xdrs, double *__dp));
-extern bool_t	xdr_reference __P ((XDR *__xdrs, caddr_t *__pp, u_int __size,
-				    xdrproc_t __proc));
-extern bool_t	xdr_pointer __P ((XDR *__xdrs, char **__objpp,
-				  u_int __obj_size, xdrproc_t __xdr_obj));
-extern bool_t	xdr_wrapstring __P ((XDR *__xdrs, char **__cpp));
+extern bool_t xdr_void __P ((void));
+extern bool_t xdr_int __P ((XDR * __xdrs, int *__ip));
+extern bool_t xdr_u_int __P ((XDR * __xdrs, u_int * __up));
+extern bool_t xdr_long __P ((XDR * __xdrs, long *__lp));
+extern bool_t xdr_u_long __P ((XDR * __xdrs, u_long * __ulp));
+extern bool_t xdr_short __P ((XDR * __xdrs, short *__sp));
+extern bool_t xdr_u_short __P ((XDR * __xdrs, u_short * __usp));
+extern bool_t xdr_bool __P ((XDR * __xdrs, bool_t * __bp));
+extern bool_t xdr_enum __P ((XDR * __xdrs, enum_t * __ep));
+extern bool_t xdr_array __P ((XDR * _xdrs, caddr_t * __addrp, u_int * __sizep,
+			      u_int __maxsize, u_int __elsize,
+			      xdrproc_t __elproc));
+extern bool_t xdr_bytes __P ((XDR * __xdrs, char **__cpp, u_int * __sizep,
+			      u_int __maxsize));
+extern bool_t xdr_opaque __P ((XDR * __xdrs, caddr_t __cp, u_int __cnt));
+extern bool_t xdr_string __P ((XDR * __xdrs, char **__cpp, u_int __maxsize));
+extern bool_t xdr_union __P ((XDR * __xdrs, enum_t * __dscmp, char *__unp,
+			      __const struct xdr_discrim * __choices,
+			      xdrproc_t dfault));
+extern bool_t xdr_char __P ((XDR * __xdrs, char *__cp));
+extern bool_t xdr_u_char __P ((XDR * __xdrs, u_char * __cp));
+extern bool_t xdr_vector __P ((XDR * __xdrs, char *__basep, u_int __nelem,
+			       u_int __elemsize, xdrproc_t __xdr_elem));
+extern bool_t xdr_float __P ((XDR * __xdrs, float *__fp));
+extern bool_t xdr_double __P ((XDR * __xdrs, double *__dp));
+extern bool_t xdr_reference __P ((XDR * __xdrs, caddr_t * __pp, u_int __size,
+				  xdrproc_t __proc));
+extern bool_t xdr_pointer __P ((XDR * __xdrs, char **__objpp,
+				u_int __obj_size, xdrproc_t __xdr_obj));
+extern bool_t xdr_wrapstring __P ((XDR * __xdrs, char **__cpp));
 
 /*
  * Common opaque bytes objects used by many rpc protocols;
  * declared here due to commonality.
  */
 #define MAX_NETOBJ_SZ 1024
-struct netobj {
-	u_int	n_len;
-	char	*n_bytes;
+struct netobj
+{
+  u_int n_len;
+  char *n_bytes;
 };
 typedef struct netobj netobj;
-extern bool_t   xdr_netobj __P ((XDR *__xdrs, struct netobj *__np));
+extern bool_t xdr_netobj __P ((XDR * __xdrs, struct netobj * __np));
 
 /*
  * These are the public routines for the various implementations of
@@ -277,26 +294,27 @@ extern bool_t   xdr_netobj __P ((XDR *__xdrs, struct netobj *__np));
  */
 
 /* XDR using memory buffers */
-extern void   xdrmem_create __P ((XDR *__xdrs, caddr_t __addr, u_int __size,
-				  enum xdr_op __op));
+extern void xdrmem_create __P ((XDR * __xdrs, caddr_t __addr, u_int __size,
+				enum xdr_op __op));
 
 /* XDR using stdio library */
-extern void   xdrstdio_create __P ((XDR *__xdrs, FILE *__file,
-				    enum xdr_op __op));
+extern void xdrstdio_create __P ((XDR * __xdrs, FILE * __file,
+				  enum xdr_op __op));
 
 /* XDR pseudo records for tcp */
-extern void   xdrrec_create __P ((XDR *__xdrs, u_int __sendsize,
-				  u_int __recvsize, caddr_t __tcp_handle,
-				  int (*__readit) (), int (*__writeit) ()));
+extern void xdrrec_create __P ((XDR * __xdrs, u_int __sendsize,
+				u_int __recvsize, caddr_t __tcp_handle,
+				int (*__readit) (char *, char *, int),
+				int (*__writeit) (char *, char *, int)));
 
 /* make end of xdr record */
-extern bool_t xdrrec_endofrecord __P ((XDR *__xdrs, bool_t __sendnow));
+extern bool_t xdrrec_endofrecord __P ((XDR * __xdrs, bool_t __sendnow));
 
 /* move to beginning of next record */
-extern bool_t xdrrec_skiprecord __P ((XDR *__xdrs));
+extern bool_t xdrrec_skiprecord __P ((XDR * __xdrs));
 
 /* true if no more input */
-extern bool_t xdrrec_eof __P ((XDR *__xdrs));
+extern bool_t xdrrec_eof __P ((XDR * __xdrs));
 
 /* free memory buffers for xdr */
 extern void xdr_free __P ((xdrproc_t __proc, char *__objp));