xref: /onnv-gate/usr/src/uts/common/rpc/clnt.h (revision 11380:73d454719071)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
56403Sgt29601  * Common Development and Distribution License (the "License").
66403Sgt29601  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11380SMarcel.Telka@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
260Sstevel@tonic-gate /* All Rights Reserved */
270Sstevel@tonic-gate /*
280Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley
290Sstevel@tonic-gate  * 4.3 BSD under license from the Regents of the University of
300Sstevel@tonic-gate  * California.
310Sstevel@tonic-gate  */
320Sstevel@tonic-gate 
330Sstevel@tonic-gate /*
340Sstevel@tonic-gate  * clnt.h - Client side remote procedure call interface.
350Sstevel@tonic-gate  */
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #ifndef	_RPC_CLNT_H
380Sstevel@tonic-gate #define	_RPC_CLNT_H
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #include <sys/types.h>
410Sstevel@tonic-gate #include <rpc/rpc_com.h>
420Sstevel@tonic-gate #include <rpc/clnt_stat.h>
430Sstevel@tonic-gate #include <rpc/auth.h>
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * rpc calls return an enum clnt_stat.  This should be looked at more,
470Sstevel@tonic-gate  * since each implementation is required to live with this (implementation
480Sstevel@tonic-gate  * independent) list of errors.
490Sstevel@tonic-gate  */
500Sstevel@tonic-gate #include <sys/netconfig.h>
510Sstevel@tonic-gate #ifdef _KERNEL
520Sstevel@tonic-gate #include <sys/t_kuser.h>
530Sstevel@tonic-gate #endif	/* _KERNEL */
540Sstevel@tonic-gate 
550Sstevel@tonic-gate #ifdef __cplusplus
560Sstevel@tonic-gate extern "C" {
570Sstevel@tonic-gate #endif
580Sstevel@tonic-gate 
590Sstevel@tonic-gate /*
600Sstevel@tonic-gate  * Following defines the multicast group address used by IPV6 enabled
610Sstevel@tonic-gate  * client to do the broadcast. IPv6 doesn't have any broadcast support
620Sstevel@tonic-gate  * as IPv4 provides, thus it used this reserved address which is joined
630Sstevel@tonic-gate  * by all rpc clients.
640Sstevel@tonic-gate  */
650Sstevel@tonic-gate 
660Sstevel@tonic-gate #define	RPCB_MULTICAST_ADDR "FF02::202"
670Sstevel@tonic-gate 
680Sstevel@tonic-gate /*
690Sstevel@tonic-gate  * the following errors are in general unrecoverable.  The caller
700Sstevel@tonic-gate  * should give up rather than retry.
710Sstevel@tonic-gate  */
720Sstevel@tonic-gate #define	IS_UNRECOVERABLE_RPC(s)	(((s) == RPC_AUTHERROR) || \
730Sstevel@tonic-gate 	((s) == RPC_CANTENCODEARGS) || \
740Sstevel@tonic-gate 	((s) == RPC_CANTDECODERES) || \
750Sstevel@tonic-gate 	((s) == RPC_VERSMISMATCH) || \
760Sstevel@tonic-gate 	((s) == RPC_PROCUNAVAIL) || \
770Sstevel@tonic-gate 	((s) == RPC_PROGUNAVAIL) || \
780Sstevel@tonic-gate 	((s) == RPC_PROGVERSMISMATCH) || \
797387SRobert.Gordon@Sun.COM 	((s) == RPC_SYSTEMERROR) || \
800Sstevel@tonic-gate 	((s) == RPC_CANTDECODEARGS))
810Sstevel@tonic-gate 
820Sstevel@tonic-gate /* Maximum rpc backoff time */
830Sstevel@tonic-gate #define	RPC_MAX_BACKOFF	30
840Sstevel@tonic-gate 
850Sstevel@tonic-gate /*
860Sstevel@tonic-gate  * Error info.
870Sstevel@tonic-gate  */
880Sstevel@tonic-gate struct rpc_err {
890Sstevel@tonic-gate 	enum clnt_stat re_status;
900Sstevel@tonic-gate 	union {
910Sstevel@tonic-gate 		struct {
920Sstevel@tonic-gate 			int RE_errno;	/* related system error */
930Sstevel@tonic-gate 			int RE_t_errno;	/* related tli error number */
940Sstevel@tonic-gate 		} RE_err;
950Sstevel@tonic-gate 		enum auth_stat RE_why;	/* why the auth error occurred */
960Sstevel@tonic-gate 		struct {
970Sstevel@tonic-gate 			rpcvers_t low;	/* lowest verion supported */
980Sstevel@tonic-gate 			rpcvers_t high;	/* highest verion supported */
990Sstevel@tonic-gate 		} RE_vers;
1000Sstevel@tonic-gate 		struct {		/* maybe meaningful if RPC_FAILED */
1010Sstevel@tonic-gate 			int32_t s1;
1020Sstevel@tonic-gate 			int32_t s2;
1030Sstevel@tonic-gate 		} RE_lb;		/* life boot & debugging only */
1040Sstevel@tonic-gate 	} ru;
1050Sstevel@tonic-gate #define	re_errno	ru.RE_err.RE_errno
1060Sstevel@tonic-gate #define	re_terrno	ru.RE_err.RE_t_errno
1070Sstevel@tonic-gate #define	re_why		ru.RE_why
1080Sstevel@tonic-gate #define	re_vers		ru.RE_vers
1090Sstevel@tonic-gate #define	re_lb		ru.RE_lb
1100Sstevel@tonic-gate };
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate /*
1140Sstevel@tonic-gate  * Timers used for the pseudo-transport protocol when using datagrams
1150Sstevel@tonic-gate  */
1160Sstevel@tonic-gate struct rpc_timers {
1170Sstevel@tonic-gate 	clock_t		rt_srtt;	/* smoothed round-trip time */
1180Sstevel@tonic-gate 	clock_t		rt_deviate;	/* estimated deviation */
1190Sstevel@tonic-gate 	clock_t		rt_rtxcur;	/* current (backed-off) rto */
1200Sstevel@tonic-gate };
1210Sstevel@tonic-gate 
1220Sstevel@tonic-gate /*
1230Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
1240Sstevel@tonic-gate  * CLIENT
1250Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
1260Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
1270Sstevel@tonic-gate  *
1280Sstevel@tonic-gate  * Client rpc handle.
1290Sstevel@tonic-gate  * Created by individual implementations
1300Sstevel@tonic-gate  * Client is responsible for initializing auth, see e.g. auth_none.c.
1310Sstevel@tonic-gate  */
1320Sstevel@tonic-gate 
1330Sstevel@tonic-gate typedef struct __client {
1340Sstevel@tonic-gate 	AUTH	*cl_auth;			/* authenticator */
1350Sstevel@tonic-gate 	struct clnt_ops {
1360Sstevel@tonic-gate #ifdef __STDC__
1370Sstevel@tonic-gate 		/* call remote procedure */
1380Sstevel@tonic-gate 		enum clnt_stat	(*cl_call)(struct __client *, rpcproc_t,
1390Sstevel@tonic-gate 				    xdrproc_t, caddr_t, xdrproc_t,
1400Sstevel@tonic-gate 				    caddr_t, struct timeval);
1410Sstevel@tonic-gate 		/* abort a call */
1420Sstevel@tonic-gate 		void		(*cl_abort)(/* various */);
1430Sstevel@tonic-gate 		/* get specific error code */
1440Sstevel@tonic-gate 		void		(*cl_geterr)(struct __client *,
1450Sstevel@tonic-gate 				    struct rpc_err *);
1460Sstevel@tonic-gate 		/* frees results */
1470Sstevel@tonic-gate 		bool_t		(*cl_freeres)(struct __client *, xdrproc_t,
1480Sstevel@tonic-gate 				    caddr_t);
1490Sstevel@tonic-gate 		/* destroy this structure */
1500Sstevel@tonic-gate 		void		(*cl_destroy)(struct __client *);
1510Sstevel@tonic-gate 		/* the ioctl() of rpc */
1520Sstevel@tonic-gate 		bool_t		(*cl_control)(struct __client *, int, char *);
1530Sstevel@tonic-gate 		/* set rpc level timers */
1540Sstevel@tonic-gate 		int		(*cl_settimers)(struct __client *,
1550Sstevel@tonic-gate 				    struct rpc_timers *, struct rpc_timers *,
1560Sstevel@tonic-gate 				    int, void (*)(), caddr_t, uint32_t);
1570Sstevel@tonic-gate #ifndef _KERNEL
1580Sstevel@tonic-gate 		/* send a one-way asynchronous call to remote procedure */
1590Sstevel@tonic-gate 		enum clnt_stat	(*cl_send)(struct __client *, rpcproc_t,
1600Sstevel@tonic-gate 				    xdrproc_t, caddr_t);
1610Sstevel@tonic-gate #endif /* !_KERNEL */
1620Sstevel@tonic-gate #else
1630Sstevel@tonic-gate 		enum clnt_stat	(*cl_call)();	/* call remote procedure */
1640Sstevel@tonic-gate 		void		(*cl_abort)();	/* abort a call */
1650Sstevel@tonic-gate 		void		(*cl_geterr)();	/* get specific error code */
1660Sstevel@tonic-gate 		bool_t		(*cl_freeres)(); /* frees results */
1670Sstevel@tonic-gate 		void		(*cl_destroy)(); /* destroy this structure */
1680Sstevel@tonic-gate 		bool_t		(*cl_control)(); /* the ioctl() of rpc */
1690Sstevel@tonic-gate 		int		(*cl_settimers)(); /* set rpc level timers */
1700Sstevel@tonic-gate #ifndef _KERNEL
1710Sstevel@tonic-gate 		enum clnt_stat  (*cl_send)();   /* send one-way request */
1720Sstevel@tonic-gate #endif /* !_KERNEL */
1730Sstevel@tonic-gate #endif
1740Sstevel@tonic-gate 	} *cl_ops;
1750Sstevel@tonic-gate 	caddr_t			cl_private;	/* private stuff */
1760Sstevel@tonic-gate #ifndef _KERNEL
1770Sstevel@tonic-gate 	char			*cl_netid;	/* network token */
1780Sstevel@tonic-gate 	char			*cl_tp;		/* device name */
1790Sstevel@tonic-gate #else
1800Sstevel@tonic-gate 	bool_t			cl_nosignal;  /* to handle NOINTR */
1810Sstevel@tonic-gate #endif
1820Sstevel@tonic-gate } CLIENT;
1830Sstevel@tonic-gate 
1840Sstevel@tonic-gate /*
1850Sstevel@tonic-gate  * Feedback values used for possible congestion and rate control
1860Sstevel@tonic-gate  */
1870Sstevel@tonic-gate #define	FEEDBACK_REXMIT1	1	/* first retransmit */
1880Sstevel@tonic-gate #define	FEEDBACK_OK		2	/* no retransmits */
1890Sstevel@tonic-gate 
1900Sstevel@tonic-gate /*
1910Sstevel@tonic-gate  * The following defines the control routines
1920Sstevel@tonic-gate  * for rpcbind.
1930Sstevel@tonic-gate  */
1940Sstevel@tonic-gate 
1950Sstevel@tonic-gate #define	CLCR_GET_RPCB_TIMEOUT	1
1960Sstevel@tonic-gate #define	CLCR_SET_RPCB_TIMEOUT	2
1970Sstevel@tonic-gate #define	CLCR_SET_LOWVERS	3
1980Sstevel@tonic-gate #define	CLCR_GET_LOWVERS	4
1990Sstevel@tonic-gate #define	CLCR_SET_RPCB_RMTTIME	5
2000Sstevel@tonic-gate #define	CLCR_GET_RPCB_RMTTIME  	6
2010Sstevel@tonic-gate #define	CLCR_SET_CRED_CACHE_SZ 	7
2020Sstevel@tonic-gate #define	CLCR_GET_CRED_CACHE_SZ 	8
2030Sstevel@tonic-gate 
2040Sstevel@tonic-gate #define	RPCSMALLMSGSIZE	400	/* a more reasonable packet size */
2050Sstevel@tonic-gate 
2060Sstevel@tonic-gate #define	KNC_STRSIZE	128	/* maximum length of knetconfig strings */
2070Sstevel@tonic-gate /*
2080Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
2090Sstevel@tonic-gate  * knetconfig
2100Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
2110Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
2120Sstevel@tonic-gate  *
2130Sstevel@tonic-gate  * Note that the knetconfig strings can either be dynamically allocated, or
2140Sstevel@tonic-gate  * they can be string literals.  The code that sets up the knetconfig is
2150Sstevel@tonic-gate  * responsible for keeping track of this and freeing the strings if
2160Sstevel@tonic-gate  * necessary when the knetconfig is destroyed.
2170Sstevel@tonic-gate  */
2180Sstevel@tonic-gate struct knetconfig {
2190Sstevel@tonic-gate 	unsigned int	knc_semantics;	/* token name */
2200Sstevel@tonic-gate 	caddr_t		knc_protofmly;	/* protocol family */
2210Sstevel@tonic-gate 	caddr_t		knc_proto;	/* protocol */
2220Sstevel@tonic-gate 	dev_t		knc_rdev;	/* device id */
2230Sstevel@tonic-gate 	unsigned int	knc_unused[8];
2240Sstevel@tonic-gate };
2250Sstevel@tonic-gate 
2260Sstevel@tonic-gate #ifdef _SYSCALL32
2270Sstevel@tonic-gate struct knetconfig32 {
2280Sstevel@tonic-gate 	uint32_t	knc_semantics;	/* token name */
2290Sstevel@tonic-gate 	caddr32_t	knc_protofmly;	/* protocol family */
2300Sstevel@tonic-gate 	caddr32_t	knc_proto;	/* protocol */
2310Sstevel@tonic-gate 	dev32_t		knc_rdev;	/* device id */
2320Sstevel@tonic-gate 	uint32_t	knc_unused[8];
2330Sstevel@tonic-gate };
2340Sstevel@tonic-gate #endif /* _SYSCALL32 */
2350Sstevel@tonic-gate 
2360Sstevel@tonic-gate #ifdef _KERNEL
2370Sstevel@tonic-gate 
2380Sstevel@tonic-gate /*
2390Sstevel@tonic-gate  * Bucket defined for the call table.  Padded out to 64 bytes so that
2400Sstevel@tonic-gate  * false sharing won't be induced.
2410Sstevel@tonic-gate  */
2420Sstevel@tonic-gate typedef	union call_table {
2430Sstevel@tonic-gate 	struct {
2440Sstevel@tonic-gate 		struct calllist_s	*uct_call_next;
2450Sstevel@tonic-gate 		struct calllist_s	*uct_call_prev;
2460Sstevel@tonic-gate 		uint_t			uct_len;
2470Sstevel@tonic-gate 		kmutex_t		uct_lock;
2480Sstevel@tonic-gate 	} ct_s;
2490Sstevel@tonic-gate 	char				uct_pad[64];
2500Sstevel@tonic-gate } call_table_t;
2510Sstevel@tonic-gate 
2520Sstevel@tonic-gate /*
2530Sstevel@tonic-gate  * Define some macros for easy access into the call table structure
2540Sstevel@tonic-gate  */
2550Sstevel@tonic-gate #define	ct_call_next ct_s.uct_call_next
2560Sstevel@tonic-gate #define	ct_call_prev ct_s.uct_call_prev
2570Sstevel@tonic-gate #define	ct_len ct_s.uct_len
2580Sstevel@tonic-gate #define	ct_lock ct_s.uct_lock
2590Sstevel@tonic-gate 
2600Sstevel@tonic-gate /*
2610Sstevel@tonic-gate  * List of outstanding calls awaiting replies, for COTS, CLTS
2620Sstevel@tonic-gate  */
2630Sstevel@tonic-gate typedef struct calllist_s {
2640Sstevel@tonic-gate 	struct calllist_s *call_next;	/* hash chain, MUST BE FIRST */
2650Sstevel@tonic-gate 	struct calllist_s *call_prev;
2660Sstevel@tonic-gate 	bool_t		call_notified;
2670Sstevel@tonic-gate 	uint_t		call_xid;	/* the xid on the call */
2680Sstevel@tonic-gate 	uint_t		call_hash;	/* hash value */
2690Sstevel@tonic-gate 	call_table_t	*call_bucket;	/* back pointer to bucket */
2700Sstevel@tonic-gate 	mblk_t		*call_reply;	/* the reply to the call */
2710Sstevel@tonic-gate 	kcondvar_t	call_cv;	/* cv to notify when reply is done */
2720Sstevel@tonic-gate 	kmutex_t	call_lock;	/* lock for cv */
2730Sstevel@tonic-gate 	struct rpc_err	call_err;	/* status on reply */
2740Sstevel@tonic-gate #define	call_status call_err.re_status	/* error on reply (rep is invalid) */
2750Sstevel@tonic-gate #define	call_reason call_err.re_errno	/* reason code on T_DISCON_IND */
2760Sstevel@tonic-gate 	queue_t		*call_wq;	/* the write queue the call is using */
2776403Sgt29601 	zoneid_t	call_zoneid;	/* zoneid the call was made from */
2780Sstevel@tonic-gate } calllist_t;
2790Sstevel@tonic-gate 
2800Sstevel@tonic-gate /*
2810Sstevel@tonic-gate  * Define macros for call table hashing
2820Sstevel@tonic-gate  */
2830Sstevel@tonic-gate /*
2840Sstevel@tonic-gate  * A simple hash function.  Due to the way XID's get allocated, this may be
2850Sstevel@tonic-gate  * sufficient.  This hash function provides round robin bucket selection so
2860Sstevel@tonic-gate  * that the next time a particular bucket gets picked is when there have
2870Sstevel@tonic-gate  * been N-1 calls.  N is the number of buckets.
2880Sstevel@tonic-gate  */
2890Sstevel@tonic-gate #define	call_hash(xid, hashsize) \
2900Sstevel@tonic-gate 		(xid % hashsize);
2910Sstevel@tonic-gate 
2920Sstevel@tonic-gate #define	call_table_enter(e)				\
2930Sstevel@tonic-gate {							\
294*11380SMarcel.Telka@Sun.COM 	call_table_t *ctp = (e)->call_bucket;		\
2950Sstevel@tonic-gate 	mutex_enter(&ctp->ct_lock);			\
2960Sstevel@tonic-gate 	ctp->ct_len++;					\
297*11380SMarcel.Telka@Sun.COM 	(e)->call_next = ctp->ct_call_next;		\
298*11380SMarcel.Telka@Sun.COM 	(e)->call_prev = (calllist_t *)ctp;		\
299*11380SMarcel.Telka@Sun.COM 	ctp->ct_call_next->call_prev = (e);		\
300*11380SMarcel.Telka@Sun.COM 	ctp->ct_call_next = (e);			\
301*11380SMarcel.Telka@Sun.COM 	mutex_exit(&ctp->ct_lock);			\
3020Sstevel@tonic-gate }
3030Sstevel@tonic-gate 
3040Sstevel@tonic-gate #define	call_table_remove(e)				\
3050Sstevel@tonic-gate {							\
306*11380SMarcel.Telka@Sun.COM 	call_table_t *ctp = (e)->call_bucket;		\
3070Sstevel@tonic-gate 	mutex_enter(&ctp->ct_lock);			\
3080Sstevel@tonic-gate 	ctp->ct_len--;					\
309*11380SMarcel.Telka@Sun.COM 	(e)->call_prev->call_next = (e)->call_next;	\
310*11380SMarcel.Telka@Sun.COM 	(e)->call_next->call_prev = (e)->call_prev;	\
3110Sstevel@tonic-gate 	mutex_exit(&ctp->ct_lock);			\
3120Sstevel@tonic-gate }
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate #define	call_table_find(ctp, xid, ele)			\
3150Sstevel@tonic-gate {							\
3160Sstevel@tonic-gate 	calllist_t *cp;					\
317*11380SMarcel.Telka@Sun.COM 	(ele) = NULL;					\
3180Sstevel@tonic-gate 	mutex_enter(&(ctp)->ct_lock);			\
3190Sstevel@tonic-gate 	for (cp = (ctp)->ct_call_next;			\
320*11380SMarcel.Telka@Sun.COM 		cp != (calllist_t *)(ctp);		\
3210Sstevel@tonic-gate 		cp = cp->call_next) {			\
322*11380SMarcel.Telka@Sun.COM 		if (cp->call_xid == (xid))		\
323*11380SMarcel.Telka@Sun.COM 			(ele) = cp;			\
3240Sstevel@tonic-gate 	}						\
3250Sstevel@tonic-gate }
3260Sstevel@tonic-gate 
3270Sstevel@tonic-gate #define	DEFAULT_MIN_HASH_SIZE	32
3280Sstevel@tonic-gate #define	DEFAULT_HASH_SIZE	1024
3290Sstevel@tonic-gate 
3300Sstevel@tonic-gate #define	RESERVED_PORTSPACE (IPPORT_RESERVED - (IPPORT_RESERVED/2))
3310Sstevel@tonic-gate #define	NONRESERVED_PORTSPACE (0xFFFF - IPPORT_RESERVED)
3320Sstevel@tonic-gate 
3330Sstevel@tonic-gate /*
3340Sstevel@tonic-gate  *	Alloc_xid presents an interface which kernel RPC clients
3350Sstevel@tonic-gate  *	should use to allocate their XIDs.  Its implementation
3360Sstevel@tonic-gate  *	may change over time (for example, to allow sharing of
3370Sstevel@tonic-gate  *	XIDs between the kernel and user-level applications, so
3380Sstevel@tonic-gate  *	all XID allocation should be done by calling alloc_xid().
3390Sstevel@tonic-gate  */
3400Sstevel@tonic-gate extern uint32_t alloc_xid(void);
3410Sstevel@tonic-gate 
342766Scarlsonj extern struct zone *rpc_zone(void);
343766Scarlsonj extern zoneid_t rpc_zoneid(void);
344766Scarlsonj 
3450Sstevel@tonic-gate extern int clnt_tli_kcreate(struct knetconfig *config, struct netbuf *svcaddr,
3460Sstevel@tonic-gate 	rpcprog_t, rpcvers_t, uint_t max_msgsize, int retrys,
3470Sstevel@tonic-gate 	struct cred *cred, CLIENT **ncl);
3480Sstevel@tonic-gate 
3490Sstevel@tonic-gate extern int clnt_tli_kinit(CLIENT *h, struct knetconfig *config,
3500Sstevel@tonic-gate 	struct netbuf *addr, uint_t max_msgsize, int retries,
3510Sstevel@tonic-gate 	struct cred *cred);
3520Sstevel@tonic-gate 
3530Sstevel@tonic-gate extern int rpc_uaddr2port(int af, char *addr);
3540Sstevel@tonic-gate 
3550Sstevel@tonic-gate /*
3560Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
3570Sstevel@tonic-gate  */
3580Sstevel@tonic-gate extern int bindresvport(TIUSER *tiptr, struct netbuf *addr,
3590Sstevel@tonic-gate 	struct netbuf *bound_addr, bool_t istcp);
3600Sstevel@tonic-gate 
3610Sstevel@tonic-gate /*
3620Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
3630Sstevel@tonic-gate  */
3640Sstevel@tonic-gate extern int clnt_clts_kcreate(struct knetconfig *config, struct netbuf *addr,
3650Sstevel@tonic-gate 	rpcprog_t, rpcvers_t, int retries, struct cred *cred, CLIENT **cl);
3660Sstevel@tonic-gate 
3670Sstevel@tonic-gate /*
3680Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
3690Sstevel@tonic-gate  */
3700Sstevel@tonic-gate extern int clnt_cots_kcreate(dev_t dev, struct netbuf *addr, int family,
3710Sstevel@tonic-gate 	rpcprog_t, rpcvers_t, uint_t max_msgsize, struct cred *cred,
3720Sstevel@tonic-gate 	CLIENT **ncl);
3730Sstevel@tonic-gate /*
3740Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
3750Sstevel@tonic-gate  */
3760Sstevel@tonic-gate extern int clnt_rdma_kcreate(char *proto, void *handle, struct netbuf *raddr,
3770Sstevel@tonic-gate 	int family, rpcprog_t pgm, rpcvers_t vers, struct cred *cred,
3780Sstevel@tonic-gate 	CLIENT **cl);
3790Sstevel@tonic-gate /*
3800Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
3810Sstevel@tonic-gate  */
3820Sstevel@tonic-gate extern int rdma_reachable(int addr_type, struct netbuf *addr,
3830Sstevel@tonic-gate 	struct knetconfig **knconf);
3840Sstevel@tonic-gate 
3850Sstevel@tonic-gate /*
3860Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
3870Sstevel@tonic-gate  */
3880Sstevel@tonic-gate extern void clnt_clts_kinit(CLIENT *h, struct netbuf *addr, int retries,
3890Sstevel@tonic-gate 	struct cred *cred);
3900Sstevel@tonic-gate 
3910Sstevel@tonic-gate /*
3920Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
3930Sstevel@tonic-gate  */
3940Sstevel@tonic-gate extern void clnt_cots_kinit(CLIENT *h, dev_t dev, int family,
3950Sstevel@tonic-gate 	struct netbuf *addr, int max_msgsize, struct cred *cred);
3960Sstevel@tonic-gate 
3970Sstevel@tonic-gate /*
3980Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
3990Sstevel@tonic-gate  */
4000Sstevel@tonic-gate extern void clnt_rdma_kinit(CLIENT *h, char *proto, void *handle,
4010Sstevel@tonic-gate 	struct netbuf *addr, struct cred *cred);
4020Sstevel@tonic-gate 
4030Sstevel@tonic-gate /*
4040Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4050Sstevel@tonic-gate  */
4060Sstevel@tonic-gate extern bool_t clnt_dispatch_notify(mblk_t *, zoneid_t);
4070Sstevel@tonic-gate 
4080Sstevel@tonic-gate /*
4090Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4100Sstevel@tonic-gate  */
4110Sstevel@tonic-gate extern bool_t clnt_dispatch_notifyconn(queue_t *, mblk_t *);
4120Sstevel@tonic-gate 
4130Sstevel@tonic-gate /*
4140Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4150Sstevel@tonic-gate  */
4160Sstevel@tonic-gate extern void clnt_dispatch_notifyall(queue_t *, int32_t, int32_t);
4170Sstevel@tonic-gate 
4180Sstevel@tonic-gate /*
4190Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4200Sstevel@tonic-gate  */
4210Sstevel@tonic-gate extern enum clnt_stat clnt_clts_kcallit_addr(CLIENT *, rpcproc_t, xdrproc_t,
4220Sstevel@tonic-gate 	caddr_t, xdrproc_t, caddr_t, struct timeval, struct netbuf *);
4230Sstevel@tonic-gate 
4240Sstevel@tonic-gate /*
4250Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4260Sstevel@tonic-gate  */
4270Sstevel@tonic-gate extern call_table_t *call_table_init(int);
4280Sstevel@tonic-gate 
4290Sstevel@tonic-gate /*
4300Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4310Sstevel@tonic-gate  */
4320Sstevel@tonic-gate extern void clnt_init(void);
4330Sstevel@tonic-gate 
4340Sstevel@tonic-gate /*
4350Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4360Sstevel@tonic-gate  */
4370Sstevel@tonic-gate extern void clnt_fini(void);
4380Sstevel@tonic-gate 
4390Sstevel@tonic-gate /*
4400Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4410Sstevel@tonic-gate  */
4420Sstevel@tonic-gate extern void clnt_clts_init(void);
4430Sstevel@tonic-gate 
4440Sstevel@tonic-gate /*
4450Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4460Sstevel@tonic-gate  */
4470Sstevel@tonic-gate extern void clnt_clts_fini(void);
4480Sstevel@tonic-gate 
4490Sstevel@tonic-gate /*
4500Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4510Sstevel@tonic-gate  */
4520Sstevel@tonic-gate extern void clnt_cots_init(void);
4530Sstevel@tonic-gate 
4540Sstevel@tonic-gate /*
4550Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4560Sstevel@tonic-gate  */
4570Sstevel@tonic-gate extern void clnt_cots_fini(void);
4580Sstevel@tonic-gate 
4590Sstevel@tonic-gate /*
4600Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
4610Sstevel@tonic-gate  */
4620Sstevel@tonic-gate extern void clnt_clts_dispatch_notify(mblk_t *, int, zoneid_t);
4630Sstevel@tonic-gate 
4640Sstevel@tonic-gate extern void rpc_poptimod(struct vnode *);
4650Sstevel@tonic-gate extern int kstr_push(struct vnode *, char *);
4660Sstevel@tonic-gate extern void t_kadvise(TIUSER *, uchar_t *, int);
4670Sstevel@tonic-gate 
4680Sstevel@tonic-gate extern boolean_t connmgr_cpr_reset(void *, int);
4690Sstevel@tonic-gate 
4700Sstevel@tonic-gate extern void put_inet_port(struct netbuf *, ushort_t);
4710Sstevel@tonic-gate extern void put_inet6_port(struct netbuf *, ushort_t);
4720Sstevel@tonic-gate extern void put_loopback_port(struct netbuf *, char *);
4730Sstevel@tonic-gate extern enum clnt_stat rpcbind_getaddr(struct knetconfig *, rpcprog_t,
4740Sstevel@tonic-gate     rpcvers_t, struct netbuf *);
4750Sstevel@tonic-gate 
4760Sstevel@tonic-gate /*
4770Sstevel@tonic-gate  * Kstat stuff
4780Sstevel@tonic-gate  */
4790Sstevel@tonic-gate #include <sys/zone.h>
4800Sstevel@tonic-gate 
4810Sstevel@tonic-gate extern zone_key_t rpcstat_zone_key;
4820Sstevel@tonic-gate 
4830Sstevel@tonic-gate struct rpc_clts_client;		/* unix:0:rpc_clts_client */
4840Sstevel@tonic-gate struct rpc_clts_server;		/* unix:0:rpc_clts_server */
4850Sstevel@tonic-gate struct rpc_cots_client;		/* unix:0:rpc_cots_client */
4860Sstevel@tonic-gate struct rpc_cots_server;		/* unix:0:rpc_cots_server */
4870Sstevel@tonic-gate 
4880Sstevel@tonic-gate struct rpcstat {
4890Sstevel@tonic-gate 	struct rpc_clts_client *rpc_clts_client;
4900Sstevel@tonic-gate 	struct rpc_clts_server *rpc_clts_server;
4910Sstevel@tonic-gate 	struct rpc_cots_client *rpc_cots_client;
4920Sstevel@tonic-gate 	struct rpc_cots_server *rpc_cots_server;
4930Sstevel@tonic-gate };
4940Sstevel@tonic-gate 
4950Sstevel@tonic-gate extern kstat_named_t *rpcstat_zone_init_common(zoneid_t, const char *,
4960Sstevel@tonic-gate     const char *, const kstat_named_t *, size_t);
4970Sstevel@tonic-gate extern void rpcstat_zone_fini_common(zoneid_t, const char *, const char *);
4980Sstevel@tonic-gate 
4990Sstevel@tonic-gate extern void clnt_clts_stats_init(zoneid_t, struct rpc_clts_client **);
5000Sstevel@tonic-gate extern void clnt_clts_stats_fini(zoneid_t, struct rpc_clts_client **);
5010Sstevel@tonic-gate 
5020Sstevel@tonic-gate extern void svc_clts_stats_init(zoneid_t, struct rpc_clts_server **);
5030Sstevel@tonic-gate extern void svc_clts_stats_fini(zoneid_t, struct rpc_clts_server **);
5040Sstevel@tonic-gate 
5050Sstevel@tonic-gate extern void clnt_cots_stats_init(zoneid_t, struct rpc_cots_client **);
5060Sstevel@tonic-gate extern void clnt_cots_stats_fini(zoneid_t, struct rpc_cots_client **);
5070Sstevel@tonic-gate 
5080Sstevel@tonic-gate extern void svc_cots_stats_init(zoneid_t, struct rpc_cots_server **);
5090Sstevel@tonic-gate extern void svc_cots_stats_fini(zoneid_t, struct rpc_cots_server **);
5100Sstevel@tonic-gate 
5110Sstevel@tonic-gate #endif /* _KERNEL */
5120Sstevel@tonic-gate 
5130Sstevel@tonic-gate /*
5140Sstevel@tonic-gate  * client side rpc interface ops
5150Sstevel@tonic-gate  */
5160Sstevel@tonic-gate 
5170Sstevel@tonic-gate /*
5180Sstevel@tonic-gate  * enum clnt_stat
5190Sstevel@tonic-gate  * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
5200Sstevel@tonic-gate  * 	CLIENT *rh;
5210Sstevel@tonic-gate  *	rpcproc_t proc;
5220Sstevel@tonic-gate  *	xdrproc_t xargs;
5230Sstevel@tonic-gate  *	caddr_t argsp;
5240Sstevel@tonic-gate  *	xdrproc_t xres;
5250Sstevel@tonic-gate  *	caddr_t resp;
5260Sstevel@tonic-gate  *	struct timeval timeout;
5270Sstevel@tonic-gate  *
5280Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
5290Sstevel@tonic-gate  * CLNT_CALL
5300Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
5310Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
5320Sstevel@tonic-gate  */
5330Sstevel@tonic-gate #define	CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)	\
5340Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
5350Sstevel@tonic-gate #define	clnt_call(rh, proc, xargs, argsp, xres, resp, secs)	\
5360Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
5370Sstevel@tonic-gate 
5380Sstevel@tonic-gate #ifndef _KERNEL
5390Sstevel@tonic-gate /*
5400Sstevel@tonic-gate  * enum clnt_stat
5410Sstevel@tonic-gate  * CLNT_SEND(rh, proc, xargs, argsp)
5420Sstevel@tonic-gate  * 	CLIENT *rh;
5430Sstevel@tonic-gate  *	rpcproc_t proc;
5440Sstevel@tonic-gate  *	xdrproc_t xargs;
5450Sstevel@tonic-gate  *	caddr_t argsp;
5460Sstevel@tonic-gate  *
5470Sstevel@tonic-gate  * PSARC 2000/428  Contract Private Interface
5480Sstevel@tonic-gate  */
5490Sstevel@tonic-gate #define	CLNT_SEND(rh, proc, xargs, argsp)	\
5500Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_send)(rh, proc, xargs, argsp))
5510Sstevel@tonic-gate #define	clnt_send(rh, proc, xargs, argsp)	\
5520Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_send)(rh, proc, xargs, argsp))
5530Sstevel@tonic-gate #endif /* !_KERNEL */
5540Sstevel@tonic-gate 
5550Sstevel@tonic-gate /*
5560Sstevel@tonic-gate  * void
5570Sstevel@tonic-gate  * CLNT_ABORT(rh);
5580Sstevel@tonic-gate  * 	CLIENT *rh;
5590Sstevel@tonic-gate  */
5600Sstevel@tonic-gate #define	CLNT_ABORT(rh)	((*(rh)->cl_ops->cl_abort)(rh))
5610Sstevel@tonic-gate #define	clnt_abort(rh)	((*(rh)->cl_ops->cl_abort)(rh))
5620Sstevel@tonic-gate 
5630Sstevel@tonic-gate /*
5640Sstevel@tonic-gate  * struct rpc_err
5650Sstevel@tonic-gate  * CLNT_GETERR(rh);
5660Sstevel@tonic-gate  * 	CLIENT *rh;
5670Sstevel@tonic-gate  */
5680Sstevel@tonic-gate #define	CLNT_GETERR(rh, errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
5690Sstevel@tonic-gate #define	clnt_geterr(rh, errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
5700Sstevel@tonic-gate 
5710Sstevel@tonic-gate /*
5720Sstevel@tonic-gate  * bool_t
5730Sstevel@tonic-gate  * CLNT_FREERES(rh, xres, resp);
5740Sstevel@tonic-gate  * 	CLIENT *rh;
5750Sstevel@tonic-gate  *	xdrproc_t xres;
5760Sstevel@tonic-gate  *	caddr_t resp;
5770Sstevel@tonic-gate  */
5780Sstevel@tonic-gate #define	CLNT_FREERES(rh, xres, resp) \
5790Sstevel@tonic-gate 		((*(rh)->cl_ops->cl_freeres)(rh, xres, resp))
5800Sstevel@tonic-gate #define	clnt_freeres(rh, xres, resp) \
5810Sstevel@tonic-gate 		((*(rh)->cl_ops->cl_freeres)(rh, xres, resp))
5820Sstevel@tonic-gate 
5830Sstevel@tonic-gate /*
5840Sstevel@tonic-gate  * bool_t
5850Sstevel@tonic-gate  * CLNT_CONTROL(cl, request, info)
5860Sstevel@tonic-gate  *	CLIENT *cl;
5870Sstevel@tonic-gate  *	uint_t request;
5880Sstevel@tonic-gate  *	char *info;
5890Sstevel@tonic-gate  *
5900Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
5910Sstevel@tonic-gate  * CLNT_CONTROL
5920Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
5930Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
5940Sstevel@tonic-gate  */
5950Sstevel@tonic-gate #define	CLNT_CONTROL(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in))
5960Sstevel@tonic-gate #define	clnt_control(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in))
5970Sstevel@tonic-gate 
5980Sstevel@tonic-gate 
5990Sstevel@tonic-gate /*
6000Sstevel@tonic-gate  * control operations that apply to all transports
6010Sstevel@tonic-gate  */
6020Sstevel@tonic-gate #define	CLSET_TIMEOUT		1	/* set timeout (timeval) */
6030Sstevel@tonic-gate #define	CLGET_TIMEOUT		2	/* get timeout (timeval) */
6040Sstevel@tonic-gate #define	CLGET_SERVER_ADDR	3	/* get server's address (sockaddr) */
6050Sstevel@tonic-gate #define	CLGET_FD		6	/* get connections file descriptor */
6060Sstevel@tonic-gate #define	CLGET_SVC_ADDR		7	/* get server's address (netbuf) */
6070Sstevel@tonic-gate #define	CLSET_FD_CLOSE		8	/* close fd while clnt_destroy */
6080Sstevel@tonic-gate #define	CLSET_FD_NCLOSE		9	/* Do not close fd while clnt_destroy */
6090Sstevel@tonic-gate #define	CLGET_XID 		10	/* Get xid */
6100Sstevel@tonic-gate #define	CLSET_XID		11	/* Set xid */
6110Sstevel@tonic-gate #define	CLGET_VERS		12	/* Get version number */
6120Sstevel@tonic-gate #define	CLSET_VERS		13	/* Set version number */
6130Sstevel@tonic-gate #define	CLGET_PROG		14	/* Get program number */
6140Sstevel@tonic-gate #define	CLSET_PROG		15	/* Set program number */
6150Sstevel@tonic-gate #define	CLSET_SVC_ADDR		16	/* get server's address (netbuf) */
6160Sstevel@tonic-gate #define	CLSET_PUSH_TIMOD	17	/* push timod if not already present */
6170Sstevel@tonic-gate #define	CLSET_POP_TIMOD		18	/* pop timod */
6180Sstevel@tonic-gate #ifndef _KERNEL
6190Sstevel@tonic-gate /* 00-08-17 - NON STANDARD CONTROL PARAMETER */
6200Sstevel@tonic-gate #define	CLSET_IO_MODE		19	/* clnt_send behavior */
6210Sstevel@tonic-gate #define	CLGET_IO_MODE		20	/* clnt_send behavior */
6220Sstevel@tonic-gate #define	CLSET_FLUSH_MODE	21	/* flush behavior */
6230Sstevel@tonic-gate #define	CLGET_FLUSH_MODE	22	/* flush behavior */
6240Sstevel@tonic-gate #define	CLFLUSH			23	/* flush now (user wants it) */
6250Sstevel@tonic-gate #define	CLSET_CONNMAXREC_SIZE	24	/* set pending request buffer size */
6260Sstevel@tonic-gate #define	CLGET_CONNMAXREC_SIZE	25	/* set pending request buffer size */
6270Sstevel@tonic-gate #define	CLGET_CURRENT_REC_SIZE	26	/* get pending request buffer size */
6280Sstevel@tonic-gate 
6290Sstevel@tonic-gate typedef enum {
6300Sstevel@tonic-gate 	RPC_CL_BESTEFFORT_FLUSH = 100,	/* flush as much as possible */
6310Sstevel@tonic-gate 					/* without blocking */
6320Sstevel@tonic-gate 	RPC_CL_BLOCKING_FLUSH,		/* flush the buffer completely */
6330Sstevel@tonic-gate 					/* (possibly blocking) */
6340Sstevel@tonic-gate 	RPC_CL_DEFAULT_FLUSH		/* flush according to the currently */
6350Sstevel@tonic-gate 					/* defined policy. */
6360Sstevel@tonic-gate } rpcflushmode_t;
6370Sstevel@tonic-gate 
6380Sstevel@tonic-gate 
6390Sstevel@tonic-gate typedef enum {
6400Sstevel@tonic-gate 	RPC_CL_BLOCKING = 10,	/* PASSED CLNT_CONTROL SET_IO_MODE */
6410Sstevel@tonic-gate 	RPC_CL_NONBLOCKING
6420Sstevel@tonic-gate } rpciomode_t;
6430Sstevel@tonic-gate #endif /* !_KERNEL */
6440Sstevel@tonic-gate /*
6450Sstevel@tonic-gate  * Connectionless only control operations
6460Sstevel@tonic-gate  */
6470Sstevel@tonic-gate #define	CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */
6480Sstevel@tonic-gate #define	CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */
6490Sstevel@tonic-gate 
6500Sstevel@tonic-gate #ifdef	_KERNEL
6510Sstevel@tonic-gate /*
6520Sstevel@tonic-gate  * Connection oriented only control operation.
6530Sstevel@tonic-gate  */
6540Sstevel@tonic-gate #define	CLSET_PROGRESS		10000	/* Report RPC_INPROGRESS if a request */
6550Sstevel@tonic-gate 					/* has been sent but no reply */
6560Sstevel@tonic-gate 					/* received yet. */
6570Sstevel@tonic-gate #define	CLSET_BCAST		10001	/* Set RPC Broadcast hint */
6580Sstevel@tonic-gate #define	CLGET_BCAST		10002	/* Get RPC Broadcast hint */
6590Sstevel@tonic-gate #define	CLSET_NODELAYONERR	10003	/* Set enable/disable of delay on */
6600Sstevel@tonic-gate 					/* connection setup error	  */
6610Sstevel@tonic-gate #define	CLGET_NODELAYONERR	10004	/* Get enable/disable of delay on */
6620Sstevel@tonic-gate 					/* connection setup error	  */
6630Sstevel@tonic-gate #define	CLSET_BINDRESVPORT	10005	/* Set preference for reserve port */
6640Sstevel@tonic-gate #define	CLGET_BINDRESVPORT	10006	/* Get preference for reserve port */
6650Sstevel@tonic-gate #endif
6660Sstevel@tonic-gate 
6670Sstevel@tonic-gate /*
6680Sstevel@tonic-gate  * void
6690Sstevel@tonic-gate  * CLNT_SETTIMERS(rh);
6700Sstevel@tonic-gate  *	CLIENT *rh;
6710Sstevel@tonic-gate  *	struct rpc_timers *t;
6720Sstevel@tonic-gate  *	struct rpc_timers *all;
6730Sstevel@tonic-gate  *	unsigned int min;
6740Sstevel@tonic-gate  *	void    (*fdbck)();
6750Sstevel@tonic-gate  *	caddr_t arg;
6760Sstevel@tonic-gate  *	uint_t  xid;
6770Sstevel@tonic-gate  */
6780Sstevel@tonic-gate #define	CLNT_SETTIMERS(rh, t, all, min, fdbck, arg, xid) \
6790Sstevel@tonic-gate 		((*(rh)->cl_ops->cl_settimers)(rh, t, all, min, \
6800Sstevel@tonic-gate 		fdbck, arg, xid))
6810Sstevel@tonic-gate #define	clnt_settimers(rh, t, all, min, fdbck, arg, xid) \
6820Sstevel@tonic-gate 		((*(rh)->cl_ops->cl_settimers)(rh, t, all, min, \
6830Sstevel@tonic-gate 		fdbck, arg, xid))
6840Sstevel@tonic-gate 
6850Sstevel@tonic-gate 
6860Sstevel@tonic-gate /*
6870Sstevel@tonic-gate  * void
6880Sstevel@tonic-gate  * CLNT_DESTROY(rh);
6890Sstevel@tonic-gate  * 	CLIENT *rh;
6900Sstevel@tonic-gate  *
6910Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
6920Sstevel@tonic-gate  * CLNT_DESTROY
6930Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
6940Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
6950Sstevel@tonic-gate  */
6960Sstevel@tonic-gate #define	CLNT_DESTROY(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
6970Sstevel@tonic-gate #define	clnt_destroy(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
6980Sstevel@tonic-gate 
6990Sstevel@tonic-gate 
7000Sstevel@tonic-gate /*
7010Sstevel@tonic-gate  * RPCTEST is a test program which is accessable on every rpc
7020Sstevel@tonic-gate  * transport/port.  It is used for testing, performance evaluation,
7030Sstevel@tonic-gate  * and network administration.
7040Sstevel@tonic-gate  */
7050Sstevel@tonic-gate 
7060Sstevel@tonic-gate #define	RPCTEST_PROGRAM		((rpcprog_t)1)
7070Sstevel@tonic-gate #define	RPCTEST_VERSION		((rpcvers_t)1)
7080Sstevel@tonic-gate #define	RPCTEST_NULL_PROC	((rpcproc_t)2)
7090Sstevel@tonic-gate #define	RPCTEST_NULL_BATCH_PROC	((rpcproc_t)3)
7100Sstevel@tonic-gate 
7110Sstevel@tonic-gate /*
7120Sstevel@tonic-gate  * By convention, procedure 0 takes null arguments and returns them
7130Sstevel@tonic-gate  */
7140Sstevel@tonic-gate 
7150Sstevel@tonic-gate #define	NULLPROC ((rpcproc_t)0)
7160Sstevel@tonic-gate 
7170Sstevel@tonic-gate /*
7180Sstevel@tonic-gate  * Below are the client handle creation routines for the various
7190Sstevel@tonic-gate  * implementations of client side rpc.  They can return NULL if a
7200Sstevel@tonic-gate  * creation failure occurs.
7210Sstevel@tonic-gate  */
7220Sstevel@tonic-gate 
7230Sstevel@tonic-gate #ifndef _KERNEL
7240Sstevel@tonic-gate 
7250Sstevel@tonic-gate /*
7260Sstevel@tonic-gate  * Generic client creation routine. Supported protocols are which belong
7270Sstevel@tonic-gate  * to the nettype name space
7280Sstevel@tonic-gate  */
7290Sstevel@tonic-gate #ifdef __STDC__
7300Sstevel@tonic-gate extern  CLIENT * clnt_create(const char *, const rpcprog_t, const rpcvers_t,
7310Sstevel@tonic-gate 	const char *);
7320Sstevel@tonic-gate /*
7330Sstevel@tonic-gate  *
7340Sstevel@tonic-gate  * 	const char *hostname;			-- hostname
7350Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
7360Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
7370Sstevel@tonic-gate  *	const char *nettype;			-- network type
7380Sstevel@tonic-gate  */
7390Sstevel@tonic-gate #else
7400Sstevel@tonic-gate extern CLIENT * clnt_create();
7410Sstevel@tonic-gate #endif
7420Sstevel@tonic-gate 
7430Sstevel@tonic-gate /*
7440Sstevel@tonic-gate  * Generic client creation routine. Just like clnt_create(), except
7450Sstevel@tonic-gate  * it takes an additional timeout parameter.
7460Sstevel@tonic-gate  */
7470Sstevel@tonic-gate #ifdef __STDC__
7480Sstevel@tonic-gate extern  CLIENT * clnt_create_timed(const char *, const rpcprog_t,
7490Sstevel@tonic-gate 	const rpcvers_t, const char *, const struct timeval *);
7500Sstevel@tonic-gate /*
7510Sstevel@tonic-gate  *
7520Sstevel@tonic-gate  * 	const char *hostname;			-- hostname
7530Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
7540Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
7550Sstevel@tonic-gate  *	const char *nettype;			-- network type
7560Sstevel@tonic-gate  *	const struct timeval *tp;		-- timeout
7570Sstevel@tonic-gate  */
7580Sstevel@tonic-gate #else
7590Sstevel@tonic-gate extern CLIENT * clnt_create_timed();
7600Sstevel@tonic-gate #endif
7610Sstevel@tonic-gate 
7620Sstevel@tonic-gate /*
7630Sstevel@tonic-gate  * Generic client creation routine. Supported protocols are which belong
7640Sstevel@tonic-gate  * to the nettype name space.
7650Sstevel@tonic-gate  */
7660Sstevel@tonic-gate #ifdef __STDC__
7670Sstevel@tonic-gate extern CLIENT * clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *,
7680Sstevel@tonic-gate 	const rpcvers_t, const rpcvers_t, const char *);
7690Sstevel@tonic-gate /*
7700Sstevel@tonic-gate  *	const char *host;		-- hostname
7710Sstevel@tonic-gate  *	const rpcprog_t prog;		-- program number
7720Sstevel@tonic-gate  *	rpcvers_t *vers_out;	-- servers highest available version number
7730Sstevel@tonic-gate  *	const rpcvers_t vers_low;	-- low version number
7740Sstevel@tonic-gate  *	const rpcvers_t vers_high;	-- high version number
7750Sstevel@tonic-gate  *	const char *nettype;		-- network type
7760Sstevel@tonic-gate  */
7770Sstevel@tonic-gate #else
7780Sstevel@tonic-gate extern CLIENT * clnt_create_vers();
7790Sstevel@tonic-gate #endif
7800Sstevel@tonic-gate 
7810Sstevel@tonic-gate /*
7820Sstevel@tonic-gate  * Generic client creation routine. Supported protocols are which belong
7830Sstevel@tonic-gate  * to the nettype name space.
7840Sstevel@tonic-gate  */
7850Sstevel@tonic-gate #ifdef __STDC__
7860Sstevel@tonic-gate extern CLIENT * clnt_create_vers_timed(const char *, const rpcprog_t,
7870Sstevel@tonic-gate 	rpcvers_t *, const rpcvers_t, const rpcvers_t, const char *,
7880Sstevel@tonic-gate 	const struct timeval *);
7890Sstevel@tonic-gate /*
7900Sstevel@tonic-gate  *	const char *host;		-- hostname
7910Sstevel@tonic-gate  *	const rpcprog_t prog;		-- program number
7920Sstevel@tonic-gate  *	rpcvers_t *vers_out;	-- servers highest available version number
7930Sstevel@tonic-gate  *	const rpcvers_t vers_low;	-- low version number
7940Sstevel@tonic-gate  *	const prcvers_t vers_high;	-- high version number
7950Sstevel@tonic-gate  *	const char *nettype;		-- network type
7960Sstevel@tonic-gate  *	const struct timeval *tp	-- timeout
7970Sstevel@tonic-gate  */
7980Sstevel@tonic-gate #else
7990Sstevel@tonic-gate extern CLIENT * clnt_create_vers_timed();
8000Sstevel@tonic-gate #endif
8010Sstevel@tonic-gate 
8020Sstevel@tonic-gate 
8030Sstevel@tonic-gate /*
8040Sstevel@tonic-gate  * Generic client creation routine. It takes a netconfig structure
8050Sstevel@tonic-gate  * instead of nettype
8060Sstevel@tonic-gate  */
8070Sstevel@tonic-gate #ifdef __STDC__
8080Sstevel@tonic-gate extern CLIENT * clnt_tp_create(const char *, const rpcprog_t, const rpcvers_t,
8090Sstevel@tonic-gate 	const struct netconfig *);
8100Sstevel@tonic-gate /*
8110Sstevel@tonic-gate  *	const char *hostname;			-- hostname
8120Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
8130Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
8140Sstevel@tonic-gate  *	const struct netconfig *netconf; 	-- network config structure
8150Sstevel@tonic-gate  */
8160Sstevel@tonic-gate #else
8170Sstevel@tonic-gate extern CLIENT * clnt_tp_create();
8180Sstevel@tonic-gate #endif
8190Sstevel@tonic-gate 
8200Sstevel@tonic-gate /*
8210Sstevel@tonic-gate  * Generic client creation routine. Just like clnt_tp_create(), except
8220Sstevel@tonic-gate  * it takes an additional timeout parameter.
8230Sstevel@tonic-gate  */
8240Sstevel@tonic-gate #ifdef __STDC__
8250Sstevel@tonic-gate extern CLIENT * clnt_tp_create_timed(const char *, const rpcprog_t,
8260Sstevel@tonic-gate 	const rpcvers_t, const struct netconfig *, const struct timeval *);
8270Sstevel@tonic-gate /*
8280Sstevel@tonic-gate  *	const char *hostname;			-- hostname
8290Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
8300Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
8310Sstevel@tonic-gate  *	const struct netconfig *netconf; 	-- network config structure
8320Sstevel@tonic-gate  *	const struct timeval *tp;		-- timeout
8330Sstevel@tonic-gate  */
8340Sstevel@tonic-gate #else
8350Sstevel@tonic-gate extern CLIENT * clnt_tp_create_timed();
8360Sstevel@tonic-gate #endif
8370Sstevel@tonic-gate 
8380Sstevel@tonic-gate /*
8390Sstevel@tonic-gate  * Generic TLI create routine
8400Sstevel@tonic-gate  */
8410Sstevel@tonic-gate 
8420Sstevel@tonic-gate #ifdef __STDC__
8430Sstevel@tonic-gate extern CLIENT * clnt_tli_create(const int, const struct netconfig *,
8440Sstevel@tonic-gate 	struct netbuf *, const rpcprog_t, const rpcvers_t, const uint_t,
8450Sstevel@tonic-gate 	const uint_t);
8460Sstevel@tonic-gate /*
8470Sstevel@tonic-gate  *	const int fd;		-- fd
8480Sstevel@tonic-gate  *	const struct netconfig *nconf;	-- netconfig structure
8490Sstevel@tonic-gate  *	struct netbuf *svcaddr;		-- servers address
8500Sstevel@tonic-gate  *	const rpcprog_t prog;		-- program number
8510Sstevel@tonic-gate  *	const rpcvers_t vers;		-- version number
8520Sstevel@tonic-gate  *	const uint_t sendsz;		-- send size
8530Sstevel@tonic-gate  *	const uint_t recvsz;		-- recv size
8540Sstevel@tonic-gate  */
8550Sstevel@tonic-gate 
8560Sstevel@tonic-gate #else
8570Sstevel@tonic-gate extern CLIENT * clnt_tli_create();
8580Sstevel@tonic-gate #endif
8590Sstevel@tonic-gate 
8600Sstevel@tonic-gate /*
8610Sstevel@tonic-gate  * Low level clnt create routine for connectionful transports, e.g. tcp.
8620Sstevel@tonic-gate  */
8630Sstevel@tonic-gate #ifdef __STDC__
8640Sstevel@tonic-gate extern  CLIENT * clnt_vc_create(const int, struct netbuf *,
8650Sstevel@tonic-gate 	const rpcprog_t, const rpcvers_t, const uint_t, const uint_t);
8660Sstevel@tonic-gate /*
8670Sstevel@tonic-gate  *	const int fd;				-- open file descriptor
8680Sstevel@tonic-gate  *	const struct netbuf *svcaddr;		-- servers address
8690Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
8700Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
8710Sstevel@tonic-gate  *	const uint_t sendsz;			-- buffer recv size
8720Sstevel@tonic-gate  *	const uint_t recvsz;			-- buffer send size
8730Sstevel@tonic-gate  */
8740Sstevel@tonic-gate #else
8750Sstevel@tonic-gate extern CLIENT * clnt_vc_create();
8760Sstevel@tonic-gate #endif
8770Sstevel@tonic-gate 
8780Sstevel@tonic-gate /*
8790Sstevel@tonic-gate  * Low level clnt create routine for connectionless transports, e.g. udp.
8800Sstevel@tonic-gate  */
8810Sstevel@tonic-gate #ifdef __STDC__
8820Sstevel@tonic-gate extern  CLIENT * clnt_dg_create(const int, struct netbuf *,
8830Sstevel@tonic-gate 	const rpcprog_t, const rpcvers_t, const uint_t, const uint_t);
8840Sstevel@tonic-gate /*
8850Sstevel@tonic-gate  *	const int fd;				-- open file descriptor
8860Sstevel@tonic-gate  *	const struct netbuf *svcaddr;		-- servers address
8870Sstevel@tonic-gate  *	const rpcprog_t program;		-- program number
8880Sstevel@tonic-gate  *	const rpcvers_t version;		-- version number
8890Sstevel@tonic-gate  *	const uint_t sendsz;			-- buffer recv size
8900Sstevel@tonic-gate  *	const uint_t recvsz;			-- buffer send size
8910Sstevel@tonic-gate  */
8920Sstevel@tonic-gate #else
8930Sstevel@tonic-gate extern CLIENT * clnt_dg_create();
8940Sstevel@tonic-gate #endif
8950Sstevel@tonic-gate 
8960Sstevel@tonic-gate /*
8970Sstevel@tonic-gate  * Memory based rpc (for speed check and testing)
8980Sstevel@tonic-gate  * CLIENT *
8990Sstevel@tonic-gate  * clnt_raw_create(prog, vers)
9000Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
9010Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
9020Sstevel@tonic-gate  */
9030Sstevel@tonic-gate #ifdef __STDC__
9040Sstevel@tonic-gate extern CLIENT *clnt_raw_create(const rpcprog_t, const rpcvers_t);
9050Sstevel@tonic-gate #else
9060Sstevel@tonic-gate extern CLIENT *clnt_raw_create();
9070Sstevel@tonic-gate #endif
9080Sstevel@tonic-gate 
9090Sstevel@tonic-gate /*
9100Sstevel@tonic-gate  * Client creation routine over doors transport.
9110Sstevel@tonic-gate  */
9120Sstevel@tonic-gate #ifdef __STDC__
9130Sstevel@tonic-gate extern  CLIENT * clnt_door_create(const rpcprog_t, const rpcvers_t,
9140Sstevel@tonic-gate 	const uint_t);
9150Sstevel@tonic-gate /*
9160Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
9170Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
9180Sstevel@tonic-gate  *	const uint_t sendsz;			-- max send size
9190Sstevel@tonic-gate  */
9200Sstevel@tonic-gate #else
9210Sstevel@tonic-gate extern CLIENT * clnt_door_create();
9220Sstevel@tonic-gate #endif
9230Sstevel@tonic-gate 
9240Sstevel@tonic-gate /*
9250Sstevel@tonic-gate  * internal function. Not for general use. Subject to rapid change.
9260Sstevel@tonic-gate  */
9270Sstevel@tonic-gate #ifdef __STDC__
9280Sstevel@tonic-gate extern CLIENT *clnt_create_service_timed(const char *,
9290Sstevel@tonic-gate 					const char *,
9300Sstevel@tonic-gate 					const rpcprog_t,
9310Sstevel@tonic-gate 					const rpcvers_t,
9320Sstevel@tonic-gate 					const ushort_t,
9330Sstevel@tonic-gate 					const char *,
9340Sstevel@tonic-gate 					const struct timeval *);
9350Sstevel@tonic-gate #else
9360Sstevel@tonic-gate extern CLIENT *clnt_create_service_timed();
9370Sstevel@tonic-gate #endif
9380Sstevel@tonic-gate 
9390Sstevel@tonic-gate /*
9400Sstevel@tonic-gate  * Print why creation failed
9410Sstevel@tonic-gate  */
9420Sstevel@tonic-gate #ifdef __STDC__
9430Sstevel@tonic-gate void clnt_pcreateerror(const char *);	/* stderr */
9440Sstevel@tonic-gate char *clnt_spcreateerror(const char *);	/* string */
9450Sstevel@tonic-gate #else
9460Sstevel@tonic-gate void clnt_pcreateerror();
9470Sstevel@tonic-gate char *clnt_spcreateerror();
9480Sstevel@tonic-gate #endif
9490Sstevel@tonic-gate 
9500Sstevel@tonic-gate /*
9510Sstevel@tonic-gate  * Like clnt_perror(), but is more verbose in its output
9520Sstevel@tonic-gate  */
9530Sstevel@tonic-gate #ifdef __STDC__
9540Sstevel@tonic-gate void clnt_perrno(const enum clnt_stat);	/* stderr */
9550Sstevel@tonic-gate #else
9560Sstevel@tonic-gate void clnt_perrno();
9570Sstevel@tonic-gate #endif
9580Sstevel@tonic-gate 
9590Sstevel@tonic-gate /*
9600Sstevel@tonic-gate  * Print an error message, given the client error code
9610Sstevel@tonic-gate  */
9620Sstevel@tonic-gate #ifdef __STDC__
9630Sstevel@tonic-gate void clnt_perror(const CLIENT *, const char *);
9640Sstevel@tonic-gate #else
9650Sstevel@tonic-gate void clnt_perror();
9660Sstevel@tonic-gate #endif
9670Sstevel@tonic-gate 
9680Sstevel@tonic-gate /*
9690Sstevel@tonic-gate  * If a creation fails, the following allows the user to figure out why.
9700Sstevel@tonic-gate  */
9710Sstevel@tonic-gate struct rpc_createerr {
9720Sstevel@tonic-gate 	enum clnt_stat cf_stat;
9730Sstevel@tonic-gate 	struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
9740Sstevel@tonic-gate };
9750Sstevel@tonic-gate 
9760Sstevel@tonic-gate #ifdef	_REENTRANT
9770Sstevel@tonic-gate extern struct rpc_createerr	*__rpc_createerr();
9780Sstevel@tonic-gate #define	rpc_createerr	(*(__rpc_createerr()))
9790Sstevel@tonic-gate #else
9800Sstevel@tonic-gate extern struct rpc_createerr rpc_createerr;
9810Sstevel@tonic-gate #endif	/* _REENTRANT */
9820Sstevel@tonic-gate 
9830Sstevel@tonic-gate /*
9840Sstevel@tonic-gate  * The simplified interface:
9850Sstevel@tonic-gate  * enum clnt_stat
9860Sstevel@tonic-gate  * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
9870Sstevel@tonic-gate  *	const char *host;
9880Sstevel@tonic-gate  *	const rpcprog_t prognum;
9890Sstevel@tonic-gate  *	const rpcvers_t versnum;
9900Sstevel@tonic-gate  *	const rpcproc_t procnum;
9910Sstevel@tonic-gate  *	const xdrproc_t inproc, outproc;
9920Sstevel@tonic-gate  *	const char *in;
9930Sstevel@tonic-gate  *	char *out;
9940Sstevel@tonic-gate  *	const char *nettype;
9950Sstevel@tonic-gate  */
9960Sstevel@tonic-gate #ifdef __STDC__
9970Sstevel@tonic-gate extern enum clnt_stat rpc_call(const char *, const rpcprog_t, const rpcvers_t,
9980Sstevel@tonic-gate 	const rpcproc_t, const xdrproc_t, const char *, const xdrproc_t,
9990Sstevel@tonic-gate 	char *, const char *);
10000Sstevel@tonic-gate #else
10010Sstevel@tonic-gate extern enum clnt_stat rpc_call();
10020Sstevel@tonic-gate #endif
10030Sstevel@tonic-gate 
10040Sstevel@tonic-gate #ifdef	_REENTRANT
10050Sstevel@tonic-gate extern struct rpc_err	*__rpc_callerr();
10060Sstevel@tonic-gate #define	rpc_callerr	(*(__rpc_callerr()))
10070Sstevel@tonic-gate #else
10080Sstevel@tonic-gate extern struct rpc_err rpc_callerr;
10090Sstevel@tonic-gate #endif	/* _REENTRANT */
10100Sstevel@tonic-gate 
10110Sstevel@tonic-gate /*
10120Sstevel@tonic-gate  * RPC broadcast interface
10130Sstevel@tonic-gate  * The call is broadcasted to all locally connected nets.
10140Sstevel@tonic-gate  *
10150Sstevel@tonic-gate  * extern enum clnt_stat
10160Sstevel@tonic-gate  * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
10170Sstevel@tonic-gate  *			eachresult, nettype)
10180Sstevel@tonic-gate  *	const rpcprog_t		prog;		-- program number
10190Sstevel@tonic-gate  *	const rpcvers_t		vers;		-- version number
10200Sstevel@tonic-gate  *	const rpcproc_t		proc;		-- procedure number
10210Sstevel@tonic-gate  *	const xdrproc_t	xargs;		-- xdr routine for args
10220Sstevel@tonic-gate  *	caddr_t		argsp;		-- pointer to args
10230Sstevel@tonic-gate  *	const xdrproc_t	xresults;	-- xdr routine for results
10240Sstevel@tonic-gate  *	caddr_t		resultsp;	-- pointer to results
10250Sstevel@tonic-gate  *	const resultproc_t	eachresult;	-- call with each result
10260Sstevel@tonic-gate  *	const char		*nettype;	-- Transport type
10270Sstevel@tonic-gate  *
10280Sstevel@tonic-gate  * For each valid response received, the procedure eachresult is called.
10290Sstevel@tonic-gate  * Its form is:
10300Sstevel@tonic-gate  *		done = eachresult(resp, raddr, nconf)
10310Sstevel@tonic-gate  *			bool_t done;
10320Sstevel@tonic-gate  *			caddr_t resp;
10330Sstevel@tonic-gate  *			struct netbuf *raddr;
10340Sstevel@tonic-gate  *			struct netconfig *nconf;
10350Sstevel@tonic-gate  * where resp points to the results of the call and raddr is the
10360Sstevel@tonic-gate  * address if the responder to the broadcast.  nconf is the transport
10370Sstevel@tonic-gate  * on which the response was received.
10380Sstevel@tonic-gate  *
10390Sstevel@tonic-gate  * extern enum clnt_stat
10400Sstevel@tonic-gate  * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
10410Sstevel@tonic-gate  *			eachresult, inittime, waittime, nettype)
10420Sstevel@tonic-gate  *	const rpcprog_t		prog;		-- program number
10430Sstevel@tonic-gate  *	const rpcvers_t		vers;		-- version number
10440Sstevel@tonic-gate  *	const rpcproc_t		proc;		-- procedure number
10450Sstevel@tonic-gate  *	const xdrproc_t	xargs;		-- xdr routine for args
10460Sstevel@tonic-gate  *	caddr_t		argsp;		-- pointer to args
10470Sstevel@tonic-gate  *	const xdrproc_t	xresults;	-- xdr routine for results
10480Sstevel@tonic-gate  *	caddr_t		resultsp;	-- pointer to results
10490Sstevel@tonic-gate  *	const resultproc_t	eachresult;	-- call with each result
10500Sstevel@tonic-gate  *	const int 		inittime;	-- how long to wait initially
10510Sstevel@tonic-gate  *	const int 		waittime;	-- maximum time to wait
10520Sstevel@tonic-gate  *	const char		*nettype;	-- Transport type
10530Sstevel@tonic-gate  */
10540Sstevel@tonic-gate 
10550Sstevel@tonic-gate typedef bool_t(*resultproc_t)(
10560Sstevel@tonic-gate #ifdef	__STDC__
10570Sstevel@tonic-gate 	caddr_t,
10580Sstevel@tonic-gate 	... /* for backward compatibility */
10590Sstevel@tonic-gate #endif				/* __STDC__ */
10600Sstevel@tonic-gate );
10610Sstevel@tonic-gate #ifdef __STDC__
10620Sstevel@tonic-gate extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t,
10630Sstevel@tonic-gate 	const rpcproc_t, const xdrproc_t, caddr_t, const xdrproc_t,
10640Sstevel@tonic-gate 	caddr_t, const resultproc_t, const char *);
10650Sstevel@tonic-gate extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t,
10660Sstevel@tonic-gate 	const rpcproc_t, const xdrproc_t, caddr_t, const xdrproc_t, caddr_t,
10670Sstevel@tonic-gate 	const resultproc_t, const int, const int, const char *);
10680Sstevel@tonic-gate #else
10690Sstevel@tonic-gate extern enum clnt_stat rpc_broadcast();
10700Sstevel@tonic-gate extern enum clnt_stat rpc_broadcast_exp();
10710Sstevel@tonic-gate #endif
10720Sstevel@tonic-gate #endif /* !_KERNEL */
10730Sstevel@tonic-gate 
10740Sstevel@tonic-gate /*
10750Sstevel@tonic-gate  * Copy error message to buffer.
10760Sstevel@tonic-gate  */
10770Sstevel@tonic-gate #ifdef __STDC__
10780Sstevel@tonic-gate const char *clnt_sperrno(const enum clnt_stat);
10790Sstevel@tonic-gate #else
10800Sstevel@tonic-gate char *clnt_sperrno();	/* string */
10810Sstevel@tonic-gate #endif
10820Sstevel@tonic-gate 
10830Sstevel@tonic-gate /*
10840Sstevel@tonic-gate  * Print an error message, given the client error code
10850Sstevel@tonic-gate  */
10860Sstevel@tonic-gate #ifdef __STDC__
10870Sstevel@tonic-gate char *clnt_sperror(const CLIENT *, const char *);
10880Sstevel@tonic-gate #else
10890Sstevel@tonic-gate char *clnt_sperror();
10900Sstevel@tonic-gate #endif
10910Sstevel@tonic-gate 
10920Sstevel@tonic-gate /*
10930Sstevel@tonic-gate  * Client side rpc control routine for rpcbind.
10940Sstevel@tonic-gate  */
10950Sstevel@tonic-gate #ifdef __STDC__
10960Sstevel@tonic-gate bool_t __rpc_control(int, void *);
10970Sstevel@tonic-gate #else
10980Sstevel@tonic-gate bool_t __rpc_control();
10990Sstevel@tonic-gate #endif
11000Sstevel@tonic-gate 
11010Sstevel@tonic-gate #ifdef __cplusplus
11020Sstevel@tonic-gate }
11030Sstevel@tonic-gate #endif
11040Sstevel@tonic-gate 
11050Sstevel@tonic-gate #ifdef PORTMAP
11060Sstevel@tonic-gate /* For backward compatibility */
11070Sstevel@tonic-gate #include <rpc/clnt_soc.h>
11080Sstevel@tonic-gate #endif
11090Sstevel@tonic-gate 
11100Sstevel@tonic-gate #endif	/* !_RPC_CLNT_H */
1111