zoukankan      html  css  js  c++  java
  • Example: Encoded SNMP Message

    30.11 Example Encoded SNMP Message

      The encoded form of ASN.1 uses variable-length fields to represent items. In general, each field begins with a header that specifies the type of object and its length in bytes. For example, each SEQUENCE begins with an octet containing 30 (hexadecimal); the next octet specifies the number of following octets that comprise the sequence.

      Figure 30.11 contains an example SNMP message that illustrates how values are encoded into octets. The message is a get-request that specifies data item sysDescr (numeric object identifier 1.3.6.1.2.1.1.1.0).Because the example shows an actual message, it includes many details. In particular, the message contains a msgSecurityParameters section which has not been discussed above. This particular message uses the UsmSecurityParameters form of security parameters. It should be possible, however, to correlate other sections of the message with the definitions above.

      As Figure 30.11 shows, the message starts with a code for SEQUENCE which has a length of 103 octets8. The first item in the sequence is a 1-octet integer that specifies the protocol version; the value 3 indicates that this is an SNMPV3 message. Successive fields define a message ID and the maximum message size the sender can accept in a reply. Security information, including the name of the user (ComerBook) follows the message header.

      The GetRequest-PDU occupies the tail of the message. The sequence labeled ScopedPDU specifies a context in which to interpret the remainder of the message. The octet A0 specifies the operation as a get-Request. Because the high-order bit is turned on, the interpretation of the octet is context specific. That is, the hexadecimal value A0 only specifies a GetRequest-PDU when used in context; it is not a universally reserved value. Following the request octet, the length octet specifies the request is 26 octets long. The request ID is 2 octets, but each of the error-status and error-index are one octet. Finally, the sequence of pairs contains one binding, a single object identifier bound to a null value. The identifier is encoded as expected except that the fist two numeric labels are combined into a single octet.

    8Sequence items occur frequently in an SNMPmessage because SNMP uses SEQUENCE instead of conventional

    programming language constructs like arrayor struct

    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

  • 相关阅读:
    hdu1251 字典树trie 模板题
    SPOJ 1479 +SPOJ 666 无向树最小点覆盖 ,第二题要方案数,树形dp
    POJ 2125 最小点权覆盖集(输出方案)
    dfs序+主席树 或者 树链剖分+主席树(没写) 或者 线段树套线段树 或者 线段树套splay 或者 线段树套树状数组 bzoj 4448
    dfs序+主席树 BZOJ 2588 当然树链剖分+主席树也可以?
    最小生成树的边的概念问题!!! 最小生成树的计数 bzoj 1016
    BZOJ 2083 vector的巧用+二分
    vector的哈希值 Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) C
    codeforces Good bye 2016 E 线段树维护dp区间合并
    莫对 和分块 模板
  • 原文地址:https://www.cnblogs.com/klchang/p/5147859.html
Copyright © 2011-2022 走看看