30.10
SNMP Message Format
Unlike most TCP/IP protocols, SNMP messages does not have a fixed fields. Instead, they use the standard ASN.1 encoding. Thus, a message can be difficult for humans to decode and understand. After examining the SNMP message definition in ASN.1 notation, we'll review the ASN.L encoding scheme briefly, and see a n example of an encoded SNMP message. Figure 30.7 shows what an SNMP message can is described with an asn.l-style grammar. In general, each item in the grammar consists of a descriptive name followed by a declaration of the item ' s type. For example, an item such as
Msgversion INTEGER (0..2147483647)
Declares the name msgversion to is a nonnegative integer less than or equal to 2147483647.
As the figure shows, each SNMP message consists of four main Parts:an integer that identifies the protocol version, Addit ional header data, a set of security parameters, and a data area of carries the payload. A precise definition must is supplied for each of the terms used. For example, figure 30.8 illustrates how the contents of the Header-data sections can be specified.
The data area in a SNMP message is divided into protocol data units (PDUs). Each PDU consists of a request (sent by client) or a response (sent by an agent). SNMPv3 allows each PDUs to is sent as plain text or to is encrypted for privacy. Thus, the grammar specifies a CHOICE. In programming language terminology, the concept is known as a discriminated union.
Scopedpdudata:: = CHOICE {
PlainText SCOPEDPDU,
ENCRYPTEDPDU OCTET STRING--encrypted SCOPEDPDU value
}
An encrypted PDUs begins with an identifier of the engine7that produced it. The engine ID is followed by the name of the context and the octets of the encrypted message.
SCOPEDPDU:: = SEQUENCE {
Contextengineid OCTET STRING,
Ontextname OCTET STRING,
Data any--e.g, a PDU as defined below
}
The item labeled Data in the SCOPEDPDU definition have a type any because field contextname defines the exact details of the item. The SNMPv3 Message processing Model (V3MP) specifies, the data must consist of one of the SNMP PDUs as figure 30.9 illustrates:
The definition specifies that each protocol data unit consists of one of the eight types. To complete the definition of an SNMP message, we must further specify the syntax of the eight individual types. For example, figure 30.10 shows the definition of a getrequest.
Further definitions in the Specify the remaining undefined terms. Both error-status and error-index is single octet integers which contain the value of zero in a request. If An error occurs, the values sent in a response identify the cause of the error. Finally, varbindlist contains a list of object identifiers for which the client seeks values. In ASN.L terms, the definitions specify this varbindlist is a sequence of pairs of object name and value. ASN.L represents the pairs as a sequence of the items. Thus, in the simplest possible request, Varbindlist is a sequence of the items:a name and a null.
7 SNMF ' V3 distinguishes between an application that uses the service SNMP supplies and a engine, which is the underlying Software that transmits requests and receives responses.
Abstract from internetworking with TCP/IP Vol i:principles, protocols, and Architecture fourth Edition,
DOUGLAS E. Comer,
Department of computer Sciences Purdue University, West Lafayette, in 47907,
PRENTICE HALL,
Upper Saddle River, New Jersey 07458
SNMP Message Format-snmp Tutorial