Levels of the RPC package
The RPC interface can be seen as being divided into
several distinct levels.
The highest level is general, and provides for no fine control
of any kind.
The lower levels (four can be usefully distinguished)
are available for use as necessary, and provide increasingly
detailed levels of control.
Programmers should only go down to the level necessary
for the control needed.
NOTE:
For a complete specification of the routines in the RPC library,
see
rpc(3rpc)
and related manual pages.
In the ``simplified interface'',
you do not need to consider the characteristics of the
underlying transport, operating system, or other low-level
implementation mechanisms.
Programmers simply make remote procedure calls to routines on other
machines, and need specify only the
type
of transport that they wish to use.
The selling point here is simplicity.
It is this level that allows RPC to pass the ``hello world'' test
-- that simple things should be simple.
The routines at this level are used for most applications.
Included in the simplified interface are only
three basic RPC routines:
rpc_reg-
rpc_reg
registers a routine as an RPC routine and obtains a unique, system-wide
procedure-identification number for it.
rpc_call-
Given such a unique, system-wide procedure-identification number,
rpc_call
uses it to make a remote call to that routine on a specified
host.
rpc_broadcast-
Like
rpc_call,
except that it broadcasts its call message across all transports of the
specified type.
At the ``top level'', the interface is still simple, but the programmer
does have
to create client and server handles before making a call.
Like the routines in the simplified interface, the routines here
require a
nettype
argument that specifies a general class (type) of transports.
The top level essentially consists of two routines:
clnt_create-
The generic client creation.
The programmer tells
clnt_create
where the server is located and the type of transport to use to get to it.
svc_create-
Creates server handles for all the transports of the specified
nettype.
The programmer tells
svc_create
which dispatch function should be used.
The simplified interface and the top level of RPC, while simple,
do not allow the choice of a specific transport (but see
the following discussion of NETPATH).
At these levels, all routines take a nettype
argument, which serves to define the class of transport to be used.
On the client side, programs do network selection, and
hence may be slightly inefficient depending on the nettype.
On the server side, programs may have to listen on many transports, and
hence may waste system resources.
In both of these cases, however,
efficiency can be improved by judicious assignment to the NETPATH
environment variable.
If the programmer wishes the application to
run on all transports, this is the interface that should be used.
The ``intermediate interface'' of RPC, and the two
interfaces below it, allow many details to be controlled by the
programmer, and for that reason their use is necessary for special
applications.
Programs written at these lower levels are more complicated,
but also more efficient.
The intermediate differs from the two levels above it in that it allows
the programmer to specify directly the transport to be used.
It consists of two routines:
clnt_tp_create-
Creates a client handle for a specified transport.
svc_tp_create-
Likewise,
svc_tp_create
creates a server handle for a specified transport.
The ``expert level'' consists of a larger set of routines with which
the programmer can specify more parameters, but those parameters are
still all directly transport related.
It includes the following routines:
clnt_tli_create-
Creates a client handle for a specified transport, allowing fine control
of the client characteristics.
svc_tli_create-
Creates a server handle for a specified transport, allowing fine control
of the server characteristics.
rpcb_set,-
Provides a programmatic interface to
rpcbind,
one that establishes a mapping between an RPC service and a network
address.
rpcb_unset-
Destroys a mapping of the type established by
rpcb_set.
rpcb_getaddr-
Provides a programmatic interface to
rpcbind,
one that returns the transport address of specified RPC service.
svc_reg-
Associates a given program and version number pair with a given
dispatch routine.
svc_unreg-
Destroys an association of the type established by
svc_reg.
The ``bottom level'' consists of routines called when the programmer
requires full control, even down to the smallest details of transport
options.
It consists of the following routines:
clnt_dg_create-
Creates an RPC client for the specified remote program, using a
connectionless transport.
svc_dg_create-
Creates an RPC server handle, using a connectionless transport.
clnt_vc_create-
Creates an RPC client for the specified remote program, using a
connection-oriented transport.
svc_vc_create-
Creates an RPC server handle, using a connection-oriented transport.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004