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>
20 * This defines an RPC port mapping
30 * The high-level client handle
33 unsigned int cl_users
; /* number of references */
34 struct rpc_xprt
* cl_xprt
; /* transport */
35 struct rpc_procinfo
* cl_procinfo
; /* procedure info */
36 u32 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
; /* statistics */
43 unsigned int cl_softrtry
: 1,/* soft timeouts */
44 cl_intr
: 1,/* interruptible */
45 cl_chatty
: 1,/* be verbose */
46 cl_autobind
: 1,/* use getport() */
47 cl_binding
: 1,/* doing a getport() */
48 cl_oneshot
: 1,/* dispose after use */
49 cl_dead
: 1;/* abandoned */
50 unsigned int cl_flags
; /* misc client flags */
51 unsigned long cl_hardmax
; /* max hard timeout */
53 struct rpc_portmap cl_pmap
; /* port mapping */
54 struct rpc_wait_queue cl_bindwait
; /* waiting on getport() */
56 #define cl_timeout cl_xprt->timeout
57 #define cl_prog cl_pmap.pm_prog
58 #define cl_vers cl_pmap.pm_vers
59 #define cl_port cl_pmap.pm_port
60 #define cl_prot cl_pmap.pm_prot
63 * General RPC program info
65 #define RPC_MAXVERSION 4
67 char * name
; /* protocol name */
68 u32 number
; /* program number */
69 unsigned int nrvers
; /* number of versions */
70 struct rpc_version
** version
; /* version array */
71 struct rpc_stat
* stats
; /* statistics */
75 u32 number
; /* version number */
76 unsigned int nrprocs
; /* number of procs */
77 struct rpc_procinfo
* procs
; /* procedure array */
81 * Procedure information
84 char * p_procname
; /* procedure name */
85 kxdrproc_t p_encode
; /* XDR encode function */
86 kxdrproc_t p_decode
; /* XDR decode function */
87 unsigned int p_bufsiz
; /* req. buffer size */
88 unsigned int p_count
; /* call count */
91 #define rpcproc_bufsiz(clnt, proc) ((clnt)->cl_procinfo[proc].p_bufsiz)
92 #define rpcproc_encode(clnt, proc) ((clnt)->cl_procinfo[proc].p_encode)
93 #define rpcproc_decode(clnt, proc) ((clnt)->cl_procinfo[proc].p_decode)
94 #define rpcproc_name(clnt, proc) ((clnt)->cl_procinfo[proc].p_procname)
95 #define rpcproc_count(clnt, proc) ((clnt)->cl_procinfo[proc].p_count)
97 #define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
98 #define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr)
102 struct rpc_clnt
*rpc_create_client(struct rpc_xprt
*xprt
, char *servname
,
103 struct rpc_program
*info
,
104 u32 version
, int authflavor
);
105 int rpc_shutdown_client(struct rpc_clnt
*);
106 int rpc_destroy_client(struct rpc_clnt
*);
107 void rpc_release_client(struct rpc_clnt
*);
108 void rpc_getport(struct rpc_task
*, struct rpc_clnt
*);
109 int rpc_register(u32
, u32
, int, unsigned short, int *);
111 int rpc_call(struct rpc_clnt
*clnt
, u32 proc
,
112 void *argp
, void *resp
, int flags
);
113 int rpc_call_async(struct rpc_task
*task
, u32 proc
,
114 void *argp
, void *resp
, int flags
);
115 void rpc_call_setup(struct rpc_task
*task
, u32 proc
,
116 void *argp
, void *resp
, int flags
);
117 int rpc_do_call(struct rpc_clnt
*clnt
, u32 proc
,
118 void *argp
, void *resp
, int flags
,
119 rpc_action callback
, void *clntdata
);
120 void rpc_restart_call(struct rpc_task
*);
121 #define rpc_call(clnt, proc, argp, resp, flags) \
122 rpc_do_call(clnt, proc, argp, resp, flags, NULL, NULL)
124 extern __inline__
void
125 rpc_set_timeout(struct rpc_clnt
*clnt
, unsigned int retr
, unsigned long incr
)
127 xprt_set_timeout(&clnt
->cl_timeout
, retr
, incr
);
130 extern void rpciod_tcp_dispatcher(void);
131 extern void rpciod_wake_up(void);
134 * Helper function for NFSroot support
136 int rpc_getport_external(struct sockaddr_in
*, __u32
, __u32
, int);
138 #endif /* __KERNEL__ */
139 #endif /* _LINUX_SUNRPC_CLNT_H */