Manpages - rpc_soc.3t

See

for function declarations.

The

and

functions described in this page are the old, TS-RPC interface to the XDR and RPC library, and exist for backward compatibility. The new interface is described in the pages referenced from

These routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a data packet to the server. Upon receipt of the packet, the server calls a dispatch routine to perform the requested service, and then sends back a reply. Finally, the procedure call returns to the client.

Routines that are used for Secure

authentication) are described in

Secure

can be used only if

encryption is available.

A macro that destroys the authentication information associated with

Destruction usually involves deallocation of private data structures. The use of

is undefined after calling

Create and return an

authentication handle that passes nonusable authentication information with each remote procedure call. This is the default authentication used by

Create and return an

authentication handle that contains

authentication information. The

argument is the name of the machine on which the information was created;

is the user’s user ID;

is the user’s current group ID;

and

refer to a counted array of groups to which the user belongs. It is easy to impersonate a user.

Calls

with the appropriate arguments.

Call the remote procedure associated with

and

on the machine

The

argument is the address of the procedure’s argument(s), and

is the address of where to place the result(s);

is used to encode the procedure’s arguments, and

is used to decode the procedure’s results. This routine returns zero if it succeeds, or the value of

cast to an integer if it fails. The routine

is handy for translating failure statuses into messages.

Warning: calling remote procedures with this routine uses

as a transport; see

for restrictions. You do not have control of timeouts or authentication using this routine.

Like

except the call message is broadcast to all locally connected broadcast nets. Each time it receives a response, this routine calls

whose form is:

where

is the same as

passed to

except that the remote procedure’s output is decoded there;

points to the address of the machine that sent the results. If

returns zero,

waits for more replies; otherwise it returns with appropriate status.

Warning: broadcast sockets are limited in size to the maximum transfer unit of the data link. For ethernet, this value is 1500 bytes.

A macro that calls the remote procedure

associated with the client handle,

which is obtained with an

client creation routine such as

The

argument is the address of the procedure’s argument(s), and

is the address of where to place the result(s);

is used to encode the procedure’s arguments, and

is used to decode the procedure’s results;

is the time allowed for results to come back.

A macro that destroys the client’s

handle. Destruction usually involves deallocation of private data structures, including

itself. Use of

is undefined after calling

If the

library opened the associated socket, it will close it also. Otherwise, the socket remains open.

Generic client creation routine. The

argument identifies the name of the remote host where the server is located. The

argument indicates which kind of transport protocol to use. The currently supported values for this field are

and

Default timeouts are set, but can be modified using

Warning: Using

has its shortcomings. Since

messages can only hold up to 8 Kbytes of encoded data, this transport cannot be used for procedures that take large arguments or return huge results.

A macro used to change or retrieve various information about a client object. The

argument indicates the type of operation, and

is a pointer to the information. For both

and

the supported values of

and their argument types and what they do are:

Note: if you set the timeout using

the timeout argument passed to

will be ignored in all future calls.

The following operations are valid for

only:

The retry timeout is the time that

waits for the server to reply before retransmitting the request.

A macro that frees any data allocated by the

system when it decoded the results of an

call. The

argument is the address of the results, and

is the

routine describing the results. This routine returns one if the results were successfully freed, and zero otherwise.

A macro that copies the error structure out of the client handle to the structure at address

prints a message to standard error indicating why a client

handle could not be created. The message is prepended with string

and a colon. A newline is appended at the end of the message. Used when a

or

call fails.

Print a message to standard error corresponding to the condition indicated by

A newline is appended at the end of the message. Used after

Print a message to standard error indicating why an

call failed;

is the handle used to do the call. The message is prepended with string

and a colon. A newline is appended at the end of the message. Used after

Like

except that it returns a string instead of printing to the standard error.

Bugs: returns pointer to static data that is overwritten on each call.

Take the same arguments as

but instead of sending a message to the standard error indicating why an

call failed, return a pointer to a string which contains the message.

The

function is used instead of

if 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

or if a message format different from that supported by

is to be used.

Note: unlike

and

returns pointer to static data, but the result will not get overwritten on each call.

Like

except that (like

it returns a string instead of printing to standard error.

Bugs: returns pointer to static data that is overwritten on each call.

This routine creates a toy

client for the remote program

version

The transport used to pass messages to the service is actually a buffer within the process’s address space, so the corresponding

server should live in the same address space; see

This allows simulation of

and acquisition of

overheads, such as round trip times, without any kernel interference. This routine returns

if it fails.

This routine creates an

client for the remote program

version

the client uses

as a transport. The remote program is located at Internet address

If

is zero, then it is set to the actual port that the remote program is listening on (the remote

service is consulted for this information). The

argument is a socket; if it is

then this routine opens a new one and sets

Since

uses buffered

the user may specify the size of the send and receive buffers with the

and

arguments; values of zero choose suitable defaults. This routine returns

if it fails.

This routine creates an

client for the remote program

version

the client uses

as a transport. The remote program is located at Internet address

If

is zero, then it is set to actual port that the remote program is listening on (the remote

service is consulted for this information). The

argument is a socket; if it is

then this routine opens a new one and sets

The

transport resends the call message in intervals of

time until a response is received or until the call times out. The total time for the call to time out is specified by

Warning: since

messages can only hold up to 8 Kbytes of encoded data, this transport cannot be used for procedures that take large arguments or return huge results.

This routine creates an

client for the remote program

on

the client uses

as a transport. The remote program is located at Internet address

If

is zero, then it is set to actual port that the remote program is listening on (the remote

service is consulted for this information). The

argument is a socket; if it is

then this routine opens a new one and sets

The

transport resends the call message in intervals of

time until a response is received or until the call times out. The total time for the call to time out is specified by

This allows the user to specify the maximum packet size for sending and receiving

messages.

This routine creates an

client for the local program

version

the client uses

sockets as a transport. The local program is located at the

The

argument is a socket; if it is

then this routine opens a new one and sets

Since

uses buffered

the user may specify the size of the send and receive buffers with the

and

arguments; values of zero choose suitable defaults. This routine returns

if it fails.

Stuff the machine’s

address into

without consulting the library routines that deal with

The port number is always set to

Returns zero on success, non-zero on failure.

A user interface to the

service, which returns a list of the current

program-to-port mappings on the host located at

address

This routine can return

The command

uses this routine.

A user interface to the

service, which returns the port number on which waits a service that supports program number

version

and speaks the transport protocol associated with

The value of

is most likely

or

A return value of zero means that the mapping does not exist or that the

system failed to contact the remote

service. In the latter case, the global variable

contains the

status.

A user interface to the

service, which instructs

on the host at

address

to make an

call on your behalf to a procedure on that host. The

argument will be modified to the program’s port number if the procedure succeeds. The definitions of other arguments are discussed in

and

This procedure should be used for a

and nothing else. See also

A user interface to the

service, which establishes a mapping between the triple

and

on the machine’s

service. The value of

is most likely

or

This routine returns one if it succeeds, zero otherwise. Automatically done by

A user interface to the

service, which destroys all mapping between the triple

and

on the machine’s

service. This routine returns one if it succeeds, zero otherwise.

Register procedure

with the

service package. If a request arrives for program

version

and procedure

is called with a pointer to its argument(s);

should return a pointer to its static result(s);

is used to decode the arguments while

is used to encode the results. This routine returns zero if the registration succeeded, -1 otherwise.

Warning: remote procedures registered in this form are accessed using the

transport; see

for restrictions.

A global variable whose value is set by any

client creation routine that does not succeed. Use the routine

to print the reason why.

A macro that destroys the

service transport handle,

Destruction usually involves deallocation of private data structures, including

itself. Use of

is undefined after calling this routine.

A global variable reflecting the

service side’s read file descriptor bit mask; it is suitable as a template argument to the

system call. This is only of interest if a service implementor does not call

but rather does his own asynchronous event processing. This variable is read-only (do not pass its address to

yet it may change after calls to

or any creation routines. As well, note that if the process has descriptor limits which are extended beyond

this variable will only be usable for the first

descriptors.

Similar to

but limited to 32 descriptors. This interface is obsoleted by

A macro that frees any data allocated by the

system when it decoded the arguments to a service procedure using

This routine returns 1 if the results were successfully freed, and zero otherwise.

A macro that decodes the arguments of an

request associated with the

service transport handle,

The

argument is the address where the arguments will be placed;

is the

routine used to decode the arguments. This routine returns one if decoding succeeds, and zero otherwise.

The approved way of getting the network address of the caller of a procedure associated with the

service transport handle,

This routine is only of interest if a service implementor does not call

but instead implements custom asynchronous event processing. It is called when the

system call has determined that an

request has arrived on some

socket(s);

is the resultant read file descriptor bit mask. The routine returns when all sockets associated with the value of

have been serviced.

Similar to

but limited to 32 descriptors. This interface is obsoleted by

Associates

and

with the service dispatch procedure,

If

is zero, the service is not registered with the

service. If

is non-zero, then a mapping of the triple

to

is established with the local

service (generally

is zero,

or

The procedure

has the following form:

The

routine returns one if it succeeds, and zero otherwise.

This routine never returns. It waits for

requests to arrive, and calls the appropriate service procedure using

when one arrives. This procedure is usually waiting for a

system call to return.

Called by an

service’s dispatch routine to send the results of a remote procedure call. The

argument is the request’s associated transport handle;

is the

routine which is used to encode the results; and

is the address of the results. This routine returns one if it succeeds, zero otherwise.

Remove all mapping of the double

to dispatch routines, and of the triple

to port number.

Called by a service dispatch routine that refuses to perform a remote procedure call due to an authentication error.

Called by a service dispatch routine that cannot successfully decode its arguments. See also

Called by a service dispatch routine that does not implement the procedure number that the caller requests.

Called when the desired program is not registered with the

package. Service implementors usually do not need this routine.

Called when the desired version of a program is not registered with the

package. Service implementors usually do not need this routine.

Called by a service dispatch routine when it detects a system error not covered by any particular protocol. For example, if a service can no longer allocate storage, it may call this routine.

Called by a service dispatch routine that refuses to perform a remote procedure call due to insufficient authentication arguments. The routine calls

This routine creates a toy

service transport, to which it returns a pointer. The transport is really a buffer within the process’s address space, so the corresponding

client should live in the same address space; see

This routine allows simulation of

and acquisition of

overheads (such as round trip times), without any kernel interference. This routine returns

if it fails.

This routine creates a

service transport, to which it returns a pointer. The transport is associated with the socket

which may be

in which case a new socket is created. If the socket is not bound to a local

port, then this routine binds it to an arbitrary port. Upon completion,

is the transport’s socket descriptor, and

is the transport’s port number. This routine returns

if it fails. Since

uses buffered

users may specify the size of buffers; values of zero choose suitable defaults.

This routine creates a

service transport, to which it returns a pointer. The transport is associated with the socket

which may be

in which case a new socket is created. The

argument is a variable-length file system pathname of at most 104 characters. This file is

removed when the socket is closed. The

system call must be used to remove the file. Upon completion,

is the transport’s socket descriptor. This routine returns

if it fails. Since

uses buffered

users may specify the size of buffers; values of zero choose suitable defaults.

Create a service on top of any open descriptor. The

and

arguments indicate sizes for the send and receive buffers. If they are zero, a reasonable default is chosen.

Create a service on top of any open descriptor. Typically, this descriptor is a connected socket for a stream protocol such as

The

and

arguments indicate sizes for the send and receive buffers. If they are zero, a reasonable default is chosen.

This routine creates a

service transport, to which it returns a pointer. The transport is associated with the socket

which may be

in which case a new socket is created. If the socket is not bound to a local

port, then this routine binds it to an arbitrary port. Upon completion,

is the transport’s socket descriptor, and

is the transport’s port number. This routine returns

if it fails.

This allows the user to specify the maximum packet size for sending and receiving

messages.

Used for encoding

reply messages. This routine is useful for users who wish to generate

messages without using the

package.

Used for describing

credentials. This routine is useful for users who wish to generate these credentials without using the

authentication package.

Used for describing

call header messages. This routine is useful for users who wish to generate

messages without using the

package.

Used for describing

call messages. This routine is useful for users who wish to generate

messages without using the

package.

Used for describing

authentication information messages. This routine is useful for users who wish to generate

messages without using the

package.

Used for describing arguments to various

procedures, externally. This routine is useful for users who wish to generate these arguments without using the

interface.

Used for describing a list of port mappings, externally. This routine is useful for users who wish to generate these arguments without using the

interface.

Used for describing

reply messages. This routine is useful for users who wish to generate

messages without using the

package.

Used for describing

reply messages. This routine is useful for users who wish to generate

style messages without using the

package.

After

service transport handles are created, they should register themselves with the

service package. This routine modifies the global variable

Service implementors usually do not need this routine.

Before an

service transport handle is destroyed, it should unregister itself with the

service package. This routine modifies the global variable

Service implementors usually do not need this routine.

These functions are part of libtirpc.

Author: dt

Created: 2022-02-20 Sun 18:05