OSI/TS Management Programming Manual
Sample Programs
056786 Tandem Computers Incorporated C–31
 * Puts the finishing touches on an SPI command that has
 * been prepared by another procedure. Sends the command to
 * the distributor and checks the response.
 */
int send_spi_cmd(void)
{
 int ccval; /* for CC return from WRITEREAD */
 /* Determine how much buffer space was used. */
 spi_err = SSGETTKN( (int *)spi_buf, ZSPI_TKN_USEDLEN,
 (char *)&used_len );
 if (spi_err != ZSPI_ERR_OK)
 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.\n");
 return(ems_err);
 }
 else
 DEBUG();
 }
 return( spi_err );
}
#pragma PAGE
/************************************************************
 * 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,










