Previous | Table of Contents | Next |
In the following sections, well discuss the fields of the two PDU formats and the operation of the five PDUs. If you feel comfortable with ASN.1 notation, you may wish to refer to the SNMP definition in Section 4.5.
The GetRequest, GetNextRequest, SetRequest, and GetResponse PDUs share a common format (see Figure 4-6). The first field, PDU Type, specifies the type of PDU the message contains:
PDU | PDU Type Field Value | |
---|---|---|
GetRequest | 0 | |
GetNextRequest | 1 | |
GetResponse | 2 | |
SetRequest | 3 | |
Trap | 4 | |
The Request ID field is an INTEGER type that correlates the managers request to the agents response. The Error Status field is an enumerated INTEGER type that indicates normal operation (noError) or one of five error conditions. The possible values are:
Error | Value | Meaning | |
---|---|---|---|
noError | 0 | Proper manager/agent operation. | |
TooBig | 1 | The size of the required GetResponse PDU exceeds a local limitation. | |
noSuchName | 2 | The requested object name did not match the names available in the relevant MIB View. | |
badValue | 3 | A SetRequest contained an inconsistent type, length, and value for the variable. | |
readOnly | 4 | Not defined in RFC 1157. (Historical footnote: this error is listed, but the description of the SetRequest PDU processing does not describe how this error is generated. The standard interpretation is that this error should not be generated, although some vendors agents nevertheless do.) | |
genErr | 5 | Other errors, not explicitly defined, have occurred. | |
When an error occurs, the Error Index field identifies the entry within the variable bindings list that caused the error. For example, if a readOnly error occurred, it would return an Error Index = 4.
A Variable Binding (VarBind) pairs a variable name with its value. A VarBindList is a list of such pairings. Note that within the Variable Bindings fields of the SNMP PDUs (see Figures 4-6 through 4-11), the word Object identifies the variable name (OID encoding of object type plus the instance) for which a value is being communicated. Also note that GetRequest or GetNextRequest PDUs use a value of NULL, which is a special ASN.1 data type.
Figure 4-7. GetRequest/GetResponse PDU transmission (with no errors) (Courtesy 3Com Corp.)
Figure 4-8. GetNextRequest/GetResponse PDU transmission (with no errors) (Courtesy 3Com Corp.)
Figure 4-9. SetRequest/GetResponse PDU transmission (with no errors) (Courtesy 3Com Corp.)
Figure 4-10. SNMP Trap PDU structure
Figure 4-11. Trap PDU operation (Courtesy 3Com Corp.)
The manager uses the GetRequest PDU to retrieve the value of one or more object(s) from an agent. In most cases, these are scalar, not columnar, objects. To generate the GetRequest PDU, the manager assigns PDU Type = 0, specifies a locally defined Request ID, and sets both the ErrorStatus and ErrorIndex to 0. A VarBindList, containing the requested variables and corresponding NULL (placeholder) values, completes the PDU. Under error-free conditions, the agent generates a GetResponse PDU, which is assigned PDU Type = 2, the same value of Request ID, Error Status = noError, and Error Index = 0. The Variable Bindings now contain the values associated with each of the variables noted in the GetRequest PDU (see Figure 4-7). Recall that the term variable refers to an instance of a managed object.
Four error conditions are possible:
The manager uses the GetNextRequest PDU to retrieve one or more objects and their values from an agent. In most cases, these multiple objects will reside within a table. As you can see in Figure 4-8, to generate the GetNextRequest PDU the manager assigns PDU Type = 1, specifies a locally defined Request ID, and sets both the ErrorStatus and the ErrorIndex to 0. A VarBindList, containing the OIDs and corresponding NULL (placeholder) values, completes the PDU. These OIDs can be any OID (which may be a variable) that immediately precedes the variable and value returned. Under error-free conditions, the agent generates a GetResponse PDU, which is assigned PDU Type = 2, the same value of Request ID, Error Status = noError, and Error Index = 0. The Variable Bindings contain the name and value associated with the lexicographical successor of each of the OIDs noted in the GetNextRequest PDU.
Previous | Table of Contents | Next |