30.10 SNMP Message Format

  Unlike most TCP/IP protocols, SNMP messages do not have 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 will review the ASN.l encoding scheme briefly, and see an example of an encoded SNMP message. Figure 30.7 shows how an SNMP message can be 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 be 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, additional header data, a set of security parameters, and a data area that carries the payload. A precise definition must be supplied for each of the terms used. For example, Figure 30.8 illustrates how the contents of the Header-Data section can be specified.

  The data area in an 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 PDU to be sent as plain text or to be 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 PDU 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 has a type ANY because field contextName defines the exact details of the item. The SNMPv3 Message Processing Model (v3MP) specifies that 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 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 standard specify the remaining undefined terms. Both error-status and error-index are single octet integers which contain the value 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 that VarBindList is a sequence of pairs of object name and value. ASN.l represents the pairs as a sequence of two items. Thus, in the simplest possible request, VarBindList is a sequence of two items: a name and a null.

7 SNMF'v3 distinguishes between an application that uses the service SNMP supplies and an 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的更多相关文章

  1. Example: Encoded SNMP Message - SNMP Tutorial

    30.11 Example Encoded SNMP Message The encoded form of ASN.1 uses variable-length fields to represen ...

  2. MySQL主从复制中断,报“Error on master: message (format)='Cannot delete or update a parent row: a foreign key constraint fails' error code=1217” 错误

    前几天,发现从库挂了,具体报错信息如下: 分析思路 1. 因为我采用的是选择性复制,只针对以下几个库进行复制: card,upay,deal,monitor,collect.所以,不太可能出现对于sa ...

  3. Centos 6.5下一个SNMP简单配置(snmp protocol v3,监控宝)

    Centos 6.5下一个SNMP简单配置(snmp protocol v3.监控宝) jom_ch@2014/7/25 1,安装 >yum -y install net-snmp net-sn ...

  4. 浅议SNMP安全、SNMP协议、网络管理学习

    相关学习资料 tcp-ip详解卷1:协议.pdf(重点看25章SNMP部分) http://www.rfc-editor.org/rfc/rfc1213.txt http://www.rfc-edit ...

  5. Zabbix的snmp监控一些snmp常用的一些OID (KEY)

    摘自: http://www.iyunv.com/thread-167287-1-1.html System Group sysDescr 1.3.6.1.2.1.1.1 sysObjectID 1. ...

  6. python解析处理snmp回显----snmp

    查看服务端配置:https://www.cnblogs.com/dpf-10/p/9175409.html 查看内容示例: D:\python>snmpwalk -v 2c -c public ...

  7. SNMP Tutorial

    Applications: Internet Management (SNMP) 30.1 Introduction 30.2 The Level Of Management Protocols 30 ...

  8. SNMP: Simple? Network Management Protocol(转)

    转自:http://www.rane.com/note161.html An SNMP Overview The Message Format The Actual Bytes Introductio ...

  9. C++开源库集合

    | Main | Site Index | Download | mimetic A free/GPL C++ MIME Library mimetic is a free/GPL Email lib ...

随机推荐

  1. Linux 磁盘自检介绍

    在Linux系统中,有时候重启会耗费非常长的时间,如果你进一步检查细节,就会发现绝大部分时间都耗费在磁盘自检(fsck)上了,有时候遇到时间比较紧急的情况,磁盘自检耗费的时间非常长,真的是让人心焦火急 ...

  2. Windows系统下Oracle每天自动备份

    linux和unix下面使用shell可以很方便实现,如果windows环境下可以结合计划任务实现 创建备份目录d:\backup, 创建批处理命令Bak.bat,编写备份脚本 exp user/pa ...

  3. MongoDB学习笔记~索引提高查询效率

    回到目录 索引这个东西大家不会陌生,只要接触到稍微大一点的数据,都会用到这东西,它可以提升查询的速度,相当代价就是占用了更多的存储空间,这也是正常的,符合“能量守恒定理”,哈哈!今天说的是MongoD ...

  4. Window10可用的转串口驱动CH340

    下载地址:http://pan.baidu.com/s/1cvCNtO

  5. CentOS 7 虚拟机无法开机问题

    若虚拟机在不正常关机的时候会遇到如下图所示的问题:先点击"取消"按钮

  6. hadoop从非HA转到NAMENODE HA时需要注意的一个问题

    配置core-site.xml 配置hdfs-site.xml 配置mapred-site.xml 配置yarn-site.xml 纷发至其他节点 修改RM 2 ..N 上面的节点信息 格式化ZK h ...

  7. CI连接多个数据库

    参考http://codeigniter.org.cn/user_guide/database/connecting.html手册 首先,在database.php中设置多个数据库的连接信息,这里命名 ...

  8. 识别 Linux上的设备(磁盘)类型

    1. Linux 上的设备 (device) Linux 操作系统中,各种设备驱动(device driver)通过设备控制器(device controller)来管理各种设备(device),其关 ...

  9. AngularJS笔记--自定义指令

    在前端开发中, 我们会遇到很多地方都会用到同一种类型的控件.AngularJS提供了自定义指令功能,我们可以在指令里面定义特定的html模板.提供给前台html调用. 一. 指令的简单定义.  下面定 ...

  10. Hibernate双向多对多关联

    一.配置双向多对多关联 以Project类(项目)和Emp类(员工)为例: 1.创建Project类,并需要定义集合类型的Emp属性 public class Project { //编号 priva ...