NetBSD/usr.bin/rpcgen/rpcgen.1

156 lines
3.4 KiB
Groff
Raw Normal View History

1993-04-03 04:51:49 +04:00
.\" @(#)rpcgen.1 2.2 88/08/02 4.0 RPCSRC
1993-06-10 23:15:08 +04:00
.\" converted to -mdoc macros by J.T. Conklin <jtc@wimsey.com>
.Dd January 18, 1988
.Dt RPCGEN 1
.Os
.Sh NAME
.Nm rpcgen
.Nd RPC protocol compiler
.Sh SYNOPSIS
.Nm rpcgen
.Ar infile
.Nm rpcgen
.Fl c Li |
.Fl h Li |
.Fl l Li |
.Fl m
.Op Fl o Ar outfile
.Op Ar infile
.Nm rpcgen
.Fl s Ar transport
.Op Fl o Ar outfile
.Op Ar infile
.Sh DESCRIPTION
.Nm rpcgen
is a tool that generates C code to implement an
.Tn RPC
1993-04-03 04:51:49 +04:00
protocol. The input to
1993-06-10 23:15:08 +04:00
.Nm rpcgen
is a language similar to C known as
.Tn RPC
Language (Remote Procedure Call Language). Information about the
syntax of
.Tn RPC
1993-04-03 04:51:49 +04:00
Language is available in the
1993-06-10 23:15:08 +04:00
.Rs
.%T "rpcgen Programming Guide"
.Re
.Pp
.Nm rpcgen
1993-04-03 04:51:49 +04:00
is normally used as in the first synopsis where it takes an input file
and generates four output files. If the
1993-06-10 23:15:08 +04:00
.Ar infile
1993-04-03 04:51:49 +04:00
is named
1993-06-10 23:15:08 +04:00
.Pa proto.x ,
1993-04-03 04:51:49 +04:00
then
1993-06-10 23:15:08 +04:00
.Nm rpcgen
1993-04-03 04:51:49 +04:00
will generate a header file in
1993-06-10 23:15:08 +04:00
.Pa proto.h ,
.Tn XDR
1993-04-03 04:51:49 +04:00
routines in
1993-06-10 23:15:08 +04:00
.Pa proto_xdr.c ,
1993-04-03 04:51:49 +04:00
server-side stubs in
1993-06-10 23:15:08 +04:00
.Pa proto_svc.c ,
1993-04-03 04:51:49 +04:00
and client-side stubs in
1993-06-10 23:15:08 +04:00
.Pa proto_clnt.c .
.Pp
1993-04-03 04:51:49 +04:00
The other synopses shown above are used when one does not want to
1993-06-10 23:15:08 +04:00
generate all the output files, but only a particular one.
.\" Their usage is described in the
.\" .Sx USAGE
.\" section below.
.Pp
1993-04-03 04:51:49 +04:00
The C-preprocessor,
1993-06-10 23:15:08 +04:00
.Xr cpp 1 ,
1993-04-03 04:51:49 +04:00
is run on all input files before they are actually
interpreted by
1993-06-10 23:15:08 +04:00
.Nm rpcgen ,
1993-04-03 04:51:49 +04:00
so all the
1993-06-10 23:15:08 +04:00
.Xr cpp
1993-04-03 04:51:49 +04:00
directives are legal within an
1993-06-10 23:15:08 +04:00
.Nm rpcgen
1993-04-03 04:51:49 +04:00
input file. For each type of output file,
1993-06-10 23:15:08 +04:00
.Nm rpcgen
1993-04-03 04:51:49 +04:00
defines a special
1993-06-10 23:15:08 +04:00
.Xr cpp
1993-04-03 04:51:49 +04:00
symbol for use by the
1993-06-10 23:15:08 +04:00
.Nm rpcgen
1993-04-03 04:51:49 +04:00
programmer:
1993-06-10 23:15:08 +04:00
.Pp
.Bl -tag -width RPC_CLNT -compact
.It Dv RPC_HDR
1993-04-03 04:51:49 +04:00
defined when compiling into header files
1993-06-10 23:15:08 +04:00
.It Dv RPC_XDR
1993-04-03 04:51:49 +04:00
defined when compiling into
1993-06-10 23:15:08 +04:00
.Tn XDR
1993-04-03 04:51:49 +04:00
routines
1993-06-10 23:15:08 +04:00
.It Dv RPC_SVC
1993-04-03 04:51:49 +04:00
defined when compiling into server-side stubs
1993-06-10 23:15:08 +04:00
.It Dv RPC_CLNT
1993-04-03 04:51:49 +04:00
defined when compiling into client-side stubs
1993-06-10 23:15:08 +04:00
.El
.Pp
1993-04-03 04:51:49 +04:00
In addition,
1993-06-10 23:15:08 +04:00
.Nm rpcgen
does a little preprocessing of its own. Any line beginning with
.Sq %
1993-04-03 04:51:49 +04:00
is passed directly into the output file, uninterpreted by
1993-06-10 23:15:08 +04:00
.Nm rpcgen .
.Pp
1993-04-03 04:51:49 +04:00
You can customize some of your
1993-06-10 23:15:08 +04:00
.Tn XDR
routines by leaving those data types undefined. For every data type
that is undefined,
.Nm rpcgen
1993-04-03 04:51:49 +04:00
will assume that there exists a routine with the name
1993-06-10 23:15:08 +04:00
.Tn xdr_
1993-04-03 04:51:49 +04:00
prepended to the name of the undefined type.
1993-06-10 23:15:08 +04:00
.Sh OPTIONS
.Bl -tag -width indent
.It Fl c
1993-04-03 04:51:49 +04:00
Compile into
1993-06-10 23:15:08 +04:00
.Tn XDR
1993-04-03 04:51:49 +04:00
routines.
1993-06-10 23:15:08 +04:00
.It Fl h
Compile into C data-definitions (a header file).
.It Fl l
1993-04-03 04:51:49 +04:00
Compile into client-side stubs.
1993-06-10 23:15:08 +04:00
.It Fl m
Compile into server-side stubs, but do not generate a
.Fn main
routine. This option is useful for doing callback-routines and for
people who need to write their own
.Fn main
routine to do initialization.
.It Fl o Ar outfile
Specify the name of the output file. If none is specified, standard
output is used (
.Fl c ,
.Fl h ,
.Fl l
1993-04-03 04:51:49 +04:00
and
1993-06-10 23:15:08 +04:00
.Fl s
1993-04-03 04:51:49 +04:00
modes only).
1993-06-10 23:15:08 +04:00
.It Fl s Ar transport
1993-04-03 04:51:49 +04:00
Compile into server-side stubs, using the the given transport. The
1993-06-10 23:15:08 +04:00
supported transports are
.Tn udp
1993-04-03 04:51:49 +04:00
and
1993-06-10 23:15:08 +04:00
.Tn tcp .
This option may be invoked more than once so as to compile a server
that serves multiple transports.
.El
.Sh SEE ALSO
.Xr cpp 1
.Rs
.%T "rpcgen Programming Guide"
.Re
.Sh BUGS
Nesting is not supported. As a work-around, structures can be
declared at top-level, and their name used inside other structures in
order to achieve the same effect.
.Pp
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.