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