rpcgen(NC)


rpcgen -- an RPC protocol compiler

Syntax

rpcgen infile
rpcgen -h [-o outfile] [inputfile]
rpcgen -c [-o outfile] [infile]
rpcgen -s transport [-o outfile] [infile]
rpcgen -l [-o outfile] [infile]
rpcgen -m [-o outfile] [infile]

Description

rpcgen is a tool that generates C code to implement an RPC protocol. The input to rpcgen is a language known as RPC Language (Remote Procedure Call Language). Information about the syntax of RPC Language is available in UNRESOLVED XREF-0.

rpcgen is normally used as in the first syntax where it takes an input file and generates four output files. If the infile is named proto.x, then rpcgen will generate a header file in proto.h, XDR routines in proto_xdr.c, server-side stubs in proto_svc.c, and client-side stubs in proto_clnt.c.

The other syntax examples shown above are used when one does not want to generate all the output files, but only a particular one. Their usage is described below.

The C-preprocessor, cpp(CP), is run on all input files before they are actually interpreted by rpcgen, so all the cpp directives are legal within an rpcgen input file. For each type of output file, rpcgen defines a special cpp symbol for use by the rpcgen programmer:


RPC_HDR
defined when compiling into header files

RPC_XDR
defined when compiling into XDR routines

RPC_SVC
defined when compiling into server-side stubs

RPC_CLNT
defined when compiling into client-side stubs
In addition, rpcgen does some preprocessing of its own. Any line beginning with ``%'' is passed directly into the output file, uninterpreted by rpcgen.

You can customize some of your XDR routines by leaving those data types undefined. For every undefined data type, rpcgen will assume that there exists a routine with the name xdr_ prepended to the name of the undefined type.

SVR5 versus OSR5 ABI

rpcgen has knowledge of specific OS-based headers files for networking. These header files differ between the SVR5 and OSR5 ABIs. The SVR5 rpcgen is found in /usr/bin and the OSR5 rpcgen is in /osr5/usr/bin/rpcgen. Those who wish to compile OSR5 ABI network programs with rpcgen should prefix their PATH environment variable with /osr5/usr/bin. The correct rpcgen and C compilers are then selected automatically.

Options


-c
compile into XDR routines

-h
compile into C data-definitions (a header file)

-l
compile into client-side stubs

-s transport
compile into server-side stubs, using the the given transport. The supported transports are udp and tcp. This option may be invoked more than once so as to compile a server that serves multiple transports.

-m
compile into server-side stubs, but do not produce a main() routine. This option is useful if you want to supply your own main().

-o outfile
specify the name of the output file. If none is specified, standard output is used (-c, -h, -l, and -s modes only).

Limitations

Nesting is not supported. As a work-around, structures can be declared at the top-level and their names can be used within other structures in order to achieve the same effect.

Name clashes can occur when using program definitions, since the apparent scoping does not really apply. Most of these can be avoided by giving unique names for programs, versions, procedures, and types.


© 2007 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 05 June 2007