clnt.h revision 1.17 1 1.17 fvdl /* $NetBSD: clnt.h,v 1.17 2002/11/08 00:10:58 fvdl Exp $ */
2 1.4 cgd
3 1.1 deraadt /*
4 1.1 deraadt * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5 1.1 deraadt * unrestricted use provided that this legend is included on all tape
6 1.1 deraadt * media and as a part of the software program in whole or part. Users
7 1.1 deraadt * may copy or modify Sun RPC without charge, but are not authorized
8 1.1 deraadt * to license or distribute it to anyone else except as part of a product or
9 1.1 deraadt * program developed by the user.
10 1.1 deraadt *
11 1.1 deraadt * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12 1.1 deraadt * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13 1.1 deraadt * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14 1.1 deraadt *
15 1.1 deraadt * Sun RPC is provided with no support and without any obligation on the
16 1.1 deraadt * part of Sun Microsystems, Inc. to assist in its use, correction,
17 1.1 deraadt * modification or enhancement.
18 1.1 deraadt *
19 1.1 deraadt * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20 1.1 deraadt * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21 1.1 deraadt * OR ANY PART THEREOF.
22 1.1 deraadt *
23 1.1 deraadt * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24 1.1 deraadt * or profits or other special, indirect and consequential damages, even if
25 1.1 deraadt * Sun has been advised of the possibility of such damages.
26 1.1 deraadt *
27 1.1 deraadt * Sun Microsystems, Inc.
28 1.1 deraadt * 2550 Garcia Avenue
29 1.1 deraadt * Mountain View, California 94043
30 1.3 mycroft *
31 1.14 fvdl * from: @(#)clnt.h 1.31 94/04/29 SMI
32 1.4 cgd * @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC
33 1.1 deraadt */
34 1.1 deraadt
35 1.1 deraadt /*
36 1.1 deraadt * clnt.h - Client side remote procedure call interface.
37 1.1 deraadt *
38 1.1 deraadt * Copyright (C) 1984, Sun Microsystems, Inc.
39 1.1 deraadt */
40 1.1 deraadt
41 1.2 brezak #ifndef _RPC_CLNT_H_
42 1.2 brezak #define _RPC_CLNT_H_
43 1.2 brezak #include <sys/cdefs.h>
44 1.17 fvdl
45 1.17 fvdl #include <rpc/rpc_com.h>
46 1.1 deraadt
47 1.1 deraadt /*
48 1.14 fvdl * Well-known IPV6 RPC broadcast address.
49 1.14 fvdl */
50 1.14 fvdl #define RPCB_MULTICAST_ADDR "ff02::202"
51 1.14 fvdl
52 1.14 fvdl /*
53 1.10 lukem * Rpc calls return an enum clnt_stat. This should be looked at more,
54 1.1 deraadt * since each implementation is required to live with this (implementation
55 1.1 deraadt * independent) list of errors.
56 1.1 deraadt */
57 1.1 deraadt enum clnt_stat {
58 1.1 deraadt RPC_SUCCESS=0, /* call succeeded */
59 1.1 deraadt /*
60 1.1 deraadt * local errors
61 1.1 deraadt */
62 1.1 deraadt RPC_CANTENCODEARGS=1, /* can't encode arguments */
63 1.1 deraadt RPC_CANTDECODERES=2, /* can't decode results */
64 1.1 deraadt RPC_CANTSEND=3, /* failure in sending call */
65 1.1 deraadt RPC_CANTRECV=4, /* failure in receiving result */
66 1.1 deraadt RPC_TIMEDOUT=5, /* call timed out */
67 1.1 deraadt /*
68 1.1 deraadt * remote errors
69 1.1 deraadt */
70 1.10 lukem RPC_VERSMISMATCH=6, /* rpc versions not compatible */
71 1.1 deraadt RPC_AUTHERROR=7, /* authentication error */
72 1.1 deraadt RPC_PROGUNAVAIL=8, /* program not available */
73 1.1 deraadt RPC_PROGVERSMISMATCH=9, /* program version mismatched */
74 1.1 deraadt RPC_PROCUNAVAIL=10, /* procedure unavailable */
75 1.1 deraadt RPC_CANTDECODEARGS=11, /* decode arguments error */
76 1.1 deraadt RPC_SYSTEMERROR=12, /* generic "other problem" */
77 1.1 deraadt
78 1.1 deraadt /*
79 1.14 fvdl * rpc_call & clnt_create errors
80 1.1 deraadt */
81 1.1 deraadt RPC_UNKNOWNHOST=13, /* unknown host name */
82 1.1 deraadt RPC_UNKNOWNPROTO=17, /* unkown protocol */
83 1.14 fvdl RPC_UNKNOWNADDR = 19, /* Remote address unknown */
84 1.14 fvdl RPC_NOBROADCAST = 21, /* Broadcasting not supported */
85 1.1 deraadt
86 1.1 deraadt /*
87 1.14 fvdl * rpcbind errors
88 1.1 deraadt */
89 1.14 fvdl RPC_RPCBFAILURE=14, /* the pmapper failed in its call */
90 1.14 fvdl #define RPC_PMAPFAILURE RPC_RPCBFAILURE
91 1.1 deraadt RPC_PROGNOTREGISTERED=15, /* remote program is not registered */
92 1.14 fvdl RPC_N2AXLATEFAILURE = 22, /* name -> addr translation failed */
93 1.14 fvdl
94 1.14 fvdl /*
95 1.14 fvdl * Misc error in the TLI library (provided for compatibility)
96 1.14 fvdl */
97 1.14 fvdl RPC_TLIERROR = 20,
98 1.14 fvdl
99 1.1 deraadt /*
100 1.1 deraadt * unspecified error
101 1.1 deraadt */
102 1.14 fvdl RPC_FAILED=16,
103 1.14 fvdl
104 1.14 fvdl /*
105 1.14 fvdl * asynchronous errors
106 1.14 fvdl */
107 1.14 fvdl RPC_INPROGRESS = 24,
108 1.14 fvdl RPC_STALERACHANDLE = 25
109 1.1 deraadt };
110 1.1 deraadt
111 1.1 deraadt
112 1.1 deraadt /*
113 1.1 deraadt * Error info.
114 1.1 deraadt */
115 1.1 deraadt struct rpc_err {
116 1.1 deraadt enum clnt_stat re_status;
117 1.1 deraadt union {
118 1.11 lukem int RE_errno; /* related system error */
119 1.1 deraadt enum auth_stat RE_why; /* why the auth error occurred */
120 1.1 deraadt struct {
121 1.14 fvdl rpcvers_t low; /* lowest version supported */
122 1.14 fvdl rpcvers_t high; /* highest version supported */
123 1.1 deraadt } RE_vers;
124 1.1 deraadt struct { /* maybe meaningful if RPC_FAILED */
125 1.6 cgd int32_t s1;
126 1.6 cgd int32_t s2;
127 1.1 deraadt } RE_lb; /* life boot & debugging only */
128 1.1 deraadt } ru;
129 1.1 deraadt #define re_errno ru.RE_errno
130 1.1 deraadt #define re_why ru.RE_why
131 1.1 deraadt #define re_vers ru.RE_vers
132 1.1 deraadt #define re_lb ru.RE_lb
133 1.1 deraadt };
134 1.1 deraadt
135 1.1 deraadt
136 1.1 deraadt /*
137 1.10 lukem * Client rpc handle.
138 1.14 fvdl * Created by individual implementations
139 1.1 deraadt * Client is responsible for initializing auth, see e.g. auth_none.c.
140 1.1 deraadt */
141 1.5 cgd typedef struct __rpc_client {
142 1.1 deraadt AUTH *cl_auth; /* authenticator */
143 1.12 mycroft const struct clnt_ops {
144 1.10 lukem /* call remote procedure */
145 1.5 cgd enum clnt_stat (*cl_call) __P((struct __rpc_client *,
146 1.14 fvdl rpcproc_t, xdrproc_t, caddr_t, xdrproc_t,
147 1.10 lukem caddr_t, struct timeval));
148 1.10 lukem /* abort a call */
149 1.5 cgd void (*cl_abort) __P((struct __rpc_client *));
150 1.10 lukem /* get specific error code */
151 1.5 cgd void (*cl_geterr) __P((struct __rpc_client *,
152 1.10 lukem struct rpc_err *));
153 1.10 lukem /* frees results */
154 1.5 cgd bool_t (*cl_freeres) __P((struct __rpc_client *,
155 1.10 lukem xdrproc_t, caddr_t));
156 1.10 lukem /* destroy this structure */
157 1.5 cgd void (*cl_destroy) __P((struct __rpc_client *));
158 1.10 lukem /* the ioctl() of rpc */
159 1.10 lukem bool_t (*cl_control) __P((struct __rpc_client *, u_int,
160 1.10 lukem char *));
161 1.1 deraadt } *cl_ops;
162 1.13 christos void *cl_private; /* private stuff */
163 1.14 fvdl char *cl_netid; /* network token */
164 1.14 fvdl char *cl_tp; /* device name */
165 1.1 deraadt } CLIENT;
166 1.1 deraadt
167 1.1 deraadt
168 1.1 deraadt /*
169 1.14 fvdl * Timers used for the pseudo-transport protocol when using datagrams
170 1.14 fvdl */
171 1.14 fvdl struct rpc_timers {
172 1.14 fvdl u_short rt_srtt; /* smoothed round-trip time */
173 1.14 fvdl u_short rt_deviate; /* estimated deviation */
174 1.14 fvdl u_long rt_rtxcur; /* current (backed-off) rto */
175 1.14 fvdl };
176 1.14 fvdl
177 1.14 fvdl /*
178 1.14 fvdl * Feedback values used for possible congestion and rate control
179 1.14 fvdl */
180 1.14 fvdl #define FEEDBACK_REXMIT1 1 /* first retransmit */
181 1.14 fvdl #define FEEDBACK_OK 2 /* no retransmits */
182 1.14 fvdl
183 1.14 fvdl /* Used to set version of portmapper used in broadcast */
184 1.14 fvdl
185 1.14 fvdl #define CLCR_SET_LOWVERS 3
186 1.14 fvdl #define CLCR_GET_LOWVERS 4
187 1.14 fvdl
188 1.14 fvdl #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */
189 1.14 fvdl
190 1.14 fvdl /*
191 1.10 lukem * client side rpc interface ops
192 1.1 deraadt *
193 1.1 deraadt * Parameter types are:
194 1.1 deraadt *
195 1.1 deraadt */
196 1.1 deraadt
197 1.1 deraadt /*
198 1.1 deraadt * enum clnt_stat
199 1.1 deraadt * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
200 1.10 lukem * CLIENT *rh;
201 1.14 fvdl * rpcproc_t proc;
202 1.10 lukem * xdrproc_t xargs;
203 1.10 lukem * caddr_t argsp;
204 1.10 lukem * xdrproc_t xres;
205 1.10 lukem * caddr_t resp;
206 1.10 lukem * struct timeval timeout;
207 1.1 deraadt */
208 1.5 cgd #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
209 1.13 christos ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
210 1.13 christos (caddr_t)(void *)argsp, xres, (caddr_t)(void *)resp, secs))
211 1.5 cgd #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
212 1.13 christos ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
213 1.13 christos (caddr_t)(void *)argsp, xres, (caddr_t)(void *)resp, secs))
214 1.1 deraadt
215 1.1 deraadt /*
216 1.1 deraadt * void
217 1.1 deraadt * CLNT_ABORT(rh);
218 1.10 lukem * CLIENT *rh;
219 1.1 deraadt */
220 1.1 deraadt #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh))
221 1.1 deraadt #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh))
222 1.1 deraadt
223 1.1 deraadt /*
224 1.1 deraadt * struct rpc_err
225 1.1 deraadt * CLNT_GETERR(rh);
226 1.10 lukem * CLIENT *rh;
227 1.1 deraadt */
228 1.1 deraadt #define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
229 1.1 deraadt #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
230 1.1 deraadt
231 1.1 deraadt
232 1.1 deraadt /*
233 1.1 deraadt * bool_t
234 1.1 deraadt * CLNT_FREERES(rh, xres, resp);
235 1.10 lukem * CLIENT *rh;
236 1.10 lukem * xdrproc_t xres;
237 1.10 lukem * caddr_t resp;
238 1.1 deraadt */
239 1.1 deraadt #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
240 1.1 deraadt #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
241 1.1 deraadt
242 1.1 deraadt /*
243 1.1 deraadt * bool_t
244 1.1 deraadt * CLNT_CONTROL(cl, request, info)
245 1.10 lukem * CLIENT *cl;
246 1.10 lukem * u_int request;
247 1.10 lukem * char *info;
248 1.1 deraadt */
249 1.1 deraadt #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
250 1.1 deraadt #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
251 1.1 deraadt
252 1.1 deraadt /*
253 1.1 deraadt * control operations that apply to both udp and tcp transports
254 1.1 deraadt */
255 1.14 fvdl #define CLSET_TIMEOUT 1 /* set timeout (timeval) */
256 1.14 fvdl #define CLGET_TIMEOUT 2 /* get timeout (timeval) */
257 1.14 fvdl #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */
258 1.14 fvdl #define CLGET_FD 6 /* get connections file descriptor */
259 1.14 fvdl #define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */
260 1.14 fvdl #define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */
261 1.14 fvdl #define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */
262 1.14 fvdl #define CLGET_XID 10 /* Get xid */
263 1.14 fvdl #define CLSET_XID 11 /* Set xid */
264 1.14 fvdl #define CLGET_VERS 12 /* Get version number */
265 1.14 fvdl #define CLSET_VERS 13 /* Set version number */
266 1.14 fvdl #define CLGET_PROG 14 /* Get program number */
267 1.14 fvdl #define CLSET_PROG 15 /* Set program number */
268 1.14 fvdl #define CLSET_SVC_ADDR 16 /* get server's address (netbuf) */
269 1.14 fvdl #define CLSET_PUSH_TIMOD 17 /* push timod if not already present */
270 1.14 fvdl #define CLSET_POP_TIMOD 18 /* pop timod */
271 1.1 deraadt /*
272 1.14 fvdl * Connectionless only control operations
273 1.1 deraadt */
274 1.1 deraadt #define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
275 1.1 deraadt #define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
276 1.1 deraadt
277 1.1 deraadt /*
278 1.1 deraadt * void
279 1.1 deraadt * CLNT_DESTROY(rh);
280 1.10 lukem * CLIENT *rh;
281 1.1 deraadt */
282 1.1 deraadt #define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
283 1.1 deraadt #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
284 1.1 deraadt
285 1.1 deraadt
286 1.1 deraadt /*
287 1.16 wiz * RPCTEST is a test program which is accessible on every rpc
288 1.1 deraadt * transport/port. It is used for testing, performance evaluation,
289 1.1 deraadt * and network administration.
290 1.1 deraadt */
291 1.1 deraadt
292 1.14 fvdl #define RPCTEST_PROGRAM ((rpcprog_t)1)
293 1.14 fvdl #define RPCTEST_VERSION ((rpcvers_t)1)
294 1.14 fvdl #define RPCTEST_NULL_PROC ((rpcproc_t)2)
295 1.14 fvdl #define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3)
296 1.1 deraadt
297 1.1 deraadt /*
298 1.1 deraadt * By convention, procedure 0 takes null arguments and returns them
299 1.1 deraadt */
300 1.1 deraadt
301 1.14 fvdl #define NULLPROC ((rpcproc_t)0)
302 1.1 deraadt
303 1.1 deraadt /*
304 1.1 deraadt * Below are the client handle creation routines for the various
305 1.14 fvdl * implementations of client side rpc. They can return NULL if a
306 1.14 fvdl * creation failure occurs.
307 1.14 fvdl */
308 1.1 deraadt
309 1.1 deraadt /*
310 1.14 fvdl * Generic client creation routine. Supported protocols are those that
311 1.14 fvdl * belong to the nettype namespace (/etc/netconfig).
312 1.1 deraadt * CLIENT *
313 1.14 fvdl * clnt_create(host, prog, vers, prot);
314 1.14 fvdl * const char *host; -- hostname
315 1.14 fvdl * const rpcprog_t prog; -- program number
316 1.14 fvdl * const rpcvers_t vers; -- version number
317 1.14 fvdl * const char *prot; -- protocol
318 1.1 deraadt */
319 1.2 brezak __BEGIN_DECLS
320 1.14 fvdl extern CLIENT *clnt_create __P((const char *, const rpcprog_t, const rpcvers_t,
321 1.14 fvdl const char *));
322 1.14 fvdl /*
323 1.14 fvdl *
324 1.14 fvdl * const char *hostname; -- hostname
325 1.14 fvdl * const rpcprog_t prog; -- program number
326 1.14 fvdl * const rpcvers_t vers; -- version number
327 1.14 fvdl * const char *nettype; -- network type
328 1.14 fvdl */
329 1.14 fvdl
330 1.14 fvdl /*
331 1.14 fvdl * Generic client creation routine. Supported protocols are which belong
332 1.14 fvdl * to the nettype name space.
333 1.14 fvdl */
334 1.14 fvdl extern CLIENT *clnt_create_vers __P((const char *, const rpcprog_t, rpcvers_t *,
335 1.14 fvdl const rpcvers_t, const rpcvers_t,
336 1.14 fvdl const char *));
337 1.14 fvdl /*
338 1.14 fvdl * const char *host; -- hostname
339 1.14 fvdl * const rpcprog_t prog; -- program number
340 1.14 fvdl * rpcvers_t *vers_out; -- servers highest available version
341 1.14 fvdl * const rpcvers_t vers_low; -- low version number
342 1.14 fvdl * const rpcvers_t vers_high; -- high version number
343 1.14 fvdl * const char *nettype; -- network type
344 1.14 fvdl */
345 1.1 deraadt
346 1.1 deraadt
347 1.1 deraadt /*
348 1.14 fvdl * Generic client creation routine. It takes a netconfig structure
349 1.14 fvdl * instead of nettype
350 1.14 fvdl */
351 1.14 fvdl extern CLIENT *clnt_tp_create __P((const char *, const rpcprog_t,
352 1.14 fvdl const rpcvers_t, const struct netconfig *));
353 1.14 fvdl /*
354 1.14 fvdl * const char *hostname; -- hostname
355 1.14 fvdl * const rpcprog_t prog; -- program number
356 1.14 fvdl * const rpcvers_t vers; -- version number
357 1.14 fvdl * const struct netconfig *netconf; -- network config structure
358 1.14 fvdl */
359 1.14 fvdl
360 1.14 fvdl /*
361 1.14 fvdl * Generic TLI create routine. Only provided for compatibility.
362 1.2 brezak */
363 1.1 deraadt
364 1.14 fvdl extern CLIENT *clnt_tli_create __P((const int, const struct netconfig *,
365 1.14 fvdl const struct netbuf *, const rpcprog_t,
366 1.14 fvdl const rpcvers_t, const u_int, const u_int));
367 1.14 fvdl /*
368 1.14 fvdl * const register int fd; -- fd
369 1.14 fvdl * const struct netconfig *nconf; -- netconfig structure
370 1.14 fvdl * const struct netbuf *svcaddr; -- servers address
371 1.14 fvdl * const u_long prog; -- program number
372 1.14 fvdl * const u_long vers; -- version number
373 1.14 fvdl * const u_int sendsz; -- send size
374 1.14 fvdl * const u_int recvsz; -- recv size
375 1.14 fvdl */
376 1.1 deraadt
377 1.1 deraadt /*
378 1.14 fvdl * Low level clnt create routine for connectionful transports, e.g. tcp.
379 1.14 fvdl */
380 1.14 fvdl extern CLIENT *clnt_vc_create __P((const int, const struct netbuf *,
381 1.14 fvdl const rpcprog_t, const rpcvers_t,
382 1.14 fvdl const u_int, const u_int));
383 1.14 fvdl /*
384 1.14 fvdl * const int fd; -- open file descriptor
385 1.14 fvdl * const struct netbuf *svcaddr; -- servers address
386 1.14 fvdl * const rpcprog_t prog; -- program number
387 1.14 fvdl * const rpcvers_t vers; -- version number
388 1.14 fvdl * const u_int sendsz; -- buffer recv size
389 1.14 fvdl * const u_int recvsz; -- buffer send size
390 1.1 deraadt */
391 1.1 deraadt
392 1.14 fvdl /*
393 1.14 fvdl * Low level clnt create routine for connectionless transports, e.g. udp.
394 1.14 fvdl */
395 1.14 fvdl extern CLIENT *clnt_dg_create __P((const int, const struct netbuf *,
396 1.14 fvdl const rpcprog_t, const rpcvers_t,
397 1.14 fvdl const u_int, const u_int));
398 1.14 fvdl /*
399 1.14 fvdl * const int fd; -- open file descriptor
400 1.14 fvdl * const struct netbuf *svcaddr; -- servers address
401 1.14 fvdl * const rpcprog_t program; -- program number
402 1.14 fvdl * const rpcvers_t version; -- version number
403 1.14 fvdl * const u_int sendsz; -- buffer recv size
404 1.14 fvdl * const u_int recvsz; -- buffer send size
405 1.14 fvdl */
406 1.2 brezak
407 1.1 deraadt /*
408 1.14 fvdl * Memory based rpc (for speed check and testing)
409 1.1 deraadt * CLIENT *
410 1.14 fvdl * clnt_raw_create(prog, vers)
411 1.14 fvdl * u_long prog;
412 1.14 fvdl * u_long vers;
413 1.1 deraadt */
414 1.14 fvdl extern CLIENT *clnt_raw_create __P((rpcprog_t, rpcvers_t));
415 1.14 fvdl
416 1.2 brezak __END_DECLS
417 1.2 brezak
418 1.1 deraadt
419 1.1 deraadt /*
420 1.1 deraadt * Print why creation failed
421 1.1 deraadt */
422 1.2 brezak __BEGIN_DECLS
423 1.15 cgd extern void clnt_pcreateerror __P((const char *)); /* stderr */
424 1.15 cgd extern char *clnt_spcreateerror __P((const char *)); /* string */
425 1.2 brezak __END_DECLS
426 1.1 deraadt
427 1.1 deraadt /*
428 1.1 deraadt * Like clnt_perror(), but is more verbose in its output
429 1.1 deraadt */
430 1.2 brezak __BEGIN_DECLS
431 1.2 brezak extern void clnt_perrno __P((enum clnt_stat)); /* stderr */
432 1.2 brezak extern char *clnt_sperrno __P((enum clnt_stat)); /* string */
433 1.2 brezak __END_DECLS
434 1.1 deraadt
435 1.1 deraadt /*
436 1.1 deraadt * Print an English error message, given the client error code
437 1.1 deraadt */
438 1.2 brezak __BEGIN_DECLS
439 1.15 cgd extern void clnt_perror __P((CLIENT *, const char *)); /* stderr */
440 1.15 cgd extern char *clnt_sperror __P((CLIENT *, const char *)); /* string */
441 1.2 brezak __END_DECLS
442 1.2 brezak
443 1.1 deraadt
444 1.1 deraadt /*
445 1.1 deraadt * If a creation fails, the following allows the user to figure out why.
446 1.1 deraadt */
447 1.1 deraadt struct rpc_createerr {
448 1.1 deraadt enum clnt_stat cf_stat;
449 1.1 deraadt struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
450 1.1 deraadt };
451 1.1 deraadt
452 1.14 fvdl #ifdef _REENTRANT
453 1.14 fvdl __BEGIN_DECLS
454 1.14 fvdl extern struct rpc_createerr *__rpc_createerr __P((void));
455 1.14 fvdl __END_DECLS
456 1.14 fvdl #define rpc_createerr (*(__rpc_createerr()))
457 1.14 fvdl #else
458 1.1 deraadt extern struct rpc_createerr rpc_createerr;
459 1.14 fvdl #endif /* _REENTRANT */
460 1.14 fvdl
461 1.14 fvdl /*
462 1.14 fvdl * The simplified interface:
463 1.14 fvdl * enum clnt_stat
464 1.14 fvdl * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
465 1.14 fvdl * const char *host;
466 1.14 fvdl * const rpcprog_t prognum;
467 1.14 fvdl * const rpcvers_t versnum;
468 1.14 fvdl * const rpcproc_t procnum;
469 1.14 fvdl * const xdrproc_t inproc, outproc;
470 1.14 fvdl * const char *in;
471 1.14 fvdl * char *out;
472 1.14 fvdl * const char *nettype;
473 1.14 fvdl */
474 1.14 fvdl __BEGIN_DECLS
475 1.14 fvdl extern enum clnt_stat rpc_call __P((const char *, const rpcprog_t,
476 1.14 fvdl const rpcvers_t, const rpcproc_t,
477 1.14 fvdl const xdrproc_t, const char *,
478 1.14 fvdl const xdrproc_t, char *, const char *));
479 1.14 fvdl __END_DECLS
480 1.1 deraadt
481 1.14 fvdl /*
482 1.14 fvdl * RPC broadcast interface
483 1.14 fvdl * The call is broadcasted to all locally connected nets.
484 1.14 fvdl *
485 1.14 fvdl * extern enum clnt_stat
486 1.14 fvdl * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
487 1.14 fvdl * eachresult, nettype)
488 1.14 fvdl * const rpcprog_t prog; -- program number
489 1.14 fvdl * const rpcvers_t vers; -- version number
490 1.14 fvdl * const rpcproc_t proc; -- procedure number
491 1.14 fvdl * const xdrproc_t xargs; -- xdr routine for args
492 1.14 fvdl * caddr_t argsp; -- pointer to args
493 1.14 fvdl * const xdrproc_t xresults; -- xdr routine for results
494 1.14 fvdl * caddr_t resultsp; -- pointer to results
495 1.14 fvdl * const resultproc_t eachresult; -- call with each result
496 1.14 fvdl * const char *nettype; -- Transport type
497 1.14 fvdl *
498 1.14 fvdl * For each valid response received, the procedure eachresult is called.
499 1.14 fvdl * Its form is:
500 1.14 fvdl * done = eachresult(resp, raddr, nconf)
501 1.14 fvdl * bool_t done;
502 1.14 fvdl * caddr_t resp;
503 1.14 fvdl * struct netbuf *raddr;
504 1.14 fvdl * struct netconfig *nconf;
505 1.14 fvdl * where resp points to the results of the call and raddr is the
506 1.14 fvdl * address if the responder to the broadcast. nconf is the transport
507 1.14 fvdl * on which the response was received.
508 1.14 fvdl *
509 1.14 fvdl * extern enum clnt_stat
510 1.14 fvdl * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
511 1.14 fvdl * eachresult, inittime, waittime, nettype)
512 1.14 fvdl * const rpcprog_t prog; -- program number
513 1.14 fvdl * const rpcvers_t vers; -- version number
514 1.14 fvdl * const rpcproc_t proc; -- procedure number
515 1.14 fvdl * const xdrproc_t xargs; -- xdr routine for args
516 1.14 fvdl * caddr_t argsp; -- pointer to args
517 1.14 fvdl * const xdrproc_t xresults; -- xdr routine for results
518 1.14 fvdl * caddr_t resultsp; -- pointer to results
519 1.14 fvdl * const resultproc_t eachresult; -- call with each result
520 1.14 fvdl * const int inittime; -- how long to wait initially
521 1.14 fvdl * const int waittime; -- maximum time to wait
522 1.14 fvdl * const char *nettype; -- Transport type
523 1.14 fvdl */
524 1.14 fvdl
525 1.14 fvdl typedef bool_t (*resultproc_t) __P((caddr_t, ...));
526 1.14 fvdl
527 1.14 fvdl __BEGIN_DECLS
528 1.14 fvdl extern enum clnt_stat rpc_broadcast __P((const rpcprog_t, const rpcvers_t,
529 1.14 fvdl const rpcproc_t, const xdrproc_t,
530 1.14 fvdl caddr_t, const xdrproc_t, caddr_t,
531 1.14 fvdl const resultproc_t, const char *));
532 1.14 fvdl extern enum clnt_stat rpc_broadcast_exp __P((const rpcprog_t, const rpcvers_t,
533 1.14 fvdl const rpcproc_t, const xdrproc_t,
534 1.14 fvdl caddr_t, const xdrproc_t, caddr_t,
535 1.14 fvdl const resultproc_t, const int,
536 1.14 fvdl const int, const char *));
537 1.14 fvdl __END_DECLS
538 1.1 deraadt
539 1.14 fvdl /* For backward compatibility */
540 1.14 fvdl #include <rpc/clnt_soc.h>
541 1.1 deraadt
542 1.7 perry #endif /* !_RPC_CLNT_H_ */
543