core K. Li
Internet-Draft B. Greevenbosch
Intended status: Standards Track Huawei Technologies
Expires: February 8, 2015 August 7, 2014

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

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 February 8, 2015.

Copyright Notice

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

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

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.

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:

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

4.1. Examples