155003Scael.\" Copyright 1991 The Regents of the University of California. 255003Scael.\" All rights reserved. 355003Scael.\" 455003Scael.\" Derived from Sun Microsystems rpcgen.1 2.2 88/08/02 4.0 RPCSRC 555003Scael.\" 655003Scael.\" %sccs.include.redist.roff% 755003Scael.\" 8*65227Smckusick.\" @(#)rpcgen.1 5.4 (Berkeley) 12/30/93 955003Scael.\" 1055003Scael.Dd 1155003Scael.Dt RPCGEN 1 1255003Scael.Sh NAME 1355003Scael.Nm rpcgen 1455003Scael.Nd an 1555003Scael.Tn RPC 1655003Scaelprotocol compiler 1755003Scael.Sh SYNOPSIS 1855003Scael.Nm rpcgen Ar infile 1955003Scael.Nm rpcgen 2055003Scael.Fl c | Fl h | Fl l | 2155003Scael.Fl m 2255003Scael.Op Fl o Ar outfile 2355003Scael.Op Ar infile 2455003Scael.Nm rpcgen Fl s Ar transport 2555003Scael.Op Fl o Ar outfile 2655003Scael.Op Ar infile 2755003Scael.Sh DESCRIPTION 2855003Scael.Nm rpcgen 2955003Scaelis a tool that generates 3055003Scael.Tn \&C 3150721Sbosticcode to implement an 3255003Scael.Tn RPC 3350721Sbosticprotocol. The input to 3455003Scael.Nm rpcgen 3550721Sbosticis a language similar to C 3650721Sbosticknown as 3755003Scael.Tn RPC 3850721SbosticLanguage (Remote Procedure Call Language). Information 3950721Sbosticabout the syntax of 4055003Scael.Tn RPC 4150721SbosticLanguage is available in the 4255003Scael.Rs 4355003Scael.%T "Rpcgen Programming Guide" 4455003Scael.Re 4555003Scael.Pp 4655003ScaelAvailable options: 4755003Scael.Bl -tag -width indent 4855003Scael.It Fl c 4955003ScaelCompile into 5055003Scael.Dv XDR 5155003Scaelroutines. 5255003Scael.It Fl h 5355003ScaelCompile into 5455003Scael.Tn \&C 5555003Scaeldata-definitions (a header file) 5655003Scael.It Fl l 5755003ScaelCompile into client-side stubs. 5855003Scael.It Fl m 5955003ScaelCompile into server-side stubs, but do not generate a 6055003Scael.Em main 6155003Scaelroutine. 6255003ScaelThis option is useful for doing callback-routines and for people who 6355003Scaelneed to write their own 6455003Scael.Em main 6555003Scaelroutine to do initialization. 6655003Scael.It Fl o Ar outfile 6755003ScaelSpecify the name of the output file. 6855003ScaelIf none is specified, standard output is used 6955003Scael.Pf ( Fl c , 7055003Scael.Fl h , 7155003Scael.Fl l 7255003Scaeland 7355003Scael.Fl s 7455003Scaelmodes only). 7555003Scael.It Fl s Ar transport 76*65227SmckusickCompile into server-side stubs, using the given transport. The 7755003Scaelsupported transports 7855003Scaelare 7955003Scael.Tn UDP 8055003Scaeland 8155003Scael.Tn TCP . 8255003ScaelThis option may be invoked more than once 8355003Scaelso as to compile a server that serves multiple transports. 8455003Scael.El 8555003Scael.Pp 8655003Scael.Nm rpcgen 8750721Sbosticis normally used as in the first synopsis where it takes an input file 8850721Sbosticand generates four output files. If the 8955003Scael.Ar infile 9050721Sbosticis named 9155003Scael.Pa proto.x , 9250721Sbosticthen 9355003Scael.Nm rpcgen 9450721Sbosticwill generate a header file in 9555003Scael.Pa proto.h , 9655003Scael.Dv XDR 9750721Sbosticroutines in 9855003Scael.Pa proto_xdr.c , 9950721Sbosticserver-side stubs in 10055003Scael.Pa proto_svc.c , 10150721Sbosticand client-side stubs in 10255003Scael.Pa proto_clnt.c . 10355003Scael.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 10755003Scael.Sx USAGE 10850721Sbosticsection below. 10955003Scael.Pp 11050721SbosticThe C-preprocessor, 11155003Scael.Xr cpp 1 , 11250721Sbosticis run on all input files before they are actually 11350721Sbosticinterpreted by 11455003Scael.Nm rpcgen , 11550721Sbosticso all the 11655003Scael.Xr cpp 11750721Sbosticdirectives are legal within an 11855003Scael.Nm rpcgen 11950721Sbosticinput file. For each type of output file, 12055003Scael.Nm rpcgen 12150721Sbosticdefines a special 12255003Scael.Xr cpp 12350721Sbosticsymbol for use by the 12455003Scael.Nm rpcgen 12550721Sbosticprogrammer: 12655003Scael.Pp 12755003Scael.Bl -tag -width "RPC_CLNT" 12855003Scael.It Dv RPC_HDR 12950721Sbosticdefined when compiling into header files 13055003Scael.It Dv RPC_XDR 13150721Sbosticdefined when compiling into 13255003Scael.Dv XDR 13350721Sbosticroutines 13455003Scael.It Dv RPC_SVC 13550721Sbosticdefined when compiling into server-side stubs 13655003Scael.It Dv RPC_CLNT 13750721Sbosticdefined when compiling into client-side stubs 13855003Scael.El 13955003Scael.Pp 14050721SbosticIn addition, 14155003Scael.Nm rpcgen 14250721Sbosticdoes a little preprocessing of its own. 14350721SbosticAny line beginning with 14455003Scael.Ql \&% 14550721Sbosticis passed directly into the output file, uninterpreted by 14655003Scael.Nm rpcgen . 14755003Scael.Pp 14850721SbosticYou can customize some of your 14955003Scael.Dv XDR 15050721Sbosticroutines by leaving those data 15150721Sbostictypes undefined. For every data type that is undefined, 15255003Scael.Nm rpcgen 15350721Sbosticwill assume that there exists a routine with the name 15455003Scael.Em xdr_ 15550721Sbosticprepended to the name of the undefined type. 15655003Scael.Sh SEE ALSO 15755003Scael.Xr cpp 1 15855003Scael.Rs 15955003Scael.%T "Rpcgen Programming Guide" 160*65227Smckusick.%I "Sun Microsystems" 16155003Scael.Re 16255003Scael.Sh BUGS 16355003Scael.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. 16855003Scael.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