an RPC protocol compiler
rpcgen -h [-o outfile]
rpcgen -c [-o outfile]
rpcgen -s transport
[-o outfile] [infile]
rpcgen -l [-o outfile]
rpcgen -m [-o outfile]
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
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
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.
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
In addition, rpcgen does some preprocessing of
its own. Any line beginning with ``%'' is passed
directly into the output file, uninterpreted by
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
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
Those who wish to compile OSR5 ABI network programs with
rpcgen should prefix their PATH environment variable with
The correct rpcgen and C compilers are then selected automatically.
compile into XDR routines
compile into C data-definitions (a header file)
compile into client-side stubs
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().
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
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