an RPC protocol compiler
rpcgen infile rpcgen -a|-c|-h|-l|-m|-Sc|-Ss [-o outfile] [infile] [-C] [-D macro[=value]] [-L] [-K secs] rpcgen -s transport [-o outfile] [infile]
The rpcgen compiler generates C code to implement an RPC protocol. The input rpcgen takes is a C-like language known as Remote Procedure Call Language. For more information about this language, we recommend Power Programming with RPC.
You normally use rpcgen in its first form, where it takes an input file and generates four output files. For example, if you specify an infile called proto.x, then rpcgen will generate:
You use the other syntax forms when you want to generate only one of these output files.
The C compiler is used to preprocess all input files before they're actually interpreted by rpcgen, so all the preprocessor directives are legal within an rpcgen input file. For each type of output file, rpcgen defines a special symbol for your use:
rpcgen defines this symbol: | When compiling into: |
---|---|
RPC_HDR | Header files |
RPC_XDR | XDR routines |
RPC_SVC | Server-side stubs |
RPC_CLNT | Client-side stubs |
In addition, rpcgen does some preprocessing of its own. It will leave any line beginning with a % uninterpreted and pass the line directly into the output file.
You can customize some of your XDR routines by leaving associated data types undefined. For every data type you leave undefined, rpcgen assumes a routine exists whose name starts with xdr_ and ends with the name of the undefined type.
The compiler doesn't support nesting. You can achieve the same effect, however, by declaring structures at top level and using their names inside other structures.
When you use program definitions, name clashes can occur since the apparent scoping doesn't really apply. You can avoid most of these clashes by assigning unique names to programs, versions, procedures, and types.
John Bloomer, Power Programming with RPC, O'Reilly & Associates (ISBN 0-937175-77-3)