OSI/MHS Gateway Programmatic Interface (GPI) Programming Guide
C Program Example
OSI/MHS Gateway Programmatic Interface (GPI) Programming Guide—424822-001
B-11
/* into the object. It then inserts the object into */
/* the im_c_interpersonal_message object. */
/**************************************************************************/
unsigned short build_and_insert_txtbody_object
(unsigned long root_id, /* Root object identifier */
unsigned long object_id) /* Object identifier from */
/* the layer above */
{
unsigned short
local_rc; /* Return code from the function call */
unsigned long
descriptor_count = 1, /* Count of the elements */
element_number, /* Length of the actual string */
local_object; /* Local object identifier */
long
string_offset; /* String offset for the GPI_OM_WRITE_ */
OM_descriptor
descriptor_list[] =
{
IM_T_REPERTOIRE, OM_S_ENUMERATION, { IM_IA5 }
};
char
*data_string; /* Data string for the GPI_OM_WRITE */
printf (" Create the object\n");
local_rc = GPI_OM_CREATE_ (IM_C_IA5_TEXT_BODY_PART,/* Class of the */
/* object */
OM_FALSE, /* Without defined initial */
/* values */
&local_object,
root_id, /* Root object identifier */
); /* Session not necessary */
if (( local_rc == OM_RC_SUCCESS ) || ( local_rc == ZGPI_RC_WARNING ))
{
if ( local_rc == ZGPI_RC_WARNING )
printf (" WARNING! number: %d \n", local_rc );
printf (" Insert all the required
attributes\n");
local_rc = GPI_OM_INSERT_ ( local_object,
IGNORED_FOR_SINGLE_VALUED_ATT,
descriptor_list,
descriptor_count);
if (( local_rc == OM_RC_SUCCESS ) || ( local_rc == ZGPI_RC_WARNING ))
{
if ( local_rc == ZGPI_RC_WARNING )
printf (" WARNING! number: %d \n", local_rc );
printf (" ");
printf ("Use GPI_OM_WRITE to write the first line\n");
/********************************************************************/
/* Note: It's not necessary to use the GPI_OM_WRITE_ function to */
/* add the content of the attribute IM_T_TEXT in this */
/* example. GPI_OM_WRITE is only used to demonstrate the */
/* usage of this function. */
/********************************************************************/
data_string = "This is the content of the message.";
element_number = strlen(data_string);