OSI/AS Programming Manual

Example 2: Presentation Layer and ACSE
Sample Programs
056783 Tandem Computers Incorporated E–53
#pragma PAGE
/*--------------------------------------------------------*/
/* */
/* wait for an event and make certain that it is the one */
/* that is expected. */
/* */
/*--------------------------------------------------------*/
void wait_for_event( expected_event_code )
int expected_event_code; /* i : expected evt */
{
status = APS_EVENT_RECEIVE_( cepi
, timelimit
, /* tag */
);
if ( status != ZAPS_VAL_STATUS_EVENT )
display_aps_status( error_event_proc );
/* */
/* Find out which event was received. */
/* */
error = APS_STATUS_( cepi
, &event_code
, (int *) &device_name
, &error_code
, &error_subcode
, &service_id
, (int *) &diagnostic_buffer
, (int *) &original_error_info
);
if ( error != ZAPS_ERR_OK )
display_aps_error( error_status_proc );
/* */
/* Check for the expected event. */
/* A real application would take appropriate action. */
/* */
if ( event_code != expected_event_code )
DEBUG();
} /* proc wait_for_event */
#pragma PAGE
/*--------------------------------------------------------*/
/* */
/* initialize APS. */
/* */
/*--------------------------------------------------------*/
void initialize_appl()
{
/* */
/* Ask the API to allocate and initialize a reserved */
/* extended segment for this process. */
/* */
error = APS_INITIALIZE_( (int *) &swapvol );