1 .\" @(#)rpcgen.1 1.35 93/06/02 SMI
2 .\" $FreeBSD: src/usr.bin/rpcgen/rpcgen.1,v 1.12.2.4 2002/06/21 15:28:50 charnier Exp $
3 .\" Copyright 1985-1993 Sun Microsystems, Inc.
9 .Nd an RPC protocol compiler
18 .Fl D Ns Ar name Ns Op Ar =value
21 .Op Fl I Op Fl K Ar seconds
55 utility is a tool that generates C code to implement an
60 is a language similar to C known as
62 Language (Remote Procedure Call Language).
66 utility is normally used as in the first synopsis where
67 it takes an input file and generates three output files.
80 and client-side stubs in
92 utility can also generate sample client and server files
93 that can be customized to suit a particular application.
99 options generate sample client, server and makefile, respectively.
102 option generates all files, including sample files.
107 then the client side sample file is written to
109 the server side sample file to
111 and the sample makefile to
114 The server created can be started both by the port monitors
118 When it is started by a port monitor,
119 it creates servers only for the transport for which
123 The name of the transport must be specified
124 by setting up the environment variable
126 When the server generated by
129 it creates server handles for all the transports
132 environment variable,
134 it creates server handles for all the visible transports from
138 the transports are chosen at run time and not at compile time.
139 When the server is self-started,
140 it backgrounds itself by default.
141 A special define symbol
143 can be used to run the server process in foreground.
145 The second synopsis provides special features which allow
146 for the creation of more sophisticated
149 These features include support for user provided
156 dispatch table contain:
157 .Bl -bullet -offset indent -compact
159 pointers to the service routine corresponding to that procedure,
161 a pointer to the input and output arguments,
163 the size of these routines.
165 A server can use the dispatch table to check authorization
166 and then to execute the service routine;
167 a client library may use it to deal with the details of storage
168 management and XDR data conversion.
170 The other three synopses shown above are used when
171 one does not want to generate all the output files,
172 but only a particular one.
175 section below for examples of
183 it creates servers for that particular class of transports.
188 it creates a server for the transport specified by
194 accepts the standard input.
198 is run on the input file before it is actually interpreted by
200 For each type of output file,
202 defines a special preprocessor symbol for use by the
205 .Bl -tag -width indent
207 defined when compiling into headers
209 defined when compiling into XDR routines
211 defined when compiling into server-side stubs
213 defined when compiling into client-side stubs
215 defined when compiling into RPC dispatch tables
218 Any line beginning with
220 is passed directly into the output file,
223 To specify the path name of the C preprocessor use
227 For every data type referred to in
230 assumes that there exists a
231 routine with the string
233 prepended to the name of the data type.
234 If this routine does not exist in the
236 library, it must be provided.
237 Providing an undefined data type
238 allows customization of
242 The following options are available:
243 .Bl -tag -width indent
245 Generate all files, including sample files.
247 Backward compatibility mode.
248 Generate transport specific
250 code for older versions
251 of the operating system.
255 this compatibility flag is turned on by
258 supports only the older
266 Generate header and stub files which can be used with
268 C compilers. Headers generated with this flag can also be
269 used with C++ programs.
271 .It Fl D Ns Ar name=value
272 .\".It Fl D Ns Ar name Ns Op Ar =value
277 directive in the source.
284 This option may be specified more than once.
286 Compile into C data-definitions (a header).
288 option can be used in conjunction to produce a
289 header which supports
293 Size at which to start generating inline code.
294 This option is useful for optimization.
295 The default size is 5.
297 Note: in order to provide backwards compatibility with the older
301 platform, the default is actually 0 (which means
302 that inline code generation is disabled by default). You must specify
303 a non-zero value explicitly to override this default.
307 in the server side stubs.
308 Such servers can be self-started or can be started by
310 When the server is self-started, it backgrounds itself by default.
311 A special define symbol
313 can be used to run the
314 server process in foreground, or the user may simply compile without
319 If there are no pending client requests, the
321 servers exit after 120 seconds (default).
322 The default can be changed with the
325 All the error messages for
328 are always logged with
332 .\" this option is supported for backward compatibility only.
335 .\" generates servers that can be invoked through portmonitors.
338 By default, services created using
341 port monitors wait 120 seconds
342 after servicing a request before exiting.
343 That interval can be changed using the
346 To create a server that exits immediately upon servicing a request,
349 To create a server that never exits, the appropriate argument is
352 When monitoring for a server,
355 spawn a new process in response to a service request.
356 If it is known that a server will be used with such a monitor, the
357 server should exit immediately on completion.
363 Compile into client-side stubs.
365 When the servers are started in foreground, use
367 to log the server errors instead of printing them on the standard
370 Compile into server-side stubs,
371 but do not generate a
374 This option is useful for doing callback-routines
375 and for users who need to write their own
377 routine to do initialization.
379 Generate multithread-safe stubs for passing arguments and results between
380 rpcgen generated code and user written code.
381 This option is useful
382 for users who want to use threads in their code.
385 functions are not yet MT-safe, which means that rpcgen generated server-side
386 code will not be MT-safe.
388 This option allows procedures to have multiple arguments.
389 It also uses the style of parameter passing that closely resembles C.
390 So, when passing an argument to a remote procedure, you do not have to
391 pass a pointer to the argument, but can pass the argument itself.
392 This behavior is different from the old style of
395 To maintain backward compatibility,
396 this option is not the default.
398 Compile into server-side stubs for the transport
401 There should be an entry for
405 This option may be specified more than once,
406 so as to compile a server that serves multiple transports.
408 Specify the name of the output file.
409 If none is specified,
410 standard output is used
425 Compile into server-side stubs for all the
426 transports belonging to the class
428 The supported classes are
440 for the meanings associated with these classes).
441 This option may be specified more than once.
443 the transports are chosen at run time and not at compile time.
445 Generate sample client code that uses remote procedure calls.
449 which can be used for compiling the application.
451 Generate sample server code that uses remote procedure calls.
457 Generate the code to support
472 are used exclusively to generate a particular type of file,
477 are global and can be used with the other options.
479 Give the name of the directory where
481 will start looking for the C-preprocessor.
484 The following example:
485 .Dl example% rpcgen -T prot.x
487 generates all the five files:
495 The following example sends the C data-definitions (header)
496 to the standard output.
497 .Dl example% rpcgen -h prot.x
499 To send the test version of the
501 server side stubs for
502 all the transport belonging to the class
504 to standard output, use:
505 .Dl example% rpcgen -s datagram_n -DTEST prot.x
507 To create the server side stubs for the transport indicated
512 .Dl example% rpcgen -n tcp -o prot_svc.c prot.x
518 .\" .BR rpc_svc_calls (3)
520 .%T The rpcgen chapter in the NETP manual