OSI/MHS Gateway Programmatic Interface (GPI) Programming Guide
OSI/MHS Gateway Programmatic Interface (GPI) Programming Guide—424822-001
B-1
B
C Program Example
/***************************************************************************
*
* Description:This program shows how a client program, operating through
* a NORMAL type GPI gateway, calls each GPI procedure. It opens a session,
* creates a root object, transfers the root object out, transfers the root
* object back in, shows values of root object attributes, then closes the
* session. For purposes of a simple example, some procedures may be called
* in a slightly different context from their normal use. In addition, the
* program assumes the root object transferred in is the same as that which
* was transferred out.
*
* The program sequence is as follows:
*
* - Start program and enter main
* - CALL GPI_INITIALIZE_
* - CALL GPI_OPEN_
* - CALL build_root_object (a function local to this example)
* - CALL GPI_MT_TRANSFER_OUT_
* - CALL GPI_MT_WAIT_
* - CALL GPI_MT_START_TRANSFER_IN_
* - CALL show_message (a function local to this example)
* - CALL GPI_MT_FINISH_TRANSFER_IN_
* - CALL GPI_CLOSE_
* - Terminate program
*
* The build_root_object function shows how to build a root object. It
* does the following:
*
* - Creates the root object
* - Creates and inserts the bilateral information
* - Creates and inserts the content
* - Creates and inserts the external trace
* - Creates and inserts the mts identifier
* - Creates and inserts the original eits
* - Creates and inserts the originator name
* - Creates and inserts the recipient descriptor
*
* Each action is handled by a lower-level function. Each creates a
* subobject, fills it with attributes, and inserts it into the root
* object. Some of the subobjects are created with the initialize flag set;
* as a result, these objects are filled with default first-level
* attributes.
*
* The show_message function shows how to inspect an inbound root
* object. It gets theclass of the inbound root object (message class)
* and displays:
*
* - All root level attributes that are not objects
* - Bilateral information
* - Interpersonal message (P2 content)
* - External trace entry
* - MTS identifier
* - EITS
* - OR name
* - Message recipient descriptor
* - Message recipient OR name (assuming certain attributes are used)
*
* The printing of these attributes and objects is handled by two
* functions: print_attributes and print_object. Each takes as input
* an array containing the attribute list to be printed. Again, the
* program assumes certain attributes are present in the inbound root