rpcgen(1) CLIX rpcgen(1)
NAME
rpcgen - Runs the Remote Procedure Call (RPC) protocol compiler
SYNOPSIS
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]
FLAGS
-c Compiles into XDR functions.
-h Compiles into C data-definitions (a header file).
-l Compiles into a client-side stubs.
-s transport Compiles into server-side stubs, using the given transport.
The supported transports are udp and tcp. This flag may be
invoked more than once to compile a server that serves
multiple transports.
-m Compiles into a server-side stubs, but does not produce a
main() function. This flag is useful if you want to supply
your own main() function.
-o outfile Specifies the name of the output file. If none is
specified, stdout is used (-c, -h, -l and -s modes only).
DESCRIPTION
The rpcgen command generates C code to implement an RPC protocol. The
input to rpcgen is a language similar C, known as the RPC language.
Information about the syntax of the RPC language is available in the
rpcgen Tutorial.
The rpcgen command is normally used as in the first synopsis, where it
takes an input file and generates four output files. If the infile is
named proto.x, rpcgen generates a header file in <proto.h>, XDR functions
in proto_xdr.c, server-side stubs in proto_svc.c, and client-side stubs in
proto_clnt.c.
2/94 - Intergraph Corporation 1
rpcgen(1) CLIX rpcgen(1)
The other synopses shown above are used when one does not want to generate
all the output files, but only a particular one.
The C-preprocessor, cpp, 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 functions.
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 functions by leaving those data types
undefined. For every undefined data type, rpcgen assumes the existence of
a function with the name xdr_ prepended to the name of the undefined type.
EXAMPLES
1. To generate all four output files for the RPC language input file
proto.x:
rpcgen proto.x
2. To generate only the server-side stubs for the udp transport:
rpcgen -s udp proto.x
CAUTIONS
Nesting is not supported. As a work-around, structures can be declared at
top-level, and their names used inside 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.
EXIT VALUES
The exit value for rpcgen is 0 if the input file is successfully compiled,
and 1 if any error is detected.
2 Intergraph Corporation - 2/94
rpcgen(1) CLIX rpcgen(1)
RELATED INFORMATION
Commands: cpp(1)
CLIX Programming Guide
2/94 - Intergraph Corporation 3