Thing-to-Thing Research Group K. Hartke Internet-Draft Universitaet Bremen TZI Intended status: Experimental October 31, 2016 Expires: May 4, 2017 CBOR-encoded Form Data draft-hartke-t2trg-cbor-forms-00 Abstract This document describes a media type to encode form data in CBOR format. 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 May 4, 2017. Copyright Notice Copyright (c) 2016 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. Hartke Expires May 4, 2017 [Page 1] Internet-Draft CBOR-encoded Form Data October 2016 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 2 2. Form Body Syntax . . . . . . . . . . . . . . . . . . . . . . 2 3. Form Data Syntax . . . . . . . . . . . . . . . . . . . . . . 3 4. Security Considerations . . . . . . . . . . . . . . . . . . . 3 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 4 5.1. Media Type . . . . . . . . . . . . . . . . . . . . . . . 4 5.2. CoAP Content-Format . . . . . . . . . . . . . . . . . . . 4 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 4 6.1. Normative References . . . . . . . . . . . . . . . . . . 4 6.2. Informative References . . . . . . . . . . . . . . . . . 4 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 5 1. Introduction This document describes a media type to encode form data in CBOR [RFC7049] format, similar to the well-known "application/x-www-form- urlencoded" [W3C.REC-html5-20141028] and "multipart/form-data" [RFC7578] media types. The use of a compact, binary representation format enables the processing of form submissions on systems with very limited memory, processor power, and instruction sets [RFC7228]. 1.1. Terminology 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 [RFC2119]. 2. Form Body Syntax CoRAL [I-D.hartke-t2trg-coral] provides a representation format for forms that is suitable for constrained systems. However, it does not provide a syntax for specifying the fields of a form in the form body and leaves this task to other specifications. This section defines such a syntax. A form body in this syntax consists of one or more form fields. Each form field consists of a field name and a type. The field name is an arbitrary text string. The field type is a text string that matches the ABNF rule "type" from [I-D.greevenbosch-appsawg-cbor-cddl]. Form fields can be combined with two combinators, ALL and ANY. The ALL combinator indicates that the form submitter MUST submit all the members of the expression. The ANY combinator indicates that the form submitter MUST submit exactly one member of the expression. Hartke Expires May 4, 2017 [Page 2] Internet-Draft CBOR-encoded Form Data October 2016 Using CDDL notation [I-D.greevenbosch-appsawg-cbor-cddl], the form body syntax can be expressed as follows: form-body = expr expr = all-expr / any-expr / field all-expr = [1, +expr] any-expr = [2, +expr] field = [3, field-name, field-type] field-name = text field-type = text Example: [1, [3, "http://xmlns.com/foaf/0.1/firstName", "text"], [3, "http://xmlns.com/foaf/0.1/lastName", "text"], [3, "http://xmlns.com/foaf/0.1/age", "uint"]] (using the FOAF [FOAF] vocabulary to indicate the semantics of the individual form fields to an automated agent). 3. Form Data Syntax Form data is serialized as a CBOR table where each entry consists of a form field name and a value. The field name MUST the name of one of the fields defined in the form body. The value MUST be a CBOR data item that matches the type specification in the field definition. The media type is "application/form-data+cbor". Using CDDL notation [I-D.greevenbosch-appsawg-cbor-cddl], the form data syntax can be expressed as follows: form-data = {*field-name => field-value} field-name = text field-value = any Example: {"http://xmlns.com/foaf/0.1/firstName": "Jane", "http://xmlns.com/foaf/0.1/lastName": "Doe", "http://xmlns.com/foaf/0.1/age": 32} 4. Security Considerations TODO. Hartke Expires May 4, 2017 [Page 3] Internet-Draft CBOR-encoded Form Data October 2016 5. IANA Considerations 5.1. Media Type This document registers the media type "application/form-data+cbor" in the "Media Types" registry. TODO. 5.2. CoAP Content-Format This document registers a content format for the "application/form- data+cbor" media type in the "CoAP Content-Formats" registry. o Media Type: application/form-data+cbor Encoding: - ID: 61 Reference: [RFCXXXX] 6. References 6.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, . 6.2. Informative References [FOAF] Brickley, D. and L. Miller, "FOAF Vocabulary Specification 0.99", January 2014, . [I-D.greevenbosch-appsawg-cbor-cddl] Vigano, C. and H. Birkholz, "CBOR data definition language (CDDL): a notational convention to express CBOR data structures", draft-greevenbosch-appsawg-cbor-cddl-09 (work in progress), September 2016. [I-D.hartke-t2trg-coral] Hartke, K., "The Constrained RESTful Application Language (CoRAL)", draft-hartke-t2trg-coral-01 (work in progress), October 2016. Hartke Expires May 4, 2017 [Page 4] Internet-Draft CBOR-encoded Form Data October 2016 [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for Constrained-Node Networks", RFC 7228, DOI 10.17487/RFC7228, May 2014, . [RFC7578] Masinter, L., "Returning Values from Forms: multipart/ form-data", RFC 7578, DOI 10.17487/RFC7578, July 2015, . [W3C.REC-html5-20141028] Hickson, I., Berjon, R., Faulkner, S., Leithead, T., Navara, E., O'Connor, T., and S. Pfeiffer, "HTML5", World Wide Web Consortium Recommendation REC- html5-20141028, October 2014, . Author's Address Klaus Hartke Universitaet Bremen TZI Postfach 330440 Bremen D-28359 Germany Phone: +49-421-218-63905 Email: hartke@tzi.org Hartke Expires May 4, 2017 [Page 5]