CoRE Working Group C. Bormann
Internet-Draft Universität Bremen TZI
Intended status: Informational March 18, 2018
Expires: September 19, 2018

The application/maybe media type
draft-bormann-core-maybe-00

Abstract

Many media types may be used in situations where it may beneficial to indicate that the object represented in this media type is not yet (or no longer) present.

The Observe option introduced in Observing Resources in the Constrained Application Protocol (CoAP) (RFC7641) requires sequences of responses (notifications) to carry the same Content-Format.

The application/maybe media type provides a way to use a single media type (and thus Content-Format) to express presence or absence of information in a specific media type.

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 https://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 September 19, 2018.

Copyright Notice

Copyright (c) 2018 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 (https://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

(See Abstract.)

1.1. Terminology

This memo uses terms from [RFC7252], [RFC7641] and [RFC7049].

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. These words may also appear in this document in lower case as plain English words, absent their normative meanings.

The term “byte”, abbreviated by “B”, is used in its now customary sense as a synonym for “octet”.

2. The application/maybe media type

An application/maybe object either indicates the absence of the underlying media type or its presence together with an object of that media type.

This is represented by a CBOR [RFC7049] object structured as follows (illustrated in CDDL [I-D.ietf-cbor-cddl]):

maybe = [
  ? (
    content-format: uint,
    content: bstr
  )
]

3. Discussion

The position for indicating a content-format could also provide an alternative for indicating a media type represented as a string.

maybe1 = [
  ? (
    (content-format: uint // media-type: tstr),
    content: bstr
  )
]

This would make the application/maybe media type easier to use with media types that do not have a content-format registered yet.

4. Implementation hints

This section describes the serialization for readers that may be new to CBOR. It does not contain any new information.

An absent object is represented by an empty CBOR array, which is serialized as a single byte with the value 0x80.

A present object is represented by a two-element CBOR array, which is serialized as 0x82 followed by the two elements. The first element is an unsigned integer for the Content-Format value, which is represented as described in Table 1. The second element is the object as a byte string, which is represented as a length as described in Table 2 followed by the bytes of the object.

Serialization of content-format
Serialization Value
0x00..0x17 0..23
0x18 0xnn 24..255
0x19 0xnn 0xnn 256..66535
Serialization of object length
Serialization Length
0x40..0x57 0..23
0x58 0xnn 24..255
0x59 0xnn 0xnn 256..66535
0x5a 0xnn 0xnn 0xnn 0xnn 66536..4294967295
0x5b 0xnn .. 0xnn (8 bytes) 4294967296..

For example, a present text/plain object (content-format 0) of value “Hello World” (11 characters) would be serialized as

In effect, the serialization is done by prefixing the object with information about its content-format.

5. IANA Considerations

TBD (add in the obvious template information).

6. Security Considerations

TBD

7. Acknowledgements

The potential need for an application/maybe media type was suggested by Klaus Hartke.

8. References

8.1. Normative References

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997.
[RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, October 2013.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017.

8.2. Informative References

[I-D.ietf-cbor-cddl] Birkholz, H., Vigano, C. and C. Bormann, "Concise data definition language (CDDL): a notational convention to express CBOR data structures", Internet-Draft draft-ietf-cbor-cddl-02, February 2018.
[RFC7252] Shelby, Z., Hartke, K. and C. Bormann, "The Constrained Application Protocol (CoAP)", RFC 7252, DOI 10.17487/RFC7252, June 2014.
[RFC7641] Hartke, K., "Observing Resources in the Constrained Application Protocol (CoAP)", RFC 7641, DOI 10.17487/RFC7641, September 2015.

Author's Address

Carsten Bormann Universität Bremen TZI Postfach 330440 Bremen, D-28359 Germany Phone: +49-421-218-63921 EMail: cabo@tzi.org