xref: /titanic_51/usr/src/lib/libbc/inc/include/rpc/clnt.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
23*7c478bd9Sstevel@tonic-gate 
24*7c478bd9Sstevel@tonic-gate /*
25*7c478bd9Sstevel@tonic-gate  * clnt.h - Client side remote procedure call interface.
26*7c478bd9Sstevel@tonic-gate  *
27*7c478bd9Sstevel@tonic-gate  * Copyright (C) 1984, Sun Microsystems, Inc.
28*7c478bd9Sstevel@tonic-gate  */
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #ifndef _rpc_clnt_h
31*7c478bd9Sstevel@tonic-gate #define	_rpc_clnt_h
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate /*
34*7c478bd9Sstevel@tonic-gate  * Rpc calls return an enum clnt_stat.  This should be looked at more,
35*7c478bd9Sstevel@tonic-gate  * since each implementation is required to live with this (implementation
36*7c478bd9Sstevel@tonic-gate  * independent) list of errors.
37*7c478bd9Sstevel@tonic-gate  */
38*7c478bd9Sstevel@tonic-gate enum clnt_stat {
39*7c478bd9Sstevel@tonic-gate 	RPC_SUCCESS=0,			/* call succeeded */
40*7c478bd9Sstevel@tonic-gate 	/*
41*7c478bd9Sstevel@tonic-gate 	 * local errors
42*7c478bd9Sstevel@tonic-gate 	 */
43*7c478bd9Sstevel@tonic-gate 	RPC_CANTENCODEARGS=1,		/* can't encode arguments */
44*7c478bd9Sstevel@tonic-gate 	RPC_CANTDECODERES=2,		/* can't decode results */
45*7c478bd9Sstevel@tonic-gate 	RPC_CANTSEND=3,			/* failure in sending call */
46*7c478bd9Sstevel@tonic-gate 	RPC_CANTRECV=4,			/* failure in receiving result */
47*7c478bd9Sstevel@tonic-gate 	RPC_TIMEDOUT=5,			/* call timed out */
48*7c478bd9Sstevel@tonic-gate 	RPC_INTR=18,			/* call interrupted */
49*7c478bd9Sstevel@tonic-gate 	/*
50*7c478bd9Sstevel@tonic-gate 	 * remote errors
51*7c478bd9Sstevel@tonic-gate 	 */
52*7c478bd9Sstevel@tonic-gate 	RPC_VERSMISMATCH=6,		/* rpc versions not compatible */
53*7c478bd9Sstevel@tonic-gate 	RPC_AUTHERROR=7,		/* authentication error */
54*7c478bd9Sstevel@tonic-gate 	RPC_PROGUNAVAIL=8,		/* program not available */
55*7c478bd9Sstevel@tonic-gate 	RPC_PROGVERSMISMATCH=9,		/* program version mismatched */
56*7c478bd9Sstevel@tonic-gate 	RPC_PROCUNAVAIL=10,		/* procedure unavailable */
57*7c478bd9Sstevel@tonic-gate 	RPC_CANTDECODEARGS=11,		/* decode arguments error */
58*7c478bd9Sstevel@tonic-gate 	RPC_SYSTEMERROR=12,		/* generic "other problem" */
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate 	/*
61*7c478bd9Sstevel@tonic-gate 	 * callrpc & clnt_create errors
62*7c478bd9Sstevel@tonic-gate 	 */
63*7c478bd9Sstevel@tonic-gate 	RPC_UNKNOWNHOST=13,		/* unknown host name */
64*7c478bd9Sstevel@tonic-gate 	RPC_UNKNOWNPROTO=17,		/* unkown protocol */
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate 	/*
67*7c478bd9Sstevel@tonic-gate 	 * _ create errors
68*7c478bd9Sstevel@tonic-gate 	 */
69*7c478bd9Sstevel@tonic-gate 	RPC_PMAPFAILURE=14,		/* the pmapper failed in its call */
70*7c478bd9Sstevel@tonic-gate 	RPC_PROGNOTREGISTERED=15,	/* remote program is not registered */
71*7c478bd9Sstevel@tonic-gate 	/*
72*7c478bd9Sstevel@tonic-gate 	 * unspecified error
73*7c478bd9Sstevel@tonic-gate 	 */
74*7c478bd9Sstevel@tonic-gate 	RPC_FAILED=16
75*7c478bd9Sstevel@tonic-gate };
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate /*
79*7c478bd9Sstevel@tonic-gate  * Error info.
80*7c478bd9Sstevel@tonic-gate  */
81*7c478bd9Sstevel@tonic-gate struct rpc_err {
82*7c478bd9Sstevel@tonic-gate 	enum clnt_stat re_status;
83*7c478bd9Sstevel@tonic-gate 	union {
84*7c478bd9Sstevel@tonic-gate 		int RE_errno;		/* realated system error */
85*7c478bd9Sstevel@tonic-gate 		enum auth_stat RE_why;	/* why the auth error occurred */
86*7c478bd9Sstevel@tonic-gate 		struct {
87*7c478bd9Sstevel@tonic-gate 			u_long low;	/* lowest verion supported */
88*7c478bd9Sstevel@tonic-gate 			u_long high;	/* highest verion supported */
89*7c478bd9Sstevel@tonic-gate 		} RE_vers;
90*7c478bd9Sstevel@tonic-gate 		struct {		/* maybe meaningful if RPC_FAILED */
91*7c478bd9Sstevel@tonic-gate 			long s1;
92*7c478bd9Sstevel@tonic-gate 			long s2;
93*7c478bd9Sstevel@tonic-gate 		} RE_lb;		/* life boot & debugging only */
94*7c478bd9Sstevel@tonic-gate 	} ru;
95*7c478bd9Sstevel@tonic-gate #define	re_errno	ru.RE_errno
96*7c478bd9Sstevel@tonic-gate #define	re_why		ru.RE_why
97*7c478bd9Sstevel@tonic-gate #define	re_vers		ru.RE_vers
98*7c478bd9Sstevel@tonic-gate #define	re_lb		ru.RE_lb
99*7c478bd9Sstevel@tonic-gate };
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate /*
103*7c478bd9Sstevel@tonic-gate  * Client rpc handle.
104*7c478bd9Sstevel@tonic-gate  * Created by individual implementations, see e.g. rpc_udp.c.
105*7c478bd9Sstevel@tonic-gate  * Client is responsible for initializing auth, see e.g. auth_none.c.
106*7c478bd9Sstevel@tonic-gate  */
107*7c478bd9Sstevel@tonic-gate typedef struct {
108*7c478bd9Sstevel@tonic-gate 	AUTH	*cl_auth;			/* authenticator */
109*7c478bd9Sstevel@tonic-gate 	struct clnt_ops {
110*7c478bd9Sstevel@tonic-gate 		enum clnt_stat	(*cl_call)();	/* call remote procedure */
111*7c478bd9Sstevel@tonic-gate 		void		(*cl_abort)();	/* abort a call */
112*7c478bd9Sstevel@tonic-gate 		void		(*cl_geterr)();	/* get specific error code */
113*7c478bd9Sstevel@tonic-gate 		bool_t		(*cl_freeres)(); /* frees results */
114*7c478bd9Sstevel@tonic-gate 		void		(*cl_destroy)(); /* destroy this structure */
115*7c478bd9Sstevel@tonic-gate 		bool_t		(*cl_control)(); /* the ioctl() of rpc */
116*7c478bd9Sstevel@tonic-gate 	} *cl_ops;
117*7c478bd9Sstevel@tonic-gate 	caddr_t			cl_private;	/* private stuff */
118*7c478bd9Sstevel@tonic-gate } CLIENT;
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate /*
122*7c478bd9Sstevel@tonic-gate  * client side rpc interface ops
123*7c478bd9Sstevel@tonic-gate  *
124*7c478bd9Sstevel@tonic-gate  * Parameter types are:
125*7c478bd9Sstevel@tonic-gate  *
126*7c478bd9Sstevel@tonic-gate  */
127*7c478bd9Sstevel@tonic-gate 
128*7c478bd9Sstevel@tonic-gate /*
129*7c478bd9Sstevel@tonic-gate  * enum clnt_stat
130*7c478bd9Sstevel@tonic-gate  * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
131*7c478bd9Sstevel@tonic-gate  * 	CLIENT *rh;
132*7c478bd9Sstevel@tonic-gate  *	u_long proc;
133*7c478bd9Sstevel@tonic-gate  *	xdrproc_t xargs;
134*7c478bd9Sstevel@tonic-gate  *	caddr_t argsp;
135*7c478bd9Sstevel@tonic-gate  *	xdrproc_t xres;
136*7c478bd9Sstevel@tonic-gate  *	caddr_t resp;
137*7c478bd9Sstevel@tonic-gate  *	struct timeval timeout;
138*7c478bd9Sstevel@tonic-gate  */
139*7c478bd9Sstevel@tonic-gate #define	CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)	\
140*7c478bd9Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
141*7c478bd9Sstevel@tonic-gate #define	clnt_call(rh, proc, xargs, argsp, xres, resp, secs)	\
142*7c478bd9Sstevel@tonic-gate 	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate /*
145*7c478bd9Sstevel@tonic-gate  * void
146*7c478bd9Sstevel@tonic-gate  * CLNT_ABORT(rh);
147*7c478bd9Sstevel@tonic-gate  * 	CLIENT *rh;
148*7c478bd9Sstevel@tonic-gate  */
149*7c478bd9Sstevel@tonic-gate #define	CLNT_ABORT(rh)	((*(rh)->cl_ops->cl_abort)(rh))
150*7c478bd9Sstevel@tonic-gate #define	clnt_abort(rh)	((*(rh)->cl_ops->cl_abort)(rh))
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate /*
153*7c478bd9Sstevel@tonic-gate  * struct rpc_err
154*7c478bd9Sstevel@tonic-gate  * CLNT_GETERR(rh);
155*7c478bd9Sstevel@tonic-gate  * 	CLIENT *rh;
156*7c478bd9Sstevel@tonic-gate  */
157*7c478bd9Sstevel@tonic-gate #define	CLNT_GETERR(rh, errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
158*7c478bd9Sstevel@tonic-gate #define	clnt_geterr(rh, errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
159*7c478bd9Sstevel@tonic-gate 
160*7c478bd9Sstevel@tonic-gate 
161*7c478bd9Sstevel@tonic-gate /*
162*7c478bd9Sstevel@tonic-gate  * bool_t
163*7c478bd9Sstevel@tonic-gate  * CLNT_FREERES(rh, xres, resp);
164*7c478bd9Sstevel@tonic-gate  * 	CLIENT *rh;
165*7c478bd9Sstevel@tonic-gate  *	xdrproc_t xres;
166*7c478bd9Sstevel@tonic-gate  *	caddr_t resp;
167*7c478bd9Sstevel@tonic-gate  */
168*7c478bd9Sstevel@tonic-gate #define	CLNT_FREERES(rh, xres, resp) ((*(rh)->cl_ops->cl_freeres)\
169*7c478bd9Sstevel@tonic-gate 	(rh, xres, resp))
170*7c478bd9Sstevel@tonic-gate #define	clnt_freeres(rh, xres, resp) ((*(rh)->cl_ops->cl_freeres)\
171*7c478bd9Sstevel@tonic-gate 	(rh, xres, resp))
172*7c478bd9Sstevel@tonic-gate 
173*7c478bd9Sstevel@tonic-gate /*
174*7c478bd9Sstevel@tonic-gate  * bool_t
175*7c478bd9Sstevel@tonic-gate  * CLNT_CONTROL(cl, request, info)
176*7c478bd9Sstevel@tonic-gate  *	CLIENT *cl;
177*7c478bd9Sstevel@tonic-gate  *	u_int request;
178*7c478bd9Sstevel@tonic-gate  *	char *info;
179*7c478bd9Sstevel@tonic-gate  */
180*7c478bd9Sstevel@tonic-gate #define	CLNT_CONTROL(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in))
181*7c478bd9Sstevel@tonic-gate #define	clnt_control(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in))
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate /*
184*7c478bd9Sstevel@tonic-gate  * control operations that apply to both udp and tcp transports
185*7c478bd9Sstevel@tonic-gate  */
186*7c478bd9Sstevel@tonic-gate #define	CLSET_TIMEOUT		1   /* set timeout (timeval) */
187*7c478bd9Sstevel@tonic-gate #define	CLGET_TIMEOUT		2   /* get timeout (timeval) */
188*7c478bd9Sstevel@tonic-gate #define	CLGET_SERVER_ADDR	3   /* get server's address (sockaddr) */
189*7c478bd9Sstevel@tonic-gate #define	CLGET_FD		6   /* get connections file descriptor */
190*7c478bd9Sstevel@tonic-gate #define	CLSET_FD_CLOSE		8   /* close fd while clnt_destroy */
191*7c478bd9Sstevel@tonic-gate #define	CLSET_FD_NCLOSE		9   /* Do not close fd while clnt_destroy */
192*7c478bd9Sstevel@tonic-gate /*
193*7c478bd9Sstevel@tonic-gate  * udp only control operations
194*7c478bd9Sstevel@tonic-gate  */
195*7c478bd9Sstevel@tonic-gate #define	CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */
196*7c478bd9Sstevel@tonic-gate #define	CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate /*
199*7c478bd9Sstevel@tonic-gate  * void
200*7c478bd9Sstevel@tonic-gate  * CLNT_DESTROY(rh);
201*7c478bd9Sstevel@tonic-gate  * 	CLIENT *rh;
202*7c478bd9Sstevel@tonic-gate  */
203*7c478bd9Sstevel@tonic-gate #define	CLNT_DESTROY(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
204*7c478bd9Sstevel@tonic-gate #define	clnt_destroy(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
205*7c478bd9Sstevel@tonic-gate 
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate /*
208*7c478bd9Sstevel@tonic-gate  * RPCTEST is a test program which is accessable on every rpc
209*7c478bd9Sstevel@tonic-gate  * transport/port.  It is used for testing, performance evaluation,
210*7c478bd9Sstevel@tonic-gate  * and network administration.
211*7c478bd9Sstevel@tonic-gate  */
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate #define	RPCTEST_PROGRAM		((u_long)1)
214*7c478bd9Sstevel@tonic-gate #define	RPCTEST_VERSION		((u_long)1)
215*7c478bd9Sstevel@tonic-gate #define	RPCTEST_NULL_PROC	((u_long)2)
216*7c478bd9Sstevel@tonic-gate #define	RPCTEST_NULL_BATCH_PROC	((u_long)3)
217*7c478bd9Sstevel@tonic-gate 
218*7c478bd9Sstevel@tonic-gate /*
219*7c478bd9Sstevel@tonic-gate  * By convention, procedure 0 takes null arguments and returns them
220*7c478bd9Sstevel@tonic-gate  */
221*7c478bd9Sstevel@tonic-gate 
222*7c478bd9Sstevel@tonic-gate #define	NULLPROC ((u_long)0)
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate /*
225*7c478bd9Sstevel@tonic-gate  * Below are the client handle creation routines for the various
226*7c478bd9Sstevel@tonic-gate  * implementations of client side rpc.  They can return NULL if a
227*7c478bd9Sstevel@tonic-gate  * creation failure occurs.
228*7c478bd9Sstevel@tonic-gate  */
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate #ifndef KERNEL
231*7c478bd9Sstevel@tonic-gate /*
232*7c478bd9Sstevel@tonic-gate  * Memory based rpc (for speed check and testing)
233*7c478bd9Sstevel@tonic-gate  * CLIENT *
234*7c478bd9Sstevel@tonic-gate  * clntraw_create(prog, vers)
235*7c478bd9Sstevel@tonic-gate  *	u_long prog;
236*7c478bd9Sstevel@tonic-gate  *	u_long vers;
237*7c478bd9Sstevel@tonic-gate  */
238*7c478bd9Sstevel@tonic-gate extern CLIENT *clntraw_create();
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate /*
242*7c478bd9Sstevel@tonic-gate  * Generic client creation routine. Supported protocols are "udp" and "tcp"
243*7c478bd9Sstevel@tonic-gate  */
244*7c478bd9Sstevel@tonic-gate extern CLIENT *
245*7c478bd9Sstevel@tonic-gate clnt_create(/*host, prog, vers, prot*/); /*
246*7c478bd9Sstevel@tonic-gate 	char *host; 	-- hostname
247*7c478bd9Sstevel@tonic-gate 	u_long prog;	-- program number
248*7c478bd9Sstevel@tonic-gate 	u_long vers;	-- version number
249*7c478bd9Sstevel@tonic-gate 	char *prot;	-- protocol
250*7c478bd9Sstevel@tonic-gate */
251*7c478bd9Sstevel@tonic-gate 
252*7c478bd9Sstevel@tonic-gate /*
253*7c478bd9Sstevel@tonic-gate  * Generic client creation routine. Supported protocols are "udp" and "tcp"
254*7c478bd9Sstevel@tonic-gate  */
255*7c478bd9Sstevel@tonic-gate extern CLIENT *
256*7c478bd9Sstevel@tonic-gate clnt_create_vers(/*host, prog, vers_out, vers_low, vers_high, prot*/);
257*7c478bd9Sstevel@tonic-gate /*
258*7c478bd9Sstevel@tonic-gate 	char *host; 	-- hostname
259*7c478bd9Sstevel@tonic-gate 	u_long prog;	-- program number
260*7c478bd9Sstevel@tonic-gate 	u_long *vers_out;	-- servers best  version number
261*7c478bd9Sstevel@tonic-gate 	u_long vers_low;	-- low version number
262*7c478bd9Sstevel@tonic-gate 	u_long vers_high;	-- high version number
263*7c478bd9Sstevel@tonic-gate 	char *prot;	-- protocol
264*7c478bd9Sstevel@tonic-gate */
265*7c478bd9Sstevel@tonic-gate 
266*7c478bd9Sstevel@tonic-gate 
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate /*
269*7c478bd9Sstevel@tonic-gate  * TCP based rpc
270*7c478bd9Sstevel@tonic-gate  * CLIENT *
271*7c478bd9Sstevel@tonic-gate  * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
272*7c478bd9Sstevel@tonic-gate  *	struct sockaddr_in *raddr;
273*7c478bd9Sstevel@tonic-gate  *	u_long prog;
274*7c478bd9Sstevel@tonic-gate  *	u_long version;
275*7c478bd9Sstevel@tonic-gate  *	register int *sockp;
276*7c478bd9Sstevel@tonic-gate  *	u_int sendsz;
277*7c478bd9Sstevel@tonic-gate  *	u_int recvsz;
278*7c478bd9Sstevel@tonic-gate  */
279*7c478bd9Sstevel@tonic-gate extern CLIENT *clnttcp_create();
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate /*
282*7c478bd9Sstevel@tonic-gate  * UDP based rpc.
283*7c478bd9Sstevel@tonic-gate  * CLIENT *
284*7c478bd9Sstevel@tonic-gate  * clntudp_create(raddr, program, version, wait, sockp)
285*7c478bd9Sstevel@tonic-gate  *	struct sockaddr_in *raddr;
286*7c478bd9Sstevel@tonic-gate  *	u_long program;
287*7c478bd9Sstevel@tonic-gate  *	u_long version;
288*7c478bd9Sstevel@tonic-gate  *	struct timeval wait;
289*7c478bd9Sstevel@tonic-gate  *	int *sockp;
290*7c478bd9Sstevel@tonic-gate  *
291*7c478bd9Sstevel@tonic-gate  * Same as above, but you specify max packet sizes.
292*7c478bd9Sstevel@tonic-gate  * CLIENT *
293*7c478bd9Sstevel@tonic-gate  * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
294*7c478bd9Sstevel@tonic-gate  *	struct sockaddr_in *raddr;
295*7c478bd9Sstevel@tonic-gate  *	u_long program;
296*7c478bd9Sstevel@tonic-gate  *	u_long version;
297*7c478bd9Sstevel@tonic-gate  *	struct timeval wait;
298*7c478bd9Sstevel@tonic-gate  *	int *sockp;
299*7c478bd9Sstevel@tonic-gate  *	u_int sendsz;
300*7c478bd9Sstevel@tonic-gate  *	u_int recvsz;
301*7c478bd9Sstevel@tonic-gate  */
302*7c478bd9Sstevel@tonic-gate extern CLIENT *clntudp_create();
303*7c478bd9Sstevel@tonic-gate extern CLIENT *clntudp_bufcreate();
304*7c478bd9Sstevel@tonic-gate 
305*7c478bd9Sstevel@tonic-gate /*
306*7c478bd9Sstevel@tonic-gate  * Print why creation failed
307*7c478bd9Sstevel@tonic-gate  */
308*7c478bd9Sstevel@tonic-gate void clnt_pcreateerror(/* char *msg */);	/* stderr */
309*7c478bd9Sstevel@tonic-gate char *clnt_spcreateerror(/* char *msg */);	/* string */
310*7c478bd9Sstevel@tonic-gate 
311*7c478bd9Sstevel@tonic-gate /*
312*7c478bd9Sstevel@tonic-gate  * Like clnt_perror(), but is more verbose in its output
313*7c478bd9Sstevel@tonic-gate  */
314*7c478bd9Sstevel@tonic-gate void clnt_perrno(/* enum clnt_stat num */);	/* stderr */
315*7c478bd9Sstevel@tonic-gate 
316*7c478bd9Sstevel@tonic-gate /*
317*7c478bd9Sstevel@tonic-gate  * Print an English error message, given the client error code
318*7c478bd9Sstevel@tonic-gate  */
319*7c478bd9Sstevel@tonic-gate void clnt_perror(/* CLIENT *clnt, char *msg */); 	/* stderr */
320*7c478bd9Sstevel@tonic-gate char *clnt_sperror(/* CLIENT *clnt, char *msg */);	/* string */
321*7c478bd9Sstevel@tonic-gate 
322*7c478bd9Sstevel@tonic-gate /*
323*7c478bd9Sstevel@tonic-gate  * If a creation fails, the following allows the user to figure out why.
324*7c478bd9Sstevel@tonic-gate  */
325*7c478bd9Sstevel@tonic-gate struct rpc_createerr {
326*7c478bd9Sstevel@tonic-gate 	enum clnt_stat cf_stat;
327*7c478bd9Sstevel@tonic-gate 	struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
328*7c478bd9Sstevel@tonic-gate };
329*7c478bd9Sstevel@tonic-gate 
330*7c478bd9Sstevel@tonic-gate extern struct rpc_createerr rpc_createerr;
331*7c478bd9Sstevel@tonic-gate 
332*7c478bd9Sstevel@tonic-gate 
333*7c478bd9Sstevel@tonic-gate #endif /* !KERNEL */
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate /*
336*7c478bd9Sstevel@tonic-gate  * Copy error message to buffer.
337*7c478bd9Sstevel@tonic-gate  */
338*7c478bd9Sstevel@tonic-gate char *clnt_sperrno(/* enum clnt_stat num */);	/* string */
339*7c478bd9Sstevel@tonic-gate 
340*7c478bd9Sstevel@tonic-gate 
341*7c478bd9Sstevel@tonic-gate #ifdef KERNEL
342*7c478bd9Sstevel@tonic-gate /*
343*7c478bd9Sstevel@tonic-gate  * Kernel udp based rpc
344*7c478bd9Sstevel@tonic-gate  * CLIENT *
345*7c478bd9Sstevel@tonic-gate  * clntkudp_create(addr, pgm, vers)
346*7c478bd9Sstevel@tonic-gate  *	struct sockaddr_in *addr;
347*7c478bd9Sstevel@tonic-gate  *	u_long pgm;
348*7c478bd9Sstevel@tonic-gate  *	u_long vers;
349*7c478bd9Sstevel@tonic-gate  */
350*7c478bd9Sstevel@tonic-gate extern CLIENT *clntkudp_create();
351*7c478bd9Sstevel@tonic-gate #endif
352*7c478bd9Sstevel@tonic-gate 
353*7c478bd9Sstevel@tonic-gate /*
354*7c478bd9Sstevel@tonic-gate  * Timers used for the pseudo-transport protocol when using datagrams
355*7c478bd9Sstevel@tonic-gate  */
356*7c478bd9Sstevel@tonic-gate struct rpc_timers {
357*7c478bd9Sstevel@tonic-gate 	u_short		rt_srtt;	/* smoothed round-trip time */
358*7c478bd9Sstevel@tonic-gate 	u_short		rt_deviate;	/* estimated deviation */
359*7c478bd9Sstevel@tonic-gate 	u_long		rt_rtxcur;	/* current (backed-off) rto */
360*7c478bd9Sstevel@tonic-gate };
361*7c478bd9Sstevel@tonic-gate 
362*7c478bd9Sstevel@tonic-gate /*
363*7c478bd9Sstevel@tonic-gate  * Feedback values used for possible congestion and rate control
364*7c478bd9Sstevel@tonic-gate  */
365*7c478bd9Sstevel@tonic-gate #define	FEEDBACK_REXMIT1	1	/* first retransmit */
366*7c478bd9Sstevel@tonic-gate #define	FEEDBACK_OK		2	/* no retransmits */
367*7c478bd9Sstevel@tonic-gate 
368*7c478bd9Sstevel@tonic-gate #define	UDPMSGSIZE	8800	/* rpc imposed limit on udp msg size */
369*7c478bd9Sstevel@tonic-gate #define	RPCSMALLMSGSIZE	400	/* a more reasonable packet size */
370*7c478bd9Sstevel@tonic-gate 
371*7c478bd9Sstevel@tonic-gate #ifdef	KERNEL
372*7c478bd9Sstevel@tonic-gate /*
373*7c478bd9Sstevel@tonic-gate  *	Alloc_xid presents an interface which kernel RPC clients
374*7c478bd9Sstevel@tonic-gate  *	should use to allocate their XIDs.  Its implementation
375*7c478bd9Sstevel@tonic-gate  *	may change over time (for example, to allow sharing of
376*7c478bd9Sstevel@tonic-gate  *	XIDs between the kernel and user-level applications, so
377*7c478bd9Sstevel@tonic-gate  *	all XID allocation should be done by calling alloc_xid().
378*7c478bd9Sstevel@tonic-gate  */
379*7c478bd9Sstevel@tonic-gate extern u_long	clntxid;
380*7c478bd9Sstevel@tonic-gate #define	alloc_xid()	(clntxid++)
381*7c478bd9Sstevel@tonic-gate #endif
382*7c478bd9Sstevel@tonic-gate 
383*7c478bd9Sstevel@tonic-gate #endif /*!_rpc_clnt_h*/
384