1 .\" @(#)rpc_clnt_calls.3n 1.30 93/08/31 SMI; from SVr4
2 .\" Copyright 1989 AT&T
3 .\" @(#)rpc_clnt_calls 1.4 89/07/20 SMI;
4 .\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
5 .\" $FreeBSD: src/lib/libc/rpc/rpc_clnt_calls.3,v 1.7 2002/12/19 09:40:23 ru Exp $
19 .Nm rpc_broadcast_exp ,
21 .Nd library routines for client side calls
25 .Fn clnt_call "CLIENT *clnt" "const rpcproc_t procnum" "const xdrproc_t inproc" "const caddr_t in" "const xdrproc_t outproc" "caddr_t out" "const struct timeval tout"
27 .Fn clnt_freeres "CLIENT *clnt" "const xdrproc_t outproc" "caddr_t out"
29 .Fn clnt_geterr "const CLIENT * clnt" "struct rpc_err * errp"
31 .Fn clnt_perrno "const enum clnt_stat stat"
33 .Fn clnt_perror "CLIENT *clnt" "const char *s"
35 .Fn clnt_sperrno "const enum clnt_stat stat"
37 .Fn clnt_sperror "CLIENT *clnt" "const char * s"
40 .Fa "const rpcprog_t prognum" "const rpcvers_t versnum"
41 .Fa "const rpcproc_t procnum" "const xdrproc_t inproc"
42 .Fa "const caddr_t in" "const xdrproc_t outproc" "caddr_t out"
43 .Fa "const resultproc_t eachresult" "const char *nettype"
47 .Fa "const rpcprog_t prognum" "const rpcvers_t versnum"
48 .Fa "const rpcproc_t procnum" "const xdrproc_t xargs"
49 .Fa "caddr_t argsp" "const xdrproc_t xresults"
50 .Fa "caddr_t resultsp" "const resultproc_t eachresult"
51 .Fa "const int inittime" "const int waittime"
52 .Fa "const char * nettype"
56 .Fa "const char *host" "const rpcprog_t prognum"
57 .Fa "const rpcvers_t versnum" "const rpcproc_t procnum"
58 .Fa "const xdrproc_t inproc" "const char *in"
59 .Fa "const xdrproc_t outproc" "char *out" "const char *nettype"
62 RPC library routines allow C language programs to make procedure
63 calls on other machines across the network.
64 First, the client calls a procedure to send a request to the server.
65 Upon receipt of the request, the server calls a dispatch routine
66 to perform the requested service, and then sends back a reply.
73 routines handle the client side of the procedure call.
74 The remaining routines deal with error handling in the case of errors.
76 Some of the routines take a
78 handle as one of the arguments.
81 handle can be created by an RPC creation routine such as
84 .Xr rpc_clnt_create 3 ) .
86 These routines are safe for use in multithreaded applications.
88 handles can be shared between threads, however in this implementation
89 requests by different threads are serialized (that is, the first request will
90 receive its results before the second request is sent).
94 for the definition of the
99 A function macro that calls the remote procedure
101 associated with the client handle,
103 which is obtained with an RPC
104 client creation routine such as
107 .Xr rpc_clnt_create 3 ) .
111 is the XDR function used to encode the procedure's arguments, and
113 is the XDR function used to decode the procedure's results;
115 is the address of the procedure's argument(s), and
117 is the address of where to place the result(s).
121 is the time allowed for results to be returned, which is overridden by
122 a time-out set explicitly through
125 .Xr rpc_clnt_create 3 .
126 If the remote call succeeds, the status returned is
128 otherwise an appropriate status is returned.
130 A function macro that frees any data allocated by the
131 RPC/XDR system when it decoded the results of an RPC call.
135 is the address of the results, and
137 is the XDR routine describing the results.
138 This routine returns 1 if the results were successfully freed,
141 A function macro that copies the error structure out of the client
142 handle to the structure at address
145 Print a message to standard error corresponding
146 to the condition indicated by
148 A newline is appended.
149 Normally used after a procedure call fails for a routine
150 for which a client handle is not needed, for instance
153 Print a message to the standard error indicating why an
156 is the handle used to do the call.
157 The message is prepended with string
160 A newline is appended.
161 Normally used after a remote procedure call fails
162 for a routine which requires a client handle,
166 Take the same arguments as
168 but instead of sending a message to the standard error
169 indicating why an RPC
170 call failed, return a pointer to a string which contains the message.
174 is normally used instead of
176 when the program does not have a standard error (as a program
177 running as a server quite likely does not), or if the programmer
178 does not want the message to be output with
182 or if a message format different than that supported by
189 .Fn clnt_spcreateerror
191 .Xr rpc_clnt_create 3 ) ,
193 does not return pointer to static data so the
194 result will not get overwritten on each call.
200 it returns a string instead of printing to standard error.
203 does not append a newline at the end of the message.
205 returns pointer to a buffer that is overwritten
210 except the call message is broadcast to
211 all the connectionless transports specified by
219 Each time it receives a response,
224 .Fn eachresult "caddr_t out" "const struct netbuf * addr" "const struct netconfig * netconf"
231 except that the remote procedure's output is decoded there;
233 points to the address of the machine that sent the results, and
235 is the netconfig structure of the transport on which the remote
241 waits for more replies;
242 otherwise it returns with appropriate status.
244 broadcast file descriptors are limited in size to the
245 maximum transfer size of that transport.
246 For Ethernet, this value is 1500 bytes.
252 credentials by default (see
253 .Xr rpc_clnt_auth 3 ) .
254 .It Fn rpc_broadcast_exp
257 except that the initial timeout,
259 and the maximum timeout,
261 are specified in milliseconds.
265 is the initial time that
266 .Fn rpc_broadcast_exp
267 waits before resending the request.
268 After the first resend, the re-transmission interval
269 increases exponentially until it exceeds
272 Call the remote procedure associated with
282 is used to encode the procedure's arguments, and
284 is used to decode the procedure's results;
286 is the address of the procedure's argument(s), and
288 is the address of where to place the result(s).
292 can be any of the values listed on
297 or an appropriate status is returned.
300 routine to translate failure status into error messages.
303 uses the first available transport belonging
306 on which it can create a connection.
307 You do not have control of timeouts or authentication
311 These functions are part of libtirpc.
315 .Xr rpc_clnt_auth 3 ,
316 .Xr rpc_clnt_create 3