ONC+ RPC Developer's Guide

Exit Print View

Updated: July 2014
 
 

Compile-Time Client and Server Templates

rpcgen generates sample code for the client and server sides. Use the options described in the following table to generate the desired templates.

Table 3-3  rpcgen Template Selection Flags
Flag
Function
–a
Generates all template files
–Sc
Generates client-side template
–Ss
Generates server-side template
–Sm
Generates makefile template

The files can be used as guides by filling in the missing parts. These files are in addition to the stubs generated.

A C-style mode server template is generated from the add.x source by the command rpcgen -N -Ss -o add_server_template.c add.x

The result is stored in the file add_server_template.c. A C-style mode, client template for the same add.x source is generated with the command rpcgen -N -Sc -o add_client_template.c add.x

The result is stored in the file add_client_template.c. A makefile template for the same add.x source is generated with the command rpcgen -N -Sm -o mkfile_template add.x

The result is stored in the file mkfile_template. It can be used to compile the client and the server. The –a flag, used in the command rpcgen -N -a add.x, generates all three template files. The client template is stored in add_client.c, the server template in add_server.c, and the makefile template inmakefile.a. If any of these files already exists, rpcgen displays an error message and exits.


Note - When you generate template files, give them new names to avoid the files being overwritten the next time rpcgen is executed.