1RPC_CLNT_CALLS(3)        BSD Library Functions Manual        RPC_CLNT_CALLS(3)
2

NAME

4     rpc_clnt_calls, clnt_call, clnt_freeres, clnt_geterr, clnt_perrno,
5     clnt_perror, clnt_sperrno, clnt_sperror, rpc_broadcast,
6     rpc_broadcast_exp, rpc_call — library routines for client side calls
7

SYNOPSIS

9     #include <rpc/rpc.h>
10
11     enum clnt_stat
12     clnt_call(CLIENT *clnt, const rpcproc_t procnum, const xdrproc_t inproc,
13         const caddr_t in, const xdrproc_t outproc, caddr_t out,
14         const struct timeval tout);
15
16     bool_t
17     clnt_freeres(CLIENT *clnt, const xdrproc_t outproc, caddr_t out);
18
19     void
20     clnt_geterr(const CLIENT * clnt, struct rpc_err * errp);
21
22     void
23     clnt_perrno(const enum clnt_stat stat);
24
25     void
26     clnt_perror(CLIENT *clnt, const char *s);
27
28     char *
29     clnt_sperrno(const enum clnt_stat stat);
30
31     char *
32     clnt_sperror(CLIENT *clnt, const char * s);
33
34     enum clnt_stat
35     rpc_broadcast(const rpcprog_t prognum, const rpcvers_t versnum,
36         const rpcproc_t procnum, const xdrproc_t inproc, const caddr_t in,
37         const xdrproc_t outproc, caddr_t out, const resultproc_t eachresult,
38         const char *nettype);
39
40     enum clnt_stat
41     rpc_broadcast_exp(const rpcprog_t prognum, const rpcvers_t versnum,
42         const rpcproc_t procnum, const xdrproc_t xargs, caddr_t argsp,
43         const xdrproc_t xresults, caddr_t resultsp,
44         const resultproc_t eachresult, const int inittime,
45         const int waittime, const char * nettype);
46
47     enum clnt_stat
48     rpc_call(const char *host, const rpcprog_t prognum,
49         const rpcvers_t versnum, const rpcproc_t procnum,
50         const xdrproc_t inproc, const char *in, const xdrproc_t outproc,
51         char *out, const char *nettype);
52

DESCRIPTION

54     RPC library routines allow C language programs to make procedure calls on
55     other machines across the network.  First, the client calls a procedure
56     to send a request to the server.  Upon receipt of the request, the server
57     calls a dispatch routine to perform the requested service, and then sends
58     back a reply.
59
60     The clnt_call(), rpc_call(), and rpc_broadcast() routines handle the
61     client side of the procedure call.  The remaining routines deal with
62     error handling in the case of errors.
63
64     Some of the routines take a CLIENT handle as one of the arguments.  A
65     CLIENT handle can be created by an RPC creation routine such as
66     clnt_create() (see rpc_clnt_create(3)).
67
68     These routines are safe for use in multithreaded applications.  CLIENT
69     handles can be shared between threads, however in this implementation
70     requests by different threads are serialized (that is, the first request
71     will receive its results before the second request is sent).
72

Routines

74     See rpc(3) for the definition of the CLIENT data structure.
75
76     clnt_call()
77            A function macro that calls the remote procedure procnum associ‐
78            ated with the client handle, clnt, which is obtained with an RPC
79            client creation routine such as clnt_create() (see
80            rpc_clnt_create(3)).  The inproc argument is the XDR function used
81            to encode the procedure's arguments, and outproc is the XDR func‐
82            tion used to decode the procedure's results; in is the address of
83            the procedure's argument(s), and out is the address of where to
84            place the result(s).  The tout argument is the time allowed for
85            results to be returned, which is overridden by a time-out set
86            explicitly through clnt_control(), see rpc_clnt_create(3).  If the
87            remote call succeeds, the status returned is RPC_SUCCESS, other‐
88            wise an appropriate status is returned.
89
90     clnt_freeres()
91            A function macro that frees any data allocated by the RPC/XDR sys‐
92            tem when it decoded the results of an RPC call.  The out argument
93            is the address of the results, and outproc is the XDR routine
94            describing the results.  This routine returns 1 if the results
95            were successfully freed, and 0 otherwise.
96
97     clnt_geterr()
98            A function macro that copies the error structure out of the client
99            handle to the structure at address errp.
100
101     clnt_perrno()
102            Print a message to standard error corresponding to the condition
103            indicated by stat.  A newline is appended.  Normally used after a
104            procedure call fails for a routine for which a client handle is
105            not needed, for instance rpc_call().
106
107     clnt_perror()
108            Print a message to the standard error indicating why an RPC call
109            failed; clnt is the handle used to do the call.  The message is
110            prepended with string s and a colon.  A newline is appended.  Nor‐
111            mally used after a remote procedure call fails for a routine which
112            requires a client handle, for instance clnt_call().
113
114     clnt_sperrno()
115            Take the same arguments as clnt_perrno(), but instead of sending a
116            message to the standard error indicating why an RPC call failed,
117            return a pointer to a string which contains the message.  The
118            clnt_sperrno() function is normally used instead of clnt_perrno()
119            when the program does not have a standard error (as a program run‐
120            ning as a server quite likely does not), or if the programmer does
121            not want the message to be output with printf() (see printf(3)),
122            or if a message format different than that supported by
123            clnt_perrno() is to be used.  Note: unlike clnt_sperror() and
124            clnt_spcreateerror() (see rpc_clnt_create(3)), clnt_sperrno() does
125            not return pointer to static data so the result will not get over‐
126            written on each call.
127
128     clnt_sperror()
129            Like clnt_perror(), except that (like clnt_sperrno()) it returns a
130            string instead of printing to standard error.  However,
131            clnt_sperror() does not append a newline at the end of the mes‐
132            sage.  Warning: returns pointer to a buffer that is overwritten on
133            each call.
134
135     rpc_broadcast()
136            Like rpc_call(), except the call message is broadcast to all the
137            connectionless transports specified by nettype.  If nettype is
138            NULL, it defaults to "netpath".  Each time it receives a response,
139            this routine calls eachresult(), whose form is: bool_t
140            eachresult(caddr_t out, const struct netbuf * addr, const struct
141            netconfig * netconf) where out is the same as out passed to
142            rpc_broadcast(), except that the remote procedure's output is
143            decoded there; addr points to the address of the machine that sent
144            the results, and netconf is the netconfig structure of the trans‐
145            port on which the remote server responded.  If eachresult()
146            returns 0, rpc_broadcast() waits for more replies; otherwise it
147            returns with appropriate status.  Warning: broadcast file descrip‐
148            tors are limited in size to the maximum transfer size of that
149            transport.  For Ethernet, this value is 1500 bytes.  The
150            rpc_broadcast() function uses AUTH_SYS credentials by default (see
151            rpc_clnt_auth(3)).
152
153     rpc_broadcast_exp()
154            Like rpc_broadcast(), except that the initial timeout, inittime
155            and the maximum timeout, waittime are specified in milliseconds.
156            The inittime argument is the initial time that rpc_broadcast_exp()
157            waits before resending the request.  After the first resend, the
158            re-transmission interval increases exponentially until it exceeds
159            waittime.
160
161     rpc_call()
162            Call the remote procedure associated with prognum, versnum, and
163            procnum on the machine, host.  The inproc argument is used to
164            encode the procedure's arguments, and outproc is used to decode
165            the procedure's results; in is the address of the procedure's
166            argument(s), and out is the address of where to place the
167            result(s).  The nettype argument can be any of the values listed
168            on rpc(3).  This routine returns RPC_SUCCESS if it succeeds, or an
169            appropriate status is returned.  Use the clnt_perrno() routine to
170            translate failure status into error messages.  Warning: rpc_call()
171            uses the first available transport belonging to the class nettype,
172            on which it can create a connection.  You do not have control of
173            timeouts or authentication using this routine.
174

AVAILABILITY

176     These functions are part of libtirpc.
177

SEE ALSO

179     printf(3), rpc(3), rpc_clnt_auth(3), rpc_clnt_create(3)
180
181BSD                               May 7, 1993                              BSD
Impressum