Network Working Group M. Urue±a Internet-Draft D. Larrabeiti Expires: September 15, 2004 UC3M March 17, 2004 eXtensible Binary Encoding (XBE32) Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http:// www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on September 15, 2004. Copyright Notice Copyright (C) The Internet Society (2004). All Rights Reserved. Abstract This document defines the eXtensible Binary Encoding (XBE32). It has been designed to represent hierarchical data in a compact and extensible format. Data elements are binary encoded inside Type-Length-Value (TLV) structures, which are 32-bit aligned to be easily parsed by computers. XBE32 is NOT a binary encoding for XML documents, but an encoding format for small, lightweight network protocols. Urue±a & Larrabeiti Expires September 15, 2004 [Page 1] Internet-Draft XBE32 Binary Encoding March 2004 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1 Notation Conventions . . . . . . . . . . . . . . . . . . . 3 2. Common TLV Format . . . . . . . . . . . . . . . . . . . . . . 4 2.1 Unspecified Length . . . . . . . . . . . . . . . . . . . . 5 3. XBE32 TLVs . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.1 TLV with inner TLV Values . . . . . . . . . . . . . . . . 6 3.2 TLV with a Variable-Length Value . . . . . . . . . . . . . 7 3.3 TLV with 1 Octet Values . . . . . . . . . . . . . . . . . 7 3.4 TLV with 2 Octets Values . . . . . . . . . . . . . . . . . 8 3.5 TLV with 4 Octets Values . . . . . . . . . . . . . . . . . 8 3.6 TLV with 8 Octets Values . . . . . . . . . . . . . . . . . 9 3.7 TLV with 12 Octets Values . . . . . . . . . . . . . . . . 9 3.8 TLV with 16 Octets Values . . . . . . . . . . . . . . . . 10 4. XBE32 Elements . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1 Extensible Elements: Ids and Names . . . . . . . . . . . . 11 4.2 Complex Elements . . . . . . . . . . . . . . . . . . . . . 12 4.3 Attribute Elements . . . . . . . . . . . . . . . . . . . . 12 4.3.1 Opaque Values . . . . . . . . . . . . . . . . . . . . 13 4.3.2 String Value . . . . . . . . . . . . . . . . . . . . . 14 4.3.3 Boolean Values . . . . . . . . . . . . . . . . . . . . 14 4.3.4 Integer Values . . . . . . . . . . . . . . . . . . . . 14 4.3.5 Float Values . . . . . . . . . . . . . . . . . . . . . 14 5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 15 References . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 15 A. XBE32 Examples . . . . . . . . . . . . . . . . . . . . . . . . 16 Intellectual Property and Copyright Statements . . . . . . . . 18 Urue±a & Larrabeiti Expires September 15, 2004 [Page 2] Internet-Draft XBE32 Binary Encoding March 2004 1. Introduction Nowadays, the most popular format to represent hierarchical structured information is XML and it is being employed in multiple network protocols. Although its textual representation allows extensible protocols and ease protocol development and debugging, it requires more bandwidth than a binary counterpart. This document defines the XBE32 encoding. A simple binary encoding for network protocols that carry hierarchical data. All XBE32 elements are encoded inside 32 bit aligned TLV structures to ease the parsing process. As data is clearly delimited, XBE32 does not require to escape characters as XML does, thus easing message creation. As TLVs have 2 octet Type an Length fields, it is well suited for simple protocols with small messages and a small set of identifiers. However, in order to be extensible, it supports variable-length binary and string identifiers. Also, XBE32 allows complex elements with an undefined length in order to start sending a message before its total length is known. In order to be employed by modern programming languages, XBE32 defines common data types as Integer, Float, Boolean, String or Arrays. Other data types can be represented as opaque binary data, also defined by XBE32. 1.1 Notation Conventions The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, NOT RECOMMENDED, MAY, and OPTIONAL, when they appear in this document, are to be interpreted as described in RFC2119 [1]. Urue±a & Larrabeiti Expires September 15, 2004 [Page 3] Internet-Draft XBE32 Binary Encoding March 2004 2. Common TLV Format 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : : Values : : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type (16 bits): This field describes which kind of value is inside this TLV. This field has the following internal structure: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |C|E| Meta | Subtype | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Type's highest-order two bits specify the actions that must be taken if the processing entity does not recognize that Type: C - Continue Processing: 0 - Discard this TLV and stop processing TLVs left. 1 - Skip this TLV and continue processing. E - Notify Error: 0 - Do not report to the sender that this Type is unknown. 1 - Report to the sender that this Type is unknown. Meta (6 bits): This field describes the internal structure of the Values field: Meta Values structure --------- ------------------------------ 0x00-0x1F Multiple, variable-length TLVs 0x20-0x2F Single, variable-length Value 0x30 Multiple, 1 octet Values 0x31 Multiple, 2 octet Values 0x32 Multiple, 4 octet Values 0x33 Multiple, 8 octet Values 0x34 Multiple, 12 octet Values 0x35 Multiple, 16 octet Values 0x36-0x3F Reserved Urue±a & Larrabeiti Expires September 15, 2004 [Page 4] Internet-Draft XBE32 Binary Encoding March 2004 Length (16 bits): This field contains the unsigned length of the whole TLV structure measured in octets, padding not included. Length SHOULD be always greater than 4 octets, that is, the length of the Type and Length values. The only exception to this rule is a complex TLV with a zero length value which is explained in next subsection. Value (variable length): The Values field contains the actual XBE32-encoded data. If a primitive Value is not aligned to 4 octet words, empty space MUST be filled with zeros (0x00). 2.1 Unspecified Length In some circumstances a message can not be delayed/stored until all the data to be encoded is available. However, as a TLV should contain the total length of the structure, it can not be sent before all the data becomes available or the length can be inferred somehow. For that reason, XBE32 allows a complex TLV (i.e. containing other TLVs) to have an "undefined length". In that case, the last of the inner TLVs MUST be an End-of-data TLV. "Undefined" length is specified by setting the complex TLV Length field to zero (0x0000). End-of-data TLV has the Type field set to zero (0x0000) and 4 octet length, thus it is empty and MUST NOT contain any value: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x0000 | Length = 4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ This mechanism allows XBE32 to encode complex TLVs of arbitrary length. However, only complex elements may have an unspecified length. Primitive Values MUST NOT be larger than 65532 octets. Urue±a & Larrabeiti Expires September 15, 2004 [Page 5] Internet-Draft XBE32 Binary Encoding March 2004 3. XBE32 TLVs Some Values transmitted may not be 4 octet word aligned, thus in that case padding MUST be added (up to 3 padding octets) to align the TLV structure to 4 octet words. Padding octets MUST be filled with zeros (0x00) in transmission and MUST be ignored in reception. 3.1 TLV with inner TLV Values This figure displays a complex TLV containing several TLV Values. If Length field is "undefined" (0x0000), complex TLV MUST end with a 4 octet End-of-data TLV. If total length is specified, End-of-data TLV MUST NOT appear. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type.Meta = 0x00-0x1F | Length = 0 or 4 + TLVs Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type #1 | Length #1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : : Values #1 : : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type #N | Length #N | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : : Values #N : : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | [ End-of-data TLV ] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ As XBE32 TLVs are always aligned to 4 octets words, the global TLV will be also aligned to 4 octet word thus padding MUST NOT be added, and the Length field will contain the total length of the TLV. Note that in the case of TLVs Values with padding, the Length of the global TLV MUST NOT be calculated as 4 plus the sum of the Length (or Extended Length TLV) fields of all the TLV values, which do not include the padding octets. Urue±a & Larrabeiti Expires September 15, 2004 [Page 6] Internet-Draft XBE32 Binary Encoding March 2004 3.2 TLV with a Variable-Length Value This figure displays a XBE32 TLV containing a single Value: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type.Meta = 0x20-0x2F | Length = 4 + Value.length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : : Value : : : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : | 0x00 | 0x00 | 0x00 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The length field contains the sum of the TLV header (Type and Length) plus the length in octets of the encoded Value. As the Value may not be aligned to 4 octet words, padding MUST be added. In that case the Length field does not contain the total length of the TLV structure but the length without the padding octets. 3.3 TLV with 1 Octet Values This figure displays a XBE32 TLV containing N, 1 octet Values: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type.Meta = 0x30 | Length = 4 + N | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Value #1 | Value #2 | Value #3 | Value #4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Value #N | 0x00 | 0x00 | 0x00 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The Length field contains the sum of the TLV header (Type and Length) plus the number of 1 octet values. As the number of Values may not multiple of 4, up to 3 padding octets SHOULD be added. In that case the length field does not contain the total length of the TLV structure but the total length without the padding octets. Urue±a & Larrabeiti Expires September 15, 2004 [Page 7] Internet-Draft XBE32 Binary Encoding March 2004 3.4 TLV with 2 Octets Values This figure displays a XBE32 TLV containing N, 2 octet Values: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type.Meta = 0x31 | Length = 4 + 2*N | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Value #1 | Value #2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Value #N | 0x0000 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The Length field contains the sum of the TLV header (Type and Length) plus the number of 2 octet values multiplied by two. As the number of Values may not multiple of 2, two padding octets SHOULD be added. In that case the length field does not contain the total length of the TLV structure but the total length without padding octets. 3.5 TLV with 4 Octets Values This figure displays a XBE32 TLV containing N, 4 octet Values: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type.Meta = 0x32 | Length = 4 + 4*N | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Value #1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Value #N | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ These TLVs are always aligned to 4 octet words. Length field MUST contain the total length of the TLV as padding MUST NOT be added. Urue±a & Larrabeiti Expires September 15, 2004 [Page 8] Internet-Draft XBE32 Binary Encoding March 2004 3.6 TLV with 8 Octets Values This figure displays a XBE32 TLV containing N, 8 octet Values: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type.Meta = 0x33 | Length = 4 + 8*N | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + Value #1 + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + Value #N + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ These TLVs are always aligned to 4 octet words. Length field MUST contain the total length of the TLV as padding MUST NOT be added. 3.7 TLV with 12 Octets Values This figure displays a XBE32 TLV containing N, 12 octet Values: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type.Meta = 0x34 | Length = 4 + 12*N | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | Value #1 | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Value #N + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Urue±a & Larrabeiti Expires September 15, 2004 [Page 9] Internet-Draft XBE32 Binary Encoding March 2004 These TLVs are always aligned to 4 octet words. Length field MUST contain the total length of the TLV as padding MUST NOT be added. 3.8 TLV with 16 Octets Values This figure displays a XBE32 TLV containing N, 16 octet Values: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type.Meta = 0x35 | Length = 4 + 16*N | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Value #1 + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Value #N + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ These TLVs are always aligned to 4 octet words. Length field MUST contain the total length of the TLV as padding MUST NOT be added. Urue±a & Larrabeiti Expires September 15, 2004 [Page 10] Internet-Draft XBE32 Binary Encoding March 2004 4. XBE32 Elements XBE32 has been designed to encode hierarchical data in a compact binary format easily generated and parsed by machines. Hierarchical data can be represented as a tree where each node has a name. The "leaf" nodes of the tree are also named but they are the only ones that carry data. In XBE32 each node on the tree is known as "Element". Every Element has an identifier, that could be a binary one or a human-readable name. There are two kinds of Elements in XBE32 based in if they carry primitive data. "Attribute Elements" are the "leafs" of the tree and carry primitive values. "Complex Elements" on the other hand don't carry primitive data, but are the parents of other Elements, that could be Attribute Elements or another Complex Elements themselves. As most of the protocols will employ a small set of elements to build its messages, XBE32 Elements MAY be identified just by its Type field. Every protocol may define its own set of Subtypes not employed in the base specification of XBE32: Meta Subtype Element -------- --------- --------------------- 0x00-0x1F 0x01-0xFF Complex Element TLV 0x20-0x35 0x03-0xFF Attribute Element TLV 4.1 Extensible Elements: Ids and Names The above mechanism allows a compact representation and is suitable for the initial definition of the mandatory operations and parameters of a protocol. However, a 2 octet Type field is not enough for truly extensible protocols, as it could be a too small namespace for vendor extensions or experimental operations. In order to cope with this requirement, XBE32 allows Extensible Elements. This kind of XBE32 Elements are not identified by their Type field but include an initial TLV with an identifier Value. After that identifier TLV, it may contain more TLVs with the specified Values (in the case of an Extensible Attribute Element) of sub-elements (if Extensible Element is a Complex one). All the Types with the Meta field set to 0x10 and Subtype field set to 0x00 are reserved for Extensible Element TLVs. Note that C and E bits may have any value. Therefore up to four different Extensible Urue±a & Larrabeiti Expires September 15, 2004 [Page 11] Internet-Draft XBE32 Binary Encoding March 2004 Elements could be defined. For example, an optional Complex Element that should not notified if unknown, will have the 0x9000 Type Value. Meta Subtype Description ---- ------- ---------------------- 0x10 0x00 Extensible Element TLV An XBE32 Extensible Element MUST have an identifier, which can be a human-readable UTF-8 string called "Name" or an opaque sequence of octets called "Id". XBE32 has defined two TLVs to carry those identifiers: Type TLV Description ------ ----------------------- 0x2000 Extensible Element Name 0x2001 Extensible Element Id 4.2 Complex Elements A Complex Element is a TLV containing Multiple, XBE32 Encoded Values (Type.Meta=0x00-0x1F). Unless a non-zero Subtype is specified, the first TLV-encoded Value MUST be an Element Name (Type=0x2000) or an Element Id (Type=0x2001) one, which value MUST be 4 octets long. If some Subtype value is assigned to the Complex Element to be encoded, the upper TLV MUST have that non-zero value in the Subtype field. As the Element is identified by that value, the Element Id/ Name TLVs are not needed and SHOULD NOT appear. A Complex Element may contain zero or more XBE32 Elements that could be Attribute Elements, Complex Elements or a combination of both. Any TLV different to an XBE32 Element TLV (i.e. Element Values TLV) is forbidden and MUST NOT appear inside a Complex Element TLV. 4.3 Attribute Elements An Attribute Element does not have any children Element as the Complex Element does, but zero or more simple values. An Extensible Attribute Element without an assigned Subtype has a format very similar to a Complex Element but containing one or more TLV Values. That is, a TLV with a zero (0x00) Subtype containing Multiple XBE32 Encoded Values (Meta=0x00-0x1F). The first one MUST be Element Id (Type=0x2001) or an Element Name (Type=0x2000) TLV. Some XBE32 TLVs (Meta=0x30-0x35) are able to carry several fixed-length values inside a single TLVs, while others Urue±a & Larrabeiti Expires September 15, 2004 [Page 12] Internet-Draft XBE32 Binary Encoding March 2004 (Meta=0x20-0x2F) only allows one Value per TLV. As an Attribute Element may have several values of the same type, an Extensible Attribute Element with a Element Id/Name TLV SHOULD carry one of the former, multi-value TLVs or one or more of the latter, single-value TLVs with the same type. Those are the TLVs containing Values that may appear inside an Extensible Attribute Element: Type TLV Description ------ ------------------------ 0x2100 Single opaque Value 0x2800 Single string Value 0x3000 Multiple opaque1 Values 0x3001 Multiple int8 Values 0x3002 Multiple boolean Values 0x3100 Multiple opaque2 Values 0x3101 Multiple int16 Values 0x3200 Multiple opaque4 Values 0x3201 Multiple int32 Values 0x3202 Multiple float32 Values 0x3300 Multiple opaque8 Values 0x3301 Multiple int64 Values 0x3302 Multiple float64 Values 0x3400 Multiple opaque12 Values 0x3500 Multiple opaque16 Values When a Subtype value is assigned to the Attribute Element, its XBE32 encoding fits in a single TLV. In that case, the Attribute TLV Type MUST have the appropriate Meta value (0x20-0x35) in order to carry its Value or Values. 4.3.1 Opaque Values An Opaque value is a sequence of octets that should not be parsed by a XBE32 entity but just being delivered to the upper layer. The Opaque values defined by XBE32 are: Type TLV Description ------ ------------------------ 0x2100 Single opaque Value 0x3000 Multiple opaque1 Values 0x3100 Multiple opaque2 Values 0x3200 Multiple opaque4 Values 0x3300 Multiple opaque8 Values 0x3400 Multiple opaque12 Values 0x3500 Multiple opaque16 Values Urue±a & Larrabeiti Expires September 15, 2004 [Page 13] Internet-Draft XBE32 Binary Encoding March 2004 4.3.2 String Value This TLV contains a single UTF-8 encoded String: Type TLV Description ------ ------------------- 0x2800 Single string Value 4.3.3 Boolean Values A boolean value is encoded inside an octet value. "False" is encoded as 0x00 while "True" is encoded as 0xFF. Other values than 0x00 or 0xFF MUST NOT appear as an encoded boolean value. Type TLV Description ------ ----------------------- 0x3002 Multiple boolean Values 4.3.4 Integer Values Signed integer values MUST be encoded as a two's complement binary number in network byte order (a.k.a. Big Endian, i.e., the most significant byte first). The integer values defined by XBE32 are: Type TLV Description ------ --------------------- 0x3001 Multiple int8 Values 0x3101 Multiple int16 Values 0x3201 Multiple int32 Values 0x3301 Multiple int64 Values 4.3.5 Float Values Float values MUST be encoded as specified in [2]. The floating point values defined by XBE32 are: Type TLV Description ------ ----------------------- 0x3202 Multiple float32 Values 0x3302 Multiple float64 Values Urue±a & Larrabeiti Expires September 15, 2004 [Page 14] Internet-Draft XBE32 Binary Encoding March 2004 5. Acknowledgements We would like to thank Miguel Fernandez by his valuable comments. References [1] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [2] Institute of Electrical and Electronics Engineers, "Standard for Binary Floating-Point Arithmetic", IEEE Standard 754, August 1985. Authors' Addresses Manuel Urue±a Universidad Carlos III de Madrid Av. Universidad 30 Legan‰s, Madrid 28911 ES Phone: +34 91 624 87 95 EMail: muruenya@it.uc3m.es David Larrabeiti Universidad Carlos III de Madrid Av. Universidad 30 Legan‰s, Madrid 28911 ES Phone: +34 91 624 99 53 EMail: dlarra@it.uc3m.es Urue±a & Larrabeiti Expires September 15, 2004 [Page 15] Internet-Draft XBE32 Binary Encoding March 2004 Appendix A. XBE32 Examples 123456789 AUTH_ERROR Invalid Password en 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x08F1 (error) | Length = 0 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x3283 (code) | Length = 8 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0x07 | 0x5B | 0xCD | 0x15 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x2861 (name) | Length = 14 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'A' | 'U' | 'T' | 'H' | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | '-' | 'E' | 'R' | 'R' | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'O' | 'R' | 0x00 | 0x00 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x0610 (desc) | Length = 32 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x2863 (text) | Length = 20 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'I' | 'n' | 'v' | 'a' | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'l' | 'i' | 'd' | ' ' | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'P' | 'a' | 's' | 's' | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'w' | 'o' | 'r' | 'd' | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x2864 (lang) | Length = 6 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'e' | 'n' | 0x00 | 0x00 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x0000 (End-of-data) | Length = 4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Urue±a & Larrabeiti Expires September 15, 2004 [Page 16] Internet-Draft XBE32 Binary Encoding March 2004 Alice, Bob 2e2312c1-4f8d-431d-ac6e-500880b42e2c, 0399eac8-69ac-4ee6-95df-9f72d128f33a 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x1000 | Length = 32 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x2001 | Length = 8 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0x00 | 0x00 | 0x28 | 0x03 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x2800 | Length = 9 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'A' | 'l' | 'i' | 'c' | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'e' | 0x00 | 0x00 | 0x00 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x2800 | Length = 7 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'B' | 'o' | 'b' | 0x00 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x1000 | Length = 48 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x2000 | Length = 7 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 'i' | 'd' | 's' | 0x00 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type = 0x3500 | Length = 36 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0x2E | 0x23 | 0x12 | 0xC1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0x4F | 0x8D | 0x43 | 0x1D | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0xAC | 0x6E | 0x50 | 0x08 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0x80 | 0xB4 | 0x2E | 0x2C | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0x03 | 0x99 | 0xEA | 0xC8 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0x69 | 0xAC | 0x4E | 0xE6 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0x95 | 0xDF | 0x9F | 0x72 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0xD1 | 0x28 | 0xF3 | 0x3A | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Urue±a & Larrabeiti Expires September 15, 2004 [Page 17] Internet-Draft XBE32 Binary Encoding March 2004 Intellectual Property Statement The IETF takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on the IETF's procedures with respect to rights in standards-track and standards-related documentation can be found in BCP-11. Copies of claims of rights made available for publication and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementors or users of this specification can be obtained from the IETF Secretariat. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to practice this standard. Please address the information to the IETF Executive Director. Full Copyright Statement Copyright (C) The Internet Society (2004). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assignees. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION Urue±a & Larrabeiti Expires September 15, 2004 [Page 18] Internet-Draft XBE32 Binary Encoding March 2004 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Acknowledgment Funding for the RFC Editor function is currently provided by the Internet Society. Urue±a & Larrabeiti Expires September 15, 2004 [Page 19]