HP T9576G06 Management Manual page 551

Snmp configuration and management manual
Table of Contents

Advertisement

Trap Multiplexer Subagent/Manager
Example 12-3. Sample Application Source Code (page 4 of 14)
/* 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
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)
{
char* b_ptr;
pt_buffer++;
*len = *pt_buffer;
pt_buffer++;
b_ptr = pt_buffer + *len; /* point to the end of array
*b_ptr = 0;
return pt_buffer;
} /* insert_null */
/*************************************************************************/
#pragma PAGE "print_octetstring()"
/* this routine prints an octet string variable.
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)
{
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.
/* base pointer
/* skip the type
/* get the length from the second byte
/* skip the length
/* insert a null to print as a string
{
SNMP Configuration and Management Manual—424777-006
and returns the pointer to
Nonprintable
12-59
Application Source Code
<-- 8
*/
*/
*/
*/
*/
*/
<-- 9

Advertisement

Table of Contents
loading

This manual is also suitable for:

T9576h01

Table of Contents