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 .\" $NetBSD: rpc_clnt_calls.3,v 1.7 2005/12/03 15:16:19 yamt 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 char *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 "const CLIENT * clnt" "const char *s"
37 .Fn clnt_sperrno "const enum clnt_stat stat"
39 .Fn clnt_sperror "const CLIENT *clnt" "const char * s"
40 .\" Note the clustered Fn arguments. It can't take more than 9. XXX
42 .Fn rpc_broadcast "const rpcprog_t prognum, const rpcvers_t versnum" "const rpcproc_t procnum" "const xdrproc_t inproc" "const char *in" "const xdrproc_t outproc" "caddr_t out" "const resultproc_t eachresult" "const char *nettype"
44 .Fn rpc_broadcast_exp "rpcprog_t prognum, const rpcvers_t versnum" "const rpcproc_t procnum, const xdrproc_t xargs" "caddr_t argsp, const xdrproc_t xresults" "caddr_t resultsp" "const int inittime" "const int waittime" "const resultproc_t eachresult" "const char * nettype"
46 .Fn rpc_call "const char *host, const rpcprog_t prognum" "const rpcvers_t versnum" "const rpcproc_t procnum, const xdrproc_t inproc" "const char *in" "const xdrproc_t outproc" "char *out" "const char *nettype"
48 RPC library routines allow C language programs to make procedure
49 calls on other machines across the network.
50 First, the client calls a procedure to send a request to the server.
51 Upon receipt of the request, the server calls a dispatch routine
52 to perform the requested service, and then sends back a reply.
59 routines handle the client side of the procedure call.
60 The remaining routines deal with error handling in the case of errors.
62 Some of the routines take a
64 handle as one of the parameters.
67 handle can be created by an RPC creation routine such as
70 .Xr rpc_clnt_create 3 ) .
72 These routines are safe for use in multithreaded applications.
74 handles can be shared between threads, however in this implementation
75 requests by different threads are serialized (that is, the first request will
76 receive its results before the second request is sent).
80 for the definition of the
86 A function macro that calls the remote procedure
88 associated with the client handle,
90 which is obtained with an RPC
91 client creation routine such as
94 .Xr rpc_clnt_create 3 ) .
97 is the XDR function used to encode the procedure's parameters, and
99 is the XDR function used to decode the procedure's results;
101 is the address of the procedure's argument(s), and
103 is the address of where to place the result(s).
105 is the time allowed for results to be returned, which is overridden by
106 a time-out set explicitly through
109 .Xr rpc_clnt_create 3 .
110 If the remote call succeeds, the status returned is
112 otherwise an appropriate status is returned.
115 A function macro that frees any data allocated by the
116 RPC/XDR system when it decoded the results of an RPC call.
119 is the address of the results, and
121 is the XDR routine describing the results.
122 This routine returns 1 if the results were successfully freed,
126 A function macro that copies the error structure out of the client
127 handle to the structure at address
131 Print a message to standard error corresponding
132 to the condition indicated by
134 A newline is appended.
135 Normally used after a procedure call fails for a routine
136 for which a client handle is not needed, for instance
140 Print a message to the standard error indicating why an
143 is the handle used to do the call.
144 The message is prepended with string
147 A newline is appended.
148 Normally used after a remote procedure call fails
149 for a routine which requires a client handle,
154 Take the same arguments as
156 but instead of sending a message to the standard error
157 indicating why an RPC
158 call failed, return a pointer to a string which contains the message.
160 is normally used instead of
162 when the program does not have a standard error (as a program
163 running as a server quite likely does not), or if the programmer
164 does not want the message to be output with
168 or if a message format different than that supported by
175 .Fn clnt_spcreaterror
177 .Xr rpc_clnt_create 3 ) ,
179 does not return pointer to static data so the
180 result will not get overwritten on each call.
187 it returns a string instead of printing to standard error.
190 does not append a newline at the end of the message.
192 returns pointer to a buffer that is overwritten
198 except the call message is broadcast to
199 all the connectionless transports specified by
207 Each time it receives a response,
212 .Fn eachresult "caddr_t out" "const struct netbuf * addr" "const struct netconfig * netconf"
219 except that the remote procedure's output is decoded there;
221 points to the address of the machine that sent the results, and
223 is the netconfig structure of the transport on which the remote
229 waits for more replies;
230 otherwise it returns with appropriate status.
232 broadcast file descriptors are limited in size to the
233 maximum transfer size of that transport.
234 For Ethernet, this value is 1500 bytes.
238 credentials by default (see
239 .Xr rpc_clnt_auth 3 ) .
241 .It Fn rpc_broadcast_exp
244 except that the initial timeout,
246 and the maximum timeout,
248 are specified in milliseconds.
250 is the initial time that
251 .Fn rpc_broadcast_exp
252 waits before resending the request.
253 After the first resend, the re-transmission interval
254 increases exponentially until it exceeds
258 Call the remote procedure associated with
267 is used to encode the procedure's parameters, and
269 is used to decode the procedure's results;
271 is the address of the procedure's argument(s), and
273 is the address of where to place the result(s).
275 can be any of the values listed on
279 if it succeeds, or an appropriate status is returned.
282 routine to translate failure status into error messages.
285 uses the first available transport belonging
288 on which it can create a connection.
289 You do not have control of timeouts or authentication
295 .Xr rpc_clnt_auth 3 ,
296 .Xr rpc_clnt_create 3