xref: /onnv-gate/usr/src/uts/common/rpc/clnt.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27*0Sstevel@tonic-gate /* All Rights Reserved */
28*0Sstevel@tonic-gate /*
29*0Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley
30*0Sstevel@tonic-gate  * 4.3 BSD under license from the Regents of the University of
31*0Sstevel@tonic-gate  * California.
32*0Sstevel@tonic-gate  */
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate /*
35*0Sstevel@tonic-gate  * clnt.h - Client side remote procedure call interface.
36*0Sstevel@tonic-gate  */
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #ifndef	_RPC_CLNT_H
39*0Sstevel@tonic-gate #define	_RPC_CLNT_H
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
42*0Sstevel@tonic-gate 
43*0Sstevel@tonic-gate #include <sys/types.h>
44*0Sstevel@tonic-gate #include <rpc/rpc_com.h>
45*0Sstevel@tonic-gate #include <rpc/clnt_stat.h>
46*0Sstevel@tonic-gate #include <rpc/auth.h>
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate /*
49*0Sstevel@tonic-gate  * rpc calls return an enum clnt_stat.  This should be looked at more,
50*0Sstevel@tonic-gate  * since each implementation is required to live with this (implementation
51*0Sstevel@tonic-gate  * independent) list of errors.
52*0Sstevel@tonic-gate  */
53*0Sstevel@tonic-gate #include <sys/netconfig.h>
54*0Sstevel@tonic-gate #ifdef _KERNEL
55*0Sstevel@tonic-gate #include <sys/t_kuser.h>
56*0Sstevel@tonic-gate #endif	/* _KERNEL */
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate #ifdef __cplusplus
59*0Sstevel@tonic-gate extern "C" {
60*0Sstevel@tonic-gate #endif
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate /*
63*0Sstevel@tonic-gate  * Following defines the multicast group address used by IPV6 enabled
64*0Sstevel@tonic-gate  * client to do the broadcast. IPv6 doesn't have any broadcast support
65*0Sstevel@tonic-gate  * as IPv4 provides, thus it used this reserved address which is joined
66*0Sstevel@tonic-gate  * by all rpc clients.
67*0Sstevel@tonic-gate  */
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate #define	RPCB_MULTICAST_ADDR "FF02::202"
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate /*
72*0Sstevel@tonic-gate  * the following errors are in general unrecoverable.  The caller
73*0Sstevel@tonic-gate  * should give up rather than retry.
74*0Sstevel@tonic-gate  */
75*0Sstevel@tonic-gate #define	IS_UNRECOVERABLE_RPC(s)	(((s) == RPC_AUTHERROR) || \
76*0Sstevel@tonic-gate 	((s) == RPC_CANTENCODEARGS) || \
77*0Sstevel@tonic-gate 	((s) == RPC_CANTDECODERES) || \
78*0Sstevel@tonic-gate 	((s) == RPC_VERSMISMATCH) || \
79*0Sstevel@tonic-gate 	((s) == RPC_PROCUNAVAIL) || \
80*0Sstevel@tonic-gate 	((s) == RPC_PROGUNAVAIL) || \
81*0Sstevel@tonic-gate 	((s) == RPC_PROGVERSMISMATCH) || \
82*0Sstevel@tonic-gate 	((s) == RPC_CANTDECODEARGS))
83*0Sstevel@tonic-gate 
84*0Sstevel@tonic-gate /* Maximum rpc backoff time */
85*0Sstevel@tonic-gate #define	RPC_MAX_BACKOFF	30
86*0Sstevel@tonic-gate 
87*0Sstevel@tonic-gate /*
88*0Sstevel@tonic-gate  * Error info.
89*0Sstevel@tonic-gate  */
90*0Sstevel@tonic-gate struct rpc_err {
91*0Sstevel@tonic-gate 	enum clnt_stat re_status;
92*0Sstevel@tonic-gate 	union {
93*0Sstevel@tonic-gate 		struct {
94*0Sstevel@tonic-gate 			int RE_errno;	/* related system error */
95*0Sstevel@tonic-gate 			int RE_t_errno;	/* related tli error number */
96*0Sstevel@tonic-gate 		} RE_err;
97*0Sstevel@tonic-gate 		enum auth_stat RE_why;	/* why the auth error occurred */
98*0Sstevel@tonic-gate 		struct {
99*0Sstevel@tonic-gate 			rpcvers_t low;	/* lowest verion supported */
100*0Sstevel@tonic-gate 			rpcvers_t high;	/* highest verion supported */
101*0Sstevel@tonic-gate 		} RE_vers;
102*0Sstevel@tonic-gate 		struct {		/* maybe meaningful if RPC_FAILED */
103*0Sstevel@tonic-gate 			int32_t s1;
104*0Sstevel@tonic-gate 			int32_t s2;
105*0Sstevel@tonic-gate 		} RE_lb;		/* life boot & debugging only */
106*0Sstevel@tonic-gate 	} ru;
107*0Sstevel@tonic-gate #define	re_errno	ru.RE_err.RE_errno
108*0Sstevel@tonic-gate #define	re_terrno	ru.RE_err.RE_t_errno
109*0Sstevel@tonic-gate #define	re_why		ru.RE_why
110*0Sstevel@tonic-gate #define	re_vers		ru.RE_vers
111*0Sstevel@tonic-gate #define	re_lb		ru.RE_lb
112*0Sstevel@tonic-gate };
113*0Sstevel@tonic-gate 
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate /*
116*0Sstevel@tonic-gate  * Timers used for the pseudo-transport protocol when using datagrams
117*0Sstevel@tonic-gate  */
118*0Sstevel@tonic-gate struct rpc_timers {
119*0Sstevel@tonic-gate 	clock_t		rt_srtt;	/* smoothed round-trip time */
120*0Sstevel@tonic-gate 	clock_t		rt_deviate;	/* estimated deviation */
121*0Sstevel@tonic-gate 	clock_t		rt_rtxcur;	/* current (backed-off) rto */
122*0Sstevel@tonic-gate };
123*0Sstevel@tonic-gate 
124*0Sstevel@tonic-gate /*
125*0Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
126*0Sstevel@tonic-gate  * CLIENT
127*0Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
128*0Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
129*0Sstevel@tonic-gate  *
130*0Sstevel@tonic-gate  * Client rpc handle.
131*0Sstevel@tonic-gate  * Created by individual implementations
132*0Sstevel@tonic-gate  * Client is responsible for initializing auth, see e.g. auth_none.c.
133*0Sstevel@tonic-gate  */
134*0Sstevel@tonic-gate 
135*0Sstevel@tonic-gate typedef struct __client {
136*0Sstevel@tonic-gate 	AUTH	*cl_auth;			/* authenticator */
137*0Sstevel@tonic-gate 	struct clnt_ops {
138*0Sstevel@tonic-gate #ifdef __STDC__
139*0Sstevel@tonic-gate 		/* call remote procedure */
140*0Sstevel@tonic-gate 		enum clnt_stat	(*cl_call)(struct __client *, rpcproc_t,
141*0Sstevel@tonic-gate 				    xdrproc_t, caddr_t, xdrproc_t,
142*0Sstevel@tonic-gate 				    caddr_t, struct timeval);
143*0Sstevel@tonic-gate 		/* abort a call */
144*0Sstevel@tonic-gate 		void		(*cl_abort)(/* various */);
145*0Sstevel@tonic-gate 		/* get specific error code */
146*0Sstevel@tonic-gate 		void		(*cl_geterr)(struct __client *,
147*0Sstevel@tonic-gate 				    struct rpc_err *);
148*0Sstevel@tonic-gate 		/* frees results */
149*0Sstevel@tonic-gate 		bool_t		(*cl_freeres)(struct __client *, xdrproc_t,
150*0Sstevel@tonic-gate 				    caddr_t);
151*0Sstevel@tonic-gate 		/* destroy this structure */
152*0Sstevel@tonic-gate 		void		(*cl_destroy)(struct __client *);
153*0Sstevel@tonic-gate 		/* the ioctl() of rpc */
154*0Sstevel@tonic-gate 		bool_t		(*cl_control)(struct __client *, int, char *);
155*0Sstevel@tonic-gate 		/* set rpc level timers */
156*0Sstevel@tonic-gate 		int		(*cl_settimers)(struct __client *,
157*0Sstevel@tonic-gate 				    struct rpc_timers *, struct rpc_timers *,
158*0Sstevel@tonic-gate 				    int, void (*)(), caddr_t, uint32_t);
159*0Sstevel@tonic-gate #ifndef _KERNEL
160*0Sstevel@tonic-gate 		/* send a one-way asynchronous call to remote procedure */
161*0Sstevel@tonic-gate 		enum clnt_stat	(*cl_send)(struct __client *, rpcproc_t,
162*0Sstevel@tonic-gate 				    xdrproc_t, caddr_t);
163*0Sstevel@tonic-gate #endif /* !_KERNEL */
164*0Sstevel@tonic-gate #else
165*0Sstevel@tonic-gate 		enum clnt_stat	(*cl_call)();	/* call remote procedure */
166*0Sstevel@tonic-gate 		void		(*cl_abort)();	/* abort a call */
167*0Sstevel@tonic-gate 		void		(*cl_geterr)();	/* get specific error code */
168*0Sstevel@tonic-gate 		bool_t		(*cl_freeres)(); /* frees results */
169*0Sstevel@tonic-gate 		void		(*cl_destroy)(); /* destroy this structure */
170*0Sstevel@tonic-gate 		bool_t		(*cl_control)(); /* the ioctl() of rpc */
171*0Sstevel@tonic-gate 		int		(*cl_settimers)(); /* set rpc level timers */
172*0Sstevel@tonic-gate #ifndef _KERNEL
173*0Sstevel@tonic-gate 		enum clnt_stat  (*cl_send)();   /* send one-way request */
174*0Sstevel@tonic-gate #endif /* !_KERNEL */
175*0Sstevel@tonic-gate #endif
176*0Sstevel@tonic-gate 	} *cl_ops;
177*0Sstevel@tonic-gate 	caddr_t			cl_private;	/* private stuff */
178*0Sstevel@tonic-gate #ifndef _KERNEL
179*0Sstevel@tonic-gate 	char			*cl_netid;	/* network token */
180*0Sstevel@tonic-gate 	char			*cl_tp;		/* device name */
181*0Sstevel@tonic-gate #else
182*0Sstevel@tonic-gate 	bool_t			cl_nosignal;  /* to handle NOINTR */
183*0Sstevel@tonic-gate #endif
184*0Sstevel@tonic-gate } CLIENT;
185*0Sstevel@tonic-gate 
186*0Sstevel@tonic-gate /*
187*0Sstevel@tonic-gate  * Feedback values used for possible congestion and rate control
188*0Sstevel@tonic-gate  */
189*0Sstevel@tonic-gate #define	FEEDBACK_REXMIT1	1	/* first retransmit */
190*0Sstevel@tonic-gate #define	FEEDBACK_OK		2	/* no retransmits */
191*0Sstevel@tonic-gate 
192*0Sstevel@tonic-gate /*
193*0Sstevel@tonic-gate  * The following defines the control routines
194*0Sstevel@tonic-gate  * for rpcbind.
195*0Sstevel@tonic-gate  */
196*0Sstevel@tonic-gate 
197*0Sstevel@tonic-gate #define	CLCR_GET_RPCB_TIMEOUT	1
198*0Sstevel@tonic-gate #define	CLCR_SET_RPCB_TIMEOUT	2
199*0Sstevel@tonic-gate #define	CLCR_SET_LOWVERS	3
200*0Sstevel@tonic-gate #define	CLCR_GET_LOWVERS	4
201*0Sstevel@tonic-gate #define	CLCR_SET_RPCB_RMTTIME	5
202*0Sstevel@tonic-gate #define	CLCR_GET_RPCB_RMTTIME  	6
203*0Sstevel@tonic-gate #define	CLCR_SET_CRED_CACHE_SZ 	7
204*0Sstevel@tonic-gate #define	CLCR_GET_CRED_CACHE_SZ 	8
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate #define	RPCSMALLMSGSIZE	400	/* a more reasonable packet size */
207*0Sstevel@tonic-gate 
208*0Sstevel@tonic-gate #define	KNC_STRSIZE	128	/* maximum length of knetconfig strings */
209*0Sstevel@tonic-gate /*
210*0Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
211*0Sstevel@tonic-gate  * knetconfig
212*0Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
213*0Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
214*0Sstevel@tonic-gate  *
215*0Sstevel@tonic-gate  * Note that the knetconfig strings can either be dynamically allocated, or
216*0Sstevel@tonic-gate  * they can be string literals.  The code that sets up the knetconfig is
217*0Sstevel@tonic-gate  * responsible for keeping track of this and freeing the strings if
218*0Sstevel@tonic-gate  * necessary when the knetconfig is destroyed.
219*0Sstevel@tonic-gate  */
220*0Sstevel@tonic-gate struct knetconfig {
221*0Sstevel@tonic-gate 	unsigned int	knc_semantics;	/* token name */
222*0Sstevel@tonic-gate 	caddr_t		knc_protofmly;	/* protocol family */
223*0Sstevel@tonic-gate 	caddr_t		knc_proto;	/* protocol */
224*0Sstevel@tonic-gate 	dev_t		knc_rdev;	/* device id */
225*0Sstevel@tonic-gate 	unsigned int	knc_unused[8];
226*0Sstevel@tonic-gate };
227*0Sstevel@tonic-gate 
228*0Sstevel@tonic-gate #ifdef _SYSCALL32
229*0Sstevel@tonic-gate struct knetconfig32 {
230*0Sstevel@tonic-gate 	uint32_t	knc_semantics;	/* token name */
231*0Sstevel@tonic-gate 	caddr32_t	knc_protofmly;	/* protocol family */
232*0Sstevel@tonic-gate 	caddr32_t	knc_proto;	/* protocol */
233*0Sstevel@tonic-gate 	dev32_t		knc_rdev;	/* device id */
234*0Sstevel@tonic-gate 	uint32_t	knc_unused[8];
235*0Sstevel@tonic-gate };
236*0Sstevel@tonic-gate #endif /* _SYSCALL32 */
237*0Sstevel@tonic-gate 
238*0Sstevel@tonic-gate #ifdef _KERNEL
239*0Sstevel@tonic-gate 
240*0Sstevel@tonic-gate /*
241*0Sstevel@tonic-gate  * Bucket defined for the call table.  Padded out to 64 bytes so that
242*0Sstevel@tonic-gate  * false sharing won't be induced.
243*0Sstevel@tonic-gate  */
244*0Sstevel@tonic-gate typedef	union call_table {
245*0Sstevel@tonic-gate 	struct {
246*0Sstevel@tonic-gate 		struct calllist_s	*uct_call_next;
247*0Sstevel@tonic-gate 		struct calllist_s	*uct_call_prev;
248*0Sstevel@tonic-gate 		uint_t			uct_len;
249*0Sstevel@tonic-gate 		kmutex_t		uct_lock;
250*0Sstevel@tonic-gate 	} ct_s;
251*0Sstevel@tonic-gate 	char				uct_pad[64];
252*0Sstevel@tonic-gate } call_table_t;
253*0Sstevel@tonic-gate 
254*0Sstevel@tonic-gate /*
255*0Sstevel@tonic-gate  * Define some macros for easy access into the call table structure
256*0Sstevel@tonic-gate  */
257*0Sstevel@tonic-gate #define	ct_call_next ct_s.uct_call_next
258*0Sstevel@tonic-gate #define	ct_call_prev ct_s.uct_call_prev
259*0Sstevel@tonic-gate #define	ct_len ct_s.uct_len
260*0Sstevel@tonic-gate #define	ct_lock ct_s.uct_lock
261*0Sstevel@tonic-gate 
262*0Sstevel@tonic-gate /*
263*0Sstevel@tonic-gate  * List of outstanding calls awaiting replies, for COTS, CLTS
264*0Sstevel@tonic-gate  */
265*0Sstevel@tonic-gate typedef struct calllist_s {
266*0Sstevel@tonic-gate 	struct calllist_s *call_next;	/* hash chain, MUST BE FIRST */
267*0Sstevel@tonic-gate 	struct calllist_s *call_prev;
268*0Sstevel@tonic-gate 	bool_t		call_notified;
269*0Sstevel@tonic-gate 	uint_t		call_xid;	/* the xid on the call */
270*0Sstevel@tonic-gate 	uint_t		call_hash;	/* hash value */
271*0Sstevel@tonic-gate 	call_table_t	*call_bucket;	/* back pointer to bucket */
272*0Sstevel@tonic-gate 	mblk_t		*call_reply;	/* the reply to the call */
273*0Sstevel@tonic-gate 	kcondvar_t	call_cv;	/* cv to notify when reply is done */
274*0Sstevel@tonic-gate 	kmutex_t	call_lock;	/* lock for cv */
275*0Sstevel@tonic-gate 	struct rpc_err	call_err;	/* status on reply */
276*0Sstevel@tonic-gate #define	call_status call_err.re_status	/* error on reply (rep is invalid) */
277*0Sstevel@tonic-gate #define	call_reason call_err.re_errno	/* reason code on T_DISCON_IND */
278*0Sstevel@tonic-gate 	queue_t		*call_wq;	/* the write queue the call is using */
279*0Sstevel@tonic-gate } calllist_t;
280*0Sstevel@tonic-gate 
281*0Sstevel@tonic-gate /*
282*0Sstevel@tonic-gate  * Define macros for call table hashing
283*0Sstevel@tonic-gate  */
284*0Sstevel@tonic-gate /*
285*0Sstevel@tonic-gate  * A simple hash function.  Due to the way XID's get allocated, this may be
286*0Sstevel@tonic-gate  * sufficient.  This hash function provides round robin bucket selection so
287*0Sstevel@tonic-gate  * that the next time a particular bucket gets picked is when there have
288*0Sstevel@tonic-gate  * been N-1 calls.  N is the number of buckets.
289*0Sstevel@tonic-gate  */
290*0Sstevel@tonic-gate #define	call_hash(xid, hashsize) \
291*0Sstevel@tonic-gate 		(xid % hashsize);
292*0Sstevel@tonic-gate 
293*0Sstevel@tonic-gate #define	call_table_enter(e)				\
294*0Sstevel@tonic-gate {							\
295*0Sstevel@tonic-gate 	call_table_t *ctp = e->call_bucket;		\
296*0Sstevel@tonic-gate 	mutex_enter(&ctp->ct_lock);			\
297*0Sstevel@tonic-gate 	ctp->ct_len++;					\
298*0Sstevel@tonic-gate 	e->call_next = (calllist_t *)ctp->ct_call_next;	\
299*0Sstevel@tonic-gate 	e->call_prev = (calllist_t *)ctp;		\
300*0Sstevel@tonic-gate 	((call_table_t *)ctp->ct_call_next)->ct_call_prev = e;		\
301*0Sstevel@tonic-gate 	ctp->ct_call_next = e;				\
302*0Sstevel@tonic-gate 	mutex_exit(&e->call_bucket->ct_lock);		\
303*0Sstevel@tonic-gate }
304*0Sstevel@tonic-gate 
305*0Sstevel@tonic-gate #define	call_table_remove(e)				\
306*0Sstevel@tonic-gate {							\
307*0Sstevel@tonic-gate 	call_table_t *ctp = e->call_bucket;		\
308*0Sstevel@tonic-gate 	mutex_enter(&ctp->ct_lock);			\
309*0Sstevel@tonic-gate 	ctp->ct_len--;					\
310*0Sstevel@tonic-gate 	((call_table_t *)e->call_prev)->ct_call_next = e->call_next;	\
311*0Sstevel@tonic-gate 	((call_table_t *)e->call_next)->ct_call_prev = e->call_prev;	\
312*0Sstevel@tonic-gate 	mutex_exit(&ctp->ct_lock);			\
313*0Sstevel@tonic-gate }
314*0Sstevel@tonic-gate 
315*0Sstevel@tonic-gate #define	call_table_find(ctp, xid, ele)			\
316*0Sstevel@tonic-gate {							\
317*0Sstevel@tonic-gate 	calllist_t *cp;					\
318*0Sstevel@tonic-gate 	ele = NULL;					\
319*0Sstevel@tonic-gate 	mutex_enter(&(ctp)->ct_lock);			\
320*0Sstevel@tonic-gate 	for (cp = (ctp)->ct_call_next;			\
321*0Sstevel@tonic-gate 		cp != (calllist_t *)ctp;		\
322*0Sstevel@tonic-gate 		cp = cp->call_next) {			\
323*0Sstevel@tonic-gate 		if (cp->call_xid == xid)		\
324*0Sstevel@tonic-gate 			ele = cp;			\
325*0Sstevel@tonic-gate 	}						\
326*0Sstevel@tonic-gate }
327*0Sstevel@tonic-gate 
328*0Sstevel@tonic-gate #define	DEFAULT_MIN_HASH_SIZE	32
329*0Sstevel@tonic-gate #define	DEFAULT_HASH_SIZE	1024
330*0Sstevel@tonic-gate 
331*0Sstevel@tonic-gate #define	RESERVED_PORTSPACE (IPPORT_RESERVED - (IPPORT_RESERVED/2))
332*0Sstevel@tonic-gate #define	NONRESERVED_PORTSPACE (0xFFFF - IPPORT_RESERVED)
333*0Sstevel@tonic-gate 
334*0Sstevel@tonic-gate /*
335*0Sstevel@tonic-gate  *	Alloc_xid presents an interface which kernel RPC clients
336*0Sstevel@tonic-gate  *	should use to allocate their XIDs.  Its implementation
337*0Sstevel@tonic-gate  *	may change over time (for example, to allow sharing of
338*0Sstevel@tonic-gate  *	XIDs between the kernel and user-level applications, so
339*0Sstevel@tonic-gate  *	all XID allocation should be done by calling alloc_xid().
340*0Sstevel@tonic-gate  */
341*0Sstevel@tonic-gate extern uint32_t alloc_xid(void);
342*0Sstevel@tonic-gate 
343*0Sstevel@tonic-gate extern int clnt_tli_kcreate(struct knetconfig *config, struct netbuf *svcaddr,
344*0Sstevel@tonic-gate 	rpcprog_t, rpcvers_t, uint_t max_msgsize, int retrys,
345*0Sstevel@tonic-gate 	struct cred *cred, CLIENT **ncl);
346*0Sstevel@tonic-gate 
347*0Sstevel@tonic-gate extern int clnt_tli_kinit(CLIENT *h, struct knetconfig *config,
348*0Sstevel@tonic-gate 	struct netbuf *addr, uint_t max_msgsize, int retries,
349*0Sstevel@tonic-gate 	struct cred *cred);
350*0Sstevel@tonic-gate 
351*0Sstevel@tonic-gate extern int rpc_uaddr2port(int af, char *addr);
352*0Sstevel@tonic-gate 
353*0Sstevel@tonic-gate /*
354*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
355*0Sstevel@tonic-gate  */
356*0Sstevel@tonic-gate extern int bindresvport(TIUSER *tiptr, struct netbuf *addr,
357*0Sstevel@tonic-gate 	struct netbuf *bound_addr, bool_t istcp);
358*0Sstevel@tonic-gate 
359*0Sstevel@tonic-gate /*
360*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
361*0Sstevel@tonic-gate  */
362*0Sstevel@tonic-gate extern int clnt_clts_kcreate(struct knetconfig *config, struct netbuf *addr,
363*0Sstevel@tonic-gate 	rpcprog_t, rpcvers_t, int retries, struct cred *cred, CLIENT **cl);
364*0Sstevel@tonic-gate 
365*0Sstevel@tonic-gate /*
366*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
367*0Sstevel@tonic-gate  */
368*0Sstevel@tonic-gate extern int clnt_cots_kcreate(dev_t dev, struct netbuf *addr, int family,
369*0Sstevel@tonic-gate 	rpcprog_t, rpcvers_t, uint_t max_msgsize, struct cred *cred,
370*0Sstevel@tonic-gate 	CLIENT **ncl);
371*0Sstevel@tonic-gate /*
372*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
373*0Sstevel@tonic-gate  */
374*0Sstevel@tonic-gate extern int clnt_rdma_kcreate(char *proto, void *handle, struct netbuf *raddr,
375*0Sstevel@tonic-gate 	int family, rpcprog_t pgm, rpcvers_t vers, struct cred *cred,
376*0Sstevel@tonic-gate 	CLIENT **cl);
377*0Sstevel@tonic-gate /*
378*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
379*0Sstevel@tonic-gate  */
380*0Sstevel@tonic-gate extern int rdma_reachable(int addr_type, struct netbuf *addr,
381*0Sstevel@tonic-gate 	struct knetconfig **knconf);
382*0Sstevel@tonic-gate 
383*0Sstevel@tonic-gate /*
384*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
385*0Sstevel@tonic-gate  */
386*0Sstevel@tonic-gate extern void clnt_clts_kinit(CLIENT *h, struct netbuf *addr, int retries,
387*0Sstevel@tonic-gate 	struct cred *cred);
388*0Sstevel@tonic-gate 
389*0Sstevel@tonic-gate /*
390*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
391*0Sstevel@tonic-gate  */
392*0Sstevel@tonic-gate extern void clnt_cots_kinit(CLIENT *h, dev_t dev, int family,
393*0Sstevel@tonic-gate 	struct netbuf *addr, int max_msgsize, struct cred *cred);
394*0Sstevel@tonic-gate 
395*0Sstevel@tonic-gate /*
396*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
397*0Sstevel@tonic-gate  */
398*0Sstevel@tonic-gate extern void clnt_rdma_kinit(CLIENT *h, char *proto, void *handle,
399*0Sstevel@tonic-gate 	struct netbuf *addr, struct cred *cred);
400*0Sstevel@tonic-gate 
401*0Sstevel@tonic-gate /*
402*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
403*0Sstevel@tonic-gate  */
404*0Sstevel@tonic-gate extern bool_t clnt_dispatch_notify(mblk_t *, zoneid_t);
405*0Sstevel@tonic-gate 
406*0Sstevel@tonic-gate /*
407*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
408*0Sstevel@tonic-gate  */
409*0Sstevel@tonic-gate extern bool_t clnt_dispatch_notifyconn(queue_t *, mblk_t *);
410*0Sstevel@tonic-gate 
411*0Sstevel@tonic-gate /*
412*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
413*0Sstevel@tonic-gate  */
414*0Sstevel@tonic-gate extern void clnt_dispatch_notifyall(queue_t *, int32_t, int32_t);
415*0Sstevel@tonic-gate 
416*0Sstevel@tonic-gate /*
417*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
418*0Sstevel@tonic-gate  */
419*0Sstevel@tonic-gate extern enum clnt_stat clnt_clts_kcallit_addr(CLIENT *, rpcproc_t, xdrproc_t,
420*0Sstevel@tonic-gate 	caddr_t, xdrproc_t, caddr_t, struct timeval, struct netbuf *);
421*0Sstevel@tonic-gate 
422*0Sstevel@tonic-gate /*
423*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
424*0Sstevel@tonic-gate  */
425*0Sstevel@tonic-gate extern call_table_t *call_table_init(int);
426*0Sstevel@tonic-gate 
427*0Sstevel@tonic-gate /*
428*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
429*0Sstevel@tonic-gate  */
430*0Sstevel@tonic-gate extern void clnt_init(void);
431*0Sstevel@tonic-gate 
432*0Sstevel@tonic-gate /*
433*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
434*0Sstevel@tonic-gate  */
435*0Sstevel@tonic-gate extern void clnt_fini(void);
436*0Sstevel@tonic-gate 
437*0Sstevel@tonic-gate /*
438*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
439*0Sstevel@tonic-gate  */
440*0Sstevel@tonic-gate extern void clnt_clts_init(void);
441*0Sstevel@tonic-gate 
442*0Sstevel@tonic-gate /*
443*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
444*0Sstevel@tonic-gate  */
445*0Sstevel@tonic-gate extern void clnt_clts_fini(void);
446*0Sstevel@tonic-gate 
447*0Sstevel@tonic-gate /*
448*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
449*0Sstevel@tonic-gate  */
450*0Sstevel@tonic-gate extern void clnt_cots_init(void);
451*0Sstevel@tonic-gate 
452*0Sstevel@tonic-gate /*
453*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
454*0Sstevel@tonic-gate  */
455*0Sstevel@tonic-gate extern void clnt_cots_fini(void);
456*0Sstevel@tonic-gate 
457*0Sstevel@tonic-gate /*
458*0Sstevel@tonic-gate  * kRPC internal function. Not for general use. Subject to rapid change.
459*0Sstevel@tonic-gate  */
460*0Sstevel@tonic-gate extern void clnt_clts_dispatch_notify(mblk_t *, int, zoneid_t);
461*0Sstevel@tonic-gate 
462*0Sstevel@tonic-gate extern void rpc_poptimod(struct vnode *);
463*0Sstevel@tonic-gate extern int kstr_push(struct vnode *, char *);
464*0Sstevel@tonic-gate extern void t_kadvise(TIUSER *, uchar_t *, int);
465*0Sstevel@tonic-gate 
466*0Sstevel@tonic-gate extern boolean_t connmgr_cpr_reset(void *, int);
467*0Sstevel@tonic-gate 
468*0Sstevel@tonic-gate extern void put_inet_port(struct netbuf *, ushort_t);
469*0Sstevel@tonic-gate extern void put_inet6_port(struct netbuf *, ushort_t);
470*0Sstevel@tonic-gate extern void put_loopback_port(struct netbuf *, char *);
471*0Sstevel@tonic-gate extern enum clnt_stat rpcbind_getaddr(struct knetconfig *, rpcprog_t,
472*0Sstevel@tonic-gate     rpcvers_t, struct netbuf *);
473*0Sstevel@tonic-gate 
474*0Sstevel@tonic-gate /*
475*0Sstevel@tonic-gate  * Kstat stuff
476*0Sstevel@tonic-gate  */
477*0Sstevel@tonic-gate #include <sys/zone.h>
478*0Sstevel@tonic-gate 
479*0Sstevel@tonic-gate extern zone_key_t rpcstat_zone_key;
480*0Sstevel@tonic-gate 
481*0Sstevel@tonic-gate struct rpc_clts_client;		/* unix:0:rpc_clts_client */
482*0Sstevel@tonic-gate struct rpc_clts_server;		/* unix:0:rpc_clts_server */
483*0Sstevel@tonic-gate struct rpc_cots_client;		/* unix:0:rpc_cots_client */
484*0Sstevel@tonic-gate struct rpc_cots_server;		/* unix:0:rpc_cots_server */
485*0Sstevel@tonic-gate 
486*0Sstevel@tonic-gate struct rpcstat {
487*0Sstevel@tonic-gate 	struct rpc_clts_client *rpc_clts_client;
488*0Sstevel@tonic-gate 	struct rpc_clts_server *rpc_clts_server;
489*0Sstevel@tonic-gate 	struct rpc_cots_client *rpc_cots_client;
490*0Sstevel@tonic-gate 	struct rpc_cots_server *rpc_cots_server;
491*0Sstevel@tonic-gate };
492*0Sstevel@tonic-gate 
493*0Sstevel@tonic-gate extern kstat_named_t *rpcstat_zone_init_common(zoneid_t, const char *,
494*0Sstevel@tonic-gate     const char *, const kstat_named_t *, size_t);
495*0Sstevel@tonic-gate extern void rpcstat_zone_fini_common(zoneid_t, const char *, const char *);
496*0Sstevel@tonic-gate 
497*0Sstevel@tonic-gate extern void clnt_clts_stats_init(zoneid_t, struct rpc_clts_client **);
498*0Sstevel@tonic-gate extern void clnt_clts_stats_fini(zoneid_t, struct rpc_clts_client **);
499*0Sstevel@tonic-gate 
500*0Sstevel@tonic-gate extern void svc_clts_stats_init(zoneid_t, struct rpc_clts_server **);
501*0Sstevel@tonic-gate extern void svc_clts_stats_fini(zoneid_t, struct rpc_clts_server **);
502*0Sstevel@tonic-gate 
503*0Sstevel@tonic-gate extern void clnt_cots_stats_init(zoneid_t, struct rpc_cots_client **);
504*0Sstevel@tonic-gate extern void clnt_cots_stats_fini(zoneid_t, struct rpc_cots_client **);
505*0Sstevel@tonic-gate 
506*0Sstevel@tonic-gate extern void svc_cots_stats_init(zoneid_t, struct rpc_cots_server **);
507*0Sstevel@tonic-gate extern void svc_cots_stats_fini(zoneid_t, struct rpc_cots_server **);
508*0Sstevel@tonic-gate 
509*0Sstevel@tonic-gate #endif /* _KERNEL */
510*0Sstevel@tonic-gate 
511*0Sstevel@tonic-gate /*
512*0Sstevel@tonic-gate  * client side rpc interface ops
513*0Sstevel@tonic-gate  */
514*0Sstevel@tonic-gate 
515*0Sstevel@tonic-gate /*
516*0Sstevel@tonic-gate  * enum clnt_stat
517*0Sstevel@tonic-gate  * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
518*0Sstevel@tonic-gate  * 	CLIENT *rh;
519*0Sstevel@tonic-gate  *	rpcproc_t proc;
520*0Sstevel@tonic-gate  *	xdrproc_t xargs;
521*0Sstevel@tonic-gate  *	caddr_t argsp;
522*0Sstevel@tonic-gate  *	xdrproc_t xres;
523*0Sstevel@tonic-gate  *	caddr_t resp;
524*0Sstevel@tonic-gate  *	struct timeval timeout;
525*0Sstevel@tonic-gate  *
526*0Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
527*0Sstevel@tonic-gate  * CLNT_CALL
528*0Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
529*0Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
530*0Sstevel@tonic-gate  */
531*0Sstevel@tonic-gate #define	CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)	\
532*0Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
533*0Sstevel@tonic-gate #define	clnt_call(rh, proc, xargs, argsp, xres, resp, secs)	\
534*0Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
535*0Sstevel@tonic-gate 
536*0Sstevel@tonic-gate #ifndef _KERNEL
537*0Sstevel@tonic-gate /*
538*0Sstevel@tonic-gate  * enum clnt_stat
539*0Sstevel@tonic-gate  * CLNT_SEND(rh, proc, xargs, argsp)
540*0Sstevel@tonic-gate  * 	CLIENT *rh;
541*0Sstevel@tonic-gate  *	rpcproc_t proc;
542*0Sstevel@tonic-gate  *	xdrproc_t xargs;
543*0Sstevel@tonic-gate  *	caddr_t argsp;
544*0Sstevel@tonic-gate  *
545*0Sstevel@tonic-gate  * PSARC 2000/428  Contract Private Interface
546*0Sstevel@tonic-gate  */
547*0Sstevel@tonic-gate #define	CLNT_SEND(rh, proc, xargs, argsp)	\
548*0Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_send)(rh, proc, xargs, argsp))
549*0Sstevel@tonic-gate #define	clnt_send(rh, proc, xargs, argsp)	\
550*0Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_send)(rh, proc, xargs, argsp))
551*0Sstevel@tonic-gate #endif /* !_KERNEL */
552*0Sstevel@tonic-gate 
553*0Sstevel@tonic-gate /*
554*0Sstevel@tonic-gate  * void
555*0Sstevel@tonic-gate  * CLNT_ABORT(rh);
556*0Sstevel@tonic-gate  * 	CLIENT *rh;
557*0Sstevel@tonic-gate  */
558*0Sstevel@tonic-gate #define	CLNT_ABORT(rh)	((*(rh)->cl_ops->cl_abort)(rh))
559*0Sstevel@tonic-gate #define	clnt_abort(rh)	((*(rh)->cl_ops->cl_abort)(rh))
560*0Sstevel@tonic-gate 
561*0Sstevel@tonic-gate /*
562*0Sstevel@tonic-gate  * struct rpc_err
563*0Sstevel@tonic-gate  * CLNT_GETERR(rh);
564*0Sstevel@tonic-gate  * 	CLIENT *rh;
565*0Sstevel@tonic-gate  */
566*0Sstevel@tonic-gate #define	CLNT_GETERR(rh, errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
567*0Sstevel@tonic-gate #define	clnt_geterr(rh, errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
568*0Sstevel@tonic-gate 
569*0Sstevel@tonic-gate /*
570*0Sstevel@tonic-gate  * bool_t
571*0Sstevel@tonic-gate  * CLNT_FREERES(rh, xres, resp);
572*0Sstevel@tonic-gate  * 	CLIENT *rh;
573*0Sstevel@tonic-gate  *	xdrproc_t xres;
574*0Sstevel@tonic-gate  *	caddr_t resp;
575*0Sstevel@tonic-gate  */
576*0Sstevel@tonic-gate #define	CLNT_FREERES(rh, xres, resp) \
577*0Sstevel@tonic-gate 		((*(rh)->cl_ops->cl_freeres)(rh, xres, resp))
578*0Sstevel@tonic-gate #define	clnt_freeres(rh, xres, resp) \
579*0Sstevel@tonic-gate 		((*(rh)->cl_ops->cl_freeres)(rh, xres, resp))
580*0Sstevel@tonic-gate 
581*0Sstevel@tonic-gate /*
582*0Sstevel@tonic-gate  * bool_t
583*0Sstevel@tonic-gate  * CLNT_CONTROL(cl, request, info)
584*0Sstevel@tonic-gate  *	CLIENT *cl;
585*0Sstevel@tonic-gate  *	uint_t request;
586*0Sstevel@tonic-gate  *	char *info;
587*0Sstevel@tonic-gate  *
588*0Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
589*0Sstevel@tonic-gate  * CLNT_CONTROL
590*0Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
591*0Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
592*0Sstevel@tonic-gate  */
593*0Sstevel@tonic-gate #define	CLNT_CONTROL(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in))
594*0Sstevel@tonic-gate #define	clnt_control(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in))
595*0Sstevel@tonic-gate 
596*0Sstevel@tonic-gate 
597*0Sstevel@tonic-gate /*
598*0Sstevel@tonic-gate  * control operations that apply to all transports
599*0Sstevel@tonic-gate  */
600*0Sstevel@tonic-gate #define	CLSET_TIMEOUT		1	/* set timeout (timeval) */
601*0Sstevel@tonic-gate #define	CLGET_TIMEOUT		2	/* get timeout (timeval) */
602*0Sstevel@tonic-gate #define	CLGET_SERVER_ADDR	3	/* get server's address (sockaddr) */
603*0Sstevel@tonic-gate #define	CLGET_FD		6	/* get connections file descriptor */
604*0Sstevel@tonic-gate #define	CLGET_SVC_ADDR		7	/* get server's address (netbuf) */
605*0Sstevel@tonic-gate #define	CLSET_FD_CLOSE		8	/* close fd while clnt_destroy */
606*0Sstevel@tonic-gate #define	CLSET_FD_NCLOSE		9	/* Do not close fd while clnt_destroy */
607*0Sstevel@tonic-gate #define	CLGET_XID 		10	/* Get xid */
608*0Sstevel@tonic-gate #define	CLSET_XID		11	/* Set xid */
609*0Sstevel@tonic-gate #define	CLGET_VERS		12	/* Get version number */
610*0Sstevel@tonic-gate #define	CLSET_VERS		13	/* Set version number */
611*0Sstevel@tonic-gate #define	CLGET_PROG		14	/* Get program number */
612*0Sstevel@tonic-gate #define	CLSET_PROG		15	/* Set program number */
613*0Sstevel@tonic-gate #define	CLSET_SVC_ADDR		16	/* get server's address (netbuf) */
614*0Sstevel@tonic-gate #define	CLSET_PUSH_TIMOD	17	/* push timod if not already present */
615*0Sstevel@tonic-gate #define	CLSET_POP_TIMOD		18	/* pop timod */
616*0Sstevel@tonic-gate #ifndef _KERNEL
617*0Sstevel@tonic-gate /* 00-08-17 - NON STANDARD CONTROL PARAMETER */
618*0Sstevel@tonic-gate #define	CLSET_IO_MODE		19	/* clnt_send behavior */
619*0Sstevel@tonic-gate #define	CLGET_IO_MODE		20	/* clnt_send behavior */
620*0Sstevel@tonic-gate #define	CLSET_FLUSH_MODE	21	/* flush behavior */
621*0Sstevel@tonic-gate #define	CLGET_FLUSH_MODE	22	/* flush behavior */
622*0Sstevel@tonic-gate #define	CLFLUSH			23	/* flush now (user wants it) */
623*0Sstevel@tonic-gate #define	CLSET_CONNMAXREC_SIZE	24	/* set pending request buffer size */
624*0Sstevel@tonic-gate #define	CLGET_CONNMAXREC_SIZE	25	/* set pending request buffer size */
625*0Sstevel@tonic-gate #define	CLGET_CURRENT_REC_SIZE	26	/* get pending request buffer size */
626*0Sstevel@tonic-gate 
627*0Sstevel@tonic-gate typedef enum {
628*0Sstevel@tonic-gate 	RPC_CL_BESTEFFORT_FLUSH = 100,	/* flush as much as possible */
629*0Sstevel@tonic-gate 					/* without blocking */
630*0Sstevel@tonic-gate 	RPC_CL_BLOCKING_FLUSH,		/* flush the buffer completely */
631*0Sstevel@tonic-gate 					/* (possibly blocking) */
632*0Sstevel@tonic-gate 	RPC_CL_DEFAULT_FLUSH		/* flush according to the currently */
633*0Sstevel@tonic-gate 					/* defined policy. */
634*0Sstevel@tonic-gate } rpcflushmode_t;
635*0Sstevel@tonic-gate 
636*0Sstevel@tonic-gate 
637*0Sstevel@tonic-gate typedef enum {
638*0Sstevel@tonic-gate 	RPC_CL_BLOCKING = 10,	/* PASSED CLNT_CONTROL SET_IO_MODE */
639*0Sstevel@tonic-gate 	RPC_CL_NONBLOCKING
640*0Sstevel@tonic-gate } rpciomode_t;
641*0Sstevel@tonic-gate #endif /* !_KERNEL */
642*0Sstevel@tonic-gate /*
643*0Sstevel@tonic-gate  * Connectionless only control operations
644*0Sstevel@tonic-gate  */
645*0Sstevel@tonic-gate #define	CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */
646*0Sstevel@tonic-gate #define	CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */
647*0Sstevel@tonic-gate 
648*0Sstevel@tonic-gate #ifdef	_KERNEL
649*0Sstevel@tonic-gate /*
650*0Sstevel@tonic-gate  * Connection oriented only control operation.
651*0Sstevel@tonic-gate  */
652*0Sstevel@tonic-gate #define	CLSET_PROGRESS		10000	/* Report RPC_INPROGRESS if a request */
653*0Sstevel@tonic-gate 					/* has been sent but no reply */
654*0Sstevel@tonic-gate 					/* received yet. */
655*0Sstevel@tonic-gate #define	CLSET_BCAST		10001	/* Set RPC Broadcast hint */
656*0Sstevel@tonic-gate #define	CLGET_BCAST		10002	/* Get RPC Broadcast hint */
657*0Sstevel@tonic-gate #define	CLSET_NODELAYONERR	10003	/* Set enable/disable of delay on */
658*0Sstevel@tonic-gate 					/* connection setup error	  */
659*0Sstevel@tonic-gate #define	CLGET_NODELAYONERR	10004	/* Get enable/disable of delay on */
660*0Sstevel@tonic-gate 					/* connection setup error	  */
661*0Sstevel@tonic-gate #define	CLSET_BINDRESVPORT	10005	/* Set preference for reserve port */
662*0Sstevel@tonic-gate #define	CLGET_BINDRESVPORT	10006	/* Get preference for reserve port */
663*0Sstevel@tonic-gate #endif
664*0Sstevel@tonic-gate 
665*0Sstevel@tonic-gate /*
666*0Sstevel@tonic-gate  * void
667*0Sstevel@tonic-gate  * CLNT_SETTIMERS(rh);
668*0Sstevel@tonic-gate  *	CLIENT *rh;
669*0Sstevel@tonic-gate  *	struct rpc_timers *t;
670*0Sstevel@tonic-gate  *	struct rpc_timers *all;
671*0Sstevel@tonic-gate  *	unsigned int min;
672*0Sstevel@tonic-gate  *	void    (*fdbck)();
673*0Sstevel@tonic-gate  *	caddr_t arg;
674*0Sstevel@tonic-gate  *	uint_t  xid;
675*0Sstevel@tonic-gate  */
676*0Sstevel@tonic-gate #define	CLNT_SETTIMERS(rh, t, all, min, fdbck, arg, xid) \
677*0Sstevel@tonic-gate 		((*(rh)->cl_ops->cl_settimers)(rh, t, all, min, \
678*0Sstevel@tonic-gate 		fdbck, arg, xid))
679*0Sstevel@tonic-gate #define	clnt_settimers(rh, t, all, min, fdbck, arg, xid) \
680*0Sstevel@tonic-gate 		((*(rh)->cl_ops->cl_settimers)(rh, t, all, min, \
681*0Sstevel@tonic-gate 		fdbck, arg, xid))
682*0Sstevel@tonic-gate 
683*0Sstevel@tonic-gate 
684*0Sstevel@tonic-gate /*
685*0Sstevel@tonic-gate  * void
686*0Sstevel@tonic-gate  * CLNT_DESTROY(rh);
687*0Sstevel@tonic-gate  * 	CLIENT *rh;
688*0Sstevel@tonic-gate  *
689*0Sstevel@tonic-gate  * PSARC 2003/523 Contract Private Interface
690*0Sstevel@tonic-gate  * CLNT_DESTROY
691*0Sstevel@tonic-gate  * Changes must be reviewed by Solaris File Sharing
692*0Sstevel@tonic-gate  * Changes must be communicated to contract-2003-523@sun.com
693*0Sstevel@tonic-gate  */
694*0Sstevel@tonic-gate #define	CLNT_DESTROY(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
695*0Sstevel@tonic-gate #define	clnt_destroy(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
696*0Sstevel@tonic-gate 
697*0Sstevel@tonic-gate 
698*0Sstevel@tonic-gate /*
699*0Sstevel@tonic-gate  * RPCTEST is a test program which is accessable on every rpc
700*0Sstevel@tonic-gate  * transport/port.  It is used for testing, performance evaluation,
701*0Sstevel@tonic-gate  * and network administration.
702*0Sstevel@tonic-gate  */
703*0Sstevel@tonic-gate 
704*0Sstevel@tonic-gate #define	RPCTEST_PROGRAM		((rpcprog_t)1)
705*0Sstevel@tonic-gate #define	RPCTEST_VERSION		((rpcvers_t)1)
706*0Sstevel@tonic-gate #define	RPCTEST_NULL_PROC	((rpcproc_t)2)
707*0Sstevel@tonic-gate #define	RPCTEST_NULL_BATCH_PROC	((rpcproc_t)3)
708*0Sstevel@tonic-gate 
709*0Sstevel@tonic-gate /*
710*0Sstevel@tonic-gate  * By convention, procedure 0 takes null arguments and returns them
711*0Sstevel@tonic-gate  */
712*0Sstevel@tonic-gate 
713*0Sstevel@tonic-gate #define	NULLPROC ((rpcproc_t)0)
714*0Sstevel@tonic-gate 
715*0Sstevel@tonic-gate /*
716*0Sstevel@tonic-gate  * Below are the client handle creation routines for the various
717*0Sstevel@tonic-gate  * implementations of client side rpc.  They can return NULL if a
718*0Sstevel@tonic-gate  * creation failure occurs.
719*0Sstevel@tonic-gate  */
720*0Sstevel@tonic-gate 
721*0Sstevel@tonic-gate #ifndef _KERNEL
722*0Sstevel@tonic-gate 
723*0Sstevel@tonic-gate /*
724*0Sstevel@tonic-gate  * Generic client creation routine. Supported protocols are which belong
725*0Sstevel@tonic-gate  * to the nettype name space
726*0Sstevel@tonic-gate  */
727*0Sstevel@tonic-gate #ifdef __STDC__
728*0Sstevel@tonic-gate extern  CLIENT * clnt_create(const char *, const rpcprog_t, const rpcvers_t,
729*0Sstevel@tonic-gate 	const char *);
730*0Sstevel@tonic-gate /*
731*0Sstevel@tonic-gate  *
732*0Sstevel@tonic-gate  * 	const char *hostname;			-- hostname
733*0Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
734*0Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
735*0Sstevel@tonic-gate  *	const char *nettype;			-- network type
736*0Sstevel@tonic-gate  */
737*0Sstevel@tonic-gate #else
738*0Sstevel@tonic-gate extern CLIENT * clnt_create();
739*0Sstevel@tonic-gate #endif
740*0Sstevel@tonic-gate 
741*0Sstevel@tonic-gate /*
742*0Sstevel@tonic-gate  * Generic client creation routine. Just like clnt_create(), except
743*0Sstevel@tonic-gate  * it takes an additional timeout parameter.
744*0Sstevel@tonic-gate  */
745*0Sstevel@tonic-gate #ifdef __STDC__
746*0Sstevel@tonic-gate extern  CLIENT * clnt_create_timed(const char *, const rpcprog_t,
747*0Sstevel@tonic-gate 	const rpcvers_t, const char *, const struct timeval *);
748*0Sstevel@tonic-gate /*
749*0Sstevel@tonic-gate  *
750*0Sstevel@tonic-gate  * 	const char *hostname;			-- hostname
751*0Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
752*0Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
753*0Sstevel@tonic-gate  *	const char *nettype;			-- network type
754*0Sstevel@tonic-gate  *	const struct timeval *tp;		-- timeout
755*0Sstevel@tonic-gate  */
756*0Sstevel@tonic-gate #else
757*0Sstevel@tonic-gate extern CLIENT * clnt_create_timed();
758*0Sstevel@tonic-gate #endif
759*0Sstevel@tonic-gate 
760*0Sstevel@tonic-gate /*
761*0Sstevel@tonic-gate  * Generic client creation routine. Supported protocols are which belong
762*0Sstevel@tonic-gate  * to the nettype name space.
763*0Sstevel@tonic-gate  */
764*0Sstevel@tonic-gate #ifdef __STDC__
765*0Sstevel@tonic-gate extern CLIENT * clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *,
766*0Sstevel@tonic-gate 	const rpcvers_t, const rpcvers_t, const char *);
767*0Sstevel@tonic-gate /*
768*0Sstevel@tonic-gate  *	const char *host;		-- hostname
769*0Sstevel@tonic-gate  *	const rpcprog_t prog;		-- program number
770*0Sstevel@tonic-gate  *	rpcvers_t *vers_out;	-- servers highest available version number
771*0Sstevel@tonic-gate  *	const rpcvers_t vers_low;	-- low version number
772*0Sstevel@tonic-gate  *	const rpcvers_t vers_high;	-- high version number
773*0Sstevel@tonic-gate  *	const char *nettype;		-- network type
774*0Sstevel@tonic-gate  */
775*0Sstevel@tonic-gate #else
776*0Sstevel@tonic-gate extern CLIENT * clnt_create_vers();
777*0Sstevel@tonic-gate #endif
778*0Sstevel@tonic-gate 
779*0Sstevel@tonic-gate /*
780*0Sstevel@tonic-gate  * Generic client creation routine. Supported protocols are which belong
781*0Sstevel@tonic-gate  * to the nettype name space.
782*0Sstevel@tonic-gate  */
783*0Sstevel@tonic-gate #ifdef __STDC__
784*0Sstevel@tonic-gate extern CLIENT * clnt_create_vers_timed(const char *, const rpcprog_t,
785*0Sstevel@tonic-gate 	rpcvers_t *, const rpcvers_t, const rpcvers_t, const char *,
786*0Sstevel@tonic-gate 	const struct timeval *);
787*0Sstevel@tonic-gate /*
788*0Sstevel@tonic-gate  *	const char *host;		-- hostname
789*0Sstevel@tonic-gate  *	const rpcprog_t prog;		-- program number
790*0Sstevel@tonic-gate  *	rpcvers_t *vers_out;	-- servers highest available version number
791*0Sstevel@tonic-gate  *	const rpcvers_t vers_low;	-- low version number
792*0Sstevel@tonic-gate  *	const prcvers_t vers_high;	-- high version number
793*0Sstevel@tonic-gate  *	const char *nettype;		-- network type
794*0Sstevel@tonic-gate  *	const struct timeval *tp	-- timeout
795*0Sstevel@tonic-gate  */
796*0Sstevel@tonic-gate #else
797*0Sstevel@tonic-gate extern CLIENT * clnt_create_vers_timed();
798*0Sstevel@tonic-gate #endif
799*0Sstevel@tonic-gate 
800*0Sstevel@tonic-gate 
801*0Sstevel@tonic-gate /*
802*0Sstevel@tonic-gate  * Generic client creation routine. It takes a netconfig structure
803*0Sstevel@tonic-gate  * instead of nettype
804*0Sstevel@tonic-gate  */
805*0Sstevel@tonic-gate #ifdef __STDC__
806*0Sstevel@tonic-gate extern CLIENT * clnt_tp_create(const char *, const rpcprog_t, const rpcvers_t,
807*0Sstevel@tonic-gate 	const struct netconfig *);
808*0Sstevel@tonic-gate /*
809*0Sstevel@tonic-gate  *	const char *hostname;			-- hostname
810*0Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
811*0Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
812*0Sstevel@tonic-gate  *	const struct netconfig *netconf; 	-- network config structure
813*0Sstevel@tonic-gate  */
814*0Sstevel@tonic-gate #else
815*0Sstevel@tonic-gate extern CLIENT * clnt_tp_create();
816*0Sstevel@tonic-gate #endif
817*0Sstevel@tonic-gate 
818*0Sstevel@tonic-gate /*
819*0Sstevel@tonic-gate  * Generic client creation routine. Just like clnt_tp_create(), except
820*0Sstevel@tonic-gate  * it takes an additional timeout parameter.
821*0Sstevel@tonic-gate  */
822*0Sstevel@tonic-gate #ifdef __STDC__
823*0Sstevel@tonic-gate extern CLIENT * clnt_tp_create_timed(const char *, const rpcprog_t,
824*0Sstevel@tonic-gate 	const rpcvers_t, const struct netconfig *, const struct timeval *);
825*0Sstevel@tonic-gate /*
826*0Sstevel@tonic-gate  *	const char *hostname;			-- hostname
827*0Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
828*0Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
829*0Sstevel@tonic-gate  *	const struct netconfig *netconf; 	-- network config structure
830*0Sstevel@tonic-gate  *	const struct timeval *tp;		-- timeout
831*0Sstevel@tonic-gate  */
832*0Sstevel@tonic-gate #else
833*0Sstevel@tonic-gate extern CLIENT * clnt_tp_create_timed();
834*0Sstevel@tonic-gate #endif
835*0Sstevel@tonic-gate 
836*0Sstevel@tonic-gate /*
837*0Sstevel@tonic-gate  * Generic TLI create routine
838*0Sstevel@tonic-gate  */
839*0Sstevel@tonic-gate 
840*0Sstevel@tonic-gate #ifdef __STDC__
841*0Sstevel@tonic-gate extern CLIENT * clnt_tli_create(const int, const struct netconfig *,
842*0Sstevel@tonic-gate 	struct netbuf *, const rpcprog_t, const rpcvers_t, const uint_t,
843*0Sstevel@tonic-gate 	const uint_t);
844*0Sstevel@tonic-gate /*
845*0Sstevel@tonic-gate  *	const int fd;		-- fd
846*0Sstevel@tonic-gate  *	const struct netconfig *nconf;	-- netconfig structure
847*0Sstevel@tonic-gate  *	struct netbuf *svcaddr;		-- servers address
848*0Sstevel@tonic-gate  *	const rpcprog_t prog;		-- program number
849*0Sstevel@tonic-gate  *	const rpcvers_t vers;		-- version number
850*0Sstevel@tonic-gate  *	const uint_t sendsz;		-- send size
851*0Sstevel@tonic-gate  *	const uint_t recvsz;		-- recv size
852*0Sstevel@tonic-gate  */
853*0Sstevel@tonic-gate 
854*0Sstevel@tonic-gate #else
855*0Sstevel@tonic-gate extern CLIENT * clnt_tli_create();
856*0Sstevel@tonic-gate #endif
857*0Sstevel@tonic-gate 
858*0Sstevel@tonic-gate /*
859*0Sstevel@tonic-gate  * Low level clnt create routine for connectionful transports, e.g. tcp.
860*0Sstevel@tonic-gate  */
861*0Sstevel@tonic-gate #ifdef __STDC__
862*0Sstevel@tonic-gate extern  CLIENT * clnt_vc_create(const int, struct netbuf *,
863*0Sstevel@tonic-gate 	const rpcprog_t, const rpcvers_t, const uint_t, const uint_t);
864*0Sstevel@tonic-gate /*
865*0Sstevel@tonic-gate  *	const int fd;				-- open file descriptor
866*0Sstevel@tonic-gate  *	const struct netbuf *svcaddr;		-- servers address
867*0Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
868*0Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
869*0Sstevel@tonic-gate  *	const uint_t sendsz;			-- buffer recv size
870*0Sstevel@tonic-gate  *	const uint_t recvsz;			-- buffer send size
871*0Sstevel@tonic-gate  */
872*0Sstevel@tonic-gate #else
873*0Sstevel@tonic-gate extern CLIENT * clnt_vc_create();
874*0Sstevel@tonic-gate #endif
875*0Sstevel@tonic-gate 
876*0Sstevel@tonic-gate /*
877*0Sstevel@tonic-gate  * Low level clnt create routine for connectionless transports, e.g. udp.
878*0Sstevel@tonic-gate  */
879*0Sstevel@tonic-gate #ifdef __STDC__
880*0Sstevel@tonic-gate extern  CLIENT * clnt_dg_create(const int, struct netbuf *,
881*0Sstevel@tonic-gate 	const rpcprog_t, const rpcvers_t, const uint_t, const uint_t);
882*0Sstevel@tonic-gate /*
883*0Sstevel@tonic-gate  *	const int fd;				-- open file descriptor
884*0Sstevel@tonic-gate  *	const struct netbuf *svcaddr;		-- servers address
885*0Sstevel@tonic-gate  *	const rpcprog_t program;		-- program number
886*0Sstevel@tonic-gate  *	const rpcvers_t version;		-- version number
887*0Sstevel@tonic-gate  *	const uint_t sendsz;			-- buffer recv size
888*0Sstevel@tonic-gate  *	const uint_t recvsz;			-- buffer send size
889*0Sstevel@tonic-gate  */
890*0Sstevel@tonic-gate #else
891*0Sstevel@tonic-gate extern CLIENT * clnt_dg_create();
892*0Sstevel@tonic-gate #endif
893*0Sstevel@tonic-gate 
894*0Sstevel@tonic-gate /*
895*0Sstevel@tonic-gate  * Memory based rpc (for speed check and testing)
896*0Sstevel@tonic-gate  * CLIENT *
897*0Sstevel@tonic-gate  * clnt_raw_create(prog, vers)
898*0Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
899*0Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
900*0Sstevel@tonic-gate  */
901*0Sstevel@tonic-gate #ifdef __STDC__
902*0Sstevel@tonic-gate extern CLIENT *clnt_raw_create(const rpcprog_t, const rpcvers_t);
903*0Sstevel@tonic-gate #else
904*0Sstevel@tonic-gate extern CLIENT *clnt_raw_create();
905*0Sstevel@tonic-gate #endif
906*0Sstevel@tonic-gate 
907*0Sstevel@tonic-gate /*
908*0Sstevel@tonic-gate  * Client creation routine over doors transport.
909*0Sstevel@tonic-gate  */
910*0Sstevel@tonic-gate #ifdef __STDC__
911*0Sstevel@tonic-gate extern  CLIENT * clnt_door_create(const rpcprog_t, const rpcvers_t,
912*0Sstevel@tonic-gate 	const uint_t);
913*0Sstevel@tonic-gate /*
914*0Sstevel@tonic-gate  *	const rpcprog_t prog;			-- program number
915*0Sstevel@tonic-gate  *	const rpcvers_t vers;			-- version number
916*0Sstevel@tonic-gate  *	const uint_t sendsz;			-- max send size
917*0Sstevel@tonic-gate  */
918*0Sstevel@tonic-gate #else
919*0Sstevel@tonic-gate extern CLIENT * clnt_door_create();
920*0Sstevel@tonic-gate #endif
921*0Sstevel@tonic-gate 
922*0Sstevel@tonic-gate /*
923*0Sstevel@tonic-gate  * internal function. Not for general use. Subject to rapid change.
924*0Sstevel@tonic-gate  */
925*0Sstevel@tonic-gate #ifdef __STDC__
926*0Sstevel@tonic-gate extern CLIENT *clnt_create_service_timed(const char *,
927*0Sstevel@tonic-gate 					const char *,
928*0Sstevel@tonic-gate 					const rpcprog_t,
929*0Sstevel@tonic-gate 					const rpcvers_t,
930*0Sstevel@tonic-gate 					const ushort_t,
931*0Sstevel@tonic-gate 					const char *,
932*0Sstevel@tonic-gate 					const struct timeval *);
933*0Sstevel@tonic-gate #else
934*0Sstevel@tonic-gate extern CLIENT *clnt_create_service_timed();
935*0Sstevel@tonic-gate #endif
936*0Sstevel@tonic-gate 
937*0Sstevel@tonic-gate /*
938*0Sstevel@tonic-gate  * Print why creation failed
939*0Sstevel@tonic-gate  */
940*0Sstevel@tonic-gate #ifdef __STDC__
941*0Sstevel@tonic-gate void clnt_pcreateerror(const char *);	/* stderr */
942*0Sstevel@tonic-gate char *clnt_spcreateerror(const char *);	/* string */
943*0Sstevel@tonic-gate #else
944*0Sstevel@tonic-gate void clnt_pcreateerror();
945*0Sstevel@tonic-gate char *clnt_spcreateerror();
946*0Sstevel@tonic-gate #endif
947*0Sstevel@tonic-gate 
948*0Sstevel@tonic-gate /*
949*0Sstevel@tonic-gate  * Like clnt_perror(), but is more verbose in its output
950*0Sstevel@tonic-gate  */
951*0Sstevel@tonic-gate #ifdef __STDC__
952*0Sstevel@tonic-gate void clnt_perrno(const enum clnt_stat);	/* stderr */
953*0Sstevel@tonic-gate #else
954*0Sstevel@tonic-gate void clnt_perrno();
955*0Sstevel@tonic-gate #endif
956*0Sstevel@tonic-gate 
957*0Sstevel@tonic-gate /*
958*0Sstevel@tonic-gate  * Print an error message, given the client error code
959*0Sstevel@tonic-gate  */
960*0Sstevel@tonic-gate #ifdef __STDC__
961*0Sstevel@tonic-gate void clnt_perror(const CLIENT *, const char *);
962*0Sstevel@tonic-gate #else
963*0Sstevel@tonic-gate void clnt_perror();
964*0Sstevel@tonic-gate #endif
965*0Sstevel@tonic-gate 
966*0Sstevel@tonic-gate /*
967*0Sstevel@tonic-gate  * If a creation fails, the following allows the user to figure out why.
968*0Sstevel@tonic-gate  */
969*0Sstevel@tonic-gate struct rpc_createerr {
970*0Sstevel@tonic-gate 	enum clnt_stat cf_stat;
971*0Sstevel@tonic-gate 	struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
972*0Sstevel@tonic-gate };
973*0Sstevel@tonic-gate 
974*0Sstevel@tonic-gate #ifdef	_REENTRANT
975*0Sstevel@tonic-gate extern struct rpc_createerr	*__rpc_createerr();
976*0Sstevel@tonic-gate #define	rpc_createerr	(*(__rpc_createerr()))
977*0Sstevel@tonic-gate #else
978*0Sstevel@tonic-gate extern struct rpc_createerr rpc_createerr;
979*0Sstevel@tonic-gate #endif	/* _REENTRANT */
980*0Sstevel@tonic-gate 
981*0Sstevel@tonic-gate /*
982*0Sstevel@tonic-gate  * The simplified interface:
983*0Sstevel@tonic-gate  * enum clnt_stat
984*0Sstevel@tonic-gate  * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
985*0Sstevel@tonic-gate  *	const char *host;
986*0Sstevel@tonic-gate  *	const rpcprog_t prognum;
987*0Sstevel@tonic-gate  *	const rpcvers_t versnum;
988*0Sstevel@tonic-gate  *	const rpcproc_t procnum;
989*0Sstevel@tonic-gate  *	const xdrproc_t inproc, outproc;
990*0Sstevel@tonic-gate  *	const char *in;
991*0Sstevel@tonic-gate  *	char *out;
992*0Sstevel@tonic-gate  *	const char *nettype;
993*0Sstevel@tonic-gate  */
994*0Sstevel@tonic-gate #ifdef __STDC__
995*0Sstevel@tonic-gate extern enum clnt_stat rpc_call(const char *, const rpcprog_t, const rpcvers_t,
996*0Sstevel@tonic-gate 	const rpcproc_t, const xdrproc_t, const char *, const xdrproc_t,
997*0Sstevel@tonic-gate 	char *, const char *);
998*0Sstevel@tonic-gate #else
999*0Sstevel@tonic-gate extern enum clnt_stat rpc_call();
1000*0Sstevel@tonic-gate #endif
1001*0Sstevel@tonic-gate 
1002*0Sstevel@tonic-gate #ifdef	_REENTRANT
1003*0Sstevel@tonic-gate extern struct rpc_err	*__rpc_callerr();
1004*0Sstevel@tonic-gate #define	rpc_callerr	(*(__rpc_callerr()))
1005*0Sstevel@tonic-gate #else
1006*0Sstevel@tonic-gate extern struct rpc_err rpc_callerr;
1007*0Sstevel@tonic-gate #endif	/* _REENTRANT */
1008*0Sstevel@tonic-gate 
1009*0Sstevel@tonic-gate /*
1010*0Sstevel@tonic-gate  * RPC broadcast interface
1011*0Sstevel@tonic-gate  * The call is broadcasted to all locally connected nets.
1012*0Sstevel@tonic-gate  *
1013*0Sstevel@tonic-gate  * extern enum clnt_stat
1014*0Sstevel@tonic-gate  * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
1015*0Sstevel@tonic-gate  *			eachresult, nettype)
1016*0Sstevel@tonic-gate  *	const rpcprog_t		prog;		-- program number
1017*0Sstevel@tonic-gate  *	const rpcvers_t		vers;		-- version number
1018*0Sstevel@tonic-gate  *	const rpcproc_t		proc;		-- procedure number
1019*0Sstevel@tonic-gate  *	const xdrproc_t	xargs;		-- xdr routine for args
1020*0Sstevel@tonic-gate  *	caddr_t		argsp;		-- pointer to args
1021*0Sstevel@tonic-gate  *	const xdrproc_t	xresults;	-- xdr routine for results
1022*0Sstevel@tonic-gate  *	caddr_t		resultsp;	-- pointer to results
1023*0Sstevel@tonic-gate  *	const resultproc_t	eachresult;	-- call with each result
1024*0Sstevel@tonic-gate  *	const char		*nettype;	-- Transport type
1025*0Sstevel@tonic-gate  *
1026*0Sstevel@tonic-gate  * For each valid response received, the procedure eachresult is called.
1027*0Sstevel@tonic-gate  * Its form is:
1028*0Sstevel@tonic-gate  *		done = eachresult(resp, raddr, nconf)
1029*0Sstevel@tonic-gate  *			bool_t done;
1030*0Sstevel@tonic-gate  *			caddr_t resp;
1031*0Sstevel@tonic-gate  *			struct netbuf *raddr;
1032*0Sstevel@tonic-gate  *			struct netconfig *nconf;
1033*0Sstevel@tonic-gate  * where resp points to the results of the call and raddr is the
1034*0Sstevel@tonic-gate  * address if the responder to the broadcast.  nconf is the transport
1035*0Sstevel@tonic-gate  * on which the response was received.
1036*0Sstevel@tonic-gate  *
1037*0Sstevel@tonic-gate  * extern enum clnt_stat
1038*0Sstevel@tonic-gate  * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
1039*0Sstevel@tonic-gate  *			eachresult, inittime, waittime, nettype)
1040*0Sstevel@tonic-gate  *	const rpcprog_t		prog;		-- program number
1041*0Sstevel@tonic-gate  *	const rpcvers_t		vers;		-- version number
1042*0Sstevel@tonic-gate  *	const rpcproc_t		proc;		-- procedure number
1043*0Sstevel@tonic-gate  *	const xdrproc_t	xargs;		-- xdr routine for args
1044*0Sstevel@tonic-gate  *	caddr_t		argsp;		-- pointer to args
1045*0Sstevel@tonic-gate  *	const xdrproc_t	xresults;	-- xdr routine for results
1046*0Sstevel@tonic-gate  *	caddr_t		resultsp;	-- pointer to results
1047*0Sstevel@tonic-gate  *	const resultproc_t	eachresult;	-- call with each result
1048*0Sstevel@tonic-gate  *	const int 		inittime;	-- how long to wait initially
1049*0Sstevel@tonic-gate  *	const int 		waittime;	-- maximum time to wait
1050*0Sstevel@tonic-gate  *	const char		*nettype;	-- Transport type
1051*0Sstevel@tonic-gate  */
1052*0Sstevel@tonic-gate 
1053*0Sstevel@tonic-gate typedef bool_t(*resultproc_t)(
1054*0Sstevel@tonic-gate #ifdef	__STDC__
1055*0Sstevel@tonic-gate 	caddr_t,
1056*0Sstevel@tonic-gate 	... /* for backward compatibility */
1057*0Sstevel@tonic-gate #endif				/* __STDC__ */
1058*0Sstevel@tonic-gate );
1059*0Sstevel@tonic-gate #ifdef __STDC__
1060*0Sstevel@tonic-gate extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t,
1061*0Sstevel@tonic-gate 	const rpcproc_t, const xdrproc_t, caddr_t, const xdrproc_t,
1062*0Sstevel@tonic-gate 	caddr_t, const resultproc_t, const char *);
1063*0Sstevel@tonic-gate extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t,
1064*0Sstevel@tonic-gate 	const rpcproc_t, const xdrproc_t, caddr_t, const xdrproc_t, caddr_t,
1065*0Sstevel@tonic-gate 	const resultproc_t, const int, const int, const char *);
1066*0Sstevel@tonic-gate #else
1067*0Sstevel@tonic-gate extern enum clnt_stat rpc_broadcast();
1068*0Sstevel@tonic-gate extern enum clnt_stat rpc_broadcast_exp();
1069*0Sstevel@tonic-gate #endif
1070*0Sstevel@tonic-gate #endif /* !_KERNEL */
1071*0Sstevel@tonic-gate 
1072*0Sstevel@tonic-gate /*
1073*0Sstevel@tonic-gate  * Copy error message to buffer.
1074*0Sstevel@tonic-gate  */
1075*0Sstevel@tonic-gate #ifdef __STDC__
1076*0Sstevel@tonic-gate const char *clnt_sperrno(const enum clnt_stat);
1077*0Sstevel@tonic-gate #else
1078*0Sstevel@tonic-gate char *clnt_sperrno();	/* string */
1079*0Sstevel@tonic-gate #endif
1080*0Sstevel@tonic-gate 
1081*0Sstevel@tonic-gate /*
1082*0Sstevel@tonic-gate  * Print an error message, given the client error code
1083*0Sstevel@tonic-gate  */
1084*0Sstevel@tonic-gate #ifdef __STDC__
1085*0Sstevel@tonic-gate char *clnt_sperror(const CLIENT *, const char *);
1086*0Sstevel@tonic-gate #else
1087*0Sstevel@tonic-gate char *clnt_sperror();
1088*0Sstevel@tonic-gate #endif
1089*0Sstevel@tonic-gate 
1090*0Sstevel@tonic-gate /*
1091*0Sstevel@tonic-gate  * Client side rpc control routine for rpcbind.
1092*0Sstevel@tonic-gate  */
1093*0Sstevel@tonic-gate #ifdef __STDC__
1094*0Sstevel@tonic-gate bool_t __rpc_control(int, void *);
1095*0Sstevel@tonic-gate #else
1096*0Sstevel@tonic-gate bool_t __rpc_control();
1097*0Sstevel@tonic-gate #endif
1098*0Sstevel@tonic-gate 
1099*0Sstevel@tonic-gate #ifdef __cplusplus
1100*0Sstevel@tonic-gate }
1101*0Sstevel@tonic-gate #endif
1102*0Sstevel@tonic-gate 
1103*0Sstevel@tonic-gate #ifdef PORTMAP
1104*0Sstevel@tonic-gate /* For backward compatibility */
1105*0Sstevel@tonic-gate #include <rpc/clnt_soc.h>
1106*0Sstevel@tonic-gate #endif
1107*0Sstevel@tonic-gate 
1108*0Sstevel@tonic-gate #endif	/* !_RPC_CLNT_H */
1109