RFC 8710: Multipart Content-Format for the Constrained Application Protocol (CoAP)
- T. Fossati,
- K. Hartke,
- C. Bormann
Abstract
This memo defines application
Status of This Memo
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
https://
Copyright Notice
Copyright (c) 2020 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://
1. Introduction
This memo defines application
This simple and efficient binary framing mechanism can be employed to
create application
As the name of the media type suggests, application
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:¶
In one case, the individual representations in an application
In another case, an application may be more interested in a bag of representations (which are distinguished by their Content-Format identifiers), such as an audio snippet and a text representation accompanying it. In such a case, the sequence in which these occur may not be relevant to the application. This specification adds the option of substituting a null value for the representation of an optional part, which indicates that the part is not present.¶
A third common situation only has a single representation in the sequence, and the sender selects just one of a set of formats possible for this situation. This kind of union "type" of formats may also make the presence of the actual representation optional, the omission of which leads to a zero-length array.¶
Where these rules are not sufficient, an application might still use
the general format defined here but register a new media type and an
associated Content-Format identifier to associate the representation
with these more specific semantics instead of using the
application
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
1.1. Requirements Language
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.¶
2. Multipart Content-Format Encoding
A representation of media type application
The collection is encoded as a CBOR [RFC7049] array with an even number of elements. Counting from zero, the odd-numbered elements are a byte string containing a representation or the value "null" (if an optional part is indicated as not given). The (even-numbered) element preceding each of these is an unsigned integer specifying the Content-Format ID of the representation following it.¶
For example, a collection containing two representations
For illustration, the structure of an application
This format is intended as a strict specification: an implementation MUST stop processing the representation if there is a CBOR well-formedness error, a deviation from the structure defined above, or any residual data left after processing the CBOR data item. (This generally means the representation is not processed at all unless some streaming processing has already happened.)¶
3. Usage Example: Observing Resources
This section illustrates a less obvious example for using
application
When a client registers to observe a resource for which no representation is available yet, the server may send one or more 2.05 (Content) notifications that indicate the lack of an actual representation. Later on, when one becomes available, the server will send the first actual 2.05 (Content) or 2.03 (Valid) notification. A diagram depicting possible resulting sequences of notifications, identified by their respective response code, is shown in Figure 2.¶
The specification of the Observe option requires that all
notifications carry the same Content-Format. The
application
4. Implementation Hints
This section describes the serialization for readers that may be new to CBOR. It does not contain any new information.¶
An application
An application
For example, a single text/plain object (Content-Format 0) of value "Hello World" (11 characters) would be serialized as follows:¶
In effect, the serialization for a single object is done by prefixing the object with information that there is one object (here: 0x82), information about its Content-Format (here: 0x00), and information regarding its length (here: 0x4b).¶
For more than one representation included in an
application
For instance, the example from Section 2 would be serialized as follows:¶
where (*) marks the start of the information about the first representation (Content-Format 42, byte string length 8), and (+) marks the start of the second representation (Content-Format 0, byte string length 5).¶
5. IANA Considerations
5.1. Registration of Media Type application/multipart-core
IANA has registered the following media type [RFC6838]:¶
- Type name:
- application¶
- Subtype name:
- multipart-core¶
- Required parameters:
- N/A¶
- Optional parameters:
- N/A¶
- Encoding considerations:
- binary¶
- Security considerations:
- See the Security Considerations section of RFC 8710.¶
- Interoperability considerations:
- N/A¶
- Published specification:
- RFC 8710¶
- Applications that use this media type:
- Applications that need to combine representations of zero or more different media types into one, e.g., EST over secure CoAP (EST-CoAP) [EST-COAPS]¶
- Fragment identifier considerations:
-
The syntax and semantics of fragment identifiers specified for
application
/multipart -core are as specified for application /cbor . (At publication of this document, there is no fragment identification syntax defined for application /cbor .)¶ - Additional information:
- Person & email address to contact for further information:
- iesg@ietf.org¶
- Intended usage:
- COMMON¶
- Restrictions on usage:
- N/A¶
- Author:
- CoRE WG¶
- Change controller:
- IESG¶
- Provisional registration? (standards tree only):
- no¶
5.2. Registration of a Content-Format Identifier for application/multipart-core
IANA has registered the following Content-Format in the "CoAP
Content
6. Security Considerations
The security considerations of [RFC7049]
apply. In particular, resource exhaustion attacks may employ large values for
the byte string size fields or employ deeply nested structures of recursively
embedded application
7. References
7.1. Normative References
- [RFC2119]
-
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10
.17487 , , <https:///RFC2119 www >..rfc -editor .org /info /rfc2119 - [RFC7049]
-
Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10
.17487 , , <https:///RFC7049 www >..rfc -editor .org /info /rfc7049 - [RFC7252]
-
Shelby, Z., Hartke, K., and C. Bormann, "The Constrained Application Protocol (CoAP)", RFC 7252, DOI 10
.17487 , , <https:///RFC7252 www >..rfc -editor .org /info /rfc7252 - [RFC8174]
-
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10
.17487 , , <https:///RFC8174 www >..rfc -editor .org /info /rfc8174
7.2. Informative References
- [EST-COAPS]
-
Stok, P., Kampanakis, P., Richardson, M., and S. Raza, "EST over secure CoAP (EST-coaps)", Work in Progress, Internet-Draft, draft
-ietf , , <https://-ace -coap -est -18 tools >..ietf .org /html /draft -ietf -ace -coap -est -18 - [RFC2046]
-
Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types", RFC 2046, DOI 10
.17487 , , <https:///RFC2046 www >..rfc -editor .org /info /rfc2046 - [RFC6838]
-
Freed, N., Klensin, J., and T. Hansen, "Media Type Specifications and Registration Procedures", BCP 13, RFC 6838, DOI 10
.17487 , , <https:///RFC6838 www >..rfc -editor .org /info /rfc6838 - [RFC7641]
-
Hartke, K., "Observing Resources in the Constrained Application Protocol (CoAP)", RFC 7641, DOI 10
.17487 , , <https:///RFC7641 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 , , <https:///RFC8610 www >..rfc -editor .org /info /rfc8610
Acknowledgements
Most of the text in this document is from earlier contributions by two of the authors, Thomas Fossati and Klaus Hartke. This earlier work was reorganized in this document based on the requirements in [EST-COAPS] and discussions with Michael Richardson, Panos Kampanis, and Peter van der Stok.¶