home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_n_r / draft-perkins-opaque-01.txt < prev    next >
Text File  |  1997-06-13  |  39KB  |  971 lines

  1.  
  2. INTERNET-DRAFT           Expires December 1997           INTERNET-DRAFT
  3.  
  4. Draft                   Domestication of Opaque            June 7, 1997
  5.  
  6.  
  7.                         The Domestication of the
  8.                           Opaque Type for SNMP
  9.  
  10.                        <draft-perkins-opaque-01.txt>
  11.  
  12.                               June 7, 1997
  13.  
  14.                             David T. Perkins
  15.                          dperkins@snmpinfo.com
  16.  
  17.  
  18.  
  19. 1.  Status of this Memo
  20.  
  21.    This document is an Internet Draft.  Internet Drafts are working
  22.    documents of the Internet Engineering Task Force (IETF), its Areas,
  23.    and its Working Groups. Note that other groups may also distribute
  24.    working documents as Internet Drafts.
  25.  
  26.    Internet Drafts are draft documents valid for a maximum of six
  27.    months.  Internet Drafts may be updated, replaced, or obsoleted by
  28.    other documents at any time.  It is not appropriate to use Internet
  29.    Drafts as reference material or to cite them other than as a
  30.    "working draft" or "work in progress."
  31.  
  32.    To learn the current status of any Internet-Draft, please check the
  33.    "1id-abstracts.txt" listing contained in the internet-drafts Shadow
  34.    Directories on:
  35.  
  36.          ftp.is.co.za (Africa)
  37.          nic.nordu.net (Europe)
  38.          ds.internic.net (US East Coast)
  39.          ftp.isi.edu (US West Coast)
  40.          munnari.oz.au (Pacific Rim)
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Expires 12/07/97                                               [Page 1]
  59. Draft                   Domestication of Opaque            June 7, 1997
  60.  
  61.  
  62. 2.  Introduction
  63.  
  64. This memo is informational.  It specifies a clarification of the
  65. definition and use of the Opaque type defined in Simple Network
  66. Management Protocol (SNMP) Structure of Management Information (SMI).
  67. There are two versions of the SMI.  The first, called SMIv1, is defined
  68. by RFCs 1155[1], 1212[2], and 1215[3].  The second, called SMIv2, is
  69. defined by RFCs 1902[4], 1903[5], and 1904[6].  This memo shows that the
  70. Opaque type is well defined, and after domestication it is an effective
  71. and low-cost solution to:
  72.  
  73.      1) support 64-bit counters in SMIv1 and SNMPv1;
  74.      2) support future types added to the SMI without changing
  75.         the SNMP protocol; and
  76.      3) support for a discriminated union type.
  77.  
  78. All of the solutions are accomplished without a change to the technical
  79. content of the specifications for the SNMPv1[7] and SNMPv2[8][9]
  80. protocols.
  81.  
  82. This memo specifies a clarification for both version 1 and version 2 of
  83. the SNMP SMI, which is a standard for the Internet community.
  84.  
  85.  
  86. 3.  Background
  87.  
  88. The SMI defines the SNMP MIB module language, which is an augmented
  89. subset of the ASN.1 specification language[10].  The SNMP protocol is
  90. defined with a proper sub-set of ASN.1 notations and SNMP protocol
  91. messages are encoded using a proper sub-set of the Basic Encoding Rules
  92. (BER) for ASN.1[11].
  93.  
  94. The Opaque data type is defined in first version of the SMI for SNMP.
  95. The ASN.1 notation is found in section 6 of SMIv1[1] and is shown below:
  96.  
  97.     Opaque ::= [APPLICATION 4] IMPLICIT OCTET
  98.  
  99.  
  100. The Opaque data type is described in section 3.2.3.6 and is shown below:
  101.  
  102.    This application-wide type supports the capability to pass arbitrary
  103.    ASN.1 syntax.  A value is encoded using the ASN.1 basic rules into a
  104.    string of octets.  This, in turn, is encoded as an OCTET STRING, in
  105.    effect "double-wrapping" the original ASN.1 value.
  106.  
  107.    Note that a conforming implementation need only be able to accept
  108.    and recognize opaquely-encoded data.  It need not be able to unwrap
  109.    the data and then interpret its contents.
  110.  
  111.    Further note that by use of the ASN.1 EXTERNAL type, encodings other
  112.    than ASN.1 may be used in opaquely-encoded data.
  113.  
  114.  
  115. Expires 12/07/97                                               [Page 2]
  116. Draft                   Domestication of Opaque            June 7, 1997
  117.  
  118.  
  119.  
  120.  
  121. Unfortunately, the last sentence in this description is not correct.
  122. This inaccuracy is fixed in the SMIv2[4], and the description for the
  123. Opaque data type from section 7.1.9 is shown below:
  124.  
  125.    The Opaque type supports the capability to pass arbitrary ASN.1
  126.    syntax.  A value is encoded using the ASN.1 Basic Encoding Rules
  127.    into a string of octets.  This, in turn, is encoded as an OCTET
  128.    STRING, in effect "double-wrapping" the original ASN.1 value.
  129.  
  130.    Note that a conforming implementation need only be able to accept
  131.    and recognize opaquely-encoded data.  It need not be able to unwrap
  132.    the data and then interpret its contents.
  133.  
  134.  
  135. The description was made correct by eliminating the last sentence, which
  136. was incorrect and provided no additional useful information.
  137.  
  138. The SNMPv2 WG added a policy statement in RFC 1902 restricting usage of
  139. the Opaque type.  This restriction was due to several factors including:
  140.      1) misunderstandings caused by the description of the Opaque
  141.         type in SMIv1;
  142.      2) incorrect "interpretations" spread by a few "SNMP
  143.         experts"; and
  144.      3) no perceived mechanisms to describe the contents (or
  145.         value) of an Opaque type when used.
  146.  
  147. This policy is specified in the following text from section 7.1.9 of the
  148. SMIv2:
  149.  
  150.    The Opaque type is provided solely for backward-compatibility, and
  151.    shall not be used for newly-defined object types.
  152.  
  153.    A requirement of "standard" MIB modules is that no object may have a
  154.    SYNTAX clause value of Opaque.
  155.  
  156. The intent of this memo is to clarify the meaning of the Opaque data
  157. type; show how it uniquely (and at a low cost) solves several important
  158. problems; and replace the policy from RFC 1902 restricting usage with
  159. the policy specified in this memo.
  160.  
  161. The harnessing of the Opaque type for practical use is called the
  162. "domestication of the Opaque type."
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172. Expires 12/07/97                                               [Page 3]
  173. Draft                   Domestication of Opaque            June 7, 1997
  174.  
  175.  
  176. 4.  A Description of the Opaque Type
  177.  
  178. The Opaque type is defined in ASN.1 notation as the following:
  179.  
  180.    -- The value for this data type must be the BER serialization
  181.    -- of a valid ASN.1 value.
  182.    Opaque ::= [APPLICATION 4] IMPLICIT OCTET
  183.  
  184.  
  185. This ASN.1 definition means that when values of the Opaque data type are
  186. used in SNMP messages, which are encoded using the basic encoding rules
  187. of ASN.1 (BER)[11], the result is the following:
  188.  
  189.  
  190.      Serialization of a value, which is an SNMP Opaque data type
  191.        ------------------------------------------------------
  192.        |       |         |    value is serialized           |
  193.        |       |         |  ------------------------------  |
  194.        | tag   | length  |  | V-tag | V-length | V-value |  |
  195.        |       |         |  ------------------------------  |
  196.        ------------------------------------------------------
  197.  
  198.   where:
  199.      - tag is one octet with value of '44'h.
  200.      - length is one or more octets, but is typically one octet for
  201.        a length value less than 128, two octets for a length value
  202.        less than 256, and three octets for a length value less
  203.        than 65536.
  204.      - value is a string of octets that is the BER serialization of
  205.        a valid value of an ASN.1 type
  206.      - V-tag, V-length, and V-value are the serialization of an
  207.        ASN.1 value using BER serialization
  208.  
  209.  
  210. A common misinterpretation of the definition of the Opaque type is that
  211. values for it can be any string of octet values.  This is incorrect,
  212. since the SMI clearly specifies that the value must be the BER
  213. serialization of a value for an ASN.1 type.
  214.  
  215. The following table contains examples of BER serialization.  The first
  216. column contains ASN.1 data type specifications.  The second column
  217. contains a valid value of the ASN.1 data type specified in the same row.
  218. The third column contains the BER serialization of the value specified
  219. in the same row.  This column also specifies valid values of the Opaque
  220. data type.  The fourth column contains the BER serialization of the
  221. value of data type Opaque in the same row.
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229. Expires 12/07/97                                               [Page 4]
  230. Draft                   Domestication of Opaque            June 7, 1997
  231.  
  232.  
  233.                            BER               BER Serialization
  234.                            Serialization     of Value as
  235.  Data Type    Value        of Value          Opaque Data Type
  236.   -------    --------      ---------------   -------------------
  237.   INTEGER     67240454     '020404020306'h   '4406020404020306'h
  238.   OCTET       '04020306'h  '040404020306'h   '4406040404020306'h
  239.    STRING
  240.   OBJECT      0.4.2.3.6    '060404020306'h   '4406060404020306'h
  241.    IDENTIFIER
  242.   IpAddress   4.2.3.6      '400404020306'h   '4406400404020306'h
  243.   Counter     67240454     '410404020306'h   '4406410404020306'h
  244.   Gauge       67240454     '420404020306'h   '4406420404020306'h
  245.   TimeTicks   67240454     '430404020306'h   '4406430404020306'h
  246.   Opaque      '04020306'h  '440404020306'h   '4406440404020306'h
  247.   Counter64   67240454     '460404020306'h   '4406460404020306'h
  248.  
  249.  
  250. These examples clearly demonstrate that the valid values of data type
  251. Opaque and their BER serialization are well defined.  Examining the
  252. result of the BER serialization reveals that the original value is not
  253. changed.  Serialization just adds an additional tag and length "around"
  254. the previously serialized value.  BER serialization is called "wrapping
  255. a value."  The values specified in column two (in the above table) are
  256. wrapped once in column three, and wrapped again (or "double wrapped") in
  257. column four.
  258.  
  259.  
  260.  
  261. 5.  The Domestication of the Opaque Data Type
  262.  
  263. There are two problems with the current definition of the Opaque type.
  264. First, there are no restrictions on the ASN.1 data types or values that
  265. can be "wrapped."  Thus, values and ASN.1 data types, even those not
  266. allowed in SNMP, may be serialized.  Secondly, usage of the Opaque data
  267. type does not require the ASN.1 data type of the double wrapped values
  268. to be specified.   Thus, it is difficult, if not impossible, to "unwrap"
  269. a serialized value.
  270.  
  271. On the other hand, the Opaque data type does provide the lowest cost
  272. solution to two critical problems in SNMP.  The first problem is how to
  273. support the addition of new basic data types to the SMI and protocol.
  274. (One example is 64-bit counters in SMI1 and SNMPv1.)  The second problem
  275. is how to support a "union" data type that is needed in sophisticated
  276. environments such as mid-level managers.
  277.  
  278. The taming of the current (and "wild") definition of the Opaque data
  279. type for practical uses is called the "domestication of Opaque."
  280.  
  281. The domestication is easily accomplished with a simple harnessing of the
  282. definition of the Opaque data type.  The replacement definition of the
  283. Opaque data type for SMIv1 and SMIv2 is:
  284.  
  285.  
  286. Expires 12/07/97                                               [Page 5]
  287. Draft                   Domestication of Opaque            June 7, 1997
  288.  
  289.  
  290.  
  291.    The Opaque data type supports the capability to pass arbitrary ASN.1
  292.    syntax.  A value is encoded using the ASN.1 Basic Encoding Rules
  293.    into a string of octets.  This, in turn, is encoded as an OCTET
  294.    STRING, in effect "double-wrapping" the original ASN.1 value.
  295.  
  296.    Note that a conforming implementation of the SNMP protocol shall be
  297.    able to encode and decode SNMP PDUs with the value portion of a
  298.    variable-bind pair using this type.
  299.  
  300.    A conforming SNMP MIB module shall specify the ASN.1 type for the
  301.    original values in the DESCRIPTION clause of the OBJECT-TYPE or
  302.    TEXTUAL-CONVENTION constructs where the Opaque data type is used.
  303.  
  304.    Furthermore, standards track MIB modules are restricted in their use
  305.    of the ASN.1 data types wrapped by the Opaque data type.  Only the
  306.    ASN.1 types defined in the SMI for use as the value for the SYNTAX
  307.    clause for columnar and scalar objects, the SEQUENCE data type, the
  308.    CHOICE data type, and specially created APPLICATION data types may
  309.    be used.  Note, that these may be also be qualified with an
  310.    "IMPLICIT" context-specific tag.  However, context-specific tags
  311.    greater than or equal to 32 are reserved for special situations, and
  312.    cannot be used.
  313.  
  314.  
  315. 5.1.  Support for New Types
  316.  
  317. SMIv2 added a new type, Counter64, not found in SMIv1.  This type was
  318. added to address the need for event and flow counts in situations where
  319. a 32-bit counter rolls over too rapidly (such as in a networking device
  320. using high-speed transmission technology including FDDI and ATM).
  321. Unfortunately, object types that are defined with syntax of Counter64
  322. cannot be converted to a MIB module in the SMIv1 format and cannot be
  323. accessed using the SNMPv1 protocol, since the type Counter64 is not
  324. defined in the SMIv1 or in the SNMPv1 protocol.  However, instead of
  325. using the Counter64 type directly, the Opaque type can be used to hold
  326. the serialization of the Counter64 type, or any other new type that
  327. needs to be added to future SMI versions.
  328.  
  329. MIB modules written to use this approach must use a textual convention
  330. instead of the new type for the data type of object types, which is
  331. specified in the SYNTAX clause.  Such a textual convention is an example
  332. domestication of the untamed Opaque data type.  The value of the Opaque
  333. data type for the textual convention is restricted to a serialized value
  334. of a tagged version of the new data type.  This approach allows only
  335. those SNMP managers or agents who need a new data type to be required to
  336. be upgraded.  This approach requires no change, and does not impact
  337. existing SNMP compliant agents or managers.
  338.  
  339. The domestication of the Opaque data type reserves ASN.1 context-
  340. specific tags greater than or equal to 32 for special use.  One use of
  341.  
  342.  
  343. Expires 12/07/97                                               [Page 6]
  344. Draft                   Domestication of Opaque            June 7, 1997
  345.  
  346.  
  347. the reserved values is to use ASN.1 context-specific tags with values 48
  348. and above for support of new SMI types in old versions of the SNMP
  349. protocol.  This is done by adding the value of the tag for a "new" type
  350. to the base value 48 and using the resulting sum as the context-specific
  351. tag for the ASN.1 type.
  352.  
  353. For example, the tag for data type Counter64 is application-specific 6,
  354. which is '46'h in BER.  The sum of 48 ('30'h) and '46'h is 118 ('76'h).
  355. Thus, the ASN.1 definition for this context-type is "[118] IMPLICIT
  356. Counter64," with the tag encoded in BER as '9F76'h.
  357.  
  358. Note that BER encodes tags as three fields.  These are class(cls),
  359. primitive/constructed flag(f), and number.  If the number is less than
  360. 31, then all three fields are encoded into one octet.  If the number is
  361. 31 or greater, then multiple octets are used to encode the tag.  The
  362. format is shown below for one and two octet tags:
  363.  
  364.       One octet tag               Two octet tag
  365.      7 6 5 4 3 2 1 0           7 6 5 4 3 2 1 0   7 6 5 4 3 2 1 0
  366.     -----------------         ----------------- -----------------
  367.     |cls|f| 0 - 30  |         |cls|f|1 1 1 1 1| |0|   31 - 127  |
  368.     -----------------         ----------------- -----------------
  369.  
  370.     where:
  371.       cls is  00 - universal
  372.               01 - application
  373.               10 - context specific
  374.               11 - private use
  375.  
  376.       f is  0 - primitive
  377.             1 - constructed
  378.  
  379.  
  380. 5.1.1.  64-Bit Counters
  381.  
  382. To support 64-bit counters in SMIv1 and SMIv2 MIB modules, and use the
  383. SNMPv1 and SNMPv2 protocols, the following textual convention must be
  384. used in SYNTAX clause instead of the data type Counter64:
  385.  
  386.    C64 TEXTUAL-CONVENTION
  387.        STATUS      current
  388.        DESCRIPTION
  389.            "A 64-bit counter which monotonically increases
  390.            until it reaches a maximum value of (2^64)-1
  391.            (18446744073709551615 decimal), when it wraps
  392.            around and starts increasing again from zero.
  393.  
  394.            Counters have no defined 'initial' value, and thus,
  395.            a single value of a counter has (in general) no
  396.            information content.  Discontinuities in the
  397.            monotonically increasing value normally occur
  398.  
  399.  
  400. Expires 12/07/97                                               [Page 7]
  401. Draft                   Domestication of Opaque            June 7, 1997
  402.  
  403.  
  404.            at re-initialization of the management system,
  405.            and at other times as specified in the description
  406.            of an object-type using this textual convention.
  407.            If such other times can occur, for example, the
  408.            creation of an object instance at times other
  409.            than re-initialization, then a corresponding
  410.            object should be defined with a SYNTAX clause
  411.            value of TimeStamp (a well-known textual
  412.            convention) indicating the time of the last
  413.            discontinuity.
  414.  
  415.            The value of the MAX-ACCESS clause for objects
  416.            with a SYNTAX clause of this textual convention
  417.            must be either 'read-only' or 'accessible-for-notify'.
  418.  
  419.            A DEFVAL clause is not allowed for objects using
  420.            this textual convention.
  421.  
  422.            The value is restricted to the BER serialization of
  423.            the following ASN.1 type:
  424.                COUNTER64 ::= [118] IMPLICIT Counter64
  425.            (note: the value 118 is the sum of '30'h and '46'h)
  426.            The BER serialization of the length for values of
  427.            this type must use the definite length, short
  428.            encoding form.
  429.  
  430.            For example, the BER serialization of value 56782 of
  431.            type COUNTER64 is '9f760300ddce'h.  (The tag is '9f76'h;
  432.            the length is '03'h; and the value is '00ddce'h.) The
  433.            BER serialization of value '9f760300ddce'h of data type
  434.            Opaque is '44069f760300ddce'h.  (The tag is '44'h; the
  435.            length is '06'h; and the value is '9f760300ddce'h.)"
  436.        SYNTAX      Opaque (SIZE(4..12))
  437.  
  438. With the C64 textual convention, objects can be defined in both the
  439. SMIv1 and SMIv2 formats and can be accessed via both SNMPv1 and SNMPv2
  440. protocols.  Shown below are definitions for the same object in both SMI
  441. formats:
  442.  
  443.  
  444.    -- in SMIv1
  445.    exmplC64 OBJECT-TYPE
  446.        SYNTAX      C64
  447.        ACCESS      read-only
  448.        STATUS      mandatory
  449.        DESCRIPTION
  450.            "Example 64-bit counter available in both SNMPv1
  451.            and SNMPv2."
  452.        ::= { exmpls 1 }
  453.  
  454.  
  455.  
  456.  
  457. Expires 12/07/97                                               [Page 8]
  458. Draft                   Domestication of Opaque            June 7, 1997
  459.  
  460.  
  461.    -- in SMIv2
  462.    exmplC64 OBJECT-TYPE
  463.        SYNTAX      C64
  464.        MAX-ACCESS  read-only
  465.        STATUS      current
  466.        DESCRIPTION
  467.            "Example 64-bit counter available in both SNMPv1
  468.            and SNMPv2."
  469.        ::= { exmpls 1 }
  470.  
  471.  
  472. 5.1.2.  Future New Data Types
  473.  
  474. In the future, there may be a need for a limited number of additional
  475. data types to support the usage of SNMP in management of networks other
  476. than those for computer data, such as heating and cooling systems, and
  477. automotive traffic control.  Also, distributed management of computer
  478. data networks with so-called mid-level managers may require addition of
  479. new data types.  The domestication of the opaque data type allows new
  480. data types to be added without disrupting existing systems and tools
  481. used to create them. The following text describes the process and
  482. requirements to add a new data type.
  483.  
  484.  
  485. The addition of new data types is serious business and may not proceed
  486. without careful review of the network management area.  A new data type
  487. may not be defined to associate semantics with an existing data type.
  488. (Note that this requirement would not have allowed the Counter or Gauge
  489. data types to be created as basic data types.  Instead, they would have
  490. been textual conventions of an unsigned integer data type.)  A new data
  491. type may be an ASN.1 universal type or an application-specific type.
  492. For each new data type defined, a textual convention must also be
  493. defined to wrap the new data type in an Opaque data type. The following
  494. example shows the definition of two new data types. The first is an
  495. application-specific data type and the second is a universal data type.
  496.  
  497.    -- define a new data type using the next available application
  498.    -- specific tag (note: using BER, the tag for the type is '48'h)
  499.    New1Type ::= [APPLICATION 8] IMPLICIT OCTET STRING (SIZE(4))
  500.  
  501.  
  502.    -- define a textual convention to wrap the new data type
  503.    New1 TEXTUAL-CONVENTION
  504.        STATUS      current
  505.        DESCRIPTION
  506.            "A new data type with some characteristics specified.
  507.  
  508.            The value is restricted to the BER serialization of
  509.            the following ASN.1 data type:
  510.                NEW1TYPE ::= [120] IMPLICIT New1Type
  511.            (note: the value 120 is the sum of '30'h and '48'h)
  512.  
  513.  
  514. Expires 12/07/97                                               [Page 9]
  515. Draft                   Domestication of Opaque            June 7, 1997
  516.  
  517.  
  518.            The BER serialization of the length for values of
  519.            this data type must use the definite length, short
  520.            encoding form.
  521.  
  522.            For example, the BER serialization of value
  523.            '12345678'h of data type NEW1TYPE is '9f780412345678'h.
  524.            (The tag is '9f78'h; the length is '04'h; and the
  525.            value is '12345678'h.) The BER serialization of value
  526.            '9f780412345678'h of data type Opaque is
  527.            '44079f780412345678'h. (The tag is '44'h; the length
  528.            is '07'h; and the value is '9f780412345678'h.)"
  529.        SYNTAX      Opaque (SIZE(7))
  530.  
  531.    or
  532.  
  533.    -- define a new data type based on an existing ASN.1 universal
  534.    -- data type (note: using BER, the tag for the data type is '03'h)
  535.    New2Type ::= BIT STRING
  536.  
  537.    -- define a textual convention to wrap the new data type
  538.    New2 TEXTUAL-CONVENTION
  539.        STATUS      current
  540.        DESCRIPTION
  541.            "A new data type with some characteristics specified.
  542.  
  543.            The value is restricted to the BER serialization of
  544.            the following ASN.1 data type:
  545.                NEW2TYPE ::= [51] IMPLICIT New2Type
  546.            (note: the value 51 is the sum of '30'h and '03'h)
  547.            The BER serialization of the length for values of
  548.            this data type must use the definite length, short
  549.            encoding form.
  550.  
  551.            For example, the BER serialization of value '12345678'h
  552.            of type NEW2TYPE is '9f33050012345678'h.  (The tag is
  553.            '9f33'h; the length is '05'h; and the value is
  554.            '0012345678'h.)  The BER serialization of value
  555.            '9f33050012345678'h of type data type Opaque is
  556.            '44089f33050012345678'h.  (The tag is '44'h; the length
  557.            is '08'h; and the value is '9f33050012345678'h.)"
  558.        SYNTAX      Opaque (SIZE(4..65535))
  559.  
  560.  
  561. 5.2.  Support for Unions
  562.  
  563. There is a need for a union data type that allows a value to be
  564. identified and that allows different value encodings based on the
  565. identification.  This need was present when the first version of the SMI
  566. and the core IETF SNMP MIB were created.  A union was needed to hold
  567. different types of network addresses.  The solution that was created,
  568. the data type NetworkAddress, proved problematic and was not included in
  569.  
  570.  
  571. Expires 12/07/97                                              [Page 10]
  572. Draft                   Domestication of Opaque            June 7, 1997
  573.  
  574.  
  575. the second version of the SMI.  However, the need for a union of network
  576. addresses still exists.  Other needs also exist for unions.  For
  577. example, researchers have created mid-level managers that allow running
  578. of scripts to compute values, and have the resulting value retrievable
  579. via SNMP.  The data type of a computed value may be any of the data
  580. types allowed by the SMI such as integers, strings, and object
  581. identifiers.  Without a union data type, however, a mid-level manager
  582. must define several objects, each with a different data type of a
  583. potential result, and also define an object that specifies which of the
  584. objects actually contains the result.  The development, maintenance, and
  585. operational costs of this approach are quite high.  Fortunately, these
  586. needs and others are easily satisfied with a low-cost domestication of
  587. the Opaque data type.
  588.  
  589.  
  590. 5.2.1.  Definition of SnmpUnion
  591.  
  592. The domestication of the Opaque data type reserves ASN.1 context-
  593. specific tags greater than or equal to 32 for special use.  The ASN.1
  594. context-specific tag with value of 47 is used to define the SNMP union.
  595. The domestication of opaque requires that the ASN.1 type definition be
  596. specified for the wrapped value.  The definitions of the ASN.1 type for
  597. the SNMP union and the textual convention to wrap values as an Opaque
  598. data type follow:
  599.  
  600.    -- A discriminated union
  601.    SnmpUnionType ::= [47] IMPLICIT SEQUENCE {
  602.        memberId INTEGER (-2147483648.. 2147483647),
  603.        memberType CHOICE {
  604.            -- the first six data types are currently defined
  605.            -- in the SNMP SMI
  606.            int32Val INTEGER (-2147483648.. 2147483647),
  607.            stringVal OCTECT STRING (SIZE(0..65535)),
  608.            oidVal OBJECT IDENTIFIER,
  609.            noneVal NULL,
  610.            uint32Val [APPLICATION 2] IMPLICIT INTEGER (0..4294967295),
  611.            opaqueVal [APPLICATION 4] IMPLICIT
  612.                    OCTET STRING (SIZE(2..65535)),
  613.            -- the last four data types are additional special
  614.            -- APPLICATION types
  615.            floatVal  -- the "single format" as defined in
  616.                   -- ANSI/IEEE Std 754-1985: IEEE Standard for
  617.                   -- Binary Floating Point[12][13]
  618.                    [APPLICATION 8] IMPLICIT OCTET STRING (SIZE(4)),
  619.            doubleVal  -- the "double format" as defined in
  620.                    -- ANSI/IEEE Std 754-1985: IEEE Standard for
  621.                    -- Binary Floating Point[12][13]
  622.                    [ APPLICATION 9] IMPLICIT OCTET STRING (SIZE(8)),
  623.            int64Val [APPLICATION 10] IMPLICIT
  624.                    INTEGER (-9223372036854775808..
  625.                                                 9223372036854775807),
  626.  
  627.  
  628. Expires 12/07/97                                              [Page 11]
  629. Draft                   Domestication of Opaque            June 7, 1997
  630.  
  631.  
  632.            uint64Val [APPLICATION 11] IMPLICIT
  633.                    INTEGER (0.. 18446744073709551615) }}
  634.  
  635.    -- The textual convention to wrap the SNMP union as an
  636.    -- Opaque data type
  637.    SnmpUnion TEXTUAL-CONVENTION
  638.        STATUS      current
  639.        DESCRIPTION
  640.            "A discriminated union, which is used to identify
  641.            one member from a choice of members.  Each member
  642.            represents one kind of value.  The objects or
  643.            textual conventions that specify this textual
  644.            convention in their SYNTAX clause shall specify
  645.            in their DESCRIPTION clause a list containing
  646.            the following information:
  647.               1) discriminator value - identifies a member
  648.               2) data type for member - one of int32, int64, string,
  649.                    oid, none, uint32, uint64, opaque, float, or double
  650.               3) description for member - any semantics associated
  651.                  with the kind of value
  652.            Updates to objects (and textual conventions) using
  653.            this textual convention may add new members,
  654.            but may never remove or change the semantics of
  655.            previously defined members.
  656.  
  657.            The value is restricted to the BER serialization of
  658.            the ASN.1 type SnmpUnionType.
  659.            The BER serialization of values of data type SnmpUnion
  660.            must 1) use primitive encoding, 2) use definite
  661.            encoding of the lengths, and 3) use the shortest
  662.            possible encoding of the lengths.
  663.  
  664.            For example, the BER serialization of value
  665.            { 1, int32Val 34 } of type SnmpUnionType is
  666.            'Bf2f06020101020122'h. (The tag is 'Bf2f'h; the length
  667.            is '06'h; and the value is '020101020122'h. The value
  668.            consists of items '020101'h and '020122'h. The first item
  669.            has tag '02'h; length '01'h; and value '01'h. The second
  670.            item has tag '02'h; length '01'h; and value '22'h.)
  671.            The BER serialization of value 'Bf2f06020101020122'h
  672.            of type Opaque is '4409Bf2f06020101020122'h."
  673.        SYNTAX      Opaque (SIZE(7..65535))
  674.  
  675.  
  676. 5.2.2.  Example Uses of SnmpUnion
  677.  
  678. With the SnmpUnion textual convention, objects can be defined in both
  679. SMIv1 and SMIv2 formats and can be accessed via both SNMPv1 and SNMPv2
  680. protocols.  Shown below are definitions for the same object in both SMI
  681. formats:
  682.  
  683.  
  684.  
  685. Expires 12/07/97                                              [Page 12]
  686. Draft                   Domestication of Opaque            June 7, 1997
  687.  
  688.  
  689.  
  690.    -- in SMIv1
  691.    exmplUnion OBJECT-TYPE
  692.        SYNTAX      SnmpUnion
  693.        ACCESS      read-write
  694.        STATUS      mandatory
  695.        DESCRIPTION
  696.            "Example object with syntax of union, available in
  697.            both SNMPv1 and SNMPv2."
  698.        ::= { exmpls 2 }
  699.  
  700.    -- in SMIv2
  701.    exmplUnion OBJECT-TYPE
  702.        SYNTAX      SnmpUnion
  703.        MAX-ACCESS  read-write
  704.        STATUS      current
  705.        DESCRIPTION
  706.            "Example object with syntax of union, available in
  707.            both SNMPv1 and SNMPv2."
  708.        ::= { exmpls 2 }
  709.  
  710.  
  711. The following example shows usage of a union to define a textual
  712. convention for all the transport address types found in "Transport
  713. Mappings for Version 2 of the Simple Network Management Protocol
  714. (SNMPv2)", RFC 1906[9]:
  715.  
  716.    Taddr TEXTUAL-CONVENTION
  717.        STATUS      current
  718.        DESCRIPTION
  719.            "A transport address.  The address can be from any
  720.            of the following protocol families: Internet UDP,
  721.            Internet TCP, OSI CLNS, OSI CONS, AppleTalk DDP,
  722.            and Novel IPX.
  723.  
  724.             ID  Syntax  Description
  725.              1  none    no transport address
  726.              2  string  UDP - in network byte order,
  727.                           octets 1..4: IP address;
  728.                           octets 5..6: UDP port
  729.              3  string  TCP - in network byte order,
  730.                           octets 1..4: IP address;
  731.                           octets 5..6: TCP port
  732.              4  string  CLNS -
  733.                           octet 1: length of NSAP (an unsigned
  734.                              integer 'n' with value of either 0
  735.                              or from 3 to 20);
  736.                           octets 2..(n+1): NSAP (in concrete binary
  737.                              representation);
  738.                           octets (n+2)..m: TSEL (a value of
  739.                             (up to 64) octets)
  740.  
  741.  
  742. Expires 12/07/97                                              [Page 13]
  743. Draft                   Domestication of Opaque            June 7, 1997
  744.  
  745.  
  746.              5  string  CONS - same format as CLNS addresses
  747.              6  string  DDP - a NBP name
  748.                           octet 1: value, 'n', is length of object;
  749.                           octets 2..(n+1): object (a value of
  750.                               (up to 32) octets);
  751.                           octet n+2: value, 'p', is length of type;
  752.                           octets (n+3)..(n+2+p): type (a value of
  753.                               (up to 32) octets);
  754.                           octet n+3+p: value, 'q', is length of zone;
  755.                           octets (n+4+p)..(n+3+p+q): zone (a value
  756.                               of (up to 32) octets).
  757.                           For comparison purposes, fields object,
  758.                           value, and zone are case-insensitive.  All
  759.                           of these fields may contain any octet value
  760.                           other than 255 (hex ff).
  761.              7  string  IPX - in network byte order
  762.                           octets 1..4: network-number;
  763.                           octets 5..10: physical-address;
  764.                           octets 11..12: socket-number."
  765.        SYNTAX      SnmpUnion
  766.  
  767.  
  768. The following example shows usage of a union to define a textual
  769. convention for the value that results from running a script at a mid-
  770. level manager.
  771.  
  772.    ScriptResult TEXTUAL-CONVENTION
  773.        STATUS      current
  774.        DESCRIPTION
  775.            "The result from running a script
  776.  
  777.             ID  Syntax  Description
  778.              1  none    The result is not available yet
  779.              2  uint32  Error running the script, the values are:
  780.                           1: syntax problem in script
  781.                           2: no response from script target
  782.                           3: invalid response from script target
  783.                           3: out of resources
  784.              3  int32   Signed integer result
  785.              4  int64   Big signed integer result
  786.              5  string  String result
  787.              6  oid     Object identifier result
  788.              7  uint32  Unsigned integer result
  789.              8  uint64  Big unsigned integer result
  790.              9  float   Float result
  791.             10  double  Double result"
  792.        SYNTAX      SnmpUnion
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799. Expires 12/07/97                                              [Page 14]
  800. Draft                   Domestication of Opaque            June 7, 1997
  801.  
  802.  
  803. 5.2.3.  Example BER for SnmpUnion Values
  804.  
  805. Below is shown an object definition and a table containing the BER
  806. encoding of values for the object.  This table illustrates the encoding
  807. of each kind of syntax allowed for a union member.
  808.  
  809.  
  810.    exmplUnionObj TEXTUAL-CONVENTION
  811.        SYNTAX      SnmpUnion
  812.        MAX-ACCESS  read-write
  813.        STATUS      current
  814.        DESCRIPTION
  815.            "An example object that shows each type of
  816.            syntax allowed for members of a union:
  817.  
  818.             ID  Syntax  Description
  819.              1  int32   Signed integer
  820.              2  int64   Big signed integer
  821.              3  string  String result
  822.              4  oid     Object identifier result
  823.              5  none
  824.              6  uint32  Unsigned integer result
  825.              7  uint64  Big unsigned integer result
  826.              8  opaque
  827.              9  float   Float result
  828.             10  double  Double result"
  829.        ::= { exmpl 3 }
  830.  
  831.  
  832.     Member        Example          BER Serialization
  833.   ID  Syntax       Value           SnmpUnion data type
  834.   --  ------      -------          -------------------
  835.    1  int32          1             'bf2f06020101020101'h
  836.       BER of object's value is '4409bf2f06020101020101'h
  837.  
  838.    2  int64          1             'bf2f060201024a0101'h
  839.       BER of object's value is '4409bf2f060201024a0101'h
  840.  
  841.    3  string       "01"            'bf2f0702010304023031'h
  842.       BER of object's value is '440abf2f0702010304023031'h
  843.  
  844.    4  oid          1.3.6           'bf2f0702010406034306'h
  845.       BER of object's value is '440abf2f0702010406034306'h
  846.  
  847.    5  none           -             'bf2f050201050500'h
  848.       BER of object's value is '4408bf2f050201050500'h
  849.  
  850.    6  unit32       56782           'bf2f08020106420300ddce'h
  851.       BER of object's value is '440bbf2f08020106420300ddce'
  852.  
  853.  
  854.  
  855.  
  856. Expires 12/07/97                                              [Page 15]
  857. Draft                   Domestication of Opaque            June 7, 1997
  858.  
  859.  
  860.    7  unit64       56782           'bf2f080201074b0300ddce'h
  861.       BER of object's value is '440bbf2f080201074b0300ddce'h
  862.  
  863.    8  opaque      '010100'h        'bf2f080201084403010100'h
  864.       BER of object's value is '440bbf2f080201084403010100'h
  865.  
  866.    9  float         123            'bf2f09020109480442f60000'h
  867.       BER of object's value is '440cbf2f09020109480442f60000'h
  868.  
  869.   10  double        123            'bf2f0d02010a4908405ec00000000000'h
  870.       BER of object's value is '4410bf2f0d02010a4908405ec00000000000'h
  871.  
  872.  
  873. 6.  Suggestions for Further Work
  874.  
  875. The SnmpUnion textual convention is a powerful addition to the usage of
  876. SNMP.  However, there is currently no direct support for it in the SMI.
  877. Thus, the identification, syntax, and description of the members of a
  878. union can only be specified in the DESCRIPTION clause for the object or
  879. textual convention where it is used.  Inside a DESCRIPTION clause, there
  880. is no enforcement of proper specification.  A MIB compiler cannot
  881. reliably parse the content of the a DESCRIPTION clause and make that
  882. information available to its users, such as application programs.  For
  883. these reasons, it is suggested that a construct be added to a future
  884. version of the SMI to specify the characteristics of members of a union.
  885. The resulting addition should be well defined so that it is parsable
  886. with a MIB compiler.
  887.  
  888.  
  889. 7.  Acknowledgments
  890.  
  891. Thanks go to Sandy M. Perkins for editorial assistance and review.
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913. Expires 12/07/97                                              [Page 16]
  914. Draft                   Domestication of Opaque            June 7, 1997
  915.  
  916.  
  917. 8.  References
  918.  
  919.  
  920. [1]  K. McCloghrie, M. Rose, "Structure and Identification of Management
  921.      Information for TCP/IP-based Internets", RFC 1155, 05/10/1990.
  922.  
  923. [2]  K. McCloghrie, M. Rose, "Concise MIB Definitions", RFC 1212,
  924.      03/26/1991.
  925.  
  926. [3]  M. Rose, "A Convention for Defining Traps for use with the SNMP",
  927.      RFC 1215, 03/27/1991.
  928.  
  929. [4]  J. Case, K. McCloghrie, M. Rose, S. Waldbusser, "Structure of
  930.      Management Information for Version 2 of the Simple Network
  931.      Management Protocol (SNMPv2)", RFC 1902, 01/22/1996.
  932.  
  933. [5]  J. Case, K. McCloghrie, M. Rose, S. Waldbusser, "Textual
  934.      Conventions for Version 2 of the Simple Network Management Protocol
  935.      (SNMPv2)", RFC 1903, 01/22/1996.
  936.  
  937. [6]  J. Case, K. McCloghrie, M. Rose, S. Waldbusser, "Conformance
  938.      Statements for Version 2 of the Simple Network Management Protocol
  939.      (SNMPv2)", RFC 1904, 01/22/1996.
  940.  
  941. [7]  M. Schoffstall, M. Fedor, J. Davin, J. Case, "A Simple Network
  942.      Management Protocol (SNMP)", RFC 1157, 05/10/1990.
  943.  
  944. [8]  J. Case, K. McCloghrie, M. Rose, S. Waldbusser, "Protocol
  945.      Operations for Version 2 of the Simple Network Management Protocol
  946.      (SNMPv2)", RFC 1905, 01/22/1996.
  947.  
  948. [9]  SNMPv2 Working Group, Case, J., McCloghrie, K., Rose, M., and
  949.      S. Waldbusser, "Transport Mappings for Version 2 of the Simple
  950.      Network Management Protocol (SNMPv2)", RFC 1906, 01/22/1996.
  951.  
  952. [10] Information processing systems - Open Systems Interconnection -
  953.      Specification of Abstract Syntax Notation One (ASN.1),
  954.      International Organization for Standardization.  International
  955.      Standard 8824, (December, 1987).
  956.  
  957. [11] Information processing systems - Open Systems Interconnection -
  958.      Specification of Basic Encoding Rules for Abstract Syntax Notation
  959.      One (ASN.1), International Organization for Standardization.
  960.      International Standard 8825, (December, 1987).
  961.  
  962. [12] "IEEE Standard for Binary Floating-Point Arithmetic", ANSI/IEEE
  963.      Standard 754-1985, Institute of Electrical and Electronics
  964.      Engineers, August 1985.
  965.  
  966. [13] R. Srinivasan, "XDR: External Data Representation Standard",
  967.      RFC 1832, 08/09/1995.
  968.  
  969.  
  970. Expires 12/07/97                                              [Page 17]
  971.