OSI/AS Management Programming Manual
Event-Retrieval Example
Sample Programs
C–46 056785 Tandem Computers Incorporated
event_buf = (EMSBUFDEF *)((char *)(spi_buf) +
byteoffset + 2);
/* Display the event message at your terminal. */
displ_event( event_buf );
/* Save context token from this GETEVENT response for */
/* the next GETEVENT request. */
spi_err = SSMOVETKN(ZSPI_TKN_CONTEXT,
(int *)spi_buf, 1, /* source */
(int *)sav_buf, 1); /* destination */
if (spi_err != ZSPI_ERR_OK)
DEBUG();
/* Move the updated command to spi_buf for next time */
/* through the loop. */
movmem( (char *)sav_buf, (char *)spi_buf,
sizeof(EMSBUFDEF) );
} /* end while */
return(0);
} /* end getevent_loop() */
#pragma PAGE "main program code"
/* ---------- main: -------------------------------------
* Starts a distributor and calls procedures that use
* SPI commands to connect a source collector, load a
* filter, and position the distributor within the log
* files. Then the getevent_loop procedure is called to
* retrieve and process event messages.
*/
main(int argc, char *argv[])
{
CISTART *startup; /* local pointer to startup message
* structure */
char *cptr;
char *cptr1;
int ccval = 0;
static char zspi_name[] = "#ZSPI";
/* Initialize subsystem IDs. */
cptr = strncpy(zems_val_ssid.u_z_filler.z_filler,
ZSPI_VAL_TANDEM, 8);
zems_val_ssid.z_number = ZSPI_SSN_ZEMS;
zems_val_ssid.z_version = ZEMS_VAL_VERSION;
cptr1 = strncpy(zosi_val_ssid.z_owner, ZSPI_VAL_TANDEM, 8);
zosi_val_ssid.z_number = ZSPI_SSN_ZOSI;
zosi_val_ssid.z_version = ZOSI_VAL_VERSION;
/* Allocate memory for SPI buffers. */
spi_buf = (EMSBUFDEF *) malloc( sizeof(EMSBUFDEF) );
if (spi_buf == NULL)
DEBUG();
sav_buf = (EMSBUFDEF *) malloc( sizeof(EMSBUFDEF) );