SNMP Configuration and Management Manual
Trap Multiplexer Subagent/Manager
SNMP Configuration and Management Manual—424777-006
12-57
Application Source Code
/* These defines are used for zems structs to shorten names  */
#define SPIERRDEF zspi_ddl_error_def
/* spi error */
short spi_err;
/* declare the SSIDs using the type defs from the DDL output */
zems_val_ssid_def emsssid;
ztmx_val_ssid_def tmxssid;
/************************************************************************/
#pragma PAGE "send_spi_cmd()"
/* Determines the used portion of a SPI buffer prepared by another
 procedure. Sends the SPI command to the distributor and checks the
 command response
 Input : SPI buffer and distributor file number
 Return : None
*/
void send_spi_cmd (char* spi_buf, short distr)           <-- 5
{
 short ccval;     /* for cc return from writeread */
 short ibuflen  = ZCOM_VAL_MAX_RSP_BUFLEN;
 short used_len;
 short spi_ret_code;
 /* Determine how much buffer was used       */
 spi_err = SSGETTKN ((short*)spi_buf,   /* buffer  */
       ZSPI_TKN_USEDLEN,   /* token-id  */
       (char*)&used_len);   /* token-value */
 if (spi_err != ZSPI_ERR_OK)
  DEBUG();
 /* Send the used part to the distributor     */
 ccval = WRITEREADX(distr,      /* file-number */
       (char*)spi_buf,    /* buffer  */
       used_len,      /* write-count */
       ZCOM_VAL_MAX_RSP_BUFLEN); /* read-count */
 if (ccval != CCE)
  DEBUG();
 /* reset the buffer */
 spi_err = SSPUTTKN((short*)spi_buf,   /* buffer  */
       ZSPI_TKN_RESET_BUFFER,  /* token-id  */
       (char*)ibuflen);   /* token-value */
 if (spi_err != ZSPI_ERR_OK)
  DEBUG();
 /* response is in the buffer, check for the return code */
 spi_err = SSGETTKN ((short*)spi_buf,
       ZSPI_TKN_RETCODE,
       (char*)&spi_ret_code, 1);
 if (spi_err != ZSPI_ERR_OK)
  DEBUG();
 if (spi_ret_code != ZSPI_ERR_OK)
  DEBUG();
} /* send_spi_cmd */
Example 12-3. Sample Application Source Code (page 2 of 14)










