SNMP Configuration and Management Manual
Trap Multiplexer Subagent/Manager
SNMP Configuration and Management Manual—424777-006
12-59
Application Source Code
 /* send the comand to the distributor */
 send_spi_cmd (spi_buf, distr);
} /* spi_cmd_load_filter */
/*************************************************************************/
#pragma PAGE "insert_null()"
/* this routine inserts a NULL at the end of an array of characters so
 that printf can print it as a string and returns the pointer to
 the beginning of the printable string
 Input : pointer to t_buffer and length of the data
 Return : pointer to the beginning of the string
*/
char* insert_null(char* pt_buffer, short* len)           <-- 8
{
 char* b_ptr;     /* base pointer        */
 pt_buffer++;     /* skip the type        */
 *len = *pt_buffer;   /* get the length from the second byte */
 pt_buffer++;     /* skip the length       */
 b_ptr = pt_buffer + *len; /* point to the end of array   */
 *b_ptr = 0;      /* insert a null to print as a string  */
 return pt_buffer;
} /* insert_null */
/*************************************************************************/
#pragma PAGE "print_octetstring()"
/* this routine prints an octet string variable.  Nonprintable
 chars are replaced with "."
 Input : pointer to the buffer, length and title to be displayed
 Return : None
*/
void print_octetstring(char* buffer, int buflen, char* title)      <-- 9
{
 static char printbuf[2048];
 unsigned char c;
 int i;
 memcpy (printbuf, buffer, buflen);
 printbuf[buflen] = '\0';
 for (i = 0; i < buflen; i++)  {
  c = *buffer++;
  if (c < 32 || c >= 127)
   printbuf[i] = '.';
 }
 printf ( "%s %s\n", title, printbuf);
} /* print_octetstring */
/*************************************************************************/
#pragma PAGE "getevent_loop()"
/* this procedure contains a loop to retrieve event messages. Each time
 through the loop, the procedure gets all the tokens pertaining to this
 event and displays them on the terminal.
Example 12-3. Sample Application Source Code (page 4 of 14)










