1 .\" Copyright 1985-1993 Sun Microsystems, Inc.
8 .Nd an RPC protocol compiler
17 .Fl D Ns Ar name Ns Op Ar =value
20 .Op Fl I Fl P Op Fl K Ar seconds
54 utility is a tool that generates C code to implement an
59 is a language similar to C known as
61 Language (Remote Procedure Call Language).
65 utility is normally used as in the first synopsis where
66 it takes an input file and generates three output files.
79 and client-side stubs in
91 utility can also generate sample client and server files
92 that can be customized to suit a particular application.
98 options generate sample client, server and makefile, respectively.
101 option generates all files, including sample files.
106 then the client side sample file is written to
108 the server side sample file to
110 and the sample makefile to
116 the server created can be started both by the port monitors
120 When it is started by a port monitor,
121 it creates servers only for the transport for which
125 The name of the transport may be specified
126 by setting up the environment variable
128 When the server generated by
131 it creates server handles for all the transports
134 environment variable,
136 it creates server handles for all the visible transports from
140 the transports are chosen at run time and not at compile time.
141 When the server is self-started,
142 it backgrounds itself by default.
143 A special define symbol
145 can be used to run the server process in foreground.
147 The second synopsis provides special features which allow
148 for the creation of more sophisticated
151 These features include support for user provided
158 dispatch table contain:
159 .Bl -bullet -offset indent -compact
161 pointers to the service routine corresponding to that procedure,
163 a pointer to the input and output arguments,
165 the size of these routines.
167 A server can use the dispatch table to check authorization
168 and then to execute the service routine;
169 a client library may use it to deal with the details of storage
170 management and XDR data conversion.
172 The other three synopses shown above are used when
173 one does not want to generate all the output files,
174 but only a particular one.
177 section below for examples of
185 it creates servers for that particular class of transports.
190 it creates a server for the transport specified by
196 accepts the standard input.
200 is run on the input file before it is actually interpreted by
202 For each type of output file,
204 defines a special preprocessor symbol for use by the
207 .Bl -tag -width indent
209 defined when compiling into headers
211 defined when compiling into XDR routines
213 defined when compiling into server-side stubs
215 defined when compiling into client-side stubs
217 defined when compiling into RPC dispatch tables
220 Any line beginning with
222 is passed directly into the output file,
225 To specify the path name of the C preprocessor use
229 For every data type referred to in
232 assumes that there exists a
233 routine with the string
235 prepended to the name of the data type.
236 If this routine does not exist in the
238 library, it must be provided.
239 Providing an undefined data type
240 allows customization of
244 The following options are available:
245 .Bl -tag -width indent
247 Generate all files, including sample files.
249 Backward compatibility mode.
250 Generate transport specific
252 code for older versions
253 of the operating system.
259 Generate ANSI C code.
260 This is always done, the flag is only provided for backwards compatibility.
262 .It Fl D Ns Ar name=value
263 .\".It Fl D Ns Ar name Ns Op Ar =value
268 directive in the source.
275 This option may be specified more than once.
277 Compile into C data-definitions (a header).
279 option can be used in conjunction to produce a
280 header which supports
284 Size at which to start generating inline code.
285 This option is useful for optimization.
286 The default size is 5.
288 Note: in order to provide backwards compatibility with the older
292 platform, the default is actually 0 (which means
293 that inline code generation is disabled by default).
295 a non-zero value explicitly to override this default.
299 in the server side stubs.
300 Such servers can be self-started or can be started by
302 When the server is self-started, it backgrounds itself by default.
303 A special define symbol
305 can be used to run the
306 server process in foreground, or the user may simply compile without
311 If there are no pending client requests, the
313 servers exit after 120 seconds (default).
314 The default can be changed with the
317 All the error messages for
320 are always logged with
324 Contrary to some systems, in
326 this option is needed to generate
327 servers that can be invoked through portmonitors and
330 By default, services created using
333 port monitors wait 120 seconds
334 after servicing a request before exiting.
335 That interval can be changed using the
338 To create a server that exits immediately upon servicing a request,
341 To create a server that never exits, the appropriate argument is
344 When monitoring for a server,
347 spawn a new process in response to a service request.
348 If it is known that a server will be used with such a monitor, the
349 server should exit immediately on completion.
355 Compile into client-side stubs.
357 When the servers are started in foreground, use
359 to log the server errors instead of printing them on the standard
362 Compile into server-side stubs,
363 but do not generate a
366 This option is useful for doing callback-routines
367 and for users who need to write their own
369 routine to do initialization.
371 Generate multithread-safe stubs for passing arguments and results between
372 rpcgen generated code and user written code.
373 This option is useful
374 for users who want to use threads in their code.
377 functions are not yet MT-safe, which means that rpcgen generated server-side
378 code will not be MT-safe.
380 Allow procedures to have multiple arguments.
381 It also uses the style of parameter passing that closely resembles C.
382 So, when passing an argument to a remote procedure, you do not have to
383 pass a pointer to the argument, but can pass the argument itself.
384 This behavior is different from the old style of
387 To maintain backward compatibility,
388 this option is not the default.
390 Compile into server-side stubs for the transport
393 There should be an entry for
397 This option may be specified more than once,
398 so as to compile a server that serves multiple transports.
400 Specify the name of the output file.
401 If none is specified,
402 standard output is used
418 in the server side stubs.
421 Contrary to some systems, in
423 this option is needed to generate
424 servers that can be monitored.
428 option has been specified,
430 is turned off automatically.
432 Compile into server-side stubs for all the
433 transports belonging to the class
435 The supported classes are
447 for the meanings associated with these classes).
448 This option may be specified more than once.
450 the transports are chosen at run time and not at compile time.
452 Generate sample client code that uses remote procedure calls.
456 which can be used for compiling the application.
458 Generate sample server code that uses remote procedure calls.
464 Generate the code to support
479 are used exclusively to generate a particular type of file,
484 are global and can be used with the other options.
486 Give the name of the directory where
488 will start looking for the C-preprocessor.
493 environment variable is set, its value is used as the command line of the
494 C preprocessor to be run on the input file.
496 The following example:
497 .Dl example% rpcgen -T prot.x
499 generates all the five files:
507 The following example sends the C data-definitions (header)
508 to the standard output.
509 .Dl example% rpcgen -h prot.x
511 To send the test version of the
513 server side stubs for
514 all the transport belonging to the class
516 to standard output, use:
517 .Dl example% rpcgen -s datagram_n -DTEST prot.x
519 To create the server side stubs for the transport indicated
524 .Dl example% rpcgen -n tcp -o prot_svc.c prot.x
528 .Xr rpc_svc_calls 3 ,
533 .%T The rpcgen chapter in the NETP manual