2 * linux/include/linux/sunrpc/clnt.h
4 * Declarations for the high-level RPC client interface
6 * Copyright (C) 1995, 1996, Olaf Kirch <okir@monad.swb.de>
9 #ifndef _LINUX_SUNRPC_CLNT_H
10 #define _LINUX_SUNRPC_CLNT_H
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>
24 * The high-level client handle
27 atomic_t cl_count; /* Number of clones */
28 atomic_t cl_users; /* number of references */
29 struct list_head cl_clients; /* Global list of clients */
30 struct list_head cl_tasks; /* List of tasks */
31 spinlock_t cl_lock; /* spinlock */
32 struct rpc_xprt * cl_xprt; /* transport */
33 struct rpc_procinfo * cl_procinfo; /* procedure info */
34 u32 cl_prog, /* RPC program number */
35 cl_vers, /* RPC version number */
36 cl_maxproc; /* max procedure number */
38 char * cl_server; /* server machine name */
39 char * cl_protname; /* protocol name */
40 struct rpc_auth * cl_auth; /* authenticator */
41 struct rpc_stat * cl_stats; /* per-program statistics */
42 struct rpc_iostats * cl_metrics; /* per-client statistics */
44 unsigned int cl_softrtry : 1,/* soft timeouts */
45 cl_intr : 1,/* interruptible */
46 cl_discrtry : 1,/* disconnect before retry */
47 cl_autobind : 1,/* use getport() */
48 cl_oneshot : 1,/* dispose after use */
49 cl_dead : 1;/* abandoned */
51 struct rpc_rtt * cl_rtt; /* RTO estimator data */
53 int cl_nodelen; /* nodename length */
54 char cl_nodename[UNX_MAXNODENAME];
55 char cl_pathname[30];/* Path in rpc_pipe_fs */
56 struct vfsmount * cl_vfsmnt;
57 struct dentry * cl_dentry; /* inode */
58 struct rpc_clnt * cl_parent; /* Points to parent of clones */
59 struct rpc_rtt cl_rtt_default;
60 struct rpc_program * cl_program;
61 char cl_inline_name[32];
65 * General RPC program info
67 #define RPC_MAXVERSION 4
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 */
78 u32 number; /* version number */
79 unsigned int nrprocs; /* number of procs */
80 struct rpc_procinfo * procs; /* procedure array */
84 * Procedure information
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 */
100 struct rpc_create_args {
102 struct sockaddr *address;
104 struct rpc_timeout *timeout;
106 struct rpc_program *program;
108 rpc_authflavor_t authflavor;
112 /* Values for "flags" field */
113 #define RPC_CLNT_CREATE_HARDRTRY (1UL << 0)
114 #define RPC_CLNT_CREATE_INTR (1UL << 1)
115 #define RPC_CLNT_CREATE_AUTOBIND (1UL << 2)
116 #define RPC_CLNT_CREATE_ONESHOT (1UL << 3)
117 #define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4)
118 #define RPC_CLNT_CREATE_NOPING (1UL << 5)
119 #define RPC_CLNT_CREATE_DISCRTRY (1UL << 6)
121 struct rpc_clnt *rpc_create(struct rpc_create_args *args);
122 struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
123 struct rpc_program *, int);
124 struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
125 int rpc_shutdown_client(struct rpc_clnt *);
126 int rpc_destroy_client(struct rpc_clnt *);
127 void rpc_release_client(struct rpc_clnt *);
128 void rpc_register_client(struct rpc_clnt *);
129 void rpc_unregister_client(struct rpc_clnt *);
130 int rpcb_register(u32, u32, int, unsigned short, int *);
131 void rpcb_getport(struct rpc_task *);
133 void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
135 int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
136 int flags, const struct rpc_call_ops *tk_ops,
138 int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
140 void rpc_restart_call(struct rpc_task *);
141 void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset);
142 void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset);
143 void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
144 size_t rpc_max_payload(struct rpc_clnt *);
145 void rpc_force_rebind(struct rpc_clnt *);
146 int rpc_ping(struct rpc_clnt *clnt, int flags);
147 size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
148 char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
151 * Helper function for NFSroot support
153 int rpcb_getport_external(struct sockaddr_in *, __u32, __u32, int);
155 #endif /* __KERNEL__ */
156 #endif /* _LINUX_SUNRPC_CLNT_H */