2013-12-15 13:18:14 +04:00
|
|
|
.\" $NetBSD: rpcgen.1,v 1.24 2013/12/15 09:18:14 wiz Exp $
|
1995-06-12 01:49:50 +04:00
|
|
|
.\" from: @(#)rpcgen.new.1 1.1 90/11/09 TIRPC 1.0; from 40.10 of 10/10/89
|
|
|
|
.\" Copyright (c) 1988,1990 Sun Microsystems, Inc. - All Rights Reserved.
|
2013-12-15 04:40:17 +04:00
|
|
|
.Dd December 14, 2013
|
1993-06-10 23:15:08 +04:00
|
|
|
.Dt RPCGEN 1
|
2009-03-11 16:57:53 +03:00
|
|
|
.Os
|
1993-06-10 23:15:08 +04:00
|
|
|
.Sh NAME
|
|
|
|
.Nm rpcgen
|
1998-04-28 11:19:28 +04:00
|
|
|
.Nd Remote Procedure Call (RPC) protocol compiler
|
1993-06-10 23:15:08 +04:00
|
|
|
.Sh SYNOPSIS
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1993-06-10 23:15:08 +04:00
|
|
|
.Ar infile
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
2013-12-15 13:18:14 +04:00
|
|
|
.Op Fl AaBbILMNTv
|
2004-05-12 19:58:12 +04:00
|
|
|
.Op Fl D Ar name Op =value
|
2004-05-12 22:49:30 +04:00
|
|
|
.Op Fl i Ar size
|
2004-05-12 19:58:12 +04:00
|
|
|
.Op Fl K Ar secs
|
|
|
|
.Op Fl Y Ar pathname
|
|
|
|
.Ar infile
|
|
|
|
.Nm
|
1993-06-10 23:15:08 +04:00
|
|
|
.Fl c Li |
|
|
|
|
.Fl h Li |
|
|
|
|
.Fl l Li |
|
1995-06-12 01:49:50 +04:00
|
|
|
.Fl m Li |
|
|
|
|
.Fl t Li |
|
|
|
|
.Fl S\&c Li |
|
2001-03-21 03:30:39 +03:00
|
|
|
.Fl S\&s
|
2004-05-12 19:58:12 +04:00
|
|
|
.\" .Fl S\&m
|
1995-06-12 01:49:50 +04:00
|
|
|
.Op Fl o Ar outfile
|
|
|
|
.Op Ar infile
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
2004-05-12 19:58:12 +04:00
|
|
|
.Op Fl s Ar nettype
|
1993-06-10 23:15:08 +04:00
|
|
|
.Op Fl o Ar outfile
|
|
|
|
.Op Ar infile
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
2004-05-12 19:58:12 +04:00
|
|
|
.Op Fl n Ar netid
|
1993-06-10 23:15:08 +04:00
|
|
|
.Op Fl o Ar outfile
|
|
|
|
.Op Ar infile
|
|
|
|
.Sh DESCRIPTION
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1993-06-10 23:15:08 +04:00
|
|
|
is a tool that generates C code to implement an
|
|
|
|
.Tn RPC
|
1995-06-12 01:49:50 +04:00
|
|
|
protocol.
|
|
|
|
The input to
|
|
|
|
.Nm
|
1993-06-10 23:15:08 +04:00
|
|
|
is a language similar to C known as
|
|
|
|
.Tn RPC
|
1995-06-12 01:49:50 +04:00
|
|
|
Language (Remote Procedure Call Language).
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1995-06-12 01:49:50 +04:00
|
|
|
is normally used as in the first synopsis where
|
|
|
|
it takes an input file and generates up to four output files.
|
|
|
|
If the
|
1993-06-10 23:15:08 +04:00
|
|
|
.Ar infile
|
1993-04-03 04:51:49 +04:00
|
|
|
is named
|
1993-06-10 23:15:08 +04:00
|
|
|
.Pa proto.x ,
|
1993-04-03 04:51:49 +04:00
|
|
|
then
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1993-04-03 04:51:49 +04:00
|
|
|
will generate a header file in
|
1993-06-10 23:15:08 +04:00
|
|
|
.Pa proto.h ,
|
|
|
|
.Tn XDR
|
1993-04-03 04:51:49 +04:00
|
|
|
routines in
|
1993-06-10 23:15:08 +04:00
|
|
|
.Pa proto_xdr.c ,
|
1993-04-03 04:51:49 +04:00
|
|
|
server-side stubs in
|
1993-06-10 23:15:08 +04:00
|
|
|
.Pa proto_svc.c ,
|
1993-04-03 04:51:49 +04:00
|
|
|
and client-side stubs in
|
1993-06-10 23:15:08 +04:00
|
|
|
.Pa proto_clnt.c .
|
1995-06-12 01:49:50 +04:00
|
|
|
With the
|
|
|
|
.Fl T
|
|
|
|
option,
|
|
|
|
it will also generate the
|
|
|
|
.Tn RPC
|
|
|
|
dispatch table in
|
|
|
|
.Pa proto_tbl.i .
|
|
|
|
With the
|
|
|
|
.Fl S\&c
|
|
|
|
option,
|
|
|
|
it will also generate sample code which would illustrate how to use the
|
2002-09-30 15:08:56 +04:00
|
|
|
remote procedures on the client side.
|
|
|
|
This code would be created in
|
1995-06-12 01:49:50 +04:00
|
|
|
.Pa proto_client.c .
|
|
|
|
With the
|
|
|
|
.Fl S\&s
|
|
|
|
option,
|
|
|
|
it will also generate a sample server code which would illustrate how to write
|
2002-09-30 15:08:56 +04:00
|
|
|
the remote procedures.
|
|
|
|
This code would be created in
|
1995-06-12 01:49:50 +04:00
|
|
|
.Pa proto_server.c .
|
|
|
|
.Pp
|
|
|
|
The server created can be started both by the port monitors
|
|
|
|
(for example,
|
|
|
|
.Em inetd
|
|
|
|
or
|
|
|
|
.Em listen )
|
|
|
|
or by itself.
|
|
|
|
When it is started by a port monitor,
|
|
|
|
it creates servers only for the transport for which
|
|
|
|
the file descriptor 0 was passed.
|
|
|
|
The name of the transport must be specified
|
|
|
|
by setting up the environmental variable
|
|
|
|
.Ev PM_TRANSPORT .
|
|
|
|
When the server generated by
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1995-06-12 01:49:50 +04:00
|
|
|
is executed,
|
|
|
|
it creates server handles for all the transports
|
|
|
|
specified in
|
|
|
|
.Ev NETPATH
|
|
|
|
environment variable,
|
|
|
|
or if it is unset,
|
|
|
|
it creates server handles for all the visible transports from
|
|
|
|
.Pa /etc/netconfig
|
|
|
|
file.
|
1998-04-28 11:19:28 +04:00
|
|
|
.Pp
|
2001-04-04 13:41:36 +04:00
|
|
|
.Em Note :
|
1995-06-12 01:49:50 +04:00
|
|
|
the transports are chosen at run time and not at compile time.
|
|
|
|
When the server is self-started,
|
|
|
|
it backgrounds itself by default.
|
|
|
|
A special define symbol
|
|
|
|
.Dv RPC_SVC_FG
|
|
|
|
can be used to run the server process in foreground.
|
2009-03-11 16:57:53 +03:00
|
|
|
.Pp
|
1995-06-12 01:49:50 +04:00
|
|
|
The second synopsis provides special features which allow
|
|
|
|
for the creation of more sophisticated
|
|
|
|
.Tn RPC
|
|
|
|
servers.
|
|
|
|
These features include support for user provided
|
|
|
|
.Li #defines
|
|
|
|
and
|
|
|
|
.Tn RPC
|
|
|
|
dispatch tables.
|
|
|
|
The entries in the
|
|
|
|
.Tn RPC
|
|
|
|
dispatch table contain:
|
|
|
|
.Pp
|
|
|
|
.Bl -inset -offset indent -compact
|
|
|
|
.It +
|
|
|
|
pointers to the service routine corresponding to that procedure,
|
|
|
|
.It +
|
|
|
|
a pointer to the input and output arguments,
|
|
|
|
.It +
|
|
|
|
the size of these routines
|
|
|
|
.El
|
1993-06-10 23:15:08 +04:00
|
|
|
.Pp
|
1995-06-12 01:49:50 +04:00
|
|
|
A server can use the dispatch table to check authorization
|
|
|
|
and then to execute the service routine;
|
|
|
|
a client library may use it to deal with the details of storage
|
|
|
|
management and
|
|
|
|
.Tn XDR
|
|
|
|
data conversion.
|
1993-06-10 23:15:08 +04:00
|
|
|
.Pp
|
1995-06-12 01:49:50 +04:00
|
|
|
The other three synopses shown above are used when
|
|
|
|
one does not want to generate all the output files,
|
|
|
|
but only a particular one.
|
|
|
|
Some examples of their usage is described in the
|
2001-12-08 22:12:34 +03:00
|
|
|
.Sx EXAMPLES
|
1995-06-12 01:49:50 +04:00
|
|
|
section below.
|
|
|
|
When
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1995-06-12 01:49:50 +04:00
|
|
|
is executed with the
|
|
|
|
.Fl s
|
|
|
|
option,
|
|
|
|
it creates servers for that particular class of transports.
|
|
|
|
When
|
|
|
|
executed with the
|
|
|
|
.Fl n
|
|
|
|
option,
|
|
|
|
it creates a server for the transport specified by
|
|
|
|
.Em netid .
|
|
|
|
If
|
|
|
|
.Ar infile
|
|
|
|
is not specified,
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1995-06-12 01:49:50 +04:00
|
|
|
accepts the standard input.
|
|
|
|
.Pp
|
|
|
|
The C preprocessor,
|
|
|
|
.Xr cpp 1
|
|
|
|
is run on the input file before it is actually interpreted by
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1995-06-12 01:49:50 +04:00
|
|
|
For each type of output file,
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1995-06-12 01:49:50 +04:00
|
|
|
defines a special preprocessor symbol for use by the
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1993-04-03 04:51:49 +04:00
|
|
|
programmer:
|
1998-04-28 11:19:28 +04:00
|
|
|
.Bl -tag -width RPC_CLNT
|
|
|
|
.It Dv RPC_HDR
|
1993-04-03 04:51:49 +04:00
|
|
|
defined when compiling into header files
|
1998-04-28 11:19:28 +04:00
|
|
|
.It Dv RPC_XDR
|
1993-04-03 04:51:49 +04:00
|
|
|
defined when compiling into
|
1993-06-10 23:15:08 +04:00
|
|
|
.Tn XDR
|
1993-04-03 04:51:49 +04:00
|
|
|
routines
|
1998-04-28 11:19:28 +04:00
|
|
|
.It Dv RPC_SVC
|
1993-04-03 04:51:49 +04:00
|
|
|
defined when compiling into server-side stubs
|
1998-04-28 11:19:28 +04:00
|
|
|
.It Dv RPC_CLNT
|
1993-04-03 04:51:49 +04:00
|
|
|
defined when compiling into client-side stubs
|
1998-04-28 11:19:28 +04:00
|
|
|
.It Dv RPC_TBL
|
1995-06-12 01:49:50 +04:00
|
|
|
defined when compiling into
|
|
|
|
.Tn RPC
|
|
|
|
dispatch tables
|
1998-04-28 11:19:28 +04:00
|
|
|
.El
|
1993-06-10 23:15:08 +04:00
|
|
|
.Pp
|
1995-06-12 01:49:50 +04:00
|
|
|
Any line beginning with
|
1993-06-10 23:15:08 +04:00
|
|
|
.Sq %
|
1995-06-12 01:49:50 +04:00
|
|
|
is passed directly into the output file,
|
|
|
|
uninterpreted by
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm .
|
1993-06-10 23:15:08 +04:00
|
|
|
.Pp
|
1995-06-12 01:49:50 +04:00
|
|
|
For every data type referred to in
|
|
|
|
.Ar infile
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1995-06-12 01:49:50 +04:00
|
|
|
assumes that there exists a
|
|
|
|
routine with the string
|
|
|
|
.Dq xdr_
|
|
|
|
prepended to the name of the data type.
|
|
|
|
If this routine does not exist in the
|
|
|
|
.Tn RPC/XDR
|
|
|
|
library, it must be provided.
|
|
|
|
Providing an undefined data type
|
|
|
|
allows customization of
|
|
|
|
.Tn XDR
|
|
|
|
routines.
|
1993-06-10 23:15:08 +04:00
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width indent
|
2004-05-12 19:58:12 +04:00
|
|
|
.It Fl A
|
|
|
|
Generate an
|
|
|
|
.Fn svc_caller
|
|
|
|
function.
|
2013-12-15 13:18:14 +04:00
|
|
|
.It Fl a
|
|
|
|
Generate all the files including sample code for client and server side.
|
2013-12-15 04:40:17 +04:00
|
|
|
.It Fl B
|
|
|
|
Generate BSD cplusplus macros (__BEGIN_DECLS, __END_DECLS).
|
1995-06-12 01:49:50 +04:00
|
|
|
.It Fl b
|
2004-05-12 17:02:01 +04:00
|
|
|
Compile stubs in "backwards compatible" mode, disabling support for
|
2004-05-12 19:58:12 +04:00
|
|
|
transport-independent RPC.
|
|
|
|
The
|
|
|
|
.Fl b
|
|
|
|
should always be specified when generating files for
|
|
|
|
.Nx ,
|
|
|
|
since there is no transport-independent RPC support in
|
|
|
|
.Nx .
|
1993-06-10 23:15:08 +04:00
|
|
|
.It Fl c
|
1993-04-03 04:51:49 +04:00
|
|
|
Compile into
|
1993-06-10 23:15:08 +04:00
|
|
|
.Tn XDR
|
1993-04-03 04:51:49 +04:00
|
|
|
routines.
|
1995-06-12 01:49:50 +04:00
|
|
|
.It Fl D Ar name Ns Op Ar =value
|
|
|
|
Define a symbol
|
|
|
|
.Dv name .
|
|
|
|
Equivalent to the
|
|
|
|
.Dv #define
|
|
|
|
directive in the source.
|
|
|
|
If no
|
|
|
|
.Dv value
|
|
|
|
is given,
|
|
|
|
.Dv value
|
|
|
|
is defined as 1.
|
|
|
|
This option may be specified more than once.
|
1993-06-10 23:15:08 +04:00
|
|
|
.It Fl h
|
|
|
|
Compile into C data-definitions (a header file).
|
1995-06-12 01:49:50 +04:00
|
|
|
The
|
|
|
|
.Fl T
|
|
|
|
option can be used in conjunction to produce a
|
|
|
|
header file which supports
|
|
|
|
.Tn RPC
|
|
|
|
dispatch tables.
|
2004-05-12 19:58:12 +04:00
|
|
|
.It Fl I
|
|
|
|
Support
|
|
|
|
.Xr inetd 8
|
|
|
|
in the server side stubs.
|
|
|
|
Servers generated using this flag can either be standalone or
|
|
|
|
started from
|
|
|
|
.Xr inetd 8 .
|
|
|
|
If a server is started as standalone, then it places itself
|
|
|
|
in the background, unless
|
|
|
|
.Dv RCP_SVC_FG
|
|
|
|
is defined, or the server is compiled without
|
|
|
|
.Fl I .
|
2013-12-15 13:18:14 +04:00
|
|
|
.It Fl i Ar size
|
|
|
|
Size to decide when to start generating inline code.
|
|
|
|
The default size is 3.
|
1995-06-12 01:49:50 +04:00
|
|
|
.It Fl K Ar secs
|
|
|
|
By default, services created using
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1995-06-12 01:49:50 +04:00
|
|
|
wait 120 seconds
|
|
|
|
after servicing a request before exiting.
|
|
|
|
That interval can be changed using the
|
|
|
|
.Fl K
|
|
|
|
flag.
|
|
|
|
To create a server that exits immediately upon servicing a request,
|
|
|
|
.Dq Fl K No 0
|
|
|
|
can be used.
|
|
|
|
To create a server that never exits, the appropriate argument is
|
|
|
|
.Dq Fl K No -1 .
|
1998-04-28 11:19:28 +04:00
|
|
|
.Pp
|
1995-06-12 01:49:50 +04:00
|
|
|
When monitoring for a server,
|
|
|
|
some port monitors, like the
|
1998-04-28 11:19:28 +04:00
|
|
|
.At V.4
|
1995-06-12 01:49:50 +04:00
|
|
|
utility
|
2001-04-04 13:41:36 +04:00
|
|
|
.Ic listen ,
|
1995-06-12 01:49:50 +04:00
|
|
|
.Em always
|
|
|
|
spawn a new process in response to a service request.
|
|
|
|
If it is known that a server will be used with such a monitor, the
|
|
|
|
server should exit immediately on completion.
|
|
|
|
For such servers,
|
1997-10-17 19:51:48 +04:00
|
|
|
.Nm
|
1995-06-12 01:49:50 +04:00
|
|
|
should be used with
|
|
|
|
.Dq Fl K No -1 .
|
2013-12-15 13:18:14 +04:00
|
|
|
.It Fl L
|
|
|
|
Server errors will be sent to syslog instead of stderr.
|
1993-06-10 23:15:08 +04:00
|
|
|
.It Fl l
|
1993-04-03 04:51:49 +04:00
|
|
|
Compile into client-side stubs.
|
2003-01-06 22:26:17 +03:00
|
|
|
.Xr inetd 8 .
|
2001-03-21 03:30:39 +03:00
|
|
|
.It Fl M
|
2002-09-30 15:08:56 +04:00
|
|
|
Generate thread-safe stubs.
|
|
|
|
This alters the calling pattern of client and
|
|
|
|
server stubs so that storage for results is allocated by the caller.
|
|
|
|
Note
|
2001-03-21 03:30:39 +03:00
|
|
|
that all components for a particular service (stubs, client and service
|
|
|
|
wrappers, etc.) must be built either with or without the
|
|
|
|
.Fl M
|
|
|
|
flag.
|
2013-12-15 13:18:14 +04:00
|
|
|
.It Fl m
|
|
|
|
Compile into server-side stubs,
|
|
|
|
but do not generate a
|
|
|
|
.Fn main
|
|
|
|
routine.
|
|
|
|
This option is useful for doing callback-routines
|
|
|
|
and for users who need to write their own
|
|
|
|
.Fn main
|
|
|
|
routine to do initialization.
|
1995-06-12 01:49:50 +04:00
|
|
|
.It Fl N
|
1998-04-28 11:19:28 +04:00
|
|
|
Use the newstyle of
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm .
|
1998-04-28 11:19:28 +04:00
|
|
|
This allows procedures to have multiple arguments.
|
|
|
|
It also uses the style of parameter passing that closely resembles C.
|
|
|
|
So, when passing an argument to a remote procedure you do not have
|
|
|
|
to pass a pointer to the argument but the argument itself.
|
|
|
|
This behaviour is different from the oldstyle
|
|
|
|
of
|
|
|
|
.Nm
|
|
|
|
generated code.
|
|
|
|
The newstyle is not the default case because of backward compatibility.
|
2004-05-12 19:58:12 +04:00
|
|
|
.It Fl n Ar netid
|
|
|
|
Compile into server-side stubs for the transport
|
|
|
|
specified by
|
|
|
|
.Ar netid .
|
|
|
|
There should be an entry for
|
|
|
|
.Ar netid
|
|
|
|
in the
|
|
|
|
netconfig database.
|
|
|
|
This option may be specified more than once,
|
|
|
|
so as to compile a server that serves multiple transports.
|
1993-06-10 23:15:08 +04:00
|
|
|
.It Fl o Ar outfile
|
1995-06-12 01:49:50 +04:00
|
|
|
Specify the name of the output file.
|
|
|
|
If none is specified,
|
|
|
|
standard output is used
|
|
|
|
.Po
|
|
|
|
.Fl c Fl h Fl l
|
|
|
|
.Fl m Fl n Fl s
|
|
|
|
modes only
|
|
|
|
.Pc
|
|
|
|
.It Fl s Ar nettype
|
|
|
|
Compile into server-side stubs for all the
|
|
|
|
transports belonging to the class
|
|
|
|
.Ar nettype .
|
|
|
|
The supported classes are
|
2001-04-04 13:41:36 +04:00
|
|
|
.Em netpath ,
|
|
|
|
.Em visible ,
|
|
|
|
.Em circuit_n ,
|
|
|
|
.Em circuit_v ,
|
|
|
|
.Em datagram_n ,
|
|
|
|
.Em datagram_v ,
|
|
|
|
.Em tcp ,
|
1993-04-03 04:51:49 +04:00
|
|
|
and
|
1995-06-12 01:49:50 +04:00
|
|
|
.Em udp
|
|
|
|
[see
|
|
|
|
.Xr rpc 3
|
1998-04-28 11:19:28 +04:00
|
|
|
for the meanings associated with these classes.
|
2001-04-04 13:41:36 +04:00
|
|
|
.Em Note :
|
1995-06-12 01:49:50 +04:00
|
|
|
.Bx
|
|
|
|
currently supports only the
|
|
|
|
.Em tcp
|
1993-04-03 04:51:49 +04:00
|
|
|
and
|
1995-06-12 01:49:50 +04:00
|
|
|
.Em udp
|
|
|
|
classes].
|
|
|
|
This option may be specified more than once.
|
2001-04-04 13:41:36 +04:00
|
|
|
.Em Note :
|
1995-06-12 01:49:50 +04:00
|
|
|
the transports are chosen at run time and not at compile time.
|
|
|
|
.It Fl S\&c
|
|
|
|
Generate sample code to show the use of remote procedure and how to bind
|
1998-04-28 11:19:28 +04:00
|
|
|
to the server before calling the client side stubs generated by
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm .
|
1995-06-12 01:49:50 +04:00
|
|
|
.It Fl S\&s
|
2002-09-30 15:08:56 +04:00
|
|
|
Generate skeleton code for the remote procedures on the server side.
|
|
|
|
You would need
|
1995-06-12 01:49:50 +04:00
|
|
|
to fill in the actual code for the remote procedures.
|
2004-05-12 19:58:12 +04:00
|
|
|
.\" .It Fl S\&m
|
|
|
|
.\" Generate a sample Makefile that can be used to compile the application.
|
1995-06-12 01:49:50 +04:00
|
|
|
.It Fl T
|
|
|
|
Generate the code to support
|
|
|
|
.Tn RPC
|
|
|
|
dispatch tables.
|
2013-12-15 13:18:14 +04:00
|
|
|
.It Fl t
|
|
|
|
Compile into
|
|
|
|
.Tn RPC
|
|
|
|
dispatch table.
|
2004-05-12 19:58:12 +04:00
|
|
|
.It Fl v
|
|
|
|
Display the version number.
|
|
|
|
.It Fl Y Ar pathname
|
|
|
|
Specify the directory where
|
|
|
|
.Nm
|
|
|
|
looks for the C pre-processor.
|
1993-06-10 23:15:08 +04:00
|
|
|
.El
|
1995-06-12 01:49:50 +04:00
|
|
|
.Pp
|
|
|
|
The options
|
|
|
|
.Fl c ,
|
|
|
|
.Fl h ,
|
|
|
|
.Fl l ,
|
|
|
|
.Fl m ,
|
|
|
|
.Fl s ,
|
|
|
|
and
|
|
|
|
.Fl t
|
|
|
|
are used exclusively to generate a particular type of file,
|
|
|
|
while the options
|
|
|
|
.Fl D
|
|
|
|
and
|
|
|
|
.Fl T
|
|
|
|
are global and can be used with the other options.
|
2008-01-15 23:04:48 +03:00
|
|
|
.Sh ENVIRONMENT
|
|
|
|
If the
|
2008-01-19 17:22:05 +03:00
|
|
|
.Ev RPCGEN_CPP
|
2008-01-15 23:04:48 +03:00
|
|
|
environment variable is set, its value is used as the pathname of the
|
|
|
|
C preprocessor to be run on the input file.
|
1995-06-12 01:49:50 +04:00
|
|
|
.Sh NOTES
|
|
|
|
The
|
|
|
|
.Tn RPC
|
|
|
|
Language does not support nesting of structures.
|
|
|
|
As a work-around,
|
|
|
|
structures can be declared at the top-level,
|
|
|
|
and their name used inside other structures in
|
1993-06-10 23:15:08 +04:00
|
|
|
order to achieve the same effect.
|
|
|
|
.Pp
|
1995-06-12 01:49:50 +04:00
|
|
|
Name clashes can occur when using program definitions,
|
|
|
|
since the apparent scoping does not really apply.
|
|
|
|
Most of these can be avoided by giving
|
|
|
|
unique names for programs,
|
|
|
|
versions,
|
|
|
|
procedures and types.
|
|
|
|
.Pp
|
|
|
|
The server code generated with
|
|
|
|
.Fl n
|
|
|
|
option refers to the transport indicated by
|
|
|
|
.Em netid
|
|
|
|
and hence is very site specific.
|
2001-12-08 22:12:34 +03:00
|
|
|
.Sh EXAMPLES
|
1995-06-12 01:49:50 +04:00
|
|
|
The command
|
|
|
|
.Pp
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
$ rpcgen -T prot.x
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
generates the five files:
|
|
|
|
.Pa prot.h ,
|
|
|
|
.Pa prot_clnt.c ,
|
|
|
|
.Pa prot_svc.c ,
|
|
|
|
.Pa prot_xdr.c
|
|
|
|
and
|
|
|
|
.Pa prot_tbl.i .
|
|
|
|
.Pp
|
|
|
|
The following example sends the C data-definitions (header file)
|
|
|
|
to standard output.
|
|
|
|
.Pp
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
$ rpcgen -h prot.x
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
To send the test version of the
|
|
|
|
.Dv -DTEST ,
|
|
|
|
server side stubs for
|
|
|
|
all the transport belonging to the class
|
|
|
|
.Em datagram_n
|
|
|
|
to standard output, use:
|
|
|
|
.Pp
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
$ rpcgen -s datagram_n -DTEST prot.x
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
To create the server side stubs for the transport indicated by
|
|
|
|
.Em netid
|
|
|
|
.Em tcp ,
|
|
|
|
use:
|
|
|
|
.Pp
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
$ rpcgen -n tcp -o prot_svc.c prot.x
|
|
|
|
.Ed
|
2001-04-04 13:41:36 +04:00
|
|
|
.Sh SEE ALSO
|
2003-01-06 22:26:17 +03:00
|
|
|
.Xr cpp 1 ,
|
2003-01-05 22:28:13 +03:00
|
|
|
.Xr inetd 8
|
2001-03-21 03:30:39 +03:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Fl M
|
|
|
|
option was first implemented in RedHat Linux, and was reimplemented by
|
|
|
|
Charles M. Hannum in
|
|
|
|
.Nx 1.6 .
|