OSI/AS Management Programming Manual

Event-Retrieval Example
Sample Programs
056785 Tandem Computers Incorporated C–43
DEBUG();
/* Send the used part to the distributor. */
ccval = WRITEREAD( distr, (int *)spi_buf, used_len,
ZEMS_VAL_BUFLEN );
if (ccval != CCE)
DEBUG();
/* Reset the buffer length to what was declared for
* spi_buf.
*/
spi_err = SSPUTTKN( (int *)spi_buf, ZSPI_TKN_RESET_BUFFER,
(char *)ibuflen );
if (spi_err != ZSPI_ERR_OK)
DEBUG();
/* Response is in the buffer--check for return token. */
spi_err = SSGETTKN( (int *)spi_buf, ZSPI_TKN_RETCODE,
(char *)&ems_err, 1 );
if (spi_err != ZSPI_ERR_OK)
DEBUG();
if (ems_err != 0) {
if (ems_err = ZEMS_ERR_FLT_LOAD){
printf("THE DISTRIBUTOR COULD NOT LOAD THE FILTER");
return(ems_err);
}
else
DEBUG();
}
return( spi_err );
}
#pragma PAGE "spi_cmd_set_source()"
/* ---------- spi_cmd_set_source ----------------------------
* Builds an SPI command that directs the distributor to use
* an EMS collector as the source of event messages.
*/
int spi_cmd_set_source(void)
{
/* Initialize spi_buf for distributor CONTROL command. */
spi_err = SSINIT( (int *)spi_buf, ZEMS_VAL_BUFLEN,
(int *)&zems_val_ssid,
ZSPI_VAL_CMDHDR, ZEMS_CMD_CONTROL );
if (spi_err != ZSPI_ERR_OK)
DEBUG();
/* Place connect-source-collector token in buffer.*/
spi_err = SSPUTTKN( (int *)spi_buf,
ZEMS_TKN_CONNECT_SRC_COLL,
coll_name );
if (spi_err != ZSPI_ERR_OK)
DEBUG();
/* Send command to distributor. */
spi_err = send_spi_cmd();
return spi_err;