SNMP Manager Programmer's Guide
SNMP Manager Programmer’s Guide–134249
5-1
5
Constructing and Interpreting
Packets
Packets are the messages exchanged between SNMP entities to retrieve, change, or
report on the values of MIB objects. This section briefly explores the nature of the three
kinds of packets (request, response, and trap) and how you use Manager Services
functions and structures to construct request and trap packets and interpret response and
trap packets. Finally, this section describes the Manager Services packet-handling
functions:
Packet Attributes
As RFC 1157 prescribes and Figure 5-1 indicates, every SNMP packet contains three
elements: a version number, a community identifier, and a PDU. The version number
identifies the version of SNMP whose information and packet protocol is being used;
Manager Services packets contain version fields set to 0, indicating that Version 1 of
SNMP is being implemented. The community identifier is a name associated with the
manager; it is a string used by SNMP agents for request authentication. The PDU is a
collection of fields constituting a request, a response, or a trap.
Table 5-1 summarizes how you use Manager Services to assign the values of the version
and community fields; subsequent subsections describe how PDU values are assigned.
Table 5-1 also identifies the fields in the Manager Services SNMP_PKT_T structure
where the packet field values are stored. Refer to Section 4, Using Header Files, Data
Structures, and Defines, for a complete description of this structure.
Functions for initializing packets SNMP_Create_Request()
SNMP_Create_Trap()
Functions for binding MIB variables SNMP_Bind_Integer()
SNMP_Bind_IP_Address()
SNMP_Bind_Null()
SNMP_Bind_Object_ID()
SNMP_Bind_String()
SNMP_Bind_Unsigned_Integer()
Function for releasing memory for packet
structure
SNMP_Free()
Figure 5-1. The SNMP Packet
102
version community Protocol Data Unit (PDU)