Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rpcgen(1) — HP-UX 9.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

rpcgen(1)

NAME

rpcgen − an RPC protocol compiler

SYNOPSIS

rpcgen [-u] infile
rpcgen -h [-o outfile] [infile]
rpcgen -c [-o outfile] [infile]
rpcgen -s transport [-u] [-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 similar to C known as RPC (Remote Procedure Call) Language.  Information about RPC Language syntax is available in the rpcgen chapter of the manual Programming and Protocols for NFS Services.

rpcgen is normally used in the first synopsis shown above 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 routines in proto_xdr.c, server-side stubs in proto_svc.c, and client-side stubs in proto_clnt.c. 

The other synopsis forms shown above are used when only a particular output file is needed.  Their usage is described in the Options section below. 

The input file is processed by cpp before being interpreted by rpcgen (see cpp(1)), meaning that all standard cpp directives are available for use in an rpcgen input file.  Preprocessing by cpp is done for each output file created.  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 preprocessing of its own.  Any line beginning with % is passed directly into the output file, uninterpreted by rpcgen.  By using the cpp symbols mentioned above, you can pass text into a specific output file. 

To provide customized XDR routines for customized data types, you can declare data objects to be of a data type that is undefined to rpcgen.  rpcgen passes them through to the .h file it creates.  You are responsible for providing the definition of such data types in user-supplied files.  For every data type that is undefined, rpcgen assumes that there exists a routine with the name xdr_ prefixed to the name of the undefined type. 

Options

rpcgen recognizes the following options and command-line arguments:

-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 specified transport.  The supported transports are udp and tcp.  This option can be invoked more than once so as to compile a server that serves multiple transports.  If rpcgen is called without options, the server-side code that is generated can serve both udp and tcp 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, -m, and -s modes only). 

-u When the server-side stub is produced, additional code to handle signals is generated.  On reception of a signal, this signal handler code unmaps the server program from the port mapper before the server terminates.  This code is added only if a main() routine is produced in the server-side stub.  The -u option must not be specified with the -c, -h, -l, or -m options. 

The following signals are trapped: SIGHUP, SIGINT, SIGQUIT, and SIGTERM. 

WARNINGS

Nesting of structures is not supported.  As a work-around, structures can be declared at the 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. 

AUTHOR

rpcgen was developed by Sun Microsystems, Inc. and HP. 

SEE ALSO

rpcgen chapter of Programming and Protocols for NFS Services

INTERNATIONAL SUPPORT

8- and 16-bit data only in strings, comments and filenames. 

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026