summaryrefslogtreecommitdiff
path: root/include/rpc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-07-06 19:22:49 +0000
committerEric Andersen <andersen@codepoet.org>2000-07-06 19:22:49 +0000
commitffb96c090015f49059d146deefbbd7e1f6baa642 (patch)
tree53229e8793e289f18a7453b144850b6583078c32 /include/rpc
parentafb85e9d6ca1de8f1ecb267e8c30b88ba4382820 (diff)
Some more major updates to further superate ucLibc from the kernel
headers (the way it has been done in GNU libc). -Erik
Diffstat (limited to 'include/rpc')
-rw-r--r--include/rpc/auth.h110
-rw-r--r--include/rpc/auth_des.h81
-rw-r--r--include/rpc/auth_unix.h56
-rw-r--r--include/rpc/clnt.h234
-rw-r--r--include/rpc/des_crypt.h97
-rw-r--r--include/rpc/key_prot.h346
-rw-r--r--include/rpc/netdb.h74
-rw-r--r--include/rpc/pmap_clnt.h59
-rw-r--r--include/rpc/pmap_prot.h32
-rw-r--r--include/rpc/pmap_rmt.h28
-rw-r--r--include/rpc/rpc.h21
-rw-r--r--include/rpc/rpc_des.h72
-rw-r--r--include/rpc/rpc_msg.h35
-rw-r--r--include/rpc/svc.h142
-rw-r--r--include/rpc/svc_auth.h26
-rw-r--r--include/rpc/types.h44
-rw-r--r--include/rpc/xdr.h323
17 files changed, 1417 insertions, 363 deletions
diff --git a/include/rpc/auth.h b/include/rpc/auth.h
index 33cb42951..35f30e4a3 100644
--- a/include/rpc/auth.h
+++ b/include/rpc/auth.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -38,6 +38,13 @@
* "sessions".
*/
+#ifndef _RPC_AUTH_H
+
+#define _RPC_AUTH_H 1
+#include <features.h>
+#include <rpc/xdr.h>
+
+__BEGIN_DECLS
#define MAX_AUTH_BYTES 400
#define MAXNETNAMELEN 255 /* maximum length of network user's name */
@@ -62,19 +69,15 @@ enum auth_stat {
AUTH_FAILED=7 /* some unknown reason */
};
-#if (mc68000 || sparc || vax || i386)
-typedef u_long u_int32; /* 32-bit unsigned integers */
-#endif
-
union des_block {
struct {
- u_int32 high;
- u_int32 low;
+ u_int32_t high;
+ u_int32_t low;
} key;
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.
@@ -85,23 +88,24 @@ struct opaque_auth {
u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
};
-
/*
* 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 varifier */
- 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;
+};
/*
@@ -154,13 +158,57 @@ extern struct opaque_auth _null_auth;
* int len;
* int *aup_gids;
*/
-extern AUTH *authunix_create();
-extern AUTH *authunix_create_default(); /* takes no parameters */
-extern AUTH *authnone_create(); /* takes no parameters */
-extern AUTH *authdes_create();
+extern AUTH *authunix_create __P ((char *__machname, __uid_t __uid,
+ __gid_t __gid, int __len,
+ __gid_t *__aup_gids));
+extern AUTH *authunix_create_default __P ((void));
+extern AUTH *authnone_create __P ((void));
+extern AUTH *authdes_create __P ((const char *__servername, u_int __window,
+ struct sockaddr *__syncaddr,
+ des_block *__ckey));
+extern AUTH *authdes_pk_create __P ((const char *, netobj *, u_int,
+ struct sockaddr *, des_block *));
+
#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_DH AUTH_DES /* Diffie-Hellman (this is DES) */
+#define AUTH_KERB 4 /* kerberos style */
+
+/*
+ * Netname manipulating functions
+ *
+ */
+extern int getnetname __P ((char *));
+extern int host2netname __P ((char *, __const char *, __const char *));
+extern int user2netname __P ((char *, __const uid_t, __const char *));
+extern int netname2user __P ((__const char *, uid_t *, gid_t *, int *,
+ gid_t *));
+extern int netname2host __P ((__const char *, char *, __const int));
+
+/*
+ *
+ * These routines interface to the keyserv daemon
+ *
+ */
+extern int key_decryptsession __P ((char *, des_block *));
+extern int key_decryptsession_pk __P ((char *, netobj *, des_block *));
+extern int key_encryptsession __P ((char *, des_block *));
+extern int key_encryptsession_pk __P ((char *, netobj *, des_block *));
+extern int key_gendes __P ((des_block *));
+extern int key_setsecret __P ((char *));
+extern int key_secretkey_is_set __P ((void));
+extern int key_get_conv __P ((char *, des_block *));
+
+/*
+ * XDR an opaque authentication struct.
+ */
+extern bool_t xdr_opaque_auth __P ((XDR *, struct opaque_auth *));
+
+__END_DECLS
+
+#endif /* rpc/auth.h */
diff --git a/include/rpc/auth_des.h b/include/rpc/auth_des.h
index 8c2f79469..b94bafb67 100644
--- a/include/rpc/auth_des.h
+++ b/include/rpc/auth_des.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,30 +17,97 @@
Boston, MA 02111-1307, USA. */
#ifndef _RPC_AUTH_DES_H
-
#define _RPC_AUTH_DES_H 1
+
#include <sys/cdefs.h>
+#include <rpc/auth.h>
__BEGIN_DECLS
-/* This is no complete version of this header. More definitions with
- the real authentication stuff will come in 1997. For now we only
- need to define the function for handling public keys. */
+/* There are two kinds of "names": fullnames and nicknames */
+enum authdes_namekind
+ {
+ ADN_FULLNAME,
+ ADN_NICKNAME
+ };
+
+/* A fullname contains the network name of the client,
+ a conversation key and the window */
+struct authdes_fullname
+ {
+ char *name; /* network name of client, up to MAXNETNAMELEN */
+ des_block key; /* conversation key */
+ uint32_t window; /* associated window */
+ };
+
+/* A credential */
+struct authdes_cred
+ {
+ enum authdes_namekind adc_namekind;
+ struct authdes_fullname adc_fullname;
+ uint32_t adc_nickname;
+ };
+
+/* A timeval replacement for !32bit platforms */
+struct rpc_timeval
+ {
+ uint32_t tv_sec; /* Seconds. */
+ uint32_t tv_usec; /* Microseconds. */
+ };
+
+/* A des authentication verifier */
+struct authdes_verf
+ {
+ union
+ {
+ struct rpc_timeval adv_ctime; /* clear time */
+ des_block adv_xtime; /* crypt time */
+ }
+ adv_time_u;
+ uint32_t adv_int_u;
+ };
+/* des authentication verifier: client variety
+
+ adv_timestamp is the current time.
+ adv_winverf is the credential window + 1.
+ Both are encrypted using the conversation key. */
+#define adv_timestamp adv_time_u.adv_ctime
+#define adv_xtimestamp adv_time_u.adv_xtime
+#define adv_winverf adv_int_u
+
+/* des authentication verifier: server variety
+
+ adv_timeverf is the client's timestamp + client's window
+ adv_nickname is the server's nickname for the client.
+ adv_timeverf is encrypted using the conversation key. */
+#define adv_timeverf adv_time_u.adv_ctime
+#define adv_xtimeverf adv_time_u.adv_xtime
+#define adv_nickname adv_int_u
+
+/* Map a des credential into a unix cred. */
+extern int authdes_getucred __P ((__const struct authdes_cred * __adc,
+ uid_t * __uid, gid_t * __gid,
+ short *__grouplen, gid_t * __groups));
/* Get the public key for NAME and place it in KEY. NAME can only be
up to MAXNETNAMELEN bytes long and the destination buffer KEY should
- have HEXKEYBATES + 1 bytes long to fit all characters from the key. */
+ have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */
extern int getpublickey __P ((__const char *__name, char *__key));
/* Get the secret key for NAME and place it in KEY. PASSWD is used to
decrypt the encrypted key stored in the database. NAME can only be
up to MAXNETNAMELEN bytes long and the destination buffer KEY
- should have HEXKEYBATES + 1 bytes long to fit all characters from
+ should have HEXKEYBYTES + 1 bytes long to fit all characters from
the key. */
extern int getsecretkey __P ((__const char *__name, char *__key,
__const char *__passwd));
+extern int rtime __P ((struct sockaddr_in *__addrp,
+ struct rpc_timeval *__timep,
+ struct rpc_timeval *__timeout));
+
__END_DECLS
+
#endif /* rpc/auth_des.h */
diff --git a/include/rpc/auth_unix.h b/include/rpc/auth_unix.h
index 705741e13..ed3b9322c 100644
--- a/include/rpc/auth_unix.h
+++ b/include/rpc/auth_unix.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -42,6 +42,17 @@
* for the credentials.
*/
+#ifndef _RPC_AUTH_UNIX_H
+#define _RPC_AUTH_UNIX_H 1
+
+#include <features.h>
+#include <sys/types.h>
+#include <rpc/types.h>
+#include <rpc/auth.h>
+#include <rpc/xdr.h>
+
+__BEGIN_DECLS
+
/* The machine name is part of a credential; it may not exceed 255 bytes */
#define MAX_MACHINE_NAME 255
@@ -51,22 +62,29 @@
/*
* Unix style credentials.
*/
-struct authunix_parms {
- u_long aup_time;
- char *aup_machname;
- int aup_uid;
- int aup_gid;
- u_int aup_len;
- int *aup_gids;
-};
+struct authunix_parms
+ {
+ u_long aup_time;
+ char *aup_machname;
+ __uid_t aup_uid;
+ __gid_t aup_gid;
+ u_int aup_len;
+ __gid_t *aup_gids;
+ };
-extern bool_t xdr_authunix_parms();
+extern bool_t xdr_authunix_parms __P ((XDR *__xdrs,
+ struct authunix_parms *__p));
-/*
- * If a response verifier has flavor AUTH_SHORT,
+/*
+ * If a response verifier has flavor AUTH_SHORT,
* then the body of the response verifier encapsulates the following structure;
* again it is serialized in the obvious fashion.
*/
-struct short_hand_verf {
- struct opaque_auth new_cred;
-};
+struct short_hand_verf
+ {
+ struct opaque_auth new_cred;
+ };
+
+__END_DECLS
+
+#endif /* rpc/auth_unix.h */
diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h
index 8c002a19f..b3852927a 100644
--- a/include/rpc/clnt.h
+++ b/include/rpc/clnt.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -34,8 +34,16 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#ifndef _CLNT_
-#define _CLNT_
+#ifndef _RPC_CLNT_H
+#define _RPC_CLNT_H 1
+
+#include <features.h>
+#include <sys/types.h>
+#include <rpc/types.h>
+#include <rpc/auth.h>
+#include <sys/un.h>
+
+__BEGIN_DECLS
/*
* Rpc calls return an enum clnt_stat. This should be looked at more,
@@ -62,22 +70,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, /* unkown protocol */
+ 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
};
@@ -85,19 +104,19 @@ enum clnt_stat {
* Error info.
*/
struct rpc_err {
- enum clnt_stat re_status;
- union {
- int RE_errno; /* realated 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
@@ -110,18 +129,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) __PMT ((CLIENT *, u_long, xdrproc_t,
+ caddr_t, xdrproc_t,
+ caddr_t, struct timeval));
+ /* call remote procedure */
+ void (*cl_abort) __PMT ((void)); /* abort a call */
+ void (*cl_geterr) __PMT ((CLIENT *, struct rpc_err *));
+ /* get specific error code */
+ bool_t (*cl_freeres) __PMT ((CLIENT *, xdrproc_t, caddr_t));
+ /* frees results */
+ void (*cl_destroy) __PMT ((CLIENT *)); /* destroy this structure */
+ bool_t (*cl_control) __PMT ((CLIENT *, int, char *));
+ /* the ioctl() of rpc */
+ } *cl_ops;
+ caddr_t cl_private; /* private stuff */
+};
/*
@@ -185,16 +211,33 @@ 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
+ *
+ * Note: options marked XXX are no-ops in this implementation of RPC.
+ * The are present in TI-RPC but can't be implemented here since they
+ * depend on the presence of STREAMS/TLI, which we don't have.
*/
-#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) XXX */
+#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) XXX */
+#define CLSET_PUSH_TIMOD 17 /* push timod if not already present XXX */
+#define CLSET_POP_TIMOD 18 /* pop timod XXX */
/*
- * 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
@@ -206,7 +249,7 @@ typedef struct {
/*
- * RPCTEST is a test program which is accessable on every rpc
+ * RPCTEST is a test program which is accessible on every rpc
* transport/port. It is used for testing, performance evaluation,
* and network administration.
*/
@@ -224,7 +267,7 @@ typedef struct {
/*
* Below are the client handle creation routines for the various
- * implementations of client side rpc. They can return NULL if a
+ * implementations of client side rpc. They can return NULL if a
* creation failure occurs.
*/
@@ -235,21 +278,22 @@ typedef struct {
* u_long prog;
* u_long vers;
*/
-extern CLIENT *clntraw_create();
+extern CLIENT *clntraw_create __P ((__const u_long __prog,
+ __const u_long __vers));
/*
- * Generic client creation routine. Supported protocols are "udp" and "tcp"
+ * Generic client creation routine. Supported protocols are "udp", "tcp" and
+ * "unix"
+ * CLIENT *
+ * clnt_create(host, prog, vers, prot)
+ * char *host; -- hostname
+ * u_long prog; -- program number
+ * u_ong vers; -- version number
+ * char *prot; -- protocol
*/
-extern CLIENT *
-clnt_create(/*host, prog, vers, prot*/); /*
- char *host; -- hostname
- u_long prog; -- program number
- u_long vers; -- version number
- char *prot; -- protocol
-*/
-
-
+extern CLIENT *clnt_create __P ((__const char *__host, __const u_long __prog,
+ __const u_long __vers, __const char *__prot));
/*
@@ -263,7 +307,10 @@ clnt_create(/*host, prog, vers, prot*/); /*
* u_int sendsz;
* u_int recvsz;
*/
-extern CLIENT *clnttcp_create();
+extern CLIENT *clnttcp_create __P ((struct sockaddr_in *__raddr,
+ u_long __prog, u_long __version,
+ int *__sockp, u_int __sendsz,
+ u_int __recvsz));
/*
* UDP based rpc.
@@ -272,7 +319,7 @@ extern CLIENT *clnttcp_create();
* struct sockaddr_in *raddr;
* u_long program;
* u_long version;
- * struct timeval wait;
+ * struct timeval wait_resend;
* int *sockp;
*
* Same as above, but you specify max packet sizes.
@@ -281,32 +328,65 @@ extern CLIENT *clnttcp_create();
* struct sockaddr_in *raddr;
* u_long program;
* u_long version;
- * struct timeval wait;
+ * struct timeval wait_resend;
* int *sockp;
* u_int sendsz;
* u_int recvsz;
*/
-extern CLIENT *clntudp_create();
-extern CLIENT *clntudp_bufcreate();
+extern CLIENT *clntudp_create __P ((struct sockaddr_in *__raddr,
+ u_long __program, u_long __version,
+ struct timeval __wait_resend,
+ int *__sockp));
+extern CLIENT *clntudp_bufcreate __P ((struct sockaddr_in *__raddr,
+ u_long __program, u_long __version,
+ struct timeval __wait_resend,
+ int *__sockp, u_int __sendsz,
+ u_int __recvsz));
+
+
+/*
+ * AF_UNIX based rpc
+ * CLIENT *
+ * clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
+ * struct sockaddr_un *raddr;
+ * u_long prog;
+ * u_long version;
+ * register int *sockp;
+ * u_int sendsz;
+ * u_int recvsz;
+ */
+extern CLIENT *clntunix_create __P ((struct sockaddr_un *__raddr,
+ u_long __program, u_long __version,
+ 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
*/
-void clnt_pcreateerror(/* char *msg */); /* stderr */
-char *clnt_spcreateerror(/* 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
- */
-void clnt_perrno(/* enum clnt_stat num */); /* stderr */
+ */
+extern void clnt_perrno __P ((enum clnt_stat __num)); /* stderr */
/*
* Print an English error message, given the client error code
*/
-void clnt_perror(/* CLIENT *clnt, char *msg */); /* stderr */
-char *clnt_sperror(/* 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.
*/
struct rpc_createerr {
@@ -321,11 +401,23 @@ extern struct rpc_createerr rpc_createerr;
/*
* Copy error message to buffer.
*/
-char *clnt_sperrno(/* enum clnt_stat num */); /* string */
+extern char *clnt_sperrno __P ((enum clnt_stat __num)); /* string */
+/*
+ * get the port number on the host for the rpc program,version and proto
+ */
+extern int getrpcport __P ((__const char * __host, u_long __prognum,
+ u_long __versnum, u_int proto));
+/*
+ * get the local host's IP address without consulting
+ * name service library functions
+ */
+extern void get_myaddress __P ((struct sockaddr_in *));
#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */
#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */
-#endif /*!_CLNT_*/
+__END_DECLS
+
+#endif /* rpc/clnt.h */
diff --git a/include/rpc/des_crypt.h b/include/rpc/des_crypt.h
new file mode 100644
index 000000000..e20cc3824
--- /dev/null
+++ b/include/rpc/des_crypt.h
@@ -0,0 +1,97 @@
+/*
+ * @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI
+ *
+ * des_crypt.h, des library routine interface
+ * Copyright (C) 1986, Sun Microsystems, Inc.
+ */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#ifndef __DES_CRYPT_H__
+#define __DES_CRYPT_H__ 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+#define DES_MAXDATA 8192 /* max bytes encrypted in one call */
+#define DES_DIRMASK (1 << 0)
+#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */
+#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */
+
+
+#define DES_DEVMASK (1 << 1)
+#define DES_HW (0*DES_DEVMASK) /* Use hardware device */
+#define DES_SW (1*DES_DEVMASK) /* Use software device */
+
+
+#define DESERR_NONE 0 /* succeeded */
+#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */
+#define DESERR_HWERROR 2 /* failed, hardware/driver error */
+#define DESERR_BADPARAM 3 /* failed, bad parameter to call */
+
+#define DES_FAILED(err) \
+ ((err) > DESERR_NOHWDEVICE)
+
+/*
+ * cbc_crypt()
+ * ecb_crypt()
+ *
+ * Encrypt (or decrypt) len bytes of a buffer buf.
+ * The length must be a multiple of eight.
+ * The key should have odd parity in the low bit of each byte.
+ * ivec is the input vector, and is updated to the new one (cbc only).
+ * The mode is created by oring together the appropriate parameters.
+ * DESERR_NOHWDEVICE is returned if DES_HW was specified but
+ * there was no hardware to do it on (the data will still be
+ * encrypted though, in software).
+ */
+
+
+/*
+ * Cipher Block Chaining mode
+ */
+extern int cbc_crypt __P ((char *__key, char *__buf, unsigned __len,
+ unsigned __mode, char *__ivec));
+
+/*
+ * Electronic Code Book mode
+ */
+extern int ecb_crypt __P ((char *__key, char *__buf, unsigned __len,
+ unsigned __mode));
+
+/*
+ * Set des parity for a key.
+ * DES parity is odd and in the low bit of each byte
+ */
+extern void des_setparity __P ((char *__key));
+
+__END_DECLS
+
+#endif
diff --git a/include/rpc/key_prot.h b/include/rpc/key_prot.h
new file mode 100644
index 000000000..3e2eb7208
--- /dev/null
+++ b/include/rpc/key_prot.h
@@ -0,0 +1,346 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _KEY_PROT_H_RPCGEN
+#define _KEY_PROT_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+#if 0
+#pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI"
+#endif
+/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */
+
+/*
+ * Compiled from key_prot.x using rpcgen.
+ * DO NOT EDIT THIS FILE!
+ * This is NOT source code!
+ */
+#define PROOT 3
+#define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"
+#define HEXKEYBYTES 48
+#define KEYSIZE 192
+#define KEYBYTES 24
+#define KEYCHECKSUMSIZE 16
+
+enum keystatus {
+ KEY_SUCCESS = 0,
+ KEY_NOSECRET = 1,
+ KEY_UNKNOWN = 2,
+ KEY_SYSTEMERR = 3,
+};
+typedef enum keystatus keystatus;
+#ifdef __cplusplus
+extern "C" bool_t xdr_keystatus(XDR *, keystatus*);
+#elif __STDC__
+extern bool_t xdr_keystatus(XDR *, keystatus*);
+#else /* Old Style C */
+bool_t xdr_keystatus();
+#endif /* Old Style C */
+
+
+typedef char keybuf[HEXKEYBYTES];
+#ifdef __cplusplus
+extern "C" bool_t xdr_keybuf(XDR *, keybuf);
+#elif __STDC__
+extern bool_t xdr_keybuf(XDR *, keybuf);
+#else /* Old Style C */
+bool_t xdr_keybuf();
+#endif /* Old Style C */
+
+
+typedef char *netnamestr;
+#ifdef __cplusplus
+extern "C" bool_t xdr_netnamestr(XDR *, netnamestr*);
+#elif __STDC__
+extern bool_t xdr_netnamestr(XDR *, netnamestr*);
+#else /* Old Style C */
+bool_t xdr_netnamestr();
+#endif /* Old Style C */
+
+
+struct cryptkeyarg {
+ netnamestr remotename;
+ des_block deskey;
+};
+typedef struct cryptkeyarg cryptkeyarg;
+#ifdef __cplusplus
+extern "C" bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*);
+#elif __STDC__
+extern bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*);
+#else /* Old Style C */
+bool_t xdr_cryptkeyarg();
+#endif /* Old Style C */
+
+
+struct cryptkeyarg2 {
+ netnamestr remotename;
+ netobj remotekey;
+ des_block deskey;
+};
+typedef struct cryptkeyarg2 cryptkeyarg2;
+#ifdef __cplusplus
+extern "C" bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*);
+#elif __STDC__
+extern bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*);
+#else /* Old Style C */
+bool_t xdr_cryptkeyarg2();
+#endif /* Old Style C */
+
+
+struct cryptkeyres {
+ keystatus status;
+ union {
+ des_block deskey;
+ } cryptkeyres_u;
+};
+typedef struct cryptkeyres cryptkeyres;
+#ifdef __cplusplus
+extern "C" bool_t xdr_cryptkeyres(XDR *, cryptkeyres*);
+#elif __STDC__
+extern bool_t xdr_cryptkeyres(XDR *, cryptkeyres*);
+#else /* Old Style C */
+bool_t xdr_cryptkeyres();
+#endif /* Old Style C */
+
+#define MAXGIDS 16
+
+struct unixcred {
+ u_int uid;
+ u_int gid;
+ struct {
+ u_int gids_len;
+ u_int *gids_val;
+ } gids;
+};
+typedef struct unixcred unixcred;
+#ifdef __cplusplus
+extern "C" bool_t xdr_unixcred(XDR *, unixcred*);
+#elif __STDC__
+extern bool_t xdr_unixcred(XDR *, unixcred*);
+#else /* Old Style C */
+bool_t xdr_unixcred();
+#endif /* Old Style C */
+
+
+struct getcredres {
+ keystatus status;
+ union {
+ unixcred cred;
+ } getcredres_u;
+};
+typedef struct getcredres getcredres;
+#ifdef __cplusplus
+extern "C" bool_t xdr_getcredres(XDR *, getcredres*);
+#elif __STDC__
+extern bool_t xdr_getcredres(XDR *, getcredres*);
+#else /* Old Style C */
+bool_t xdr_getcredres();
+#endif /* Old Style C */
+
+
+struct key_netstarg {
+ keybuf st_priv_key;
+ keybuf st_pub_key;
+ netnamestr st_netname;
+};
+typedef struct key_netstarg key_netstarg;
+#ifdef __cplusplus
+extern "C" bool_t xdr_key_netstarg(XDR *, key_netstarg*);
+#elif __STDC__
+extern bool_t xdr_key_netstarg(XDR *, key_netstarg*);
+#else /* Old Style C */
+bool_t xdr_key_netstarg();
+#endif /* Old Style C */
+
+
+struct key_netstres {
+ keystatus status;
+ union {
+ key_netstarg knet;
+ } key_netstres_u;
+};
+typedef struct key_netstres key_netstres;
+#ifdef __cplusplus
+extern "C" bool_t xdr_key_netstres(XDR *, key_netstres*);
+#elif __STDC__
+extern bool_t xdr_key_netstres(XDR *, key_netstres*);
+#else /* Old Style C */
+bool_t xdr_key_netstres();
+#endif /* Old Style C */
+
+
+#ifndef opaque
+#define opaque char
+#endif
+
+
+#define KEY_PROG ((u_long)100029)
+#define KEY_VERS ((u_long)1)
+
+#ifdef __cplusplus
+#define KEY_SET ((u_long)1)
+extern "C" keystatus * key_set_1(opaque *, CLIENT *);
+extern "C" keystatus * key_set_1_svc(opaque *, struct svc_req *);
+#define KEY_ENCRYPT ((u_long)2)
+extern "C" cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *);
+extern "C" cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *);
+#define KEY_DECRYPT ((u_long)3)
+extern "C" cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *);
+extern "C" cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *);
+#define KEY_GEN ((u_long)4)
+extern "C" des_block * key_gen_1(void *, CLIENT *);
+extern "C" des_block * key_gen_1_svc(void *, struct svc_req *);
+#define KEY_GETCRED ((u_long)5)
+extern "C" getcredres * key_getcred_1(netnamestr *, CLIENT *);
+extern "C" getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *);
+
+#elif __STDC__
+#define KEY_SET ((u_long)1)
+extern keystatus * key_set_1(opaque *, CLIENT *);
+extern keystatus * key_set_1_svc(opaque *, struct svc_req *);
+#define KEY_ENCRYPT ((u_long)2)
+extern cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *);
+extern cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *);
+#define KEY_DECRYPT ((u_long)3)
+extern cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *);
+extern cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *);
+#define KEY_GEN ((u_long)4)
+extern des_block * key_gen_1(void *, CLIENT *);
+extern des_block * key_gen_1_svc(void *, struct svc_req *);
+#define KEY_GETCRED ((u_long)5)
+extern getcredres * key_getcred_1(netnamestr *, CLIENT *);
+extern getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *);
+
+#else /* Old Style C */
+#define KEY_SET ((u_long)1)
+extern keystatus * key_set_1();
+extern keystatus * key_set_1_svc();
+#define KEY_ENCRYPT ((u_long)2)
+extern cryptkeyres * key_encrypt_1();
+extern cryptkeyres * key_encrypt_1_svc();
+#define KEY_DECRYPT ((u_long)3)
+extern cryptkeyres * key_decrypt_1();
+extern cryptkeyres * key_decrypt_1_svc();
+#define KEY_GEN ((u_long)4)
+extern des_block * key_gen_1();
+extern des_block * key_gen_1_svc();
+#define KEY_GETCRED ((u_long)5)
+extern getcredres * key_getcred_1();
+extern getcredres * key_getcred_1_svc();
+#endif /* Old Style C */
+#define KEY_VERS2 ((u_long)2)
+
+#ifdef __cplusplus
+extern "C" keystatus * key_set_2(opaque *, CLIENT *);
+extern "C" keystatus * key_set_2_svc(opaque *, struct svc_req *);
+extern "C" cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *);
+extern "C" cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *);
+extern "C" cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *);
+extern "C" cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *);
+extern "C" des_block * key_gen_2(void *, CLIENT *);
+extern "C" des_block * key_gen_2_svc(void *, struct svc_req *);
+extern "C" getcredres * key_getcred_2(netnamestr *, CLIENT *);
+extern "C" getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *);
+#define KEY_ENCRYPT_PK ((u_long)6)
+extern "C" cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *);
+extern "C" cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
+#define KEY_DECRYPT_PK ((u_long)7)
+extern "C" cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *);
+extern "C" cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
+#define KEY_NET_PUT ((u_long)8)
+extern "C" keystatus * key_net_put_2(key_netstarg *, CLIENT *);
+extern "C" keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *);
+#define KEY_NET_GET ((u_long)9)
+extern "C" key_netstres * key_net_get_2(void *, CLIENT *);
+extern "C" key_netstres * key_net_get_2_svc(void *, struct svc_req *);
+#define KEY_GET_CONV ((u_long)10)
+extern "C" cryptkeyres * key_get_conv_2(opaque *, CLIENT *);
+extern "C" cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *);
+
+#elif __STDC__
+extern keystatus * key_set_2(opaque *, CLIENT *);
+extern keystatus * key_set_2_svc(opaque *, struct svc_req *);
+extern cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *);
+extern cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *);
+extern cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *);
+extern cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *);
+extern des_block * key_gen_2(void *, CLIENT *);
+extern des_block * key_gen_2_svc(void *, struct svc_req *);
+extern getcredres * key_getcred_2(netnamestr *, CLIENT *);
+extern getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *);
+#define KEY_ENCRYPT_PK ((u_long)6)
+extern cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *);
+extern cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
+#define KEY_DECRYPT_PK ((u_long)7)
+extern cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *);
+extern cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
+#define KEY_NET_PUT ((u_long)8)
+extern keystatus * key_net_put_2(key_netstarg *, CLIENT *);
+extern keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *);
+#define KEY_NET_GET ((u_long)9)
+extern key_netstres * key_net_get_2(void *, CLIENT *);
+extern key_netstres * key_net_get_2_svc(void *, struct svc_req *);
+#define KEY_GET_CONV ((u_long)10)
+extern cryptkeyres * key_get_conv_2(opaque *, CLIENT *);
+extern cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *);
+
+#else /* Old Style C */
+extern keystatus * key_set_2();
+extern keystatus * key_set_2_svc();
+extern cryptkeyres * key_encrypt_2();
+extern cryptkeyres * key_encrypt_2_svc();
+extern cryptkeyres * key_decrypt_2();
+extern cryptkeyres * key_decrypt_2_svc();
+extern des_block * key_gen_2();
+extern des_block * key_gen_2_svc();
+extern getcredres * key_getcred_2();
+extern getcredres * key_getcred_2_svc();
+#define KEY_ENCRYPT_PK ((u_long)6)
+extern cryptkeyres * key_encrypt_pk_2();
+extern cryptkeyres * key_encrypt_pk_2_svc();
+#define KEY_DECRYPT_PK ((u_long)7)
+extern cryptkeyres * key_decrypt_pk_2();
+extern cryptkeyres * key_decrypt_pk_2_svc();
+#define KEY_NET_PUT ((u_long)8)
+extern keystatus * key_net_put_2();
+extern keystatus * key_net_put_2_svc();
+#define KEY_NET_GET ((u_long)9)
+extern key_netstres * key_net_get_2();
+extern key_netstres * key_net_get_2_svc();
+#define KEY_GET_CONV ((u_long)10)
+extern cryptkeyres * key_get_conv_2();
+extern cryptkeyres * key_get_conv_2_svc();
+#endif /* Old Style C */
+
+#endif /* !_KEY_PROT_H_RPCGEN */
diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h
new file mode 100644
index 000000000..6b820c84d
--- /dev/null
+++ b/include/rpc/netdb.h
@@ -0,0 +1,74 @@
+/* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+/* @(#)rpc.h 1.8 87/07/24 SMI */
+
+/* Cleaned up for GNU C library roland@gnu.ai.mit.edu:
+ added multiple inclusion protection and use of <sys/cdefs.h>.
+ In GNU this file is #include'd by <netdb.h>. */
+
+#ifndef _RPC_NETDB_H
+#define _RPC_NETDB_H 1
+
+#include <features.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+__BEGIN_DECLS
+
+struct rpcent
+{
+ char *r_name; /* Name of server for this rpc program. */
+ char **r_aliases; /* Alias list. */
+ int r_number; /* RPC program number. */
+};
+
+extern void setrpcent __P ((int _stayopen));
+extern void endrpcent __P ((void));
+extern struct rpcent *getrpcbyname __P ((__const char *__name));
+extern struct rpcent *getrpcbynumber __P ((int __number));
+extern struct rpcent *getrpcent __P ((void));
+
+#ifdef __USE_MISC
+extern int getrpcbyname_r __P ((__const char *__name,
+ struct rpcent *__result_buf, char *__buffer,
+ size_t __buflen, struct rpcent **__result));
+
+extern int getrpcbynumber_r __P ((int __number, struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct rpcent **__result));
+
+extern int getrpcent_r __P ((struct rpcent *__result_buf, char *__buffer,
+ size_t __buflen, struct rpcent **__result));
+#endif
+
+__END_DECLS
+
+#endif /* rpc/netdb.h */
diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index d2ea2a88e..d9800d400 100644
--- a/include/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -35,6 +35,19 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
+#ifndef _RPC_PMAP_CLNT_H
+#define _RPC_PMAP_CLNT_H 1
+
+#include <features.h>
+#include <rpc/types.h>
+#include <rpc/xdr.h>
+#include <rpc/clnt.h>
+
+__BEGIN_DECLS
+
+typedef bool_t (*resultproc_t) __PMT ((caddr_t resp,
+ struct sockaddr_in *raddr));
+
/*
* Usage:
* success = pmap_set(program, version, protocol, port);
@@ -43,7 +56,7 @@
* head = pmap_getmaps(address);
* clnt_stat = pmap_rmtcall(address, program, version, procedure,
* xdrargs, argsp, xdrres, resp, tout, port_ptr)
- * (works for udp only.)
+ * (works for udp only.)
* clnt_stat = clnt_broadcast(program, version, procedure,
* xdrargs, argsp, xdrres, resp, eachresult)
* (like pmap_rmtcall, except the call is broadcasted to all
@@ -57,9 +70,31 @@
* address if the responder to the broadcast.
*/
-extern bool_t pmap_set();
-extern bool_t pmap_unset();
-extern struct pmaplist *pmap_getmaps();
-enum clnt_stat pmap_rmtcall();
-enum clnt_stat clnt_broadcast();
-extern u_short pmap_getport();
+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 ((__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,
+ __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 ((__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,
+ __const u_long __program,
+ __const u_long __version,
+ u_int __protocol));
+
+__END_DECLS
+
+#endif /* rpc/pmap_clnt.h */
diff --git a/include/rpc/pmap_prot.h b/include/rpc/pmap_prot.h
index ccf7a77b4..52185d319 100644
--- a/include/rpc/pmap_prot.h
+++ b/include/rpc/pmap_prot.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -33,8 +33,18 @@
* Protocol for the local binder service, or pmap.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * The following procedures are supported by the protocol:
+ */
+
+#ifndef _RPC_PMAP_PROT_H
+#define _RPC_PMAP_PROT_H 1
+
+#include <features.h>
+
+#include <rpc/xdr.h>
+
+__BEGIN_DECLS
+
+/* The following procedures are supported by the protocol:
*
* PMAPPROC_NULL() returns ()
* takes nothing, returns nothing
@@ -84,11 +94,15 @@ struct pmap {
long unsigned pm_port;
};
-extern bool_t xdr_pmap();
+extern bool_t xdr_pmap __P ((XDR *__xdrs, struct pmap *__regs));
struct pmaplist {
struct pmap pml_map;
struct pmaplist *pml_next;
};
-extern bool_t xdr_pmaplist();
+extern bool_t xdr_pmaplist __P ((XDR *__xdrs, struct pmaplist **__rp));
+
+__END_DECLS
+
+#endif /* rpc/pmap_prot.h */
diff --git a/include/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h
index ee68cebec..bb35ad63e 100644
--- a/include/rpc/pmap_rmt.h
+++ b/include/rpc/pmap_rmt.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -35,13 +35,23 @@
* Copyright (C) 1986, Sun Microsystems, Inc.
*/
+#ifndef _RPC_PMAP_RMT_H
+#define _RPC_PMAP_RMT_H 1
+
+#include <features.h>
+#include <sys/types.h>
+#include <rpc/types.h>
+#include <rpc/xdr.h>
+
+__BEGIN_DECLS
+
struct rmtcallargs {
u_long prog, vers, proc, arglen;
caddr_t args_ptr;
xdrproc_t xdr_args;
};
-bool_t xdr_rmtcall_args();
+extern bool_t xdr_rmtcall_args __P ((XDR *__xdrs, struct rmtcallargs *__crp));
struct rmtcallres {
u_long *port_ptr;
@@ -50,4 +60,8 @@ struct rmtcallres {
xdrproc_t xdr_results;
};
-bool_t xdr_rmtcallres();
+extern bool_t xdr_rmtcallres __P ((XDR *__xdrs, struct rmtcallres *__crp));
+
+__END_DECLS
+
+#endif /* rpc/pmap_rmt.h */
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index f1da8fa7f..a966d2e23 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -6,11 +6,11 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
@@ -34,12 +34,9 @@
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#ifndef __RPC_HEADER__
-#define __RPC_HEADER__
-#ifdef __linux__
-#include <sys/time.h>
-#endif
+#ifndef _RPC_RPC_H
+#define _RPC_RPC_H 1
#include <rpc/types.h> /* some typedefs */
#include <netinet/in.h>
@@ -56,11 +53,7 @@
/* semi-private protocol headers */
#include <rpc/rpc_msg.h> /* protocol for rpc messages */
#include <rpc/auth_unix.h> /* protocol for unix style cred */
-/*
- * Uncomment-out the next line if you are building the rpc library with
- * DES Authentication (see the README file in the secure_rpc/ directory).
- */
-/*#include <rpc/auth_des.h>*/ /* protocol for des style cred */
+#include <rpc/auth_des.h> /* protocol for des style cred */
/* Server side only remote procedure callee */
#include <rpc/svc.h> /* service manager and multiplexer */
@@ -72,8 +65,6 @@
* defined by <rpc/netdb.h> included in <netdb.h>.
*/
/* routines for parsing /etc/rpc */
-#if 0
#include <rpc/netdb.h> /* structures and routines to parse /etc/rpc */
-#endif
-#endif /* ndef __RPC_HEADER__ */
+#endif /* rpc/rpc.h */
diff --git a/include/rpc/rpc_des.h b/include/rpc/rpc_des.h
new file mode 100644
index 000000000..0f36d1697
--- /dev/null
+++ b/include/rpc/rpc_des.h
@@ -0,0 +1,72 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+/*
+ * Generic DES driver interface
+ * Keep this file hardware independent!
+ * Copyright (c) 1986 by Sun Microsystems, Inc.
+ */
+
+#ifndef _DES_H
+#define _DES_H
+
+#include <sys/types.h>
+
+#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
+#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
+
+enum desdir
+ {
+ ENCRYPT, DECRYPT
+ };
+enum desmode
+ {
+ CBC, ECB
+ };
+
+/*
+ * parameters to ioctl call
+ */
+struct desparams
+ {
+ u_char des_key[8]; /* key (with low bit parity) */
+ enum desdir des_dir; /* direction */
+ enum desmode des_mode; /* mode */
+ u_char des_ivec[8]; /* input vector */
+ unsigned des_len; /* number of bytes to crypt */
+ union
+ {
+ u_char UDES_data[DES_QUICKLEN];
+ u_char *UDES_buf;
+ }
+ UDES;
+#define des_data UDES.UDES_data /* direct data here if quick */
+#define des_buf UDES.UDES_buf /* otherwise, pointer to data */
+ };
+
+#endif
diff --git a/include/rpc/rpc_msg.h b/include/rpc/rpc_msg.h
index b78872b6a..e2908ac9c 100644
--- a/include/rpc/rpc_msg.h
+++ b/include/rpc/rpc_msg.h
@@ -6,29 +6,37 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/* @(#)rpc_msg.h 1.7 86/07/16 SMI */
+#ifndef _RPC_MSG_H
+#define _RPC_MSG_H 1
+
+#include <sys/cdefs.h>
+
+#include <rpc/xdr.h>
+#include <rpc/clnt.h>
+
/*
* rpc_msg.h
* rpc message definition
@@ -39,9 +47,11 @@
#define RPC_MSG_VERSION ((u_long) 2)
#define RPC_SERVICE_PORT ((u_short) 2048)
+__BEGIN_DECLS
+
/*
* Bottom up definition of an rpc message.
- * NOTE: call and reply use the same overall stuct but
+ * NOTE: call and reply use the same overall struct but
* different parts of unions within it.
*/
@@ -160,7 +170,7 @@ struct rpc_msg {
* XDR *xdrs;
* struct rpc_msg *cmsg;
*/
-extern bool_t xdr_callmsg();
+extern bool_t xdr_callmsg __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
/*
* XDR routine to pre-serialize the static part of a rpc message.
@@ -168,7 +178,7 @@ extern bool_t xdr_callmsg();
* XDR *xdrs;
* struct rpc_msg *cmsg;
*/
-extern bool_t xdr_callhdr();
+extern bool_t xdr_callhdr __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
/*
* XDR routine to handle a rpc reply.
@@ -176,7 +186,7 @@ extern bool_t xdr_callhdr();
* XDR *xdrs;
* struct rpc_msg *rmsg;
*/
-extern bool_t xdr_replymsg();
+extern bool_t xdr_replymsg __P ((XDR *__xdrs, struct rpc_msg *__rmsg));
/*
* Fills in the error part of a reply message.
@@ -184,4 +194,9 @@ extern bool_t xdr_replymsg();
* struct rpc_msg *msg;
* struct rpc_err *error;
*/
-extern void _seterr_reply();
+extern void _seterr_reply __P ((struct rpc_msg *__msg,
+ struct rpc_err *__error));
+
+__END_DECLS
+
+#endif /* rpc/rpc_msg.h */
diff --git a/include/rpc/svc.h b/include/rpc/svc.h
index a36a24ba0..4ac2a5cdf 100644
--- a/include/rpc/svc.h
+++ b/include/rpc/svc.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -34,8 +34,13 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#ifndef __SVC_HEADER__
-#define __SVC_HEADER__
+#ifndef _RPC_SVC_H
+#define _RPC_SVC_H 1
+
+#include <features.h>
+#include <rpc/rpc_msg.h>
+
+__BEGIN_DECLS
/*
* This interface must manage two items concerning remote procedure calling:
@@ -68,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 incomming 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) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+ /* receive incoming requests */
+ enum xprt_stat (*xp_stat) __PMT ((SVCXPRT *__xprt));
+ /* get transport status */
+ bool_t (*xp_getargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+ caddr_t args_ptr)); /* get arguments */
+ bool_t (*xp_reply) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+ /* send reply */
+ bool_t (*xp_freeargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+ caddr_t args_ptr));
+ /* free mem allocated for args */
+ void (*xp_destroy) __PMT ((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
@@ -142,6 +155,10 @@ struct svc_req {
SVCXPRT *rq_xprt; /* associated transport */
};
+#ifndef __DISPATCH_FN_T
+#define __DISPATCH_FN_T
+typedef void (*__dispatch_fn_t) __PMT ((struct svc_req*, SVCXPRT*));
+#endif
/*
* Service registration
@@ -151,8 +168,11 @@ struct svc_req {
* u_long prog;
* u_long vers;
* void (*dispatch)();
- * int protocol; */ /* like TCP or UDP, zero means do not register*/
-extern bool_t svc_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, __dispatch_fn_t __dispatch,
+ u_long __protocol));
/*
* Service un-registration
@@ -161,7 +181,7 @@ extern bool_t svc_register();
* u_long prog;
* u_long vers;
*/
-extern void svc_unregister();
+extern void svc_unregister __P ((u_long __prog, u_long __vers));
/*
* Transport registration.
@@ -169,7 +189,7 @@ extern void svc_unregister();
* xprt_register(xprt)
* SVCXPRT *xprt;
*/
-extern void xprt_register();
+extern void xprt_register __P ((SVCXPRT *__xprt));
/*
* Transport un-register
@@ -177,7 +197,7 @@ extern void xprt_register();
* xprt_unregister(xprt)
* SVCXPRT *xprt;
*/
-extern void xprt_unregister();
+extern void xprt_unregister __P ((SVCXPRT *__xprt));
@@ -185,7 +205,7 @@ extern void xprt_unregister();
/*
* When the service routine is called, it must first check to see if it
* knows about the procedure; if not, it should call svcerr_noproc
- * and return. If so, it should deserialize its arguments via
+ * and return. If so, it should deserialize its arguments via
* SVC_GETARGS (defined above). If the deserialization does not work,
* svcerr_decode should be called followed by a return. Successful
* decoding of the arguments should be followed the execution of the
@@ -196,7 +216,7 @@ extern void xprt_unregister();
* Note: do not confuse access-control failure with weak authentication!
*
* NB: In pure implementations of rpc, the caller always waits for a reply
- * msg. This message is sent when svc_sendreply is called.
+ * msg. This message is sent when svc_sendreply is called.
* Therefore pure service implementations should always call
* svc_sendreply even if the function logically returns void; use
* xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
@@ -208,21 +228,30 @@ extern void xprt_unregister();
* deadlock the caller and server processes!
*/
-extern bool_t svc_sendreply();
-extern void svcerr_decode();
-extern void svcerr_weakauth();
-extern void svcerr_noproc();
-extern void svcerr_progvers();
-extern void svcerr_auth();
-extern void svcerr_noprog();
-extern void svcerr_systemerr();
-
+extern bool_t svc_sendreply __P ((SVCXPRT *xprt, xdrproc_t __xdr_results,
+ caddr_t __xdr_location));
+
+extern void svcerr_decode __P ((SVCXPRT *__xprt));
+
+extern void svcerr_weakauth __P ((SVCXPRT *__xprt));
+
+extern void svcerr_noproc __P ((SVCXPRT *__xprt));
+
+extern void svcerr_progvers __P ((SVCXPRT *__xprt, u_long __low_vers,
+ u_long __high_vers));
+
+extern void svcerr_auth __P ((SVCXPRT *__xprt, enum auth_stat __why));
+
+extern void svcerr_noprog __P ((SVCXPRT *__xprt));
+
+extern void svcerr_systemerr __P ((SVCXPRT *__xprt));
+
/*
* Lowest level dispatching -OR- who owns this process anyway.
* Somebody has to wait for incoming requests and then call the correct
* service routine. The routine svc_run does infinite waiting; i.e.,
* svc_run never returns.
- * Since another (co-existant) package may wish to selectively wait for
+ * Since another (coexistent) package may wish to selectively wait for
* incoming calls or other events outside of the rpc architecture, the
* routine svc_getreq is provided. It must be passed readfds, the
* "in-place" results of a select system call (see select, section 2).
@@ -230,7 +259,7 @@ extern void svcerr_systemerr();
/*
* Global keeper of rpc service descriptors in use
- * dynamic; must be inspected before each call to select
+ * dynamic; must be inspected before each call to select
*/
#ifdef FD_SETSIZE
extern fd_set svc_fdset;
@@ -243,11 +272,10 @@ 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();
-extern void svc_getreqset(); /* takes fdset instead of int */
-extern void svc_run(); /* never returns */
+extern void svc_getreq __P ((int __rdfds));
+extern void svc_getreqset __P ((fd_set *__readfds));
+extern void svc_exit __P ((void));
+extern void svc_run __P ((void));
/*
* Socket to use on svcxxx_create call to get default socket
@@ -261,19 +289,29 @@ extern void svc_run(); /* never returns */
/*
* Memory based rpc for testing and timing.
*/
-extern SVCXPRT *svcraw_create();
+extern SVCXPRT *svcraw_create __P ((void));
/*
* Udp based rpc.
*/
-extern SVCXPRT *svcudp_create();
-extern SVCXPRT *svcudp_bufcreate();
+extern SVCXPRT *svcudp_create __P ((int __sock));
+extern SVCXPRT *svcudp_bufcreate __P ((int __sock, u_int __sendsz,
+ u_int __recvsz));
/*
* Tcp based rpc.
*/
-extern SVCXPRT *svctcp_create();
+extern SVCXPRT *svctcp_create __P ((int __sock, u_int __sendsize,
+ u_int __recvsize));
+
+
+/*
+ * Unix based rpc.
+ */
+extern SVCXPRT *svcunix_create __P ((int __sock, u_int __sendsize,
+ u_int __recvsize, char *__path));
+__END_DECLS
-#endif !__SVC_HEADER__
+#endif /* rpc/svc.h */
diff --git a/include/rpc/svc_auth.h b/include/rpc/svc_auth.h
index a36a01aba..ad08b71c7 100644
--- a/include/rpc/svc_auth.h
+++ b/include/rpc/svc_auth.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -31,12 +31,24 @@
/*
* svc_auth.h, Service side of rpc authentication.
- *
+ *
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
+#ifndef _RPC_SVC_AUTH_H
+#define _RPC_SVC_AUTH_H 1
+
+#include <features.h>
+#include <rpc/svc.h>
+
+__BEGIN_DECLS
/*
* Server side authenticator
*/
-extern enum auth_stat _authenticate();
+extern enum auth_stat _authenticate __P ((struct svc_req *__rqst,
+ struct rpc_msg *__msg));
+
+__END_DECLS
+
+#endif /* rpc/svc_auth.h */
diff --git a/include/rpc/types.h b/include/rpc/types.h
index 96d92428c..61ea3c19f 100644
--- a/include/rpc/types.h
+++ b/include/rpc/types.h
@@ -6,45 +6,54 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/* @(#)types.h 1.18 87/07/24 SMI */
+/* fixincludes should not add extern "C" to this file */
/*
* Rpc additions to <sys/types.h>
*/
-#ifndef __TYPES_RPC_HEADER__
-#define __TYPES_RPC_HEADER__
+#ifndef _RPC_TYPES_H
+#define _RPC_TYPES_H 1
+
+typedef int bool_t;
+typedef int enum_t;
+
+#define __dontcare__ -1
+
+#ifndef FALSE
+# define FALSE (0)
+#endif
+
+#ifndef TRUE
+# define TRUE (1)
+#endif
-#define bool_t int
-#define enum_t int
-#define FALSE (0)
-#define TRUE (1)
-#define __dontcare__ -1
#ifndef NULL
-# define NULL 0
+# define NULL 0
#endif
-#include <stdlib.h>
+#include <stdlib.h> /* For malloc decl. */
#define mem_alloc(bsize) malloc(bsize)
#define mem_free(ptr, bsize) free(ptr)
@@ -52,14 +61,15 @@
#include <sys/types.h>
#endif
#include <sys/time.h>
+#include <sys/param.h>
+
+#include <netinet/in.h>
-#ifndef linux
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK (u_long)0x7F000001
#endif
-#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
-#endif /* ndef __TYPES_RPC_HEADER__ */
+#endif /* rpc/types.h */
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index 6cd3e6fe0..c2505ca95 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -1,4 +1,3 @@
-/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -6,28 +5,27 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
-/* @(#)xdr.h 1.19 87/04/22 SMI */
/*
* xdr.h, External Data Representation Serialization Routines.
@@ -35,8 +33,17 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#ifndef __XDR_HEADER__
-#define __XDR_HEADER__
+#ifndef _RPC_XDR_H
+#define _RPC_XDR_H 1
+
+#include <features.h>
+#include <sys/types.h>
+#include <rpc/types.h>
+
+/* We need FILE. */
+#include <stdio.h>
+
+__BEGIN_DECLS
/*
* XDR provides a conventional way for converting between C data
@@ -47,10 +54,10 @@
*
* 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
@@ -74,17 +81,68 @@
* request.
*/
enum xdr_op {
- XDR_ENCODE=0,
- XDR_DECODE=1,
- XDR_FREE=2
+ XDR_ENCODE = 0,
+ XDR_DECODE = 1,
+ XDR_FREE = 2
};
/*
* This is the number of bytes per unit of external data.
*/
#define BYTES_PER_XDR_UNIT (4)
+/*
+ * This only works if the above is a power of 2. But it's defined to be
+ * 4 by the appropriate RFCs. So it will work. And it's normally quicker
+ * than the old routine.
+ */
+#if 1
+#define RNDUP(x) (((x) + BYTES_PER_XDR_UNIT - 1) & ~(BYTES_PER_XDR_UNIT - 1))
+#else /* this is the old routine */
#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
* BYTES_PER_XDR_UNIT)
+#endif
+
+/*
+ * The XDR handle.
+ * Contains operation which is being applied to the stream,
+ * 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 XDR XDR;
+struct XDR
+ {
+ enum xdr_op x_op; /* operation; fast additional param */
+ 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, __const 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 char *__addr,
+ u_int __len));
+ /* put some bytes to " */
+ u_int (*x_getpostn) __P ((__const XDR *__xdrs));
+ /* returns bytes off from beginning */
+ bool_t (*x_setpostn) __P ((XDR *__xdrs, u_int pos));
+ /* lets you reposition the stream */
+ int32_t *(*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 */
+ bool_t (*x_getint32) __P ((XDR *__xdrs, int32_t *__ip));
+ /* get a int from underlying stream */
+ bool_t (*x_putint32) __P ((XDR *__xdrs, __const int32_t *__ip));
+ /* put a int to " */
+ }
+ *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.
@@ -93,43 +151,31 @@ enum xdr_op {
* 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)();
+typedef bool_t (*xdrproc_t) __P ((XDR *, void *,...));
-/*
- * The XDR handle.
- * Contains operation which is being applied to the stream,
- * an operations vector for the paticular implementation (e.g. see xdr_mem.c),
- * and two private fields for the use of the particular impelementation.
- */
-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;
/*
* Operations defined on a XDR handle
*
- * XDR *xdrs;
- * long *longp;
- * caddr_t addr;
- * u_int len;
- * u_int pos;
+ * XDR *xdrs;
+ * int32_t *int32p;
+ * long *longp;
+ * caddr_t addr;
+ * u_int len;
+ * u_int pos;
*/
+#define XDR_GETINT32(xdrs, int32p) \
+ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
+#define xdr_getint32(xdrs, int32p) \
+ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
+
+#define XDR_PUTINT32(xdrs, int32p) \
+ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
+#define xdr_putint32(xdrs, int32p) \
+ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
+
#define XDR_GETLONG(xdrs, longp) \
(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
#define xdr_getlong(xdrs, longp) \
@@ -165,12 +211,16 @@ typedef struct {
#define xdr_inline(xdrs, len) \
(*(xdrs)->x_ops->x_inline)(xdrs, len)
-#define XDR_DESTROY(xdrs) \
- if ((xdrs)->x_ops->x_destroy) \
- (*(xdrs)->x_ops->x_destroy)(xdrs)
-#define xdr_destroy(xdrs) \
- if ((xdrs)->x_ops->x_destroy) \
- (*(xdrs)->x_ops->x_destroy)(xdrs)
+#define XDR_DESTROY(xdrs) \
+ do { \
+ if ((xdrs)->x_ops->x_destroy) \
+ (*(xdrs)->x_ops->x_destroy)(xdrs); \
+ } while (0)
+#define xdr_destroy(xdrs) \
+ do { \
+ if ((xdrs)->x_ops->x_destroy) \
+ (*(xdrs)->x_ops->x_destroy)(xdrs); \
+ } while (0)
/*
* Support struct for discriminated unions.
@@ -183,88 +233,149 @@ typedef struct {
* 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;
};
/*
- * In-line routines for fast encode/decode of primitve data types.
+ * Inline routines for fast encode/decode of primitive data types.
* Caveat emptor: these use single memory cycles to get the
* 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.
*
* N.B. and frozen for all time: each data type here uses 4 bytes
* of external representation.
*/
-#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++))
-#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v))
-#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
-#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
-#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
-#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
-#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
+#define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++))
+#define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)(v)))
+#define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf))
+#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32(buf, (int32_t)(v))
-#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
+/* WARNING: The IXDR_*_LONG defines are removed by Sun for new platforms
+ * and shouldn't be used any longer. Code which use this defines or longs
+ * in the RPC code will not work on 64bit Solaris platforms !
+ */
+#define IXDR_GET_LONG(buf) \
+ ((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))
+#define IXDR_PUT_LONG(buf, v) \
+ (*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))
+#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
+#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v))
+
+
+#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
+#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
+#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
+#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
+
+#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG(buf, (long)(v))
+#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG(buf, (long)(v))
+#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v))
+#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v))
/*
* These are the "generic" xdr routines.
+ * None of these can have const applied because it's not possible to
+ * know whether the call is a read or a write to the passed parameter
+ * also, the XDR structure is always updated by some of these calls.
*/
-extern bool_t xdr_void();
-extern bool_t xdr_int();
-extern bool_t xdr_u_int();
-extern bool_t xdr_long();
-extern bool_t xdr_u_long();
-extern bool_t xdr_short();
-extern bool_t xdr_u_short();
-extern bool_t xdr_bool();
-extern bool_t xdr_enum();
-extern bool_t xdr_array();
-extern bool_t xdr_bytes();
-extern bool_t xdr_opaque();
-extern bool_t xdr_string();
-extern bool_t xdr_union();
-extern bool_t xdr_char();
-extern bool_t xdr_u_char();
-extern bool_t xdr_vector();
-extern bool_t xdr_float();
-extern bool_t xdr_double();
-extern bool_t xdr_reference();
-extern bool_t xdr_pointer();
-extern bool_t xdr_wrapstring();
+extern bool_t xdr_void __P ((void));
+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_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_hyper __P ((XDR *__xdrs, quad_t *__llp));
+extern bool_t xdr_u_hyper __P ((XDR *__xdrs, u_quad_t *__ullp));
+extern bool_t xdr_longlong_t __P ((XDR *__xdrs, quad_t *__llp));
+extern bool_t xdr_u_longlong_t __P ((XDR *__xdrs, u_quad_t *__ullp));
+extern bool_t xdr_int8_t __P ((XDR *__xdrs, int8_t *__ip));
+extern bool_t xdr_uint8_t __P ((XDR *__xdrs, uint8_t *__up));
+extern bool_t xdr_int16_t __P ((XDR *__xdrs, int16_t *__ip));
+extern bool_t xdr_uint16_t __P ((XDR *__xdrs, uint16_t *__up));
+extern bool_t xdr_int32_t __P ((XDR *__xdrs, int32_t *__ip));
+extern bool_t xdr_uint32_t __P ((XDR *__xdrs, uint32_t *__up));
+extern bool_t xdr_int64_t __P ((XDR *__xdrs, int64_t *__ip));
+extern bool_t xdr_uint64_t __P ((XDR *__xdrs, uint64_t *__up));
+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 *__xpp, 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 u_long xdr_sizeof __P ((xdrproc_t, void *));
/*
* 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;
+#define MAX_NETOBJ_SZ 1024
+struct netobj
+{
+ u_int n_len;
+ char *n_bytes;
};
typedef struct netobj netobj;
-extern bool_t xdr_netobj();
+extern bool_t xdr_netobj __P ((XDR *__xdrs, struct netobj *__np));
/*
* These are the public routines for the various implementations of
* xdr streams.
*/
-extern void xdrmem_create(); /* XDR using memory buffers */
-extern void xdrstdio_create(); /* XDR using stdio library */
-extern void xdrrec_create(); /* XDR pseudo records for tcp */
-extern bool_t xdrrec_endofrecord(); /* make end of xdr record */
-extern bool_t xdrrec_skiprecord(); /* move to beginning of next record */
-extern bool_t xdrrec_eof(); /* true if no more input */
-
-#endif !__XDR_HEADER__
+
+/* XDR using memory buffers */
+extern void xdrmem_create __P ((XDR *__xdrs, __const caddr_t __addr,
+ u_int __size, enum xdr_op __xop));
+
+/* XDR using stdio library */
+extern void xdrstdio_create __P ((XDR *__xdrs, FILE *__file,
+ enum xdr_op __xop));
+
+/* XDR pseudo records for tcp */
+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));
+
+/* move to beginning of next record */
+extern bool_t xdrrec_skiprecord __P ((XDR *__xdrs));
+
+/* true if no more input */
+extern bool_t xdrrec_eof __P ((XDR *__xdrs));
+
+/* free memory buffers for xdr */
+extern void xdr_free __P ((xdrproc_t __proc, char *__objp));
+
+__END_DECLS
+
+#endif /* rpc/xdr.h */