1.\" Copyright 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" Derived from Sun Microsystems rpcgen.1 2.2 88/08/02 4.0 RPCSRC 5.\" 6.\" %sccs.include.redist.roff% 7.\" 8.\" @(#)rpcgen.1 5.3 (Berkeley) 07/12/92 9.\" 10.Dd 11.Dt RPCGEN 1 12.Sh NAME 13.Nm rpcgen 14.Nd an 15.Tn RPC 16protocol compiler 17.Sh SYNOPSIS 18.Nm rpcgen Ar infile 19.Nm rpcgen 20.Fl c | Fl h | Fl l | 21.Fl m 22.Op Fl o Ar outfile 23.Op Ar infile 24.Nm rpcgen Fl s Ar transport 25.Op Fl o Ar outfile 26.Op Ar infile 27.Sh DESCRIPTION 28.Nm rpcgen 29is a tool that generates 30.Tn \&C 31code to implement an 32.Tn RPC 33protocol. The input to 34.Nm rpcgen 35is a language similar to C 36known as 37.Tn RPC 38Language (Remote Procedure Call Language). Information 39about the syntax of 40.Tn RPC 41Language is available in the 42.Rs 43.%T "Rpcgen Programming Guide" 44.Re 45.Pp 46Available options: 47.Bl -tag -width indent 48.It Fl c 49Compile into 50.Dv XDR 51routines. 52.It Fl h 53Compile into 54.Tn \&C 55data-definitions (a header file) 56.It Fl l 57Compile into client-side stubs. 58.It Fl m 59Compile into server-side stubs, but do not generate a 60.Em main 61routine. 62This option is useful for doing callback-routines and for people who 63need to write their own 64.Em main 65routine to do initialization. 66.It Fl o Ar outfile 67Specify the name of the output file. 68If none is specified, standard output is used 69.Pf ( Fl c , 70.Fl h , 71.Fl l 72and 73.Fl s 74modes only). 75.It Fl s Ar transport 76Compile into server-side stubs, using the the given transport. The 77supported transports 78are 79.Tn UDP 80and 81.Tn TCP . 82This option may be invoked more than once 83so as to compile a server that serves multiple transports. 84.El 85.Pp 86.Nm rpcgen 87is normally used as in the first synopsis where it takes an input file 88and generates four output files. If the 89.Ar infile 90is named 91.Pa proto.x , 92then 93.Nm rpcgen 94will generate a header file in 95.Pa proto.h , 96.Dv XDR 97routines in 98.Pa proto_xdr.c , 99server-side stubs in 100.Pa proto_svc.c , 101and client-side stubs in 102.Pa proto_clnt.c . 103.Pp 104The other synopses shown above are used when one does not want to 105generate all the output files, but only a particular one. Their 106usage is described in the 107.Sx USAGE 108section below. 109.Pp 110The C-preprocessor, 111.Xr cpp 1 , 112is run on all input files before they are actually 113interpreted by 114.Nm rpcgen , 115so all the 116.Xr cpp 117directives are legal within an 118.Nm rpcgen 119input file. For each type of output file, 120.Nm rpcgen 121defines a special 122.Xr cpp 123symbol for use by the 124.Nm rpcgen 125programmer: 126.Pp 127.Bl -tag -width "RPC_CLNT" 128.It Dv RPC_HDR 129defined when compiling into header files 130.It Dv RPC_XDR 131defined when compiling into 132.Dv XDR 133routines 134.It Dv RPC_SVC 135defined when compiling into server-side stubs 136.It Dv RPC_CLNT 137defined when compiling into client-side stubs 138.El 139.Pp 140In addition, 141.Nm rpcgen 142does a little preprocessing of its own. 143Any line beginning with 144.Ql \&% 145is passed directly into the output file, uninterpreted by 146.Nm rpcgen . 147.Pp 148You can customize some of your 149.Dv XDR 150routines by leaving those data 151types undefined. For every data type that is undefined, 152.Nm rpcgen 153will assume that there exists a routine with the name 154.Em xdr_ 155prepended to the name of the undefined type. 156.Sh SEE ALSO 157.Xr cpp 1 158.Rs 159.%T "Rpcgen Programming Guide" 160.%I "Sun Micropsystems" 161.Re 162.Sh BUGS 163.Pp 164Nesting is not supported. 165As a work-around, structures can be declared at 166top-level, and their name used inside other structures in order to achieve 167the same effect. 168.Pp 169Name clashes can occur when using program definitions, since the apparent 170scoping does not really apply. Most of these can be avoided by giving 171unique names for programs, versions, procedures and types. 172