ONC RPC facilities

The ONC RPC implementation consists of:

XDR routines

Data exchanged between systems engaged in ONC RPC must always flow in a standard format specified by XDR, because different machine architectures have different representations of the same information.

Both client and server use XDR routines to convert the input and output parameters between XDR format and the local data format. You either write these yourself, or specify an XDR library function, as described below. In Figure 31, inproc and outproc are the XDR routines.

Figure 31. XDR routines used in a remote procedure call
 Diagram showing a remote procedure in a server using inproc and outproc XDR routines, and a client caller also using inproc and outproc XDR routines, as described in the text.

Notice that in Figure 31, the same XDR routine, inproc, is used to encode and decode the data as it flows from client to server, and similarly for outproc as it flows back to the client. The source for inproc is the same in the client and server, but XDR library functions in the routines are compiled to encode or decode as appropriate. Such routines are termed bidirectional, and they help to ensure that the encoding and decoding is done symmetrically in the two routines.

Using XDR library functions

XDR library functions are a set of C functions supplied with ONC RPC, which application programmers can use when writing XDR routines. They can be used as follows, depending on the complexity of the structure pointed to by the call argument and reply parameters.

For parameters that are simple single-field C data types
Use an XDR library function for inproc and outproc.
For parameters that are C data type vectors, arrays, strings, and so on
Use an XDR library function for inproc and outproc.
For more complex structures
Write an XDR routine, using XDR library functions as required. Alternatively, use the RPCGEN compiler, described in RPCGEN compiler, to create an XDR routine from an XDR data description.
CICS® ONC RPC

CICS ONC RPC supports the use of the XDR library functions that support data conversion.

RPCGEN compiler

To use RPCGEN, you write a program definition in RPCL, a language similar to a subset of C, designed for the definition of ONC RPC distributed programs. The definition defines the data to be transferred and procedures to be used for both client and server. The client application source program is written as though the remote procedure call were a call to a local program. The code to send the call and get the reply are part of the client stub, which is generated by RPCGEN. Similarly the code the server needs to accept the call and send back the reply are part of the server stub, which is also generated by RPCGEN. Figure 32 illustrates the role of RPCGEN in application development.

Figure 32. Using the RPCGEN compiler
 Diagram showing an RPCL program processed by RPCGEN to produce a client stub; XDR routines; header files; and a Server stub. The Client stub and header files are compiled to form the client stub object and the client application source is compiled to form the client object. These are then linked to form the client application. Similarly, the Server stub and XDR routines are compiled to form the Server stub object that is linked with the Server object to form the Server application.
CICS ONC RPC

RPCGEN may only be used for:

CICS ONC RPC does not use the server stub generated by RPCGEN.

ONC RPC API library

The ONC RPC API library contains two types of call: high level and low level.

The high-level ONC RPC API can be used only with UDP. It enables users to make remote procedure calls very simply and with a minimum of library calls, but at a cost of some restriction in available function. The main function of the API is provided by three calls:

registerrpc
Used in the server to register a procedure to be called as a remote procedure by clients.
svc_run
Used in the server to see if a request has arrived from a client.
callrpc
Used in the client to make a remote procedure call.

The low-level ONC RPC API contains many more calls, which give more control and flexibility. For example:

CICS ONC RPC

CICS ONC RPC provides all the server function. You don’t specify any server RPC calls.

The client can make its request with the high-level call callrpc, or can use low-level calls. CICS ONC RPC is implemented using low-level ONC RPC calls. The implementation allows concurrent dispatching of individual procedures and allows TCP to be supported as well as UDP.

Related concepts
ONC RPC concepts
ONC RPC naming and routing
Related tasks
Setting up CICS ONC RPC
[[ Contents Previous Page | Next Page Index ]]