SNMP Configuration and Management Manual
Trap Multiplexer Subagent/Manager
SNMP Configuration and Management Manual—424777-006
12-53
Application Source Code
5. The function named send_spi_cmd() sends SPI commands built by other functions
to the distributor and processes the response.
6. The function named spi_cmd_set_source() builds SPI commands to identify the
EMS collector from which events are to be retrieved and then calls
send_spi_cmd().
7. The function named spi_cmd_load_filter() builds SPI commands to identify the
EMS filter to use and then calls send_spi_cmd().
8. The function named insert_null() terminates string values with a NULL character so
that printf can be used to display these values.
9. The function named print_octetstring() formats an OCTET STRING value by
replacing nonprintable characters with a period.
10. The function named getevent_loop() is an infinite loop that uses SPI commands to
retrieve events and parse their tokens and then displays token values.
11. Storage for SNMP data is declared. Most values are allocated storage by using
compatible ZSPI data types. Values that the application treats as strings (OCTET
STRING, OBJECT IDENTIFIER, IpAddress, and Opaque values) are stored in a
1024-byte buffer named t_buffer. The following table summarizes the SPI and C
types you can use when declaring storage for trap data:
Trap Data SPI Data Type C (Wide Model) Data Type
SNMP version number zspi_ddl_int2_def int
Community value zspi_ddl_char_def char*
Enterprise value zspi_ddl_char_def char*
IP address zspi_ddl_char_def char*
Generic trap type zspi_ddl_int2_def int
Specific trap type zspi_ddl_int2_def int
Timestamp value zspi_ddl_int2_def int
Varbind count zspi_ddl_int_def short
Varbind data type zspi_ddl_enum_def short
Varbind object identifier zspi_ddl_char_def char*
INTEGER value zspi_ddl_int2_def int
Counter value zspi_ddl_int2_def int
Gauge value zspi_ddl_int2_def int
OBJECT IDENTIFIER value zspi_ddl_char_def char
OctetString value zspi_ddl_char_def char*
Opaque value zspi_ddl_char_def char*
IpAddress value zspi_ddl_char_def char*
NULL value zspi_tdt_undef
TimeTicks value zspi_ddl_int2_def int