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