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 atomic_t cl_count; /* Number of clones */ 28 atomic_t cl_users; /* number of references */ 29 struct rpc_xprt * cl_xprt; /* transport */ 30 struct rpc_procinfo * cl_procinfo; /* procedure info */ 31 u32 cl_prog, /* RPC program number */ 32 cl_vers, /* RPC version number */ 33 cl_maxproc; /* max procedure number */ 34 35 char * cl_server; /* server machine name */ 36 char * cl_protname; /* protocol name */ 37 struct rpc_auth * cl_auth; /* authenticator */ 38 struct rpc_stat * cl_stats; /* per-program statistics */ 39 struct rpc_iostats * cl_metrics; /* per-client statistics */ 40 41 unsigned int cl_softrtry : 1,/* soft timeouts */ 42 cl_intr : 1,/* interruptible */ 43 cl_discrtry : 1,/* disconnect before retry */ 44 cl_autobind : 1,/* use getport() */ 45 cl_oneshot : 1,/* dispose after use */ 46 cl_dead : 1;/* abandoned */ 47 48 struct rpc_rtt * cl_rtt; /* RTO estimator data */ 49 50 int cl_nodelen; /* nodename length */ 51 char cl_nodename[UNX_MAXNODENAME]; 52 char cl_pathname[30];/* Path in rpc_pipe_fs */ 53 struct vfsmount * cl_vfsmnt; 54 struct dentry * cl_dentry; /* inode */ 55 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 56 struct rpc_rtt cl_rtt_default; 57 struct rpc_program * cl_program; 58 char cl_inline_name[32]; 59}; 60 61/* 62 * General RPC program info 63 */ 64#define RPC_MAXVERSION 4 65struct rpc_program { 66 char * name; /* protocol name */ 67 u32 number; /* program number */ 68 unsigned int nrvers; /* number of versions */ 69 struct rpc_version ** version; /* version array */ 70 struct rpc_stat * stats; /* statistics */ 71 char * pipe_dir_name; /* path to rpc_pipefs dir */ 72}; 73 74struct rpc_version { 75 u32 number; /* version number */ 76 unsigned int nrprocs; /* number of procs */ 77 struct rpc_procinfo * procs; /* procedure array */ 78}; 79 80/* 81 * Procedure information 82 */ 83struct rpc_procinfo { 84 u32 p_proc; /* RPC procedure number */ 85 kxdrproc_t p_encode; /* XDR encode function */ 86 kxdrproc_t p_decode; /* XDR decode function */ 87 unsigned int p_arglen; /* argument hdr length (u32) */ 88 unsigned int p_replen; /* reply hdr length (u32) */ 89 unsigned int p_count; /* call count */ 90 unsigned int p_timer; /* Which RTT timer to use */ 91 u32 p_statidx; /* Which procedure to account */ 92 char * p_name; /* name of procedure */ 93}; 94 95#ifdef __KERNEL__ 96 97struct rpc_create_args { 98 int protocol; 99 struct sockaddr *address; 100 size_t addrsize; 101 struct rpc_timeout *timeout; 102 char *servername; 103 struct rpc_program *program; 104 u32 version; 105 rpc_authflavor_t authflavor; 106 unsigned long flags; 107}; 108 109/* Values for "flags" field */ 110#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0) 111#define RPC_CLNT_CREATE_INTR (1UL << 1) 112#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2) 113#define RPC_CLNT_CREATE_ONESHOT (1UL << 3) 114#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4) 115#define RPC_CLNT_CREATE_NOPING (1UL << 5) 116#define RPC_CLNT_CREATE_DISCRTRY (1UL << 6) 117 118struct rpc_clnt *rpc_create(struct rpc_create_args *args); 119struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 120 struct rpc_program *, int); 121struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 122int rpc_shutdown_client(struct rpc_clnt *); 123int rpc_destroy_client(struct rpc_clnt *); 124void rpc_release_client(struct rpc_clnt *); 125int rpcb_register(u32, u32, int, unsigned short, int *); 126void rpcb_getport(struct rpc_task *); 127 128void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 129 130int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 131 int flags, const struct rpc_call_ops *tk_ops, 132 void *calldata); 133int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, 134 int flags); 135void rpc_restart_call(struct rpc_task *); 136void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset); 137void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset); 138void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 139size_t rpc_max_payload(struct rpc_clnt *); 140void rpc_force_rebind(struct rpc_clnt *); 141int rpc_ping(struct rpc_clnt *clnt, int flags); 142size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 143char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 144 145/* 146 * Helper function for NFSroot support 147 */ 148int rpcb_getport_external(struct sockaddr_in *, __u32, __u32, int); 149 150#endif /* __KERNEL__ */ 151#endif /* _LINUX_SUNRPC_CLNT_H */ 152