[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]

FreeBSD/Linux Kernel Cross Reference
sys/rpc/clnt.h

Version: -  FREEBSD  -  FREEBSD7  -  FREEBSD70  -  FREEBSD6  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  OPENSOLARIS  -  minix-3-1-1  -  TRUSTEDBSD-SEBSD  -  FREEBSD-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  excerpts  -  bigexcerpts 

  1 /*      $NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $   */
  2 
  3 /*
  4  * The contents of this file are subject to the Sun Standards
  5  * License Version 1.0 the (the "License";) You may not use
  6  * this file except in compliance with the License.  You may
  7  * obtain a copy of the License at lib/libc/rpc/LICENSE
  8  *
  9  * Software distributed under the License is distributed on
 10  * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
 11  * express or implied.  See the License for the specific
 12  * language governing rights and limitations under the License.
 13  *
 14  * The Original Code is Copyright 1998 by Sun Microsystems, Inc
 15  *
 16  * The Initial Developer of the Original Code is:  Sun
 17  * Microsystems, Inc.
 18  *
 19  * All Rights Reserved.
 20  *
 21  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
 22  * unrestricted use provided that this legend is included on all tape
 23  * media and as a part of the software program in whole or part.  Users
 24  * may copy or modify Sun RPC without charge, but are not authorized
 25  * to license or distribute it to anyone else except as part of a product or
 26  * program developed by the user.
 27  *
 28  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
 29  * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 30  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
 31  *
 32  * Sun RPC is provided with no support and without any obligation on the
 33  * part of Sun Microsystems, Inc. to assist in its use, correction,
 34  * modification or enhancement.
 35  *
 36  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
 37  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
 38  * OR ANY PART THEREOF.
 39  *
 40  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
 41  * or profits or other special, indirect and consequential damages, even if
 42  * Sun has been advised of the possibility of such damages.
 43  *
 44  * Sun Microsystems, Inc.
 45  * 2550 Garcia Avenue
 46  * Mountain View, California  94043
 47  *
 48  *      from: @(#)clnt.h 1.31 94/04/29 SMI
 49  *      from: @(#)clnt.h        2.1 88/07/29 4.0 RPCSRC
 50  * $FreeBSD: src/sys/rpc/clnt.h,v 1.3 2008/11/03 10:38:00 dfr Exp $
 51  */
 52 
 53 /*
 54  * clnt.h - Client side remote procedure call interface.
 55  *
 56  * Copyright (c) 1986-1991,1994-1999 by Sun Microsystems, Inc.
 57  * All rights reserved.
 58  */
 59 
 60 #ifndef _RPC_CLNT_H_
 61 #define _RPC_CLNT_H_
 62 #include <rpc/clnt_stat.h>
 63 #include <sys/cdefs.h>
 64 #ifdef _KERNEL
 65 #include <sys/refcount.h>
 66 #include <rpc/netconfig.h>
 67 #else
 68 #include <netconfig.h>
 69 #endif
 70 #include <sys/un.h>
 71 
 72 /*
 73  * Well-known IPV6 RPC broadcast address.
 74  */
 75 #define RPCB_MULTICAST_ADDR "ff02::202"
 76 
 77 /*
 78  * the following errors are in general unrecoverable.  The caller
 79  * should give up rather than retry.
 80  */
 81 #define IS_UNRECOVERABLE_RPC(s) (((s) == RPC_AUTHERROR) || \
 82         ((s) == RPC_CANTENCODEARGS) || \
 83         ((s) == RPC_CANTDECODERES) || \
 84         ((s) == RPC_VERSMISMATCH) || \
 85         ((s) == RPC_PROCUNAVAIL) || \
 86         ((s) == RPC_PROGUNAVAIL) || \
 87         ((s) == RPC_PROGVERSMISMATCH) || \
 88         ((s) == RPC_CANTDECODEARGS))
 89 
 90 /*
 91  * Error info.
 92  */
 93 struct rpc_err {
 94         enum clnt_stat re_status;
 95         union {
 96                 int RE_errno;           /* related system error */
 97                 enum auth_stat RE_why;  /* why the auth error occurred */
 98                 struct {
 99                         rpcvers_t low;  /* lowest version supported */
100                         rpcvers_t high; /* highest version supported */
101                 } RE_vers;
102                 struct {                /* maybe meaningful if RPC_FAILED */
103                         int32_t s1;
104                         int32_t s2;
105                 } RE_lb;                /* life boot & debugging only */
106         } ru;
107 #define re_errno        ru.RE_errno
108 #define re_why          ru.RE_why
109 #define re_vers         ru.RE_vers
110 #define re_lb           ru.RE_lb
111 };
112 
113 #ifdef _KERNEL
114 /*
115  * Functions of this type may be used to receive notification when RPC
116  * calls have to be re-transmitted etc.
117  */
118 typedef void rpc_feedback(int cmd, int procnum, void *);
119 
120 /*
121  * Timers used for the pseudo-transport protocol when using datagrams
122  */
123 struct rpc_timers {
124         u_short         rt_srtt;        /* smoothed round-trip time */
125         u_short         rt_deviate;     /* estimated deviation */
126         u_long          rt_rtxcur;      /* current (backed-off) rto */
127 };
128 
129 /*
130  * A structure used with CLNT_CALL_EXT to pass extra information used
131  * while processing an RPC call.
132  */
133 struct rpc_callextra {
134         AUTH            *rc_auth;       /* auth handle to use for this call */
135         rpc_feedback    *rc_feedback;   /* callback for retransmits etc. */
136         void            *rc_feedback_arg; /* argument for callback */
137         struct rpc_timers *rc_timers;     /* optional RTT timers */
138         struct rpc_err  rc_err;         /* detailed call status */
139 };
140 #endif
141 
142 /*
143  * Client rpc handle.
144  * Created by individual implementations
145  * Client is responsible for initializing auth, see e.g. auth_none.c.
146  */
147 typedef struct __rpc_client {
148 #ifdef _KERNEL
149         volatile u_int cl_refs;                 /* reference count */
150         AUTH    *cl_auth;                       /* authenticator */
151         struct clnt_ops {
152                 /* call remote procedure */
153                 enum clnt_stat  (*cl_call)(struct __rpc_client *,
154                     struct rpc_callextra *, rpcproc_t,
155                     struct mbuf *, struct mbuf **, struct timeval);
156                 /* abort a call */
157                 void            (*cl_abort)(struct __rpc_client *);
158                 /* get specific error code */
159                 void            (*cl_geterr)(struct __rpc_client *,
160                                         struct rpc_err *);
161                 /* frees results */
162                 bool_t          (*cl_freeres)(struct __rpc_client *,
163                                         xdrproc_t, void *);
164                 /* close the connection and terminate pending RPCs */
165                 void            (*cl_close)(struct __rpc_client *);
166                 /* destroy this structure */
167                 void            (*cl_destroy)(struct __rpc_client *);
168                 /* the ioctl() of rpc */
169                 bool_t          (*cl_control)(struct __rpc_client *, u_int,
170                                     void *);
171         } *cl_ops;
172 #else
173         AUTH    *cl_auth;                       /* authenticator */
174         struct clnt_ops {
175                 /* call remote procedure */
176                 enum clnt_stat  (*cl_call)(struct __rpc_client *,
177                     rpcproc_t, xdrproc_t, void *, xdrproc_t,
178                     void *, struct timeval);
179                 /* abort a call */
180                 void            (*cl_abort)(struct __rpc_client *);
181                 /* get specific error code */
182                 void            (*cl_geterr)(struct __rpc_client *,
183                                         struct rpc_err *);
184                 /* frees results */
185                 bool_t          (*cl_freeres)(struct __rpc_client *,
186                                         xdrproc_t, void *);
187                 /* destroy this structure */
188                 void            (*cl_destroy)(struct __rpc_client *);
189                 /* the ioctl() of rpc */
190                 bool_t          (*cl_control)(struct __rpc_client *, u_int,
191                                     void *);
192         } *cl_ops;
193 #endif
194         void                    *cl_private;    /* private stuff */
195         char                    *cl_netid;      /* network token */
196         char                    *cl_tp;         /* device name */
197 } CLIENT;
198 
199 /*      
200  * Feedback values used for possible congestion and rate control
201  */
202 #define FEEDBACK_OK             1       /* no retransmits */    
203 #define FEEDBACK_REXMIT1        2       /* first retransmit */
204 #define FEEDBACK_REXMIT2        3       /* second and subsequent retransmit */
205 #define FEEDBACK_RECONNECT      4       /* client reconnect */
206 
207 /* Used to set version of portmapper used in broadcast */
208   
209 #define CLCR_SET_LOWVERS        3
210 #define CLCR_GET_LOWVERS        4
211  
212 #define RPCSMALLMSGSIZE 400     /* a more reasonable packet size */
213 
214 /*
215  * client side rpc interface ops
216  *
217  * Parameter types are:
218  *
219  */
220 
221 #ifdef _KERNEL
222 #define CLNT_ACQUIRE(rh)                        \
223         refcount_acquire(&(rh)->cl_refs)
224 #define CLNT_RELEASE(rh)                        \
225         if (refcount_release(&(rh)->cl_refs))   \
226                 CLNT_DESTROY(rh)
227 
228 /*
229  * void
230  * CLNT_CLOSE(rh);
231  *      CLIENT *rh;
232  */
233 #define CLNT_CLOSE(rh)  ((*(rh)->cl_ops->cl_close)(rh))
234 
235 enum clnt_stat clnt_call_private(CLIENT *, struct rpc_callextra *, rpcproc_t,
236     xdrproc_t, void *, xdrproc_t, void *, struct timeval);
237 
238 /*
239  * enum clnt_stat
240  * CLNT_CALL_MBUF(rh, ext, proc, mreq, mrepp, timeout)
241  *      CLIENT *rh;
242  *      struct rpc_callextra *ext;
243  *      rpcproc_t proc;
244  *      struct mbuf *mreq;
245  *      struct mbuf **mrepp;
246  *      struct timeval timeout;
247  *
248  * Call arguments in mreq which is consumed by the call (even if there
249  * is an error). Results returned in *mrepp.
250  */
251 #define CLNT_CALL_MBUF(rh, ext, proc, mreq, mrepp, secs)        \
252         ((*(rh)->cl_ops->cl_call)(rh, ext, proc, mreq, mrepp, secs))
253 
254 /*
255  * enum clnt_stat
256  * CLNT_CALL_EXT(rh, ext, proc, xargs, argsp, xres, resp, timeout)
257  *      CLIENT *rh;
258  *      struct rpc_callextra *ext;
259  *      rpcproc_t proc;
260  *      xdrproc_t xargs;
261  *      void *argsp;
262  *      xdrproc_t xres;
263  *      void *resp;
264  *      struct timeval timeout;
265  */
266 #define CLNT_CALL_EXT(rh, ext, proc, xargs, argsp, xres, resp, secs)    \
267         clnt_call_private(rh, ext, proc, xargs,                         \
268                 argsp, xres, resp, secs)
269 #endif
270 
271 /*
272  * enum clnt_stat
273  * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
274  *      CLIENT *rh;
275  *      rpcproc_t proc;
276  *      xdrproc_t xargs;
277  *      void *argsp;
278  *      xdrproc_t xres;
279  *      void *resp;
280  *      struct timeval timeout;
281  */
282 #ifdef _KERNEL
283 #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)     \
284         clnt_call_private(rh, NULL, proc, xargs,                \
285                 argsp, xres, resp, secs)
286 #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs)     \
287         clnt_call_private(rh, NULL, proc, xargs,                \
288                 argsp, xres, resp, secs)
289 #else
290 #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)             \
291         ((*(rh)->cl_ops->cl_call)(rh, proc, xargs,      \
292                 argsp, xres, resp, secs))
293 #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs)             \
294         ((*(rh)->cl_ops->cl_call)(rh, proc, xargs,      \
295                 argsp, xres, resp, secs))
296 #endif
297 
298 /*
299  * void
300  * CLNT_ABORT(rh);
301  *      CLIENT *rh;
302  */
303 #define CLNT_ABORT(rh)  ((*(rh)->cl_ops->cl_abort)(rh))
304 #define clnt_abort(rh)  ((*(rh)->cl_ops->cl_abort)(rh))
305 
306 /*
307  * struct rpc_err
308  * CLNT_GETERR(rh);
309  *      CLIENT *rh;
310  */
311 #define CLNT_GETERR(rh,errp)    ((*(rh)->cl_ops->cl_geterr)(rh, errp))
312 #define clnt_geterr(rh,errp)    ((*(rh)->cl_ops->cl_geterr)(rh, errp))
313 
314 
315 /*
316  * bool_t
317  * CLNT_FREERES(rh, xres, resp);
318  *      CLIENT *rh;
319  *      xdrproc_t xres;
320  *      void *resp;
321  */
322 #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
323 #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
324 
325 /*
326  * bool_t
327  * CLNT_CONTROL(cl, request, info)
328  *      CLIENT *cl;
329  *      u_int request;
330  *      char *info;
331  */
332 #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
333 #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
334 
335 /*
336  * control operations that apply to both udp and tcp transports
337  */
338 #define CLSET_TIMEOUT           1       /* set timeout (timeval) */
339 #define CLGET_TIMEOUT           2       /* get timeout (timeval) */
340 #define CLGET_SERVER_ADDR       3       /* get server's address (sockaddr) */
341 #define CLGET_FD                6       /* get connections file descriptor */
342 #define CLGET_SVC_ADDR          7       /* get server's address (netbuf) */
343 #define CLSET_FD_CLOSE          8       /* close fd while clnt_destroy */
344 #define CLSET_FD_NCLOSE         9       /* Do not close fd while clnt_destroy */
345 #define CLGET_XID               10      /* Get xid */
346 #define CLSET_XID               11      /* Set xid */
347 #define CLGET_VERS              12      /* Get version number */
348 #define CLSET_VERS              13      /* Set version number */
349 #define CLGET_PROG              14      /* Get program number */
350 #define CLSET_PROG              15      /* Set program number */
351 #define CLSET_SVC_ADDR          16      /* get server's address (netbuf) */
352 #define CLSET_PUSH_TIMOD        17      /* push timod if not already present */
353 #define CLSET_POP_TIMOD         18      /* pop timod */
354 /*
355  * Connectionless only control operations
356  */
357 #define CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */
358 #define CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */
359 #define CLSET_ASYNC             19
360 #define CLSET_CONNECT           20      /* Use connect() for UDP. (int) */
361 
362 #ifdef _KERNEL
363 /*
364  * Kernel control operations. The default msleep string is "rpcrecv",
365  * and sleeps are non-interruptible by default.
366  */
367 #define CLSET_WAITCHAN          21      /* set string to use in msleep call */
368 #define CLGET_WAITCHAN          22      /* get string used in msleep call */
369 #define CLSET_INTERRUPTIBLE     23      /* set interruptible flag */
370 #define CLGET_INTERRUPTIBLE     24      /* set interruptible flag */
371 #define CLSET_RETRIES           25      /* set retry count for reconnect */
372 #define CLGET_RETRIES           26      /* get retry count for reconnect */
373 #define CLSET_PRIVPORT          27      /* set privileged source port flag */
374 #define CLGET_PRIVPORT          28      /* get privileged source port flag */
375 #endif
376 
377 
378 /*
379  * void
380  * CLNT_DESTROY(rh);
381  *      CLIENT *rh;
382  */
383 #define CLNT_DESTROY(rh)        ((*(rh)->cl_ops->cl_destroy)(rh))
384 #define clnt_destroy(rh)        ((*(rh)->cl_ops->cl_destroy)(rh))
385 
386 
387 /*
388  * RPCTEST is a test program which is accessible on every rpc
389  * transport/port.  It is used for testing, performance evaluation,
390  * and network administration.
391  */
392 
393 #define RPCTEST_PROGRAM         ((rpcprog_t)1)
394 #define RPCTEST_VERSION         ((rpcvers_t)1)
395 #define RPCTEST_NULL_PROC       ((rpcproc_t)2)
396 #define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3)
397 
398 /*
399  * By convention, procedure 0 takes null arguments and returns them
400  */
401 
402 #define NULLPROC ((rpcproc_t)0)
403 
404 /*
405  * Below are the client handle creation routines for the various
406  * implementations of client side rpc.  They can return NULL if a
407  * creation failure occurs.
408  */
409 
410 /*
411  * Generic client creation routine. Supported protocols are those that
412  * belong to the nettype namespace (/etc/netconfig).
413  */
414 __BEGIN_DECLS
415 #ifdef _KERNEL
416 
417 /*
418  *      struct socket *so;                      -- socket
419  *      struct sockaddr *svcaddr;               -- servers address
420  *      rpcprog_t prog;                         -- program number
421  *      rpcvers_t vers;                         -- version number
422  *      size_t sendsz;                          -- buffer recv size
423  *      size_t recvsz;                          -- buffer send size
424  */
425 extern CLIENT *clnt_dg_create(struct socket *so,
426     struct sockaddr *svcaddr, rpcprog_t program, rpcvers_t version,
427     size_t sendsz, size_t recvsz);
428 
429 /*
430  *      struct socket *so;                      -- socket
431  *      struct sockaddr *svcaddr;               -- servers address
432  *      rpcprog_t prog;                         -- program number
433  *      rpcvers_t vers;                         -- version number
434  *      size_t sendsz;                          -- buffer recv size
435  *      size_t recvsz;                          -- buffer send size
436  */
437 extern CLIENT *clnt_vc_create(struct socket *so,
438     struct sockaddr *svcaddr, rpcprog_t program, rpcvers_t version,
439     size_t sendsz, size_t recvsz);
440 
441 /*
442  *      struct netconfig *nconf;                -- network type
443  *      struct sockaddr *svcaddr;               -- servers address
444  *      rpcprog_t prog;                         -- program number
445  *      rpcvers_t vers;                         -- version number
446  *      size_t sendsz;                          -- buffer recv size
447  *      size_t recvsz;                          -- buffer send size
448  */
449 extern CLIENT *clnt_reconnect_create(struct netconfig *nconf,
450     struct sockaddr *svcaddr, rpcprog_t program, rpcvers_t version,
451     size_t sendsz, size_t recvsz);
452 
453 #else
454 
455 extern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t,
456                            const char *);
457 /*
458  *
459  *      const char *hostname;                   -- hostname
460  *      const rpcprog_t prog;                   -- program number
461  *      const rpcvers_t vers;                   -- version number
462  *      const char *nettype;                    -- network type
463  */
464 
465  /*
466  * Generic client creation routine. Just like clnt_create(), except
467  * it takes an additional timeout parameter.
468  */
469 extern CLIENT * clnt_create_timed(const char *, const rpcprog_t,
470         const rpcvers_t, const char *, const struct timeval *);
471 /*
472  *
473  *      const char *hostname;                   -- hostname
474  *      const rpcprog_t prog;                   -- program number
475  *      const rpcvers_t vers;                   -- version number
476  *      const char *nettype;                    -- network type
477  *      const struct timeval *tp;               -- timeout
478  */
479 
480 /*
481  * Generic client creation routine. Supported protocols are which belong
482  * to the nettype name space.
483  */
484 extern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *,
485                                 const rpcvers_t, const rpcvers_t,
486                                 const char *);
487 /*
488  *      const char *host;               -- hostname
489  *      const rpcprog_t prog;           -- program number
490  *      rpcvers_t *vers_out;            -- servers highest available version
491  *      const rpcvers_t vers_low;       -- low version number
492  *      const rpcvers_t vers_high;      -- high version number
493  *      const char *nettype;            -- network type
494  */
495 
496 /*
497  * Generic client creation routine. Supported protocols are which belong
498  * to the nettype name space.
499  */
500 extern CLIENT * clnt_create_vers_timed(const char *, const rpcprog_t,
501         rpcvers_t *, const rpcvers_t, const rpcvers_t, const char *,
502         const struct timeval *);
503 /*
504  *      const char *host;               -- hostname
505  *      const rpcprog_t prog;           -- program number
506  *      rpcvers_t *vers_out;            -- servers highest available version
507  *      const rpcvers_t vers_low;       -- low version number
508  *      const rpcvers_t vers_high;      -- high version number
509  *      const char *nettype;            -- network type
510  *      const struct timeval *tp        -- timeout
511  */
512 
513 /*
514  * Generic client creation routine. It takes a netconfig structure
515  * instead of nettype
516  */
517 extern CLIENT *clnt_tp_create(const char *, const rpcprog_t,
518                               const rpcvers_t, const struct netconfig *);
519 /*
520  *      const char *hostname;                   -- hostname
521  *      const rpcprog_t prog;                   -- program number
522  *      const rpcvers_t vers;                   -- version number
523  *      const struct netconfig *netconf;        -- network config structure
524  */
525 
526 /*
527  * Generic client creation routine. Just like clnt_tp_create(), except
528  * it takes an additional timeout parameter.
529  */
530 extern CLIENT * clnt_tp_create_timed(const char *, const rpcprog_t,
531         const rpcvers_t, const struct netconfig *, const struct timeval *);
532 /*
533  *      const char *hostname;                   -- hostname
534  *      const rpcprog_t prog;                   -- program number
535  *      const rpcvers_t vers;                   -- version number
536  *      const struct netconfig *netconf;        -- network config structure
537  *      const struct timeval *tp                -- timeout
538  */
539 
540 /*
541  * Generic TLI create routine. Only provided for compatibility.
542  */
543 
544 extern CLIENT *clnt_tli_create(const int, const struct netconfig *,
545                                struct netbuf *, const rpcprog_t,
546                                const rpcvers_t, const u_int, const u_int);
547 /*
548  *      const register int fd;          -- fd
549  *      const struct netconfig *nconf;  -- netconfig structure
550  *      struct netbuf *svcaddr;         -- servers address
551  *      const u_long prog;                      -- program number
552  *      const u_long vers;                      -- version number
553  *      const u_int sendsz;                     -- send size
554  *      const u_int recvsz;                     -- recv size
555  */
556 
557 /*
558  * Low level clnt create routine for connectionful transports, e.g. tcp.
559  */
560 extern CLIENT *clnt_vc_create(const int, const struct netbuf *,
561                               const rpcprog_t, const rpcvers_t,
562                               u_int, u_int);
563 /*
564  * Added for compatibility to old rpc 4.0. Obsoleted by clnt_vc_create().
565  */
566 extern CLIENT *clntunix_create(struct sockaddr_un *,
567                                u_long, u_long, int *, u_int, u_int);
568 /*
569  *      const int fd;                           -- open file descriptor
570  *      const struct netbuf *svcaddr;           -- servers address
571  *      const rpcprog_t prog;                   -- program number
572  *      const rpcvers_t vers;                   -- version number
573  *      const u_int sendsz;                     -- buffer recv size
574  *      const u_int recvsz;                     -- buffer send size
575  */
576 
577 /*
578  * Low level clnt create routine for connectionless transports, e.g. udp.
579  */
580 extern CLIENT *clnt_dg_create(const int, const struct netbuf *,
581                               const rpcprog_t, const rpcvers_t,
582                               const u_int, const u_int);
583 /*
584  *      const int fd;                           -- open file descriptor
585  *      const struct netbuf *svcaddr;           -- servers address
586  *      const rpcprog_t program;                -- program number
587  *      const rpcvers_t version;                -- version number
588  *      const u_int sendsz;                     -- buffer recv size
589  *      const u_int recvsz;                     -- buffer send size
590  */
591 
592 /*
593  * Memory based rpc (for speed check and testing)
594  * CLIENT *
595  * clnt_raw_create(prog, vers)
596  *      u_long prog;
597  *      u_long vers;
598  */
599 extern CLIENT *clnt_raw_create(rpcprog_t, rpcvers_t);
600 #endif
601 
602 __END_DECLS
603 
604 
605 /*
606  * Print why creation failed
607  */
608 __BEGIN_DECLS
609 extern void clnt_pcreateerror(const char *);                    /* stderr */
610 extern char *clnt_spcreateerror(const char *);                  /* string */
611 __END_DECLS
612 
613 /*
614  * Like clnt_perror(), but is more verbose in its output
615  */
616 __BEGIN_DECLS
617 extern void clnt_perrno(enum clnt_stat);                /* stderr */
618 extern char *clnt_sperrno(enum clnt_stat);              /* string */
619 __END_DECLS
620 
621 /*
622  * Print an English error message, given the client error code
623  */
624 __BEGIN_DECLS
625 extern void clnt_perror(CLIENT *, const char *);                /* stderr */
626 extern char *clnt_sperror(CLIENT *, const char *);              /* string */
627 __END_DECLS
628 
629 
630 /*
631  * If a creation fails, the following allows the user to figure out why.
632  */
633 struct rpc_createerr {
634         enum clnt_stat cf_stat;
635         struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
636 };
637 
638 #ifdef _KERNEL
639 extern struct rpc_createerr rpc_createerr;
640 #else
641 __BEGIN_DECLS
642 extern struct rpc_createerr     *__rpc_createerr(void);
643 __END_DECLS
644 #define rpc_createerr           (*(__rpc_createerr()))
645 #endif
646 
647 #ifndef _KERNEL
648 /*
649  * The simplified interface:
650  * enum clnt_stat
651  * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
652  *      const char *host;
653  *      const rpcprog_t prognum;
654  *      const rpcvers_t versnum;
655  *      const rpcproc_t procnum;
656  *      const xdrproc_t inproc, outproc;
657  *      const char *in;
658  *      char *out;
659  *      const char *nettype;
660  */
661 __BEGIN_DECLS
662 extern enum clnt_stat rpc_call(const char *, const rpcprog_t,
663                                const rpcvers_t, const rpcproc_t,
664                                const xdrproc_t, const char *,
665                                const xdrproc_t, char *, const char *);
666 __END_DECLS
667 
668 /*
669  * RPC broadcast interface
670  * The call is broadcasted to all locally connected nets.
671  *
672  * extern enum clnt_stat
673  * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
674  *                      eachresult, nettype)
675  *      const rpcprog_t         prog;           -- program number
676  *      const rpcvers_t         vers;           -- version number
677  *      const rpcproc_t         proc;           -- procedure number
678  *      const xdrproc_t xargs;          -- xdr routine for args
679  *      caddr_t         argsp;          -- pointer to args
680  *      const xdrproc_t xresults;       -- xdr routine for results
681  *      caddr_t         resultsp;       -- pointer to results
682  *      const resultproc_t      eachresult;     -- call with each result
683  *      const char              *nettype;       -- Transport type
684  *
685  * For each valid response received, the procedure eachresult is called.
686  * Its form is:
687  *              done = eachresult(resp, raddr, nconf)
688  *                      bool_t done;
689  *                      caddr_t resp;
690  *                      struct netbuf *raddr;
691  *                      struct netconfig *nconf;
692  * where resp points to the results of the call and raddr is the
693  * address if the responder to the broadcast.  nconf is the transport
694  * on which the response was received.
695  *
696  * extern enum clnt_stat
697  * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
698  *                      eachresult, inittime, waittime, nettype)
699  *      const rpcprog_t         prog;           -- program number
700  *      const rpcvers_t         vers;           -- version number
701  *      const rpcproc_t         proc;           -- procedure number
702  *      const xdrproc_t xargs;          -- xdr routine for args
703  *      caddr_t         argsp;          -- pointer to args
704  *      const xdrproc_t xresults;       -- xdr routine for results
705  *      caddr_t         resultsp;       -- pointer to results
706  *      const resultproc_t      eachresult;     -- call with each result
707  *      const int               inittime;       -- how long to wait initially
708  *      const int               waittime;       -- maximum time to wait
709  *      const char              *nettype;       -- Transport type
710  */
711 
712 typedef bool_t (*resultproc_t)(caddr_t, ...);
713 
714 __BEGIN_DECLS
715 extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t,
716                                     const rpcproc_t, const xdrproc_t,
717                                     caddr_t, const xdrproc_t, caddr_t,
718                                     const resultproc_t, const char *);
719 extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t,
720                                         const rpcproc_t, const xdrproc_t,
721                                         caddr_t, const xdrproc_t, caddr_t,
722                                         const resultproc_t, const int,
723                                         const int, const char *);
724 __END_DECLS
725 
726 /* For backward compatibility */
727 #include <rpc/clnt_soc.h>
728 #endif
729 
730 #endif /* !_RPC_CLNT_H_ */
731 

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.