Internet DRAFT - draft-li-core-links-cbor

draft-li-core-links-cbor







core                                                               K. Li
Internet-Draft                                           B. Greevenbosch
Intended status: Standards Track                                  R. Sun
Expires: June 19, 2015                               Huawei Technologies
                                                       December 16, 2014


               Representing CoRE Link Collections in CBOR
                      draft-li-core-links-cbor-01

Abstract

   Web Linking (RFC5988) provides a way to represent links between Web
   resources as well as the relations expressed by them and attributes
   of such a link.  In constrained networks, a collection of Web links
   can be exchanged in the CoRE link format (RFC6690).

   This specification defines a common format for representing Web links
   in CBOR format (RFC7049).

Note

   Discussion and suggestions for improvement are requested, and should
   be sent to core@ietf.org.

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   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."

   This Internet-Draft will expire on June 19, 2015.

Copyright Notice

   Copyright (c) 2014 IETF Trust and the persons identified as the
   document authors.  All rights reserved.





Li, et al.                Expires June 19, 2015                 [Page 1]

Internet-Draft                 Links CBOR                  December 2014


   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Terminology . . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Information Model . . . . . . . . . . . . . . . . . . . . . .   3
   3.  Encoding  . . . . . . . . . . . . . . . . . . . . . . . . . .   3
   4.  Web Links in CBOR . . . . . . . . . . . . . . . . . . . . . .   4
     4.1.  Examples  . . . . . . . . . . . . . . . . . . . . . . . .   5
   5.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   6
   6.  Security Considerations . . . . . . . . . . . . . . . . . . .   7
   7.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . .   7
   8.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   7
     8.1.  Normative References  . . . . . . . . . . . . . . . . . .   7
     8.2.  Informative References  . . . . . . . . . . . . . . . . .   7
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .   7

1.  Introduction

   Web Linking [RFC5988] provides a way to represent links between Web
   resources as well as the relations expressed by them and attributes
   of such a link.  In constrained networks, a collection of Web links
   can be exchanged in the CoRE link format [RFC6690] to enable resource
   discovery, for instance by using the CoAP protocol [RFC7252].
   [I-D.ietf-core-links-json] defines a common format for representing
   Web links in JSON format.

   The Concise Binary Object Representation (CBOR) [RFC7049] is a data
   format whose design goals include the possibility of extremely small
   code size, fairly small message size, and extensibility without the
   need for version negotiation.

   When converting between CORE Link Format and CBOR, as usual, many
   samll decisions have to be made.  If left without guidance, it is
   likely that a number of slightly incompatible dialects will emerge.

   This specification defines a common format for representing Web Links
   in the CBOR format.




Li, et al.                Expires June 19, 2015                 [Page 2]

Internet-Draft                 Links CBOR                  December 2014


1.1.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [RFC2119].

2.  Information Model

   This section discusses the information model underlying the CORE Link
   Format payload.

   An application/link-format document is a collection of web links
   ("link-value"), each of which is a collection of attributes ("link-
   param") applied to a "URI-Reference".

   The URI-Reference is represented as a name/value pair with the name
   "href" and the URI-Reference as the value.

   The link attributes are also represented as name/value pairs with
   attribute names and attribute values.

   The information model of the CoRE Link Format can be summarized
   below:

      +------------------+--------------------+
      | name             |   value            |
      +------------------+--------------------+
      | href             | resource URI       |
      +------------------+--------------------+
      | attribute name 1 | attribute value 1  |
      +------------------+--------------------+
      | attribute name 2 | attribute value 2  |
      +------------------+--------------------+
      | ...              | ...                |
      +------------------+--------------------+
      | attribute name n | attribute value n  |
      +------------------+--------------------+

               Figure 1: CoRE Link Format Information Model

3.  Encoding

   To reduce message size, it would be beneficial to encode "href" and
   the standardized attribute names specified in [RFC5988] and [RFC6690]
   as integers.

   The encoding is summarized below:




Li, et al.                Expires June 19, 2015                 [Page 3]

Internet-Draft                 Links CBOR                  December 2014


      +----------+---------------+
      | name     | encoded value |
      +----------+---------------+
      | href     | 1             |
      +----------+---------------+
      | rel      | 2             |
      +----------+---------------+
      | anchor   | 3             |
      +----------+---------------+
      | rev      | 4             |
      +----------+---------------+
      | hreflang | 5             |
      +----------+---------------+
      | media    | 6             |
      +----------+---------------+
      | title    | 7             |
      +----------+---------------+
      | type     | 8             |
      +----------+---------------+
      | rt       | 9             |
      +----------+---------------+
      | if       | 10            |
      +----------+---------------+
      | sz       | 11            |
      +----------+---------------+
      | ct       | 12            |
      +----------+---------------+

                    Figure 2: Link Attributes Encoding

4.  Web Links in CBOR

   The objective of the CBOR mapping defined in this document is to
   contain information of the formats specified in [RFC5988] and
   [RFC6690].

   We straightforwardly map:

   o the outer collection to an array of links (Major type 4)

   o each link to a map of pairs of data items (Major type 5)

   In the object representing a "link-value", each target attribute or
   other parameter ("link-param") is represented by a CBOR pair of data
   items.

   The URI-Reference is represented as a name/value pair with the name
   "href" and the URI-Reference as the value.



Li, et al.                Expires June 19, 2015                 [Page 4]

Internet-Draft                 Links CBOR                  December 2014


4.1.  Examples

      </sensors>;ct=40;title="Sensor Index",
      </sensors/temp>;rt="temperature-c";if="sensor",
      </sensors/light>;rt="light-lux";if="sensor",
      <http://www.example.com/sensors/t123>;anchor="/sensors/temp"
      ;rel="describedby",
      </t>;anchor="/sensors/temp";rel="alternate"


                Figure 3: Example from page 15 of [RFC6690]

   becomes

85                                     # array(number of data items:5)
   a3                                  # map(number of pairs of data items:3)
      01                               # unsigned integer(value:1, "href")
      68                               # text string(8 bytes)
         2f73656e736f7273              # "/sensors"
      0c                               # unsigned integer(value:12,"ct")
      18 28                            # unsigned integer(value:40)
      07                               # unsigned integer(value:7,"title")
      6c                               # text string(12 bytes)
         53656e736f7220496e646578      # "Sensor Index"
   a3                                  # map(number of pairs of data items:3)
      01                               # unsigned integer(value:1,"href")
      6d                               # text string(13 bytes)
         2f73656e736f72732f74656d70    # "/sensors/temp"
      09                               # unsigned integer(value:9,"rt")
      6d                               # text string(13 bytes)
         74656d70657261747572652d63    # "temperature-c"
      0a                               # unsigned integer(value:10,"if")
      66                               # text string(6 bytes)
         73656e736f72                  # "sensor"
   a3                                  # map(number of pairs of data items:3)
      01                               # unsigned integer(value:1,"href")
      6e                               # text string(14 bytes)
         2f73656e736f72732f6c69676874  # "/sensors/light"
      09                               # unsigned integer(value:9,"rt")
      69                               # text string(9 bytes)
         6c696768742d6c7578            # "light-lux"
      0a                               # unsigned integer(value:10,"if")
      66                               # text string(6 bytes)
         73656e736f72                  # "sensor"
   a3                                  # map(number of pairs of data items:3)
      01                               # unsigned integer(value:1,"href")
      78 23                            # text string(35 bytes)
         687474703a2f2f7777772e6578616d706c652e636f6d2f73656e736f72732f74313233



Li, et al.                Expires June 19, 2015                 [Page 5]

Internet-Draft                 Links CBOR                  December 2014


                                       # "http://www.example.com/sensors/t123"
      03                               # unsigned integer(value:3,"anchor")
      6d                               # text string(13 bytes)
         2f73656e736f72732f74656d70    # "/sensors/temp"
      02                               # unsigned integer(value:2,"rel")
      6b                               # text string(11 bytes)
         6465736372696265646279        # "describedby"
   a3                                  # map(number of pairs of data items:3)
      01                               # unsigned integer(value:1,"href")
      62                               # text string(12 bytes)
         2f74                          # "/t"
      03                               # unsigned integer(value:3,"anchor")
      6d                               # text string(13 bytes)
         2f73656e736f72732f74656d70    # "/sensors/temp"
      02                               # unsigned integer(value:2,"rel")
      69                               # text string(9 bytes)
         616c7465726e617465            # "alternate"


                      Figure 4: Links Encoded in CBOR

5.  IANA Considerations

   This specification registers the following additional Internet Media
   Types:

   Type name: application

   Subtype name: link-format+cbor

   Required parameters: None

   Optional parameters: None

   Encoding considerations: Resources that use the "application/ link-
   format+cbor" media type are required to conform to the "application/
   cbor" Media Type and are therefore subject to the same encoding
   considerations specified in [RFC7159], Section 6.

   Security considerations: As defined in this specification

   Published specification: This specification.

   Applications that use this media type: None currently known.

   Additional information:

   --Magic number(s): N/A



Li, et al.                Expires June 19, 2015                 [Page 6]

Internet-Draft                 Links CBOR                  December 2014


   --File extension(s): N/A

   --Macintosh file type code(s): TEXT

   Person & email address to contact for further information: Kepeng Li
   <likepeng@huawei.com>

   Intended usage: COMMON

   Change controller: IESG

6.  Security Considerations

   The security considerations of [RFC6690] and [RFC7049] apply.

7.  Acknowledgements

   TBD.

8.  References

8.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC5988]  Nottingham, M., "Web Linking", RFC 5988, October 2010.

   [RFC6690]  Shelby, Z., "Constrained RESTful Environments (CoRE) Link
              Format", RFC 6690, August 2012.

   [RFC7049]  Bormann, C. and P. Hoffman, "Concise Binary Object
              Representation (CBOR)", RFC 7049, October 2013.

8.2.  Informative References

   [I-D.ietf-core-links-json]
              Bormann, C., "Representing CoRE Link Collections in JSON",
              draft-ietf-core-links-json-02 (work in progress), July
              2014.

Authors' Addresses









Li, et al.                Expires June 19, 2015                 [Page 7]

Internet-Draft                 Links CBOR                  December 2014


   Kepeng Li
   Huawei Technologies
   Huawei Base, Bantian, Longgang District
   Shenzhen, Guangdong  518129
   P. R. China

   Phone: +86-755-28974259
   Email: likepeng@huawei.com


   Bert Greevenbosch
   Huawei Technologies
   Huawei Base, Bantian, Longgang District
   Shenzhen, Guangdong  518129
   P. R. China

   Email: bert.greevenbosch@huawei.com


   Ruinan Sun
   Huawei Technologies
   Huawei Base, Bantian, Longgang District
   Shenzhen, Guangdong  518129
   P. R. China

   Phone: +86-755-28970171
   Email: sunruinan@huawei.com
























Li, et al.                Expires June 19, 2015                 [Page 8]