Netbula RPCGen
Netbula Portmapper service


Netbula RPCGen Usage

The following is modified from rpcgen(1) man page on UNIX systems.

NAME

rpcgen - an RPC protocol compiler 

USAGE

  1. rpcgen infile 
  2. rpcgen -c|-h|-l|-m [-o outfile] infile 
  3. rpcgen -s transport [-o outfile] infile 

DESCRIPTION

rpcgen is a compiler that generates C source code from a protocol specification file (normally with .x suffix). When run without additional options flags, rpcgen produces the following C files from a input file named proto.x
  • proto.h 

  • Header file for data types and function prototypes. 
  • proto_xdr.c

  • XDR routines to encode/decode arguments and return values, used by both the client and the server. 
  • proto_svc.c

  • Server side stub. This contains mainly the code to start and register the server and the dispatch routine that receives client call requests and dispatch the calls to the server implementation functions. 
  • proto_clnt.c

  • Client side stub. 
The C-preprocessor, CPP, is used by rpcgen to preprocess the input file. Therefore, rpcgen does not interprets the .x file directly, instead it operates on the output from CPP. rpcgen does multiple passes to generate each type of the files listed above, during each pass, it defines a different CPP symbol: 
  • RPC_HDR defined when compiling into header files 
  • RPC_XDR defined when compiling into XDR routines 
  • RPC_SVC defined when compiling into server-side stubs 
  • RPC_CLNT defined when compiling into client-side stubs 
For instance, to produce the header file proto.h from proto.x, rpcgen goes through the following steps 
  1. CPP -DRPC_HDR USER_CPP_FLAGS proto.x > tmpfile 
  2. compile tmpfile into proto.h 
  3. remove tmpfile 
Netbula RPCGen for Win32 uses CL.EXE in MS Visual C++ as the default C-preprocessor (with flags /C /EP /nologo). The CL.EXE must be in the search path, or rpcgen will spit out a "preprocessing failed" error. VC++ come with script named vcvars32.bat which does the proper environment setting. 

You can let rpcgen use a different CPP by setting two environment variables, RPCGEN_CPP and RPCGEN_CPP_FLAG, for the CPP program and associated flags, respectively. 

Rpcgen does a little preprocessing of its own. Any line beginning with `%' is passed directly into the output file, uninterpreted by rpcgen. 

You can customize some of your XDR routines by leaving those data types undefined. For every data type that is undefined, rpcgen will assume that there exists a routine with the name xdr_ prepended to the name of the undefined type. 

OPTIONS

Flag 
Argument 
Description 
-c none Compile into XDR routines.
-h none Compile into C data-definitions (a header file)
-l none Compile into client-side stubs.
-m none Compile into server-side stubs, but do not generate the "main" function. This option is useful for doing callback-routines and for people who need to write their own "main" function to do initialization.
-o  output filename Specify the name of the output file. If none is specified, standard output is used (-c, -h, -l and -s modes only).
-s transport name 
(udp or tcp)
Compile into server-side stubs, using the the given transport. The supported transports are udp and tcp. This option may be invoked more than once so as to compile a server that serves multiple transports. When this option is not given, rpcgen generates a server that listens on both the UDP and the TCP transport.
 

Portmapper service (Windows NT only)

When an RPC server starts up, it registers its program number and port with the Portmapper on its local machine. Before a client calls an RPC, it must contact the portmapper running on the server machine to find out the port number of the RPC server. 

The portmapper service take one optional argument only. The following table list the meaning of the options flags.
 
Flag Function
-i install the service
-a install the servive with auto start flag
-s start service, install if not already installed
-x stop the service
-u uninstall
-v status report
-h list the options

For example, to install the portmap service, run from command line 
> pmapsvc -i 

To start the service, 

> pmapsvc -s 

To get help, run pmapsvc -h

To start the service, you can also go to control panel, open the icon services, find the PowerRPC Portmapper and start it. 


Contact support@netbula.com for more questions.