rpcgen -- an RPC protocol compiler


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]


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 ``Developing distributed applications using ONC RPC and XDR'' in the Network Programmer's Guide and Reference.

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:

defined when compiling into header files

defined when compiling into XDR routines

defined when compiling into server-side stubs

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.


compile into XDR routines

compile into C data-definitions (a header file)

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.

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).


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.

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003