
Trap Multiplexer Subagent/Manager
SNMP Configuration and Management Manual — 424777-006
12 -60
Application Source Code
Input : pointer to spi_buffer and distributor file number
Return : None
*/
void getevent_loop(char* spi_buf, short distr) <-- 10
{
char* event_buf; /* pointer to event data */
short byteoffset, i;
zspi_ddl_int2_def t_version; /* trap version */ <-- 11
zspi_ddl_int2_def t_generic; /* generic trap number */
zspi_ddl_int2_def t_specific; /* specific trap number */
zspi_ddl_int2_def t_timeticks; /* timeticks */
zspi_ddl_int_def t_varbind_count; /* number of var binds */
zspi_ddl_enum_def t_varbind_datatype; /* data type of each var bind */
zspi_ddl_char_def t_null = 0;
zspi_ddl_int2_def t_integer;
zspi_ddl_int2_def t_counter;
zspi_ddl_int2_def t_gauge;
short evt_num;
unsigned char trap_buf[ZEMS_VAL_BUFLEN];
ztmx_val_ssid_def tmpssid;
char t_buffer[1024]; /* temp buffer for string manipulation */
char* pt_buffer = t_buffer; /* pointer to the temp buffer */
short len;
short ibuflen = ZEMS_VAL_BUFLEN;
/* malloc memory for the event buffer */
event_buf = malloc (ZEMS_VAL_BUFLEN); <-- 12
if (event_buf == NULL)
DEBUG();
setmem (trap_buf,sizeof(trap_buf),0); /* initialise the trap buffer */
/* begin an infinite loop that collects and displays events */
while (1)
{
/* initialize spi_buf for getevent spi command */
spi_err = SSINIT((short*)spi_buf, /* buffer */ <-- 13
ZEMS_VAL_BUFLEN, /* buffer length */
(short*)&emsssid, /* ssid */
ZSPI_VAL_CMDHDR, /* header-type */
ZEMS_CMD_GETEVENT); /* command */
if (spi_err != ZSPI_ERR_OK)
DEBUG();
/* send getevent command to distributor */
printf ("\n\nWaiting for the next Event.....\n\n");
send_spi_cmd (spi_buf, distr); <-- 14
/* Extract the event into the buffer */
spi_err = SSGETTKN ((short*) spi_buf, <-- 15
ZEMS_TKN_EVENT,
event_buf,
1);
if (spi_err != ZSPI_ERR_OK)
DEBUG();
Example 12-3. Sample Application Source Code
(page 5 of 14)
Содержание T9576G06
Страница 24: ...Contents SNMP Configuration and Management Manual 424777 006 xxii Tables continued ...
Страница 36: ...About This Manual SNMP Configuration and Management Manual 424777 006 xxxiv Change Bar Notation ...
Страница 38: ...Part I Installing and Configuring SNMP SNMP Configuration and Management Manual 424777 006 ...
Страница 140: ...Part II SCF for the SNMP Agent SNMP Configuration and Management Manual 424777 006 ...
Страница 208: ...Part III Troubleshooting SNMP Configuration and Management Manual 424777 006 ...
Страница 230: ...Part IV SNMP Subagents SNMP Configuration and Management Manual 424777 006 ...
Страница 340: ...TCP IP Subagent SNMP Configuration and Management Manual 424777 006 8 110 Converting Events to Traps ...
Страница 562: ...Trap Multiplexer Subagent Manager SNMP Configuration and Management Manual 424777 006 12 70 Application Source Code ...
Страница 636: ...IPX SPX Subagent G Series SNMP Configuration and Management Manual 424777 006 13 74 1012 ZISA EVT PROCESS TRAPPED ...
Страница 704: ...Part V Appendices SNMP Configuration and Management Manual 424777 006 ...
Страница 778: ...Index SNMP Configuration and Management Manual 424777 006 Index 32 Special Characters ...