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.8 2005/02/09 18:03:14 ru Exp $
19 .Nm rpc_broadcast_exp ,
21 .Nd library routines for client side calls
27 .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"
29 .Fn clnt_freeres "CLIENT *clnt" "const xdrproc_t outproc" "caddr_t out"
31 .Fn clnt_geterr "const CLIENT * clnt" "struct rpc_err * errp"
33 .Fn clnt_perrno "const enum clnt_stat stat"
35 .Fn clnt_perror "CLIENT *clnt" "const char *s"
37 .Fn clnt_sperrno "const enum clnt_stat stat"
39 .Fn clnt_sperror "CLIENT *clnt" "const char * s"
42 .Fa "const rpcprog_t prognum" "const rpcvers_t versnum"
43 .Fa "const rpcproc_t procnum" "const xdrproc_t inproc"
44 .Fa "const caddr_t in" "const xdrproc_t outproc" "caddr_t out"
45 .Fa "const resultproc_t eachresult" "const char *nettype"
49 .Fa "const rpcprog_t prognum" "const rpcvers_t versnum"
50 .Fa "const rpcproc_t procnum" "const xdrproc_t xargs"
51 .Fa "caddr_t argsp" "const xdrproc_t xresults"
52 .Fa "caddr_t resultsp" "const resultproc_t eachresult"
53 .Fa "const int inittime" "const int waittime"
54 .Fa "const char * nettype"
58 .Fa "const char *host" "const rpcprog_t prognum"
59 .Fa "const rpcvers_t versnum" "const rpcproc_t procnum"
60 .Fa "const xdrproc_t inproc" "const char *in"
61 .Fa "const xdrproc_t outproc" "char *out" "const char *nettype"
64 RPC library routines allow C language programs to make procedure
65 calls on other machines across the network.
66 First, the client calls a procedure to send a request to the server.
67 Upon receipt of the request, the server calls a dispatch routine
68 to perform the requested service, and then sends back a reply.
75 routines handle the client side of the procedure call.
76 The remaining routines deal with error handling in the case of errors.
78 Some of the routines take a
80 handle as one of the arguments.
83 handle can be created by an RPC creation routine such as
86 .Xr rpc_clnt_create 3 ) .
88 These routines are safe for use in multithreaded applications.
90 handles can be shared between threads, however in this implementation
91 requests by different threads are serialized (that is, the first request will
92 receive its results before the second request is sent).
96 for the definition of the
101 A function macro that calls the remote procedure
103 associated with the client handle,
105 which is obtained with an RPC
106 client creation routine such as
109 .Xr rpc_clnt_create 3 ) .
113 is the XDR function used to encode the procedure's arguments, and
115 is the XDR function used to decode the procedure's results;
117 is the address of the procedure's argument(s), and
119 is the address of where to place the result(s).
123 is the time allowed for results to be returned, which is overridden by
124 a time-out set explicitly through
127 .Xr rpc_clnt_create 3 .
128 If the remote call succeeds, the status returned is
130 otherwise an appropriate status is returned.
132 A function macro that frees any data allocated by the
133 RPC/XDR system when it decoded the results of an RPC call.
137 is the address of the results, and
139 is the XDR routine describing the results.
140 This routine returns 1 if the results were successfully freed,
143 A function macro that copies the error structure out of the client
144 handle to the structure at address
147 Print a message to standard error corresponding
148 to the condition indicated by
150 A newline is appended.
151 Normally used after a procedure call fails for a routine
152 for which a client handle is not needed, for instance
155 Print a message to the standard error indicating why an
158 is the handle used to do the call.
159 The message is prepended with string
162 A newline is appended.
163 Normally used after a remote procedure call fails
164 for a routine which requires a client handle,
168 Take the same arguments as
170 but instead of sending a message to the standard error
171 indicating why an RPC
172 call failed, return a pointer to a string which contains the message.
176 is normally used instead of
178 when the program does not have a standard error (as a program
179 running as a server quite likely does not), or if the programmer
180 does not want the message to be output with
184 or if a message format different than that supported by
191 .Fn clnt_spcreateerror
193 .Xr rpc_clnt_create 3 ) ,
195 does not return pointer to static data so the
196 result will not get overwritten on each call.
202 it returns a string instead of printing to standard error.
205 does not append a newline at the end of the message.
207 returns pointer to a buffer that is overwritten
212 except the call message is broadcast to
213 all the connectionless transports specified by
221 Each time it receives a response,
226 .Fn eachresult "caddr_t out" "const struct netbuf * addr" "const struct netconfig * netconf"
233 except that the remote procedure's output is decoded there;
235 points to the address of the machine that sent the results, and
237 is the netconfig structure of the transport on which the remote
243 waits for more replies;
244 otherwise it returns with appropriate status.
246 broadcast file descriptors are limited in size to the
247 maximum transfer size of that transport.
248 For Ethernet, this value is 1500 bytes.
254 credentials by default (see
255 .Xr rpc_clnt_auth 3 ) .
256 .It Fn rpc_broadcast_exp
259 except that the initial timeout,
261 and the maximum timeout,
263 are specified in milliseconds.
267 is the initial time that
268 .Fn rpc_broadcast_exp
269 waits before resending the request.
270 After the first resend, the re-transmission interval
271 increases exponentially until it exceeds
274 Call the remote procedure associated with
284 is used to encode the procedure's arguments, and
286 is used to decode the procedure's results;
288 is the address of the procedure's argument(s), and
290 is the address of where to place the result(s).
294 can be any of the values listed on
299 or an appropriate status is returned.
302 routine to translate failure status into error messages.
305 uses the first available transport belonging
308 on which it can create a connection.
309 You do not have control of timeouts or authentication
315 .Xr rpc_clnt_auth 3 ,
316 .Xr rpc_clnt_create 3