OpenTP1 Version 7 Programming Reference C Language

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

Create a main function (SUP, SPP, MHP)

Format

The name of a main function must include main(). For the other rules of creating main functions, comply with the specifications of the C language for coding. OpenTP1 does not limit creation of main functions. Main functions can be created according to the explanation of this section.

Description

After the UAP process starts, the OS first calls the main function.

SUP main function

The following OpenTP1 functions are always called in the SUP main function:

  1. dc_rpc_open() (Start an application program)
  2. dc_adm_complete() (Report the completion of user server start processing)
  3. dc_rpc_close() (Terminate an application program after job terminate)

In addition to the above OpenTP1 functions, the function for initializing UAP processes required for jobs, the termination processing function, and the function dc_rpc_call() can also be called.

SPP main function

Service functions created as services which are provided by an SPP are grouped into one executable file. An executable file comprising one main function and multiple service functions corresponds to a service group.

The OpenTP1 functions listed below are always called in the SPP main function. To use an MCF function with an SPP service, call the function dc_mcf_open() and the function dc_mcf_close().

  1. dc_rpc_open() (Start an application program)
  2. dc_rpc_mainloop() (Start an SPP service)
  3. dc_rpc_close() (Terminate an application program after job terminate)

After initialization processing, the main function stops when the function dc_rpc_mainloop() is called. Meanwhile, the main function performs processing requested by service functions. In addition to the above OpenTP1 functions, the function for initializing SPP processes required for jobs, the termination processing function, and the function dc_rpc_call() can also be used in the main function.

MHP main function

Service functions created as applications for message processing are grouped into one executable file. An executable file comprising one main function and multiple service functions corresponds to a service group. The service group name must be unique in the domain (in the entire network).

The following OpenTP1 functions are always called in the MHP main function:

  1. dc_rpc_open() (Start an application program)
  2. dc_mcf_open() (Open the MCF environment)
  3. dc_mcf_mainloop() (Start an MHP service)
  4. dc_mcf_close() (Close the MCF environment)
  5. dc_rpc_close() (Terminate an application program after job terminate)

The MHP having the service function corresponding to the application name is started. After initialization processing, the main function stops when the function dc_mcf_mainloop() is called. Meanwhile, the main function performs processing requested by service functions. In addition to the above OpenTP1 functions, the function for initializing MHP processes required for jobs, the termination processing function, and the function dc_rpc_call() can also be used in the main function.

Argument

No argument is passed to the main function.