RAPGEN(1)

NAME
rapgen - RPC/RAP protocol compiler

SYNOPSIS
rapgen [ -dlrpOPA ] [ -a | -M ] [ -t udp|tcp ]* infile

rapgen
    [ -dlrpOPA ] { -c | -s | -h | -x } [ -o outfile ]
    [ infile ]

rapgen
    [ -dPA ] { -C | -S } [ -t udp|tcp ]* [ -o outfile ]
    [ infile ]

DESCRIPTION
The rapgen command is an adaptation of Sun's rpcgen(1) command. The rapgen command has several features that make it a bit more usable than rpcgen, and a rap option that currently allows the same transport to be used by the RAP protocol and the protcol being compiled, but may eventually produce RAP registration code in the server and RAP lookup and binding in the client.

The original rpcgen generates the following files for the input file proto.x:

proto_svc.c	Service program, stub procedures, and optional main().
proto_clnt.c	Client stubs.
proto_xdr.c	Data structure encode/decode routines.
proto.h	Data structure and constant declarations.

The rapgen command produces these same output files, however, the service main() routine is written to a separate file. The following summarizes the additional output files generated by rapgen:

proto.c	The client's main() function.
protod.c	The service main().
Makefile	Build rules.

By default, rapgen generates the proto_svc.c, proto_clnt.c, proto_xdr.c and proto.h files.

See the SYNTAX section below for syntax changes recogized by rapgen but not by rpcgen.

OPTIONS

-a  Produce all modules.

-c  Produce client stubs (proto_clnt.c file).

-s  Produce service stubs (proto_svc.c file).

-h  Produce include file (proto.h file).

-x  Produce xdr routines (proto_xdr.c file).

-C  Produce client main (proto.c file).

-S  Produce service main (protod.c file).

-M  Produce Makefile.

-l  Produce a library of xdr, client stub, and server stub routines.

-O  Optimize xdr output (try to inline simple routines that are ordinarily procedure calls).

-P  Generate ANSI function prototypes (default depends on the default compiler for a given platform).

-A  Generate ANSI C (use const and uL, and assume standard ANSI include files).

-o name
    Output file name (default output file name depends on the option given; see the DESCRIPTION section for default names).

-t udp
    Force the use of the UDP tranport (default allows all known transports).

-t tcp
    Force the use of the TCP transport (default allows all known transports).

-d  Include debugging in output files.

-p  Generate calls to svc routines such that a pointer to the return value is passed as the final parameter, after the struct svc_req parameter. Without this option, the svc routine must allocate static space for the return value.

-r  Include RAP support in output files. This allows the same transport handle the same client and/or service routines to be use for not only the protocol specified in the proto.x file, but the RAP protocol as well, saving kernel network resources.

SYNTAX
The syntax recognized by rapgen is a superset of the syntax recognized by rpcgen. The following additional features are supported:

•   Procedures can include multiple parameters and (optional) parameter names. Single-indirect pointers are also recognized (parameter types with one star (``*'')).

•   Each procedure can include an authentication flavor list.

•   Program can include authentication flavor list.

•   Unions can include multiple fields in a single discriminated arm.

The following rules summarize the syntax changes:

decl_spec ::=	type name;
decl_list ::=	decl_spec*
procedure_spec ::=	type
	name "(" decl_list ")" "=" number
	["authentication" name [, name]* ]* ";"
program_spec ::=	"program" name "{" [version_spec]* "}" "=" number
	["authentication" name [, name]* ]* ";"
union_spec ::=	"union" name "switch (" type [name] ")" "{"
	["case" name ":" decl_list* ]*
	["default" ":" decl_list* ]*
	"}" ";"

SEE ALSO
cpp(1), rpcgen(1), rpc(3)

BUGS
The support for authentication flavors is untested.

The RAP option, -r, should generate more code when used with the -C or -S options.