CoRE K. Li Internet-Draft Huawei Technologies Intended status: Standards Track X. Sun Expires: November 27, 2012 China Telecom May 26, 2012 CoAP Payload-Length Option Extension draft-li-core-coap-payload-length-option-00 Abstract This document defines an extension to the Constrained Application Protocol (CoAP) to add one new option: Payload-Length, which is used to indicate the length of the payload of the message. 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 November 27, 2012. Copyright Notice Copyright (c) 2012 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. Li & Sun Expires November 27, 2012 [Page 1] Internet-Draft CoAP Payload Length May 2012 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Motivation . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3. Requirements Language . . . . . . . . . . . . . . . . . . . 3 2. Option Definition . . . . . . . . . . . . . . . . . . . . . . . 3 3. Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 5 5. Security Considerations . . . . . . . . . . . . . . . . . . . . 5 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 5 7. Normative References . . . . . . . . . . . . . . . . . . . . . 5 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 5 Li & Sun Expires November 27, 2012 [Page 2] Internet-Draft CoAP Payload Length May 2012 1. Introduction This specification adds one new option to the Constrained Application Protocol (CoAP): Payload-Length. 1.1. Motivation If a CoAP message is transported through UDP, the message length can be obtained from the UDP header. But not all transport mechanisms provide an unambiguous length of the CoAP message. For example, in industry field, there are some data tranport protocols, like RS232, RS422, RS485, which don't provide message length indication. For these cases, an indication of the payload length of the message is needed in CoAP message level. TBD: how about CAN bus protocol, USB 2.0? With this option, it will be easier for the receiver to extract the payload part from the whole message. Another benefit to have this option is to check the integrity of the message length. 1.2. Terminology The terms CoAP Server and CoAP Client are used synonymously to Server and Client as specified in the terminology section of [I-D.ietf-core-coap]. 1.3. Requirements Language 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. Option Definition +--------+-----+----------------+-----------+--------+---------+ | Number | C/E | Name | Data type | Length | Default | +--------+-----+----------------+-----------+--------+---------+ | TBD | E | Payload-Length | uint | 0-2 B | | +--------+-----+----------------+-----------+--------+---------+ If this option is present, the value of this option is an unsigned integer giving the length of the payload of the message. Note that this integer can be zero for a zero-length payload, which can in turn be represented by a zero-length option value. Li & Sun Expires November 27, 2012 [Page 3] Internet-Draft CoAP Payload Length May 2012 The Payload-Length option does not have a default value, so in case of its absence the receiver MUST determine the payload length through other means. This is to keep backward compatibility. If the option is absent, the payload can have any size, and the payload length needs to be determined as it is currently done for UDP. The minimum payload length is 0, and the maximum payload length is 2^16-1= 65535. In case that the transport layer does not provide message length indication, the Payload-Length option SHOULD be included in the CoAP message. Otherwise, it MAY be included. This options can be used both in the request and response. This option MUST NOT occur more than once. 3. Example In the example below, in the GET request, the payload is empty, so the Payload-Length option has a zero-length option payload. In the response, the payload is "22.3 C", and the Payload-Length is 6. Client Server | | | | +----->| Header: GET (T=CON, Code=1, MID=0x7d38) | GET | Token: 0x53 | | Uri-Path: "temperature" | | Payload-Length: 0 | | |<- - -+ Header: (T=ACK, Code=0, MID=0x7d38) | | | | |<-----+ Header: 2.05 Content (T=CON, Code=69, MID=0xad7b) | 2.05 | Token: 0x53 | | Payload: "22.3 C" | | Payload-Length: 6 | | | | +- - ->| Header: (T=ACK, Code=0, MID=0xad7b) | | Li & Sun Expires November 27, 2012 [Page 4] Internet-Draft CoAP Payload Length May 2012 4. IANA Considerations The IANA is requested to add the following option number entries: +--------+----------------+----------------------------+ | Number | Name | Reference | +--------+----------------+----------------------------+ | TBD | Payload-Length | Section 2 of this document | +--------+----------------+----------------------------+ 5. Security Considerations The Payload-Length option defined in this document presents no security considerations beyond those in Section 10 of the base CoAP specification [I-D.ietf-core-coap]. 6. Acknowledgements The authors of this draft would like to thank Carsten Bormann and Klaus Hartke, for the initial texts in draft [I-D.bormann-coap-misc]. The authors of this draft would like to thank Bert Greevenbosch for the discussion and review. 7. Normative References [I-D.bormann-coap-misc] Bormann, C. and K. Hartke, "Miscellaneous additions to CoAP", draft-bormann-coap-misc-16 (work in progress), May 2012. [I-D.ietf-core-coap] Shelby, Z., Hartke, K., Bormann, C., and B. Frank, "Constrained Application Protocol (CoAP)", draft-ietf-core-coap-09 (work in progress), March 2012. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. Li & Sun Expires November 27, 2012 [Page 5] Internet-Draft CoAP Payload Length May 2012 Authors' Addresses Kepeng Li Huawei Technologies Huawei Base, Bantian, Longgang District Shenzhen, Guangdong 518129 P. R. China Phone: +86-755-28974289 Email: likepeng@huawei.com Xianghui Sun China Telecom Xizhimen,Xicheng District Beijing 100035 P. R. China Phone: +86-010-58552839 Email: sunxh@ctbri.com.cn Li & Sun Expires November 27, 2012 [Page 6]