ONC+ Developer's Guide

Overview of Interface Routines

RPC has multiple levels of application interface to its services. These levels provide different degrees of control balanced with different amounts of interface code to implement, in order of increasing control and complexity. This section gives a summary of the routines available at each level.

Simplified Interface Routines

The simplified interfaces are used to make remote procedure calls to routines on other machines, and specify only the type of transport to use. The routines at this level are used for most applications. Descriptions and code samples are in the section Simplified Interface.

Table 2–1 RPC Routines—Simplified Level

Routine 

Function 

rpc_reg()

Registers a procedure as an RPC program on all transports of the specified type 

rpc_call()

Remotely calls the specified procedure on the specified remote host 

rpc_broadcast()

Broadcasts a call message across all transports of the specified type 

Standard Interface Routines

The standard interfaces are divided into top level, intermediate level, expert level, and bottom level. These interfaces give a programmer much greater control over communication parameters such as the transport being used, how long to wait before responding to errors and retransmitting requests, and so on.

Top-Level Routines

At the top level, the interface is still simple, but the program has to create a client handle before making a call or create a server handle before receiving calls. If you want the application to run on all transports, use this interface. You can find the use of these routines and code samples in Top-Level Interface.

Table 2–2 RPC Routines—Top Level

Routine 

Description 

clnt_create()

Generic client creation. The program tells clnt_create() where the server is located and the type of transport to use.

clnt_create_timed()

Similar to clnt_create() but enables the programmer to specify the maximum time allowed for each type of transport tried during the creation attempt.

svc_create()

Creates server handles for all transports of the specified type. The program tells svc_create() which dispatch function to use.

clnt_call() ()

Client calls a procedure to send a request to the server. 

Intermediate-Level Routines

The intermediate level interface of RPC enables you to you control details. Programs written at these lower levels are more complicated but run more efficiently. The intermediate level enables you to specify the transport to use. Intermediate-Level Interface describes the use of these routines and code samples.

Table 2–3 RPC Routines—Intermediate Level

Routine 

Description 

clnt_tp_create()

Creates a client handle for the specified transport  

clnt_tp_create_timed()

Similar to clnt_tp_create() but enables the programmer to specify the maximum time allowed

svc_tp_create()

Creates a server handle for the specified transport 

clnt_call() ()

Client calls a procedure to send a request to the server 

Expert-Level Routines

The expert level contains a larger set of routines with which to specify transport-related parameters. Expert-Level Interface describes the use of these routines and code samples.

Table 2–4 RPC Routines—Expert Level

Routine 

Description 

clnt_tli_create()

Creates a client handle for the specified transport 

svc_tli_create()

Creates a server handle for the specified transport 

rpcb_set()

Calls rpcbind to set a map between an RPC service and a network address

rpcb_unset()

Deletes a mapping set by rpcb_set()

rpcb_getaddr()

Calls rpcbind() to get the transport addresses of specified RPC services

svc_reg()

Associates the specified program and version number pair with the specified dispatch routine 

svc_unreg()

Deletes an association set by svc_reg()

clnt_call()()

Client calls a procedure to send a request to the server 

Bottom-Level Routines

The bottom level contains routines used for full control of transport options. Bottom-Level Interface describes these routines.

Table 2–5 RPC Routines—Bottom Level

Routine 

Description 

clnt_dg_create()

Creates an RPC client handle 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 handle for the specified remote program using a connection-oriented transport 

svc_vc_create()

Creates an RPC server handle using a connection-oriented transport 

clnt_call()()

Client calls a procedure to send a request to the server