draft-ietf-core-multipart-ct-03.txt   draft-ietf-core-multipart-ct-04.txt 
CoRE T. Fossati CoRE T. Fossati
Internet-Draft ARM Internet-Draft ARM
Intended status: Standards Track K. Hartke Intended status: Standards Track K. Hartke
Expires: September 9, 2019 Ericsson Expires: February 22, 2020 Ericsson
C. Bormann C. Bormann
Universitaet Bremen TZI Universitaet Bremen TZI
March 08, 2019 August 21, 2019
Multipart Content-Format for CoAP Multipart Content-Format for CoAP
draft-ietf-core-multipart-ct-03 draft-ietf-core-multipart-ct-04
Abstract Abstract
This memo defines application/multipart-core, an application- This memo defines application/multipart-core, an application-
independent media-type that can be used to combine representations of independent media-type that can be used to combine representations of
zero or more different media types into a single message, such as a zero or more different media types into a single message, such as a
CoAP request or response body, with minimal framing overhead, each CoAP request or response body, with minimal framing overhead, each
along with a CoAP Content-Format identifier. along with a CoAP Content-Format identifier.
Status of This Memo Status of This Memo
skipping to change at page 1, line 37 skipping to change at page 1, line 37
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 9, 2019. This Internet-Draft will expire on February 22, 2020.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3
2. Multipart Content-Format Encoding . . . . . . . . . . . . . . 3 2. Multipart Content-Format Encoding . . . . . . . . . . . . . . 4
3. Usage Examples . . . . . . . . . . . . . . . . . . . . . . . 4 3. Usage Example: Observing Resources . . . . . . . . . . . . . 4
3.1. Observing Resources . . . . . . . . . . . . . . . . . . . 4 4. Implementation Hints . . . . . . . . . . . . . . . . . . . . 5
4. Implementation hints . . . . . . . . . . . . . . . . . . . . 4 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 5.1. Registration of media type application/multipart-core . . 6
5.1. Registration of media type application/multipart-core . . 5
5.2. Registration of a Content-Format identifier for 5.2. Registration of a Content-Format identifier for
application/multipart-core . . . . . . . . . . . . . . . 7 application/multipart-core . . . . . . . . . . . . . . . 7
6. Security Considerations . . . . . . . . . . . . . . . . . . . 7 6. Security Considerations . . . . . . . . . . . . . . . . . . . 8
7. References . . . . . . . . . . . . . . . . . . . . . . . . . 7 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 8
7.1. Normative References . . . . . . . . . . . . . . . . . . 7 7.1. Normative References . . . . . . . . . . . . . . . . . . 8
7.2. Informative References . . . . . . . . . . . . . . . . . 7 7.2. Informative References . . . . . . . . . . . . . . . . . 8
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 8 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 9
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 8 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 9
1. Introduction 1. Introduction
This memo defines application/multipart-core, an application- This memo defines application/multipart-core, an application-
independent media-type that can be used to combine representations of independent media-type that can be used to combine representations of
zero or more different media types into a single message, such as a zero or more different media types, each along with a CoAP Content-
CoAP [RFC7252] request or response body, with minimal framing Format identifier, into a single representation, with minimal framing
overhead, each along with a CoAP Content-Format identifier. overhead. This combined representation may then be carried in a
single message, such as a CoAP [RFC7252] request or response body.
This simple and efficient binary framing mechanism can be employed to This simple and efficient binary framing mechanism can be employed to
create application specific request and response bodies which build create application specific request and response bodies which build
on multiple already existing media types. on multiple already existing media types.
As the name of the media-type suggests, it is inspired by the
multipart media types that started to be defined with the original
set of MIME specifications [RFC2046]. However, while those needed to
focus on the syntactic aspects of integrating multiple
representations into one e-mail, transfer protocols providing full
data transparency such as CoAP as well as readily available encoding
formats such as the Concise Binary Object Representation (CBOR)
[RFC7049] shift the focus towards the intended use of the combined
representations. In this respect, the basic intent of the
application/multipart-core media type is like that of multipart/mixed
(Section 5.1.3 of [RFC2046]). The detailed semantics of the
representations are refined by the context established by the
application in the accompanying request parameters, e.g., the
resource URI and any further options (header fields), but three usage
scenarios are envisioned:
The individual representations in an application/multipart-core body The individual representations in an application/multipart-core body
occur in a sequence, which may be employed by an application where occur in a sequence, which may be employed by an application where
such a sequence is natural, e.g. for a number of audio snippets in such a sequence is natural, e.g. for a number of audio snippets in
different formats to be played out in that sequence. various formats to be played out in that sequence, or search results
returned in order of relevance.
In other cases, an application may be more interested in a bag of In other cases, an application may be more interested in a bag of
representations, which are distinguished by their Content-Format representations, which are distinguished by their Content-Format
identifier, such as an audio snippet and a text representation identifier, such as an audio snippet and a text representation
accompanying it. In such a case, the sequence in which these occur accompanying it. In such a case, the sequence in which these occur
may not be relevant to the application. This specification allows to may not be relevant to the application. This specification adds the
indicate that an optional part is not present by substituting a null option of substituting a null value for the representation of an
value for the representation of the part. optional part, which indicates that the part is not present.
A third situation that is common only ever has a single A third situation that is common only ever has a single
representation in the sequence, which is one of a set of formats representation in the sequence, where the sender already selects just
possible. This kind of union of formats may also make the presence one of a set of formats possible for this situation. This kind of
of the actual representation optional, the omission of which leads to union "type" of formats may also make the presence of the actual
a zero-length array. representation optional, the omission of which leads to a zero-length
array.
Where these rules are not sufficient for an application, it might Where these rules are not sufficient for an application, it might
still use the general format defined here, but register a new media still use the general format defined here, but register a new media
type and an associated Content-Format identifier to associate the type and an associated Content-Format identifier to associate the
representation with these more specific semantics instead of using representation with these more specific semantics instead of using
application/multipart-core. the application/multipart-core media type.
Also, future specifications might want to define rough equivalents
for other multipart media types with specific semantics not covered
by the present specification, such as multipart/alternative
(Section 5.1.4 of [RFC2046]), where several alternative
representations are provided in the message, but only one of those is
to be selected by the recipient for its use (this is less likely to
be useful in a constrained environment that has facilities for pre-
flight discovery).
1.1. Requirements Language 1.1. Requirements Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in "OPTIONAL" in this document are to be interpreted as described in
BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
2. Multipart Content-Format Encoding 2. Multipart Content-Format Encoding
A representation of media-type application/multipart-core contains a A representation of media-type application/multipart-core contains a
collection of zero or more representations, each along with their collection of zero or more representations, each along with their
respective content format. respective content format.
The collection is encoded as a CBOR [RFC7049] array with an even The collection is encoded as a CBOR [RFC7049] array with an even
number of elements. The second, fourth, sixth, etc. element is a number of elements. Counting from zero, the odd-numbered elements
byte string containing a representation, or the value "null" if an are a byte string containing a representation, or the value "null" if
optional part is indicated as not given. The first, third, fifth, an optional part is indicated as not given. The (even-numbered)
etc. element is an unsigned integer specifying the content format ID element preceding each of these is an unsigned integer specifying the
of the representation following it. content format ID of the representation following it.
For example, a collection containing two representations, one with For example, a collection containing two representations, one with
content format ID 42 and one with content format ID 0, looks like content format ID 42 and one with content format ID 0, looks like
this in CBOR diagnostic notation: this in CBOR diagnostic notation:
[42, h'0123456789abcdef', 0, h'3031323334'] [42, h'0123456789abcdef', 0, h'3031323334']
For illustration, the structure of an application/multipart-core For illustration, the structure of an application/multipart-core
representation can be described by the CDDL [I-D.ietf-cbor-cddl] representation can be described by the CDDL [RFC8610] specification
specification in Figure 1: in Figure 1:
multipart-core = [* multipart-part] multipart-core = [* multipart-part]
multipart-part = (type: uint .size 2, part: bytes / null) multipart-part = (type: uint .size 2, part: bytes / null)
Figure 1: CDDL for application/multipart-core Figure 1: CDDL for application/multipart-core
This format is intended as a strict specification: An implementation This format is intended as a strict specification: An implementation
MUST stop processing the representation if there is a CBOR well- MUST stop processing the representation if there is a CBOR well-
formedness error, a deviation from the structure defined above, or formedness error, a deviation from the structure defined above, or
any residual data left after processing the CBOR data item. (This any residual data left after processing the CBOR data item. (This
generally means the representation is not processed at all except if generally means the representation is not processed at all except if
some streaming processing has already happened.) some streaming processing has already happened.)
3. Usage Examples 3. Usage Example: Observing Resources
3.1. Observing Resources This section illustrates one less obvious example for using
application/multipart-core: combining it with observing a resource
[RFC7641] to handle pending results.
When a client registers to observe a resource [RFC7641] for which no When a client registers to observe a resource for which no
representation is available yet, the server may send one or more 2.05 representation is available yet, the server may send one or more 2.05
(Content) notifications before sending the first actual 2.05 (Content) notifications before sending the first actual 2.05
(Content) or 2.03 (Valid) notification. The possible resulting (Content) or 2.03 (Valid) notification. A diagram depicting possible
sequence of notifications is shown in Figure 1. resulting sequences of notifications, identified by their respective
response code, is shown in Figure 2.
__________ __________ __________ __________ __________ __________
| | | | | | | | | | | |
---->| 2.05 |---->| 2.05 / |---->| 4.xx / | ---->| 2.05 |---->| 2.05 / |---->| 4.xx / |
| Pending | | 2.03 | | 5.xx | | Pending | | 2.03 | | 5.xx |
|__________| |__________| |__________| |__________| |__________| |__________|
^ \ \ ^ \ ^ ^ \ \ ^ \ ^
\__/ \ \___/ / \__/ \ \___/ /
\_______________________/ \_______________________/
Figure 2: Sequence of Notifications: Figure 2: Sequence of Notifications
The specification of the Observe option requires that all The specification of the Observe option requires that all
notifications carry the same Content-Format. The application/ notifications carry the same Content-Format. The application/
multipart-core media type can be used to provide that Content-Format: multipart-core media type can be used to provide that Content-Format:
e.g., carrying an empty list of representations in the case marked as e.g., carrying an empty list of representations in the case marked as
"Pending" in Figure 2, and carrying a single representation specified "Pending" in Figure 2, and carrying a single representation specified
as the target content-format in the case in the middle of the figure. as the target content-format in the case in the middle of the figure.
4. Implementation hints 4. Implementation Hints
This section describes the serialization for readers that may be new This section describes the serialization for readers that may be new
to CBOR. It does not contain any new information. to CBOR. It does not contain any new information.
An application/multipart-core representation carrying no An application/multipart-core representation carrying no
representations is represented by an empty CBOR array, which is representations is represented by an empty CBOR array, which is
serialized as a single byte with the value 0x80. serialized as a single byte with the value 0x80.
An application/multipart-core representation carrying a single An application/multipart-core representation carrying a single
representation is represented by a two-element CBOR array, which is representation is represented by a two-element CBOR array, which is
skipping to change at page 5, line 33 skipping to change at page 6, line 20
| 0x59 0xnn 0xnn | 256..65535 | | 0x59 0xnn 0xnn | 256..65535 |
| 0x5a 0xnn 0xnn 0xnn 0xnn | 65536..4294967295 | | 0x5a 0xnn 0xnn 0xnn 0xnn | 65536..4294967295 |
| 0x5b 0xnn .. 0xnn (8 bytes) | 4294967296.. | | 0x5b 0xnn .. 0xnn (8 bytes) | 4294967296.. |
+-----------------------------+-------------------+ +-----------------------------+-------------------+
Table 2: Serialization of object length Table 2: Serialization of object length
For example, a single text/plain object (content-format 0) of value For example, a single text/plain object (content-format 0) of value
"Hello World" (11 characters) would be serialized as "Hello World" (11 characters) would be serialized as
0x82 0x00 0x4b H e l l o 0x20 w o r l d 0x82 0x00 0x4b H e l l o 0x20 W o r l d
In effect, the serialization for a single object is done by prefixing In effect, the serialization for a single object is done by prefixing
the object with information that there is one object (here: 0x82), the object with information that there is one object (here: 0x82),
about its content-format (here: 0x00) and its length (here: 0x4b). about its content-format (here: 0x00) and its length (here: 0x4b).
For more than one representation included in an application/ For more than one representation included in an application/
multipart-core representation, the head of the CBOR array is adjusted multipart-core representation, the head of the CBOR array is adjusted
(0x84 for two representations, 0x86 for three, ...) and the sequences (0x84 for two representations, 0x86 for three, ...) and the sequences
of content-format and embedded representations follow. of content-format and embedded representations follow.
For instance, the example from Section 2 would be serialized as:
0x84 (*) 0x182A 0x48 0x0123456789ABCDEF (+) 0x00 0x45 0x3031323334
where (*) marks the start of the information about the first
representation (content-format 42, byte string length 8) and, (+), of
the second representation (content-format 0, byte string length 5).
5. IANA Considerations 5. IANA Considerations
5.1. Registration of media type application/multipart-core 5.1. Registration of media type application/multipart-core
IANA is requested to register the following media type [RFC6838]: IANA is requested to register the following media type [RFC6838]:
Type name: application Type name: application
Subtype name: multipart-core Subtype name: multipart-core
Required parameters: N/A Required parameters: N/A
Optional parameters: N/A Optional parameters: N/A
Encoding considerations: binary Encoding considerations: binary
Security considerations: See the Security Considerations Section of Security considerations: See the Security Considerations Section of
RFCthis RFCthis
Interoperability considerations: N/A Interoperability considerations: N/A
Published specification: RFCthis Published specification: RFCthis
Applications that use this media type: Applications that need to Applications that use this media type: Applications that need to
skipping to change at page 8, line 8 skipping to change at page 8, line 47
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
7.2. Informative References 7.2. Informative References
[I-D.ietf-ace-coap-est] [I-D.ietf-ace-coap-est]
Stok, P., Kampanakis, P., Richardson, M., and S. Raza, Stok, P., Kampanakis, P., Richardson, M., and S. Raza,
"EST over secure CoAP (EST-coaps)", draft-ietf-ace-coap- "EST over secure CoAP (EST-coaps)", draft-ietf-ace-coap-
est-10 (work in progress), March 2019. est-12 (work in progress), June 2019.
[I-D.ietf-cbor-cddl] [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Birkholz, H., Vigano, C., and C. Bormann, "Concise data Extensions (MIME) Part Two: Media Types", RFC 2046,
definition language (CDDL): a notational convention to DOI 10.17487/RFC2046, November 1996,
express CBOR and JSON data structures", draft-ietf-cbor- <https://www.rfc-editor.org/info/rfc2046>.
cddl-07 (work in progress), February 2019.
[RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type
Specifications and Registration Procedures", BCP 13, Specifications and Registration Procedures", BCP 13,
RFC 6838, DOI 10.17487/RFC6838, January 2013, RFC 6838, DOI 10.17487/RFC6838, January 2013,
<https://www.rfc-editor.org/info/rfc6838>. <https://www.rfc-editor.org/info/rfc6838>.
[RFC7641] Hartke, K., "Observing Resources in the Constrained [RFC7641] Hartke, K., "Observing Resources in the Constrained
Application Protocol (CoAP)", RFC 7641, Application Protocol (CoAP)", RFC 7641,
DOI 10.17487/RFC7641, September 2015, DOI 10.17487/RFC7641, September 2015,
<https://www.rfc-editor.org/info/rfc7641>. <https://www.rfc-editor.org/info/rfc7641>.
[RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data
Definition Language (CDDL): A Notational Convention to
Express Concise Binary Object Representation (CBOR) and
JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610,
June 2019, <https://www.rfc-editor.org/info/rfc8610>.
Acknowledgements Acknowledgements
Most of the text in this draft is from earlier contributions by two Most of the text in this draft is from earlier contributions by two
of the authors, Thomas Fossati and Klaus Hartke. The re-mix in this of the authors, Thomas Fossati and Klaus Hartke. The re-mix in this
document is based on the requirements in [I-D.ietf-ace-coap-est], document is based on the requirements in [I-D.ietf-ace-coap-est],
based on discussions with Michael Richardson, Panos Kampanis and based on discussions with Michael Richardson, Panos Kampanis and
Peter van der Stok. Peter van der Stok.
Authors' Addresses Authors' Addresses
 End of changes. 28 change blocks. 
51 lines changed or deleted 94 lines changed or added

This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/