linux/include/linux/sunrpc/clnt.h
<<
>>
Prefs
   1/*
   2 *  linux/include/linux/sunrpc/clnt.h
   3 *
   4 *  Declarations for the high-level RPC client interface
   5 *
   6 *  Copyright (C) 1995, 1996, Olaf Kirch <okir@monad.swb.de>
   7 */
   8
   9#ifndef _LINUX_SUNRPC_CLNT_H
  10#define _LINUX_SUNRPC_CLNT_H
  11
  12#include <linux/sunrpc/msg_prot.h>
  13#include <linux/sunrpc/sched.h>
  14#include <linux/sunrpc/xprt.h>
  15#include <linux/sunrpc/auth.h>
  16#include <linux/sunrpc/stats.h>
  17#include <linux/sunrpc/xdr.h>
  18#include <linux/sunrpc/timer.h>
  19#include <asm/signal.h>
  20
  21struct rpc_inode;
  22
  23/*
  24 * The high-level client handle
  25 */
  26struct rpc_clnt {
  27        struct kref             cl_kref;        /* Number of references */
  28        struct list_head        cl_clients;     /* Global list of clients */
  29        struct list_head        cl_tasks;       /* List of tasks */
  30        spinlock_t              cl_lock;        /* spinlock */
  31        struct rpc_xprt *       cl_xprt;        /* transport */
  32        struct rpc_procinfo *   cl_procinfo;    /* procedure info */
  33        u32                     cl_prog,        /* RPC program number */
  34                                cl_vers,        /* RPC version number */
  35                                cl_maxproc;     /* max procedure number */
  36
  37        char *                  cl_server;      /* server machine name */
  38        char *                  cl_protname;    /* protocol name */
  39        struct rpc_auth *       cl_auth;        /* authenticator */
  40        struct rpc_stat *       cl_stats;       /* per-program statistics */
  41        struct rpc_iostats *    cl_metrics;     /* per-client statistics */
  42
  43        unsigned int            cl_softrtry : 1,/* soft timeouts */
  44                                cl_discrtry : 1,/* disconnect before retry */
  45                                cl_autobind : 1,/* use getport() */
  46                                cl_chatty   : 1;/* be verbose */
  47
  48        struct rpc_rtt *        cl_rtt;         /* RTO estimator data */
  49        const struct rpc_timeout *cl_timeout;   /* Timeout strategy */
  50
  51        int                     cl_nodelen;     /* nodename length */
  52        char                    cl_nodename[UNX_MAXNODENAME];
  53        char                    cl_pathname[30];/* Path in rpc_pipe_fs */
  54        struct vfsmount *       cl_vfsmnt;
  55        struct dentry *         cl_dentry;      /* inode */
  56        struct rpc_clnt *       cl_parent;      /* Points to parent of clones */
  57        struct rpc_rtt          cl_rtt_default;
  58        struct rpc_timeout      cl_timeout_default;
  59        struct rpc_program *    cl_program;
  60        char                    cl_inline_name[32];
  61        char                    *cl_principal;  /* target to authenticate to */
  62};
  63
  64/*
  65 * General RPC program info
  66 */
  67#define RPC_MAXVERSION          4
  68struct rpc_program {
  69        char *                  name;           /* protocol name */
  70        u32                     number;         /* program number */
  71        unsigned int            nrvers;         /* number of versions */
  72        struct rpc_version **   version;        /* version array */
  73        struct rpc_stat *       stats;          /* statistics */
  74        char *                  pipe_dir_name;  /* path to rpc_pipefs dir */
  75};
  76
  77struct rpc_version {
  78        u32                     number;         /* version number */
  79        unsigned int            nrprocs;        /* number of procs */
  80        struct rpc_procinfo *   procs;          /* procedure array */
  81};
  82
  83/*
  84 * Procedure information
  85 */
  86struct rpc_procinfo {
  87        u32                     p_proc;         /* RPC procedure number */
  88        kxdrproc_t              p_encode;       /* XDR encode function */
  89        kxdrproc_t              p_decode;       /* XDR decode function */
  90        unsigned int            p_arglen;       /* argument hdr length (u32) */
  91        unsigned int            p_replen;       /* reply hdr length (u32) */
  92        unsigned int            p_count;        /* call count */
  93        unsigned int            p_timer;        /* Which RTT timer to use */
  94        u32                     p_statidx;      /* Which procedure to account */
  95        char *                  p_name;         /* name of procedure */
  96};
  97
  98#ifdef __KERNEL__
  99
 100struct rpc_create_args {
 101        int                     protocol;
 102        struct sockaddr         *address;
 103        size_t                  addrsize;
 104        struct sockaddr         *saddress;
 105        const struct rpc_timeout *timeout;
 106        char                    *servername;
 107        struct rpc_program      *program;
 108        u32                     prognumber;     /* overrides program->number */
 109        u32                     version;
 110        rpc_authflavor_t        authflavor;
 111        unsigned long           flags;
 112        char                    *client_name;
 113};
 114
 115/* Values for "flags" field */
 116#define RPC_CLNT_CREATE_HARDRTRY        (1UL << 0)
 117#define RPC_CLNT_CREATE_AUTOBIND        (1UL << 2)
 118#define RPC_CLNT_CREATE_NONPRIVPORT     (1UL << 3)
 119#define RPC_CLNT_CREATE_NOPING          (1UL << 4)
 120#define RPC_CLNT_CREATE_DISCRTRY        (1UL << 5)
 121#define RPC_CLNT_CREATE_QUIET           (1UL << 6)
 122
 123struct rpc_clnt *rpc_create(struct rpc_create_args *args);
 124struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
 125                                struct rpc_program *, u32);
 126struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
 127void            rpc_shutdown_client(struct rpc_clnt *);
 128void            rpc_release_client(struct rpc_clnt *);
 129
 130int             rpcb_register(u32, u32, int, unsigned short);
 131int             rpcb_v4_register(const u32 program, const u32 version,
 132                                 const struct sockaddr *address,
 133                                 const char *netid);
 134int             rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
 135void            rpcb_getport_async(struct rpc_task *);
 136
 137void            rpc_call_start(struct rpc_task *);
 138int             rpc_call_async(struct rpc_clnt *clnt,
 139                               const struct rpc_message *msg, int flags,
 140                               const struct rpc_call_ops *tk_ops,
 141                               void *calldata);
 142int             rpc_call_sync(struct rpc_clnt *clnt,
 143                              const struct rpc_message *msg, int flags);
 144struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
 145                               int flags);
 146void            rpc_restart_call_prepare(struct rpc_task *);
 147void            rpc_restart_call(struct rpc_task *);
 148void            rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
 149size_t          rpc_max_payload(struct rpc_clnt *);
 150void            rpc_force_rebind(struct rpc_clnt *);
 151size_t          rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
 152const char      *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
 153
 154#endif /* __KERNEL__ */
 155#endif /* _LINUX_SUNRPC_CLNT_H */
 156
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.