xref: /csrg-svn/lib/librpc/man/man1/rpcgen.1 (revision 55003)
1*55003Scael.\" Copyright 1991 The Regents of the University of California.
2*55003Scael.\" All rights reserved.
3*55003Scael.\"
4*55003Scael.\" Derived from Sun Microsystems rpcgen.1        2.2 88/08/02 4.0 RPCSRC
5*55003Scael.\"
6*55003Scael.\" %sccs.include.redist.roff%
7*55003Scael.\"
8*55003Scael.\"	@(#)rpcgen.1	5.3 (Berkeley) 07/12/92
9*55003Scael.\"
10*55003Scael.Dd
11*55003Scael.Dt RPCGEN 1
12*55003Scael.Sh NAME
13*55003Scael.Nm rpcgen
14*55003Scael.Nd an
15*55003Scael.Tn RPC
16*55003Scaelprotocol compiler
17*55003Scael.Sh SYNOPSIS
18*55003Scael.Nm rpcgen Ar infile
19*55003Scael.Nm rpcgen
20*55003Scael.Fl c | Fl h | Fl l |
21*55003Scael.Fl m
22*55003Scael.Op Fl o Ar outfile
23*55003Scael.Op Ar infile
24*55003Scael.Nm rpcgen Fl s Ar transport
25*55003Scael.Op Fl o Ar outfile
26*55003Scael.Op Ar infile
27*55003Scael.Sh DESCRIPTION
28*55003Scael.Nm rpcgen
29*55003Scaelis a tool that generates
30*55003Scael.Tn \&C
3150721Sbosticcode to implement an
32*55003Scael.Tn RPC
3350721Sbosticprotocol.  The input to
34*55003Scael.Nm rpcgen
3550721Sbosticis a language similar to C
3650721Sbosticknown as
37*55003Scael.Tn RPC
3850721SbosticLanguage (Remote Procedure Call Language).  Information
3950721Sbosticabout the syntax of
40*55003Scael.Tn RPC
4150721SbosticLanguage is available in the
42*55003Scael.Rs
43*55003Scael.%T "Rpcgen Programming Guide"
44*55003Scael.Re
45*55003Scael.Pp
46*55003ScaelAvailable options:
47*55003Scael.Bl -tag -width indent
48*55003Scael.It Fl c
49*55003ScaelCompile into
50*55003Scael.Dv XDR
51*55003Scaelroutines.
52*55003Scael.It Fl h
53*55003ScaelCompile into
54*55003Scael.Tn \&C
55*55003Scaeldata-definitions (a header file)
56*55003Scael.It Fl l
57*55003ScaelCompile into client-side stubs.
58*55003Scael.It Fl m
59*55003ScaelCompile into server-side stubs, but do not generate a
60*55003Scael.Em main
61*55003Scaelroutine.
62*55003ScaelThis option is useful for doing callback-routines and for people who
63*55003Scaelneed to write their own
64*55003Scael.Em main
65*55003Scaelroutine to do initialization.
66*55003Scael.It Fl o Ar outfile
67*55003ScaelSpecify the name of the output file.
68*55003ScaelIf none is specified, standard output is used
69*55003Scael.Pf ( Fl c ,
70*55003Scael.Fl h ,
71*55003Scael.Fl l
72*55003Scaeland
73*55003Scael.Fl s
74*55003Scaelmodes only).
75*55003Scael.It Fl s Ar transport
76*55003ScaelCompile into server-side stubs, using the the given transport.  The
77*55003Scaelsupported transports
78*55003Scaelare
79*55003Scael.Tn UDP
80*55003Scaeland
81*55003Scael.Tn TCP .
82*55003ScaelThis option may be invoked more than once
83*55003Scaelso as to compile a server that serves multiple transports.
84*55003Scael.El
85*55003Scael.Pp
86*55003Scael.Nm rpcgen
8750721Sbosticis normally used as in the first synopsis where it takes an input file
8850721Sbosticand generates four output files. If the
89*55003Scael.Ar infile
9050721Sbosticis named
91*55003Scael.Pa proto.x ,
9250721Sbosticthen
93*55003Scael.Nm rpcgen
9450721Sbosticwill generate a header file in
95*55003Scael.Pa proto.h ,
96*55003Scael.Dv XDR
9750721Sbosticroutines in
98*55003Scael.Pa proto_xdr.c ,
9950721Sbosticserver-side stubs in
100*55003Scael.Pa proto_svc.c ,
10150721Sbosticand client-side stubs in
102*55003Scael.Pa proto_clnt.c .
103*55003Scael.Pp
10450721SbosticThe other synopses shown above are used when one does not want to
10550721Sbosticgenerate all the output files, but only a particular one.  Their
10650721Sbosticusage is described in the
107*55003Scael.Sx USAGE
10850721Sbosticsection below.
109*55003Scael.Pp
11050721SbosticThe C-preprocessor,
111*55003Scael.Xr cpp 1 ,
11250721Sbosticis run on all input files before they are actually
11350721Sbosticinterpreted by
114*55003Scael.Nm rpcgen ,
11550721Sbosticso all the
116*55003Scael.Xr cpp
11750721Sbosticdirectives are legal within an
118*55003Scael.Nm rpcgen
11950721Sbosticinput file.  For each type of output file,
120*55003Scael.Nm rpcgen
12150721Sbosticdefines a special
122*55003Scael.Xr cpp
12350721Sbosticsymbol for use by the
124*55003Scael.Nm rpcgen
12550721Sbosticprogrammer:
126*55003Scael.Pp
127*55003Scael.Bl -tag -width "RPC_CLNT"
128*55003Scael.It Dv RPC_HDR
12950721Sbosticdefined when compiling into header files
130*55003Scael.It Dv RPC_XDR
13150721Sbosticdefined when compiling into
132*55003Scael.Dv XDR
13350721Sbosticroutines
134*55003Scael.It Dv RPC_SVC
13550721Sbosticdefined when compiling into server-side stubs
136*55003Scael.It Dv RPC_CLNT
13750721Sbosticdefined when compiling into client-side stubs
138*55003Scael.El
139*55003Scael.Pp
14050721SbosticIn addition,
141*55003Scael.Nm rpcgen
14250721Sbosticdoes a little preprocessing of its own.
14350721SbosticAny line beginning with
144*55003Scael.Ql \&%
14550721Sbosticis passed directly into the output file, uninterpreted by
146*55003Scael.Nm rpcgen .
147*55003Scael.Pp
14850721SbosticYou can customize some of your
149*55003Scael.Dv XDR
15050721Sbosticroutines by leaving those data
15150721Sbostictypes undefined.  For every data type that is undefined,
152*55003Scael.Nm rpcgen
15350721Sbosticwill assume that there exists a routine with the name
154*55003Scael.Em xdr_
15550721Sbosticprepended to the name of the undefined type.
156*55003Scael.Sh SEE ALSO
157*55003Scael.Xr cpp 1
158*55003Scael.Rs
159*55003Scael.%T "Rpcgen Programming Guide"
160*55003Scael.%I "Sun Micropsystems"
161*55003Scael.Re
162*55003Scael.Sh BUGS
163*55003Scael.Pp
16450721SbosticNesting is not supported.
16550721SbosticAs a work-around, structures can be declared at
16650721Sbostictop-level, and their name used inside other structures in order to achieve
16750721Sbosticthe same effect.
168*55003Scael.Pp
16950721SbosticName clashes can occur when using program definitions, since the apparent
17050721Sbosticscoping does not really apply. Most of these can be avoided by giving
17150721Sbosticunique names for programs, versions, procedures and types.
172