NAME | DESCRIPTION | ATTRIBUTES | SUMMARY OF TRUSTED SOLARIS CHANGES | SEE ALSO
RPC library routines allow C language programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a request to the server. Upon receipt of the request, the server calls a dispatch routine to perform the requested service, and then sends back a reply.
The clnt_call() , rpc_call() , and rpc_broadcast() routines handle the client side of the procedure call. The remaining routines deal with error handling in the case of errors.
Some of the routines take a CLIENT handle as one of the parameters. A CLIENT handle can be created by an RPC creation routine such as clnt_create() (see rpc_clnt_create(3N) ).
These routines are safe for use in multithreaded applications. CLIENT handles can be shared between threads, however in this implementation requests by different threads are serialized (that is, the first request will receive its results before the second request is sent).
Programs can retrieve network security attributes from incoming responses, and privileged programs can set the network security attributes on outgoing requests. See SUMMARY OF TRUSTED SOLARIS CHANGES for more information.
A function macro that calls the remote procedure procnum associated with the client handle, clnt , which is obtained with an RPC client creation routine such as clnt_create() (see rpc_clnt_create(3N) ). The parameter inproc is the XDR function used to encode the procedure's parameters, and outproc is the XDR function used to decode the procedure's results; in is the address of the procedure's argument(s), and out is the address of where to place the result(s). tout is the time allowed for results to be returned, which is overridden by a time-out set explicitly through clnt_control() , see rpc_clnt_create(3N) .
If the remote call succeeds, the status returned is RPC_SUCCESS , otherwise an appropriate status is returned.
A function macro that frees any data allocated by the RPC/XDR system when it decoded the results of an RPC call. The parameter out is the address of the results, and outproc is the XDR routine describing the results. This routine returns 1 if the results were successfully freed, and 0 otherwise.
A function macro that copies the error structure out of the client handle to the structure at address errp .
Print a message to standard error corresponding to the condition indicated by stat . A newline is appended. Normally used after a procedure call fails for a routine for which a client handle is not needed, for instance rpc_call().
Print a message to the standard error indicating why an RPC call failed; clnt is the handle used to do the call. The message is prepended with string s and a colon. A newline is appended. Normally used after a remote procedure call fails for a routine which requires a client handle, for instance clnt_call() .
Take the same arguments as clnt_perrno() , but instead of sending a message to the standard error indicating why an RPC call failed, return a pointer to a string which contains the message.
clnt_sperrno() is normally used instead of clnt_perrno() when the program does not have a standard error (as a program running as a server quite likely does not), or if the programmer does not want the message to be output with printf() [see printf(3S) ], or if a message format different than that supported by clnt_perrno() is to be used. Note: unlike clnt_sperror() and clnt_spcreaterror() [see rpc_clnt_create(3N) ], clnt_sperrno() does not return pointer to static data so the result will not get overwritten on each call.
Like clnt_perror() , except that (like clnt_sperrno() ) it returns a string instead of printing to standard error. However, clnt_sperror() does not append a newline at the end of the message.
Warning: Returns pointer to a buffer that is overwritten on each call. In multithread applications, this buffer is implemented as thread-specific data.
Like rpc_call() , except the call message is broadcast to all the connectionless transports specified by nettype . If nettype is NULL , it defaults to " netpath . Each time it receives a response, this routine calls eachresult() , whose form is:
bool_t eachresult(caddr_t out, const struct netbuf *addr, const struct netconfig *netconf);
Warning: broadcast file descriptors are limited in size to the maximum transfer size of that transport. For Ethernet, this value is 1500 bytes.
rpc_broadcast()
uses
AUTH_SYS
credentials by default [see
rpc_clnt_auth(3N)
].
The process requires the
PRIV_NET_BROADCAST
privilege.
Like rpc_broadcast() , except that the initial timeout, inittime and the maximum timeout, waittime are specified in milliseconds.
inittime is the initial time that rpc_broadcast_exp() waits before resending the request. After the first resend, the re-transmission interval increases exponentially until it exceeds waittime .
The process
requires the
PRIV_NET_BROADCAST
privilege.
Call the remote procedure associated with prognum , versnum , and procnum on the machine, host . The parameter inproc is used to encode the procedure's parameters, and outproc is used to decode the procedure's results; in is the address of the procedure's argument(s), and out is the address of where to place the result(s). nettype can be any of the values listed on rpc(3N) . This routine returns RPC_SUCCESS if it succeeds, or an appropriate status is returned. Use the clnt_perrno() routine to translate failure status into error messages.
Warning: rpc_call() uses the first available transport belonging to the class nettype , on which it can create a connection. You do not have control of timeouts or authentication using this routine.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
MT-Level | MT-Safe |
Most
rpcbind()
services operate only on mappings that either match the sensitivity label of the server or are multilevel.
rpc_broadcast()
and
rpc_broadcast_exp()
require the
PRIV_NET_BROADCAST
privilege.
The CLIENT structure allows a client to provide t6attr_t pointers to opaque structures for accessing the security attributes of a reply or request. When a new CLIENT structure is created, the pointers are initialized to NULL . If it needs to access the security attributes, the client uses the t6alloc_blk() routine to allocate attribute-control structures and set the t6attr_t pointers in the CLIENT structure. When clnt_destroy() is used to destroy a client handle, the client should also use t6free_blk() to free any attribute-control structures previously allocated for that client handle.
NAME | DESCRIPTION | ATTRIBUTES | SUMMARY OF TRUSTED SOLARIS CHANGES | SEE ALSO