The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

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

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: 167bd1aedba0e015b4509a33b2b45da5


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


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