1 .\" $NetBSD: rpcgen.1,v 1.8 1998/04/28 07:19:29 fair Exp $
2 .\" from: @(#)rpcgen.new.1 1.1 90/11/09 TIRPC 1.0; from 40.10 of 10/10/89
3 .\" Copyright (c) 1988,1990 Sun Microsystems, Inc. - All Rights Reserved.
8 .Nd Remote Procedure Call (RPC) protocol compiler
13 .Op Fl D Op Ar name=value
42 is a tool that generates C code to implement an
47 is a language similar to C known as
49 Language (Remote Procedure Call Language).
51 is normally used as in the first synopsis where
52 it takes an input file and generates up to four output files.
59 will generate a header file in
66 and client-side stubs in
71 it will also generate the
78 it will also generate sample code which would illustrate how to use the
79 remote procedures on the client side. This code would be created in
84 it will also generate a sample server code which would illustrate how to write
85 the remote procedures. This code would be created in
88 The server created can be started both by the port monitors
94 When it is started by a port monitor,
95 it creates servers only for the transport for which
96 the file descriptor 0 was passed.
97 The name of the transport must be specified
98 by setting up the environmental variable
100 When the server generated by
103 it creates server handles for all the transports
106 environment variable,
108 it creates server handles for all the visible transports from
113 the transports are chosen at run time and not at compile time.
114 When the server is self-started,
115 it backgrounds itself by default.
116 A special define symbol
118 can be used to run the server process in foreground.
120 The second synopsis provides special features which allow
121 for the creation of more sophisticated
124 These features include support for user provided
131 dispatch table contain:
133 .Bl -inset -offset indent -compact
135 pointers to the service routine corresponding to that procedure,
137 a pointer to the input and output arguments,
139 the size of these routines
142 A server can use the dispatch table to check authorization
143 and then to execute the service routine;
144 a client library may use it to deal with the details of storage
149 The other three synopses shown above are used when
150 one does not want to generate all the output files,
151 but only a particular one.
152 Some examples of their usage is described in the
160 it creates servers for that particular class of transports.
165 it creates a server for the transport specified by
171 accepts the standard input.
175 is run on the input file before it is actually interpreted by
177 For each type of output file,
179 defines a special preprocessor symbol for use by the
182 .Bl -tag -width RPC_CLNT
184 defined when compiling into header files
186 defined when compiling into
190 defined when compiling into server-side stubs
192 defined when compiling into client-side stubs
194 defined when compiling into
199 Any line beginning with
201 is passed directly into the output file,
205 For every data type referred to in
208 assumes that there exists a
209 routine with the string
211 prepended to the name of the data type.
212 If this routine does not exist in the
214 library, it must be provided.
215 Providing an undefined data type
216 allows customization of
220 .Bl -tag -width indent
222 Generate all the files including sample code for client and server side.
224 This generates code for the
233 This option also generates code that could be compiled with the
239 .It Fl D Ar name Ns Op Ar =value
244 directive in the source.
250 This option may be specified more than once.
252 Compile into C data-definitions (a header file).
255 option can be used in conjunction to produce a
256 header file which supports
260 By default, services created using
263 after servicing a request before exiting.
264 That interval can be changed using the
267 To create a server that exits immediately upon servicing a request,
270 To create a server that never exits, the appropriate argument is
273 When monitoring for a server,
274 some port monitors, like the
279 spawn a new process in response to a service request.
280 If it is known that a server will be used with such a monitor, the
281 server should exit immediately on completion.
287 Server errors will be sent to syslog instead of stderr.
289 Compile into client-side stubs.
291 Compile into server-side stubs,
292 but do not generate a
295 This option is useful for doing callback-routines
296 and for users who need to write their own
298 routine to do initialization.
302 This allows procedures to have multiple arguments.
303 It also uses the style of parameter passing that closely resembles C.
304 So, when passing an argument to a remote procedure you do not have
305 to pass a pointer to the argument but the argument itself.
306 This behaviour is different from the oldstyle
310 The newstyle is not the default case because of backward compatibility.
312 Compile into server-side stubs for the transport
315 There should be an entry for
319 This option may be specified more than once,
320 so as to compile a server that serves multiple transports.
322 Specify the name of the output file.
323 If none is specified,
324 standard output is used
331 Generate sample code to show the use of remote procedure and how to bind
332 to the server before calling the client side stubs generated by
335 Generate skeleton code for the remote procedures on the server side. You would need
336 to fill in the actual code for the remote procedures.
338 Compile into server-side stubs for all the
339 transports belonging to the class
341 The supported classes are
353 for the meanings associated with these classes.
356 currently supports only the
361 This option may be specified more than once.
363 the transports are chosen at run time and not at compile time.
365 Generate the code to support
382 are used exclusively to generate a particular type of file,
387 are global and can be used with the other options.
391 Language does not support nesting of structures.
393 structures can be declared at the top-level,
394 and their name used inside other structures in
395 order to achieve the same effect.
397 Name clashes can occur when using program definitions,
398 since the apparent scoping does not really apply.
399 Most of these can be avoided by giving
400 unique names for programs,
402 procedures and types.
404 The server code generated with
406 option refers to the transport indicated by
408 and hence is very site specific.
413 .Bd -literal -offset indent
417 generates the five files:
425 The following example sends the C data-definitions (header file)
428 .Bd -literal -offset indent
432 To send the test version of the
434 server side stubs for
435 all the transport belonging to the class
437 to standard output, use:
439 .Bd -literal -offset indent
440 $ rpcgen -s datagram_n -DTEST prot.x
443 To create the server side stubs for the transport indicated by
448 .Bd -literal -offset indent
449 $ rpcgen -n tcp -o prot_svc.c prot.x