1、 ETSI TS 118 108 V1.1.0 (2016-03) oneM2M; CoAP Protocol Binding (oneM2M TS-0008 version 1.3.2 Release 1) TECHNICAL SPECIFICATION oneM2M TS-0008 version 1.3.2 Release 1 ETSI ETSI TS 118 108 V1.1.0 (2016-03)2 Reference RTS/oneM2M-000008v110 Keywords IoT, M2M, protocol ETSI 650 Route des Lucioles F-069
2、21 Sophia Antipolis Cedex - FRANCE Tel.: +33 4 92 94 42 00 Fax: +33 4 93 65 47 16 Siret N 348 623 562 00017 - NAF 742 C Association but non lucratif enregistre la Sous-Prfecture de Grasse (06) N 7803/88 Important notice The present document can be downloaded from: http:/www.etsi.org/standards-search
3、 The present document may be made available in electronic versions and/or in print. The content of any electronic and/or print versions of the present document shall not be modified without the prior written authorization of ETSI. In case of any existing or perceived difference in contents between s
4、uch versions and/or in print, the only prevailing document is the print of the Portable Document Format (PDF) version kept on a specific network drive within ETSI Secretariat. Users of the present document should be aware that the document may be subject to revision or change of status. Information
5、on the current status of this and other ETSI documents is available at https:/portal.etsi.org/TB/ETSIDeliverableStatus.aspx If you find errors in the present document, please send your comment to one of the following services: https:/portal.etsi.org/People/CommiteeSupportStaff.aspx Copyright Notific
6、ation No part may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm except as authorized by written permission of ETSI. The content of the PDF version shall not be modified without the written authorization of ETSI. The copyright an
7、d the foregoing restriction extend to reproduction in all media. European Telecommunications Standards Institute 2016. All rights reserved. DECTTM, PLUGTESTSTM, UMTSTMand the ETSI logo are Trade Marks of ETSI registered for the benefit of its Members. 3GPPTM and LTE are Trade Marks of ETSI registere
8、d for the benefit of its Members and of the 3GPP Organizational Partners. GSM and the GSM logo are Trade Marks registered and owned by the GSM Association. oneM2M TS-0008 version 1.3.2 Release 1 ETSI ETSI TS 118 108 V1.1.0 (2016-03)3 Contents Intellectual Property Rights 5g3Foreword . 5g31 Scope 6g3
9、2 References 6g32.1 Normative references . 6g32.2 Informative references 6g33 Abbreviations . 6g34 Conventions 7g35 Overview 7g35.0 Introduction 7g35.1 Required Features . 7g35.2 Introduction of CoAP . 7g35.2.0 Introduction. 7g35.2.1 Message Format 7g35.2.2 Caching . 8g35.2.2.0 Introduction . 8g35.2
10、.2.1 Freshness . 8g35.2.2.2 Validity . 8g35.2.3 Blockwise Transfers . 8g36 CoAP Message Mapping 8g36.1 Introduction 8g36.2 Primitive Mapping to CoAP Message 9g36.2.0 Introduction. 9g36.2.1 Header . 9g36.2.2 Configuration of Token and Options 9g36.2.2.0 Introduction . 9g36.2.2.1 Token 9g36.2.2.2 Cont
11、ent Format Negotiation Options 9g36.2.2.3 URI Options 10g36.2.2.4 Definition of New Options 10g36.2.2.4.0 Introduction . 10g36.2.2.4.1 From 11g36.2.2.4.2 Request Identifier 11g36.2.2.4.3 Void . 11g36.2.2.4.4 Originating Timestamp 11g36.2.2.4.5 Request Expiration Timestamp . 11g36.2.2.4.6 Result Expi
12、ration Timestamp 11g36.2.2.4.7 Operation Execution Time. 11g36.2.2.4.8 notificationURI of Response Type 11g36.2.2.4.9 Event Category 11g36.2.2.4.10 Response Status Code 11g36.2.2.4.11 Group Request Identifier . 11g36.2.2.4.12 Resource Type . 11g36.2.3 Payload . 12g36.2.4 Response Codes Mapping . 12g
13、36.3 Accessing Resources in CSEs 13g36.3.0 Introduction. 13g36.3.1 Blocking case 13g36.3.2 Non-Blocking Asynchronous case 13g36.3.3 Non-Blocking Synchronous case 13g36.4 Mapping rules of caching . 13g36.5 Usage of Blockwise Transfers 14g37 Security Consideration . 14g3oneM2M TS-0008 version 1.3.2 Re
14、lease 1 ETSI ETSI TS 118 108 V1.1.0 (2016-03)4 Annex A (informative): Example Procedures 15g3A.1 AE Registration 15g3History 16g3oneM2M TS-0008 version 1.3.2 Release 1 ETSI ETSI TS 118 108 V1.1.0 (2016-03)5 Intellectual Property Rights IPRs essential or potentially essential to the present document
15、may have been declared to ETSI. The information pertaining to these essential IPRs, if any, is publicly available for ETSI members and non-members, and can be found in ETSI SR 000 314: “Intellectual Property Rights (IPRs); Essential, or potentially Essential, IPRs notified to ETSI in respect of ETSI
16、 standards“, which is available from the ETSI Secretariat. Latest updates are available on the ETSI Web server (https:/ipr.etsi.org/). Pursuant to the ETSI IPR Policy, no investigation, including IPR searches, has been carried out by ETSI. No guarantee can be given as to the existence of other IPRs
17、not referenced in ETSI SR 000 314 (or the updates on the ETSI Web server) which are, or may be, or may become, essential to the present document. Foreword This Technical Specification (TS) has been produced by ETSI Partnership Project oneM2M (oneM2M). oneM2M TS-0008 version 1.3.2 Release 1 ETSI ETSI
18、 TS 118 108 V1.1.0 (2016-03)6 1 Scope The present document will cover the protocol specific part of communication protocol used by oneM2M compliant systems as RESTful CoAP binding. The scope of the present document is (not limited to as shown below): Binding oneM2M primitives to CoAP messages Bindin
19、g oneM2M Response Status Codes to CoAP Response Codes Defining behaviour of a CoAP Client and Server depending on oneM2M parameters 2 References 2.1 Normative references References are either specific (identified by date of publication and/or edition number or version number) or non-specific. For sp
20、ecific references, only the cited version applies. For non-specific references, the latest version of the referenced document (including any amendments) applies. The following referenced documents are necessary for the application of the present document. 1 IETF RFC 7252: “The Constrained Applicatio
21、n Protocol (CoAP)“. 2 ETSI TS 118 104: “oneM2M; Service Layer Core Protocol Specification (oneM2M TS-0004)“. 3 IETF draft-ietf-core-block-15: “Blockwise transfers in CoAP“. 4 ETSI TS 118 103: “oneM2M; Security solutions (oneM2M TS-0003)“. 5 IETF RFC 6347: “Datagram Transport Layer Security Version 1
22、.2“. 2.2 Informative references References are either specific (identified by date of publication and/or edition number or version number) or non-specific. For specific references, only the cited version applies. For non-specific references, the latest version of the referenced document (including a
23、ny amendments) applies. The following referenced documents are not necessary for the application of the present document but they assist the user with regard to a particular subject area. i.1 oneM2M Drafting Rules. NOTE: Available http:/member.onem2m.org/Static_pages/Others/Rules_Pages/oneM2M-Drafti
24、ng-Rules-V1_0.doc. 3 Abbreviations For the purposes of the present document, the following abbreviations apply: AE Application Entity CSE Common Service Entity DTLS Datagram Transport Layer Security HTTP Hyper Text Transfer Protocol IP Internet Protocol RST CoAP Reset message TCP Transport Control P
25、rotocol TLS Transport Layer Security TLV Tag - Length - Value (data structure) UDP User Datagram Protocol oneM2M TS-0008 version 1.3.2 Release 1 ETSI ETSI TS 118 108 V1.1.0 (2016-03)7 URI Uniform Resource Identifier 4 Conventions The keywords “Shall“, “Shall not“, “May“, “Need not“, “Should“, “Shoul
26、d not“ in the present document are to be interpreted as described in the oneM2M Drafting Rules i.1. 5 Overview 5.0 Introduction The clause describes which features need to be supported in CoAP layer and introduces a message format and several features of CoAP used in this procotol binding specificat
27、ion. 5.1 Required Features This clause explicitely specifies the required features of the CoAP layer for oneM2M to properly bind oneM2M primitives into CoAP messages. The 4-byte binary CoAP message header is defined in Section 3 of 1. Confirmable (CON), Acknowledgement (ACK) and Reset (RST) messages
28、 shall be supported. The Reset message is used to send a error message in response to a malformed Confirmable message in CoAP layer. GET, PUT, POST and DELETE methods shall be supported. oneM2M primitives map to these methods. A subset of Response Code specified in clause 6.2.4 shall be supported fo
29、r oneM2M Response Status Code parameter mapping. The Uri-Host, Uri-Port, Uri-Path, and Uri-Query shall be supported. The Content-Type Option shall be used to indicate the media types of the payload. The Token Option may be used. Block-wise transfers feature may be supported to carry large payloads.
30、Caching feature may be supported. 5.2 Introduction of CoAP 5.2.0 Introduction This clause describes a message format, and caching and block-wise transfers features which may be used to map oneM2M primitives to CoAP messages. 5.2.1 Message Format This clause specifies details about the CoAP 1 message
31、 format: CoAP message occupies the data section of one UDP datagram. CoAP message format supports a 4-byte fixed-size header. Fixed-size header is followed by a Token value of length 0 to 8 bytes. The Token value is followed by a sequence of zero or more CoAP Options in TLV format. CoAP Options are
32、followed by the payload part. For more details on the CoAP message format and the supported header fields, refer to 1. oneM2M TS-0008 version 1.3.2 Release 1 ETSI ETSI TS 118 108 V1.1.0 (2016-03)8 5.2.2 Caching 5.2.2.0 Introduction CoAP 1 supports caching of responses to fulfill future equivalent re
33、quests to the same resource. Caching is supported using freshness and validity information carried with CoAP 1 responses. 5.2.2.1 Freshness CoAP server shall use Max-Age CoAP Option to specify the explicit expiration time for the CoAP Responses resource representation. This indicates that the respon
34、se is not fresh after its age is greater than the specified number of seconds. Max-Age Option defaults to a value of 60 (seconds). In case, Max-Age Option is not present in the cacheable response, the response shall not be considered fresh after its age is greater than 60 seconds. The CoAP server sh
35、all set the Max-Age Option value to 0 (zero) to prevent or disable caching. The CoAP client, having a fresh stored response, can make new request matching the request for that stored response. In this case, the new response shall invalidate the old response. 5.2.2.2 Validity A CoAP endpoint with sto
36、red responses but not able to satisfy subsequent requests (for example, the response is not fresh), shall use the ETag Option to perform a conditional request to the CoAP server where the resource is hosted. If the cached response with the CoAP client is still valid, the server shall include the Max
37、-Age Option in the response along with a code of 2.03 - Valid. This shall update the freshness of the cached response at the CoAP client. If the cached response with the CoAP client is not valid, the server shall respond with an updated representation of the resource with response code 2.05 - Conten
38、t. The CoAP client shall use the updated response to satisfy request and may also replace/update the stored or cached response. 5.2.3 Blockwise Transfers CoAP Block 3 Options may be used when CoAP endpoints need to transfer large payloads e.g. firmware, software updates. Instead of relying on IP fra
39、gmentation, CoAP Block Option should be used for transferring multiple blocks of information in multiple request-response pairs. 6 CoAP Message Mapping 6.1 Introduction When AE or CSE binds oneM2M primitives to CoAP messages, or binds CoAP messages to oneM2M primitives, it is required that: AE shall
40、 host a CoAP client and should host a CoAP server; or CSE shall host both a CoAP client and a CoAP server. Basically single oneM2M request primitive is mapped to single CoAP request message, and single oneM2M response primitive is mapped to single CoAP response message. However, single oneM2M reques
41、t/response primitive is mapped to multiple CoAP request/response messages respectively when CoAP block-wise transfers feature is used. Mapping between CoAP message and oneM2M primitive shall be applied in the following cases: when the Originator sends a request primitive; when the Receiver receives
42、a CoAP message(s); oneM2M TS-0008 version 1.3.2 Release 1 ETSI ETSI TS 118 108 V1.1.0 (2016-03)9 when the Receiver sends a response primitive; when the Originator receives a CoAP message(s). The following sub-clauses specify how to map each oneM2M primitive parameter defined in 2 to a corresponding
43、CoAP message field to compose a CoAP request/response message. 6.2 Primitive Mapping to CoAP Message 6.2.0 Introduction This clause describes where to map oneM2M parameters in a primitive to header, Option and payload fields in a CoAP message. 6.2.1 Header This clause specifies how to configure CoAP
44、 header information. The Version field shall be configured as 1. The Type field shall be configured according to clause 6.3. The Reset message is used to send a error message in response to a malformed Confirmable message in CoAP layer. In case of a request, the Code field indicates CoAP Method. The
45、 oneM2M Operation parameter shall be mapped to a CoAP Method according to the table 6.2.1-1. In case of a response, the Code field indicates CoAP Response Code. The oneM2M Response Status Code parameter shall be mapped to CoAP Response Code as specified in clause 6.2.4. The configurations of Token L
46、ength and Message ID are left to implementation. Table 6.2.1-1: oneM2M Operation Parameter Mapping oneM2M Operation Parameter CoAP Method CREATE POST RETRIEVE GET UPDATE PUT DELETE DELETE NOTIFY POST At the Receiver, CoAP request message with POST method shall be mapped to oneM2M CREATE or NOTIFY Op
47、eration parameter in accordance with the existence of Resource Type parameter. If Resource Type parameter exists then value of the Operation parameter is CREATE and if Resource Type parameter does not exist, the value of Operation parameter is NOTIFY. 6.2.2 Configuration of Token and Options 6.2.2.0
48、 Introduction This clause describes configuration of Token and Options based on oneM2M parameters. 6.2.2.1 Token Due to size limitation, Request Identifier is not mapped to Token option. However, Token may be used in CoAP layer to match a CoAP request and response. 6.2.2.2 Content Format Negotiation
49、 Options The CoAP Accept Option may be used to indicate which Content-Format is acceptable to an Originator. If a Hosting CSE supports the Content-Format specified in Accept Option of the request, the Hosting CSE shall respond with that Content-Format. If the Hosting CSE does not support the Content-Format specified in Accept Option of the request, 4.06 “Not Acceptable“ shall be sent as a response, unless another error code takes precedence for this response. oneM2M TS-0008 vers