SNMP Configuration and Management Manual
Trap Multiplexer Subagent/Manager
SNMP Configuration and Management Manual—424777-006
12-54
Application Source Code
12. A buffer named event_buf is allocated for holding a trap event.
ZEMS_VAL_BUFLEN provides 4200 bytes for this purpose.
13. A SPI command is built to initialize a buffer named spi_buf. This buffer, declared in
the main block, is large enough to hold the longest SPI response.
14. The SPI command is processed by calling send_spi_cmd().
15. The EMS event information is extracted from spi_buf and stored in event_buf for
token parsing.
16. The beginning of event_buf is identified.
17. The subsystem ID is retrieved and examined to determine whether it matches the
subsystem ID of the Trap Multiplexer.
18. The event number is examined to determine whether it is a trap event.
19. The original BER-encoded trap is copied into trap_buf. SPI inserts the size of this
value in the first two bytes of the buffer.
20. The value of ZTMX-TKN-TRAP-VERSION, the SNMP version in the trap PDU, is
extracted and displayed.
21. The value of ZTMX-TKN-TRAP-COMMUNITY, the community name in the trap
PDU, is extracted and displayed after insert_null() is called.
22. The value of ZTMX-TKN-TRAP-ENTERPRISE, the enterprise name in the trap
PDU, is extracted and displayed after insert_null() is called.
23. The value of ZTMX-TKN-TRAP-NETADDR, the IP address of the trap originator, is
extracted and displayed after insert_null() is called.
24. The value of ZTMX-TKN-TRAP-GENERIC, the generic trap type in the trap PDU,
is extracted and displayed.
25. The value of ZTMX-TKN-TRAP-SPECIFIC, the specific trap type in the trap PDU,
is extracted and displayed.
26. The value of ZTMX-TKN-TRAP-TIMETICKS, the timestamp in the trap PDU, is
extracted and displayed.
27. The token list enclosing varbind information is accessed.
28. The value of ZTMX-TKN-TRAP-VARBIND-COUNT, the number of varbinds in the
trap PDU, is extracted and displayed.
29. This “for” loop is executed once for each varbind.
30. The inner list delimiting one varbind is accessed.
31. The value of ZTMX-TKN-TRAP-VARBIND-OID, the object identifier of the varbind,
is extracted and displayed after insert_null() is called.
32. The value of ZTMX-TKN-TRAP-VARBIND-DATATYPE, the SNMP data type of the
varbind, is extracted.