Internet DRAFT - draft-li-core-coap-payload-length-option

draft-li-core-coap-payload-length-option







CoRE                                                               K. Li
Internet-Draft                                                    R. Sun
Intended status: Standards Track                     Huawei Technologies
Expires: June 19, 2015                                 December 16, 2014


                  CoAP Payload-Length Option Extension
              draft-li-core-coap-payload-length-option-03

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 June 19, 2015.

Copyright Notice

   Copyright (c) 2014 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 June 19, 2015                 [Page 1]

Internet-Draft             CoAP Payload Length             December 2014


Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Motivation  . . . . . . . . . . . . . . . . . . . . . . .   2
     1.2.  Justification . . . . . . . . . . . . . . . . . . . . . .   2
     1.3.  Terminology . . . . . . . . . . . . . . . . . . . . . . .   3
     1.4.  Requirements Language . . . . . . . . . . . . . . . . . .   3
   2.  Option Definition . . . . . . . . . . . . . . . . . . . . . .   3
   3.  Example . . . . . . . . . . . . . . . . . . . . . . . . . . .   4
   4.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   4
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .   4
   6.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . .   5
   7.  Normative References  . . . . . . . . . . . . . . . . . . . .   5
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .   5

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.  Justification

   To indicate the payload length, another alternative is to use
   encoding method as specified in section 3.2 of [RFC7252], but it is
   better to use an Option for this.

   Reason is that, payload length is an optional feature, and in most of
   the cases, it is not necessary to be indicated.  If we use encoding
   method, every implementation needs to support this encoding for the




Li & Sun                  Expires June 19, 2015                 [Page 2]

Internet-Draft             CoAP Payload Length             December 2014


   payload, not only for the options.  If we use an Option for this, it
   is optional, and it can be optionally implemented where necessary.

1.3.  Terminology

   The terms CoAP Server and CoAP Client are used synonymously to Server
   and Client as specified in the terminology section of [RFC7252].

1.4.  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

   +------+---+---+---+---+----------------+--------+--------+---------+
   | Type | C | U | N | R |     Name       | Format | Length | Default |
   +------+---+---+---+---+----------------+--------+--------+---------+
   | TBD  | - | - | - | - | Payload-Length | uint   | 0-2 B  | (none)  |
   +------+---+---+---+---+----------------+--------+--------+---------+

   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.

   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.








Li & Sun                  Expires June 19, 2015                 [Page 3]

Internet-Draft             CoAP Payload Length             December 2014


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)
         |      |


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 [RFC7252].







Li & Sun                  Expires June 19, 2015                 [Page 4]

Internet-Draft             CoAP Payload Length             December 2014


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 and
   Xianghui Sun 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-27 (work in progress),
              November 2014.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC7252]  Shelby, Z., Hartke, K., and C. Bormann, "The Constrained
              Application Protocol (CoAP)", RFC 7252, June 2014.

Authors' Addresses

   Kepeng Li
   Huawei Technologies
   Huawei Base, Bantian, Longgang District
   Shenzhen, Guangdong  518129
   P. R. China

   Phone: +86-755-289718087
   Email: likepeng@huawei.com


   Ruinan Sun
   Huawei Technologies
   Huawei Base, Bantian, Longgang District
   Shenzhen, Guangdong  518129
   P. R. China

   Phone: +86-755-28970171
   Email: sunruinan@huawei.com










Li & Sun                  Expires June 19, 2015                 [Page 5]