OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

1.2.2 Creating stubs

UAPs used with the OpenTP1 require libraries for fulfilling inter-UAP service requests. One of these libraries is called a stub.

The explanation below deals with stubs of UAPs (SUP and SPP) which use an OpenTP1 remote procedure calls (dc_rpc_call()) and MHP stubs. See 1.3 Creating XATMI interface application programs (TCP/IP, OSI TP) on how to create stubs which will be used when the XATMI interface is used for communication.

Organization of this subsection
(1) Application programs requiring stubs
(2) Stub creation procedure
(3) Creation of RPC interface definition file
(4) RPC interface definition file name

(1) Application programs requiring stubs

Among the UAPs used with the OpenTP1, UAPs having service functions (SPP and MHP) usually require a stub. However, a stub is not required if all service functions are put in the UAP shared library from which they are loaded dynamically. The UAP shared library is created by linking the UAP object files compiled from UAP source files.

Note that UAPs that handle offline work and SUPs do not require a stub because they do not have a service function.

(2) Stub creation procedure

Before creating a stub, create a file (RPC interface definition file) in which UAP service functions are defined. Execute the stbmake command with this file as the argument.

When the stbmake command is executed, a source file (C-language source file) for the stub is created. Compile this file with the C-language compiler and link it to the object file of the UAP.

When modifying the stub, create the UAP from scratch. Modify the RPC interface definition file, recreate the stub, and link it to the object file of the recompiled UAP.

The figure below shows the stub creation procedure.

Figure 1-7 Stub creation procedure

[Figure]

(3) Creation of RPC interface definition file

When creating a stub, create a file which defines entry points to the SPP and MHP services. This is called the RPC interface definition. The file containing this definition is called the RPC interface definition file.

Create an RPC interface definition file for each executable file of the SPP or MHP.

(a) Format of RPC interface definition

Write the RPC interface definition in the following format:

Format
entry "entry-point-name"["entry-point-name"...];

Description
This statement specifies the names of the entry points to the SPP and MHP service functions. Each entry point name must be a C-language function name.
Use 20 characters or fewer to specify each entry point.
The entry point names must correspond to the service names as specified in the user service definition.
Comments can be added to the RPC interface definition. Begin each comment with /* and terminate it with */. Comments cannot be nested. Comments cannot be written within a keyword, identifier, or other character string.
More than one entry statement can be written in one file. An example of RPC interface definition is given below.

Example
Specification of RPC interface definition for a UAP which has service functions with their entry points identified by sv01 and sv02 (use either format below)

Format 1:
entry "sv01";
entry "sv02";

Format 2:
entry "sv01" "sv02";

(4) RPC interface definition file name

The file name must end with the suffix .def indicating an RPC interface definition file. The directory to contain the file must be in a path that the stbmake command can search. No other restrictions are placed on it.

The name of an RPC interface definition file can have up to 255 characters. However, the name that can be specified may be shorter than 255 characters due to OS restrictions.

After the stbmake command is executed, a stub source file is created under a name different from that of the RPC interface definition file. Therefore, the RPC interface definition file is not used during the OpenTP1 operation.