idnits 2.17.1 draft-ietf-lpwan-coap-static-context-hc-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** The document is more than 15 pages and seems to lack a Table of Contents. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack a Security Considerations section. ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 257 has weird spacing: '...I-Query k= ...' -- The document date (March 10, 2017) is 2604 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- == Unused Reference: 'RFC1332' is defined on line 758, but no explicit reference was found in the text == Unused Reference: 'RFC3095' is defined on line 762, but no explicit reference was found in the text == Unused Reference: 'RFC4944' is defined on line 770, but no explicit reference was found in the text == Unused Reference: 'RFC4997' is defined on line 775, but no explicit reference was found in the text == Unused Reference: 'RFC5225' is defined on line 780, but no explicit reference was found in the text == Unused Reference: 'RFC6282' is defined on line 785, but no explicit reference was found in the text == Outdated reference: A later version (-17) exists of draft-ietf-core-comi-00 Summary: 3 errors (**), 0 flaws (~~), 9 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 lpwan Working Group A. Minaburo 3 Internet-Draft Acklio 4 Intended status: Informational L. Toutain 5 Expires: September 11, 2017 Institut MINES TELECOM ; IMT Atlantique 6 March 10, 2017 8 LPWAN Static Context Header Compression (SCHC) for CoAP 9 draft-ietf-lpwan-coap-static-context-hc-01 11 Abstract 13 This draft discusses the way SCHC header compression can be applied 14 to CoAP headers in an LPWAN flow regarding the generated traffic. 15 CoAP protocol differs from IPv6 and UDP protocols because the CoAP 16 Header has a flexible header due to variable options. Another 17 important difference is the asymmetric format in the header 18 information used in the request and the response packets. This draft 19 shows that the Client and the Server do not uses the same fields and 20 how the SCHC header compression can be used. 22 Status of This Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at http://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on September 11, 2017. 39 Copyright Notice 41 Copyright (c) 2017 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (http://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 1. Introduction 56 [I-D.toutain-lpwan-ipv6-static-context-hc] defines a header 57 compression mechanism for LPWAN network based on a static context. 58 Where the context is said static since the element values composing 59 the context are not learned during the packet exchanges but are 60 previously defined. The context(s) is(are) known by both ends before 61 transmission. 63 A context is composed of a set of rules (contexts) that are 64 referenced by Rule IDs (identifiers). A rule describes the header 65 fields with some associated Target Values (TV). A Matching Operator 66 (MO) is associated to each header field description. The rule is 67 selected if all the MOs fit the TVs. In that case, a Compression 68 Decompression Function (CDF) associated to each field defines the 69 link between the compressed and decompressed value for each of the 70 header fields. 72 This draft discusses the way SCHC can be applied to CoAP headers, how 73 to extend MOs to match a specific element when several fields of the 74 same type are presented in the header. It also introduces the notion 75 of bidirectional or unidirectional (upstream and downstream) fields. 77 2. CoAP Compressing 79 CoAP [RFC7252] is an implementation of the REST architecture for 80 constrained devices. Gateway between CoAP and HTTP can be easily 81 built since both protocols uses the same address space (URL), caching 82 mechanisms and methods. 84 Nevertheless, if limited, the size of a CoAP header may be too large 85 for LPWAN constraints and some compression may be needed to reduce 86 the header size. CoAP compression is not straightforward. Some 87 differences between IPv6/UDP and CoAP can be highlighted. CoAP 88 differs from IPv6 and UDP protocols in the following 89 aspects: 91 o IPv6 and UDP are symmetrical protocols. The same fields are found 92 in the request and in the response, only position in the header 93 may change (e.g. source and destination fields). A CoAP request 94 is different from an response. For example, the URI-path option 95 is mandatory in the request and is not found in the response. 97 o CoAP also obeys to the client/server paradigm and the compression 98 rate can be different if the request is issued from a LPWAN node 99 or from an non LPWAN device. For instance a Thing (ES) aware of 100 LPWAN constraints can generate a 1 byte token, but a regular CoAP 101 cleint will certainly send a larger token to the Thing. 103 o In IPv6 and UDP header fields have a fixed size. In CoAP, Token 104 size may vary from 0 to 8 bytes, length is given by a field in the 105 header. More systematically, the CoAP options are described using 106 the Type-Length-Value. When applying SCHC header compression, the 107 token size is not known at the rule creation, the sender and the 108 receiver must agree on its compressed size. 110 o The options type in CoAP is not defined with the same value. The 111 Delta TLV coding makes that the type is not independent of 112 previous option and may vary regarding the options contained in 113 the header. 115 2.1. CoAP behavior 117 A LPWAN node can either be a client or a server and sometimes both. 118 In the client mode, the LPWAN node sends request to a server and 119 expects an answer or acknowledgements. Acknowledgements can be at 2 120 different levels: 122 o In the transport level, a CON message is acknowledged by an ACK 123 message. A NON confirmable message is not acknowledged at all. 125 o In REST level, a REST request is acknowledged by an "error" code. 126 The [RFC7967] defines an option to limit the number of 127 acknowledgements. 129 Note that acknowledgement can be optimized and a REST level 130 acknowledgement can be used as a transport level acknowledgement. 132 2.2. CoAP protocol analysis 134 CoAP header format defines the following fields: 136 o version (2 bits): this field can be elided during the SCHC 137 compresssion 139 o type (2 bits). It defines the type of the transport messages, 4 140 values are defined, regarding the type of exchange. If only NON 141 messages are sent or CON/ACK messages, this field can be reduced 142 to 0 or 1 bit. 144 o token length (4 bits). The standard allows up to 8 bytes for a 145 token. If a fixed token size is chosen, then this field can be 146 elided. If some variation in length are needed then 1 or 2 bits 147 could be enough for most of LPWAN applications. 149 o code (8 bits). This field codes the request and the response 150 values. In CoAP these values are represented in a more compact 151 way then the coding used in HTTP, but the coding is not optimal. 153 o message id (16 bits). This value of this header field is used to 154 acknowledge CON frames. The size of this field is computed to 155 allow the anticipation (how many frames can be sent without 156 acknowledgement). When a value is used, the [RFC7252] defines the 157 time before it can be reused without ambiguities. This size 158 defined may be too large for a LPWAN node sending or receiving few 159 messages a day. 161 o Token (0 to 8 bytes). Token header field is used to identify 162 active flows. Regarding the usage for LPWAN (stability in time 163 and limited number), a short token (1 Byte or less) can be enough. 165 o options are coded using delta-TLV. The delta-T depends on 166 previous values, length is encoded inside the option. The 167 [RFC7252] distinguishes repeatable options that can appear several 168 times in the header. Among them we can distinguish: 170 * list options which appear several time in the header but are 171 exclusive such as the Accept option. 173 * cumulative options which appear several times in the header but 174 are part of a more generic value such as Uri-Path and Uri- 175 Query. In that case, some elements may not change during the 176 Thing lifetime and other may change at each request. For 177 instance CoMi [I-D.ietf-core-comi] defines the following path 178 /c/X6?k="eth0", where the first path element "c" does not 179 change, the second element can vary over time with a different 180 length (it represents the base64 enconding of a SID) and the 181 query string can also vary over time. 183 For a given flow some value options are stable through time. 184 Observe, ETag, If-Match, If-None-Match and Size varies in each 185 message. 187 The CoAP protocol must not be altered by the compression/ 188 decompression phase, but if no semantic is attributed to a value, it 189 may be changed during this phase. For instance, the compression 190 phase may reduce the size of a token but must maintain its unicity. 191 The decompressor will not be able to restore the original value but 192 the behavior will remain the same. If no special semantic is 193 assigned to the token, this will be transparent. If a special 194 semantic is assigned to the token, its compression may not be 195 possible. 197 3. SCHC rules for CoAP header compression 199 This draft refines the rules definition by adding the direction of 200 the message, from the Thing point of view (uplink, downlink or 201 bidirectional). It does not introduce new Machting Operator or new 202 Compression Decompression Function, but add some possibility to check 203 one particular element when several of them are present at the same 204 time. 206 A rule can contain CoAP and IPv6/UDP entries. In that case, IPv6/UDP 207 entries are tagged bidirectional. 209 3.1. Directional Rules 211 By default, an entry in a rule is bidirectional which means that it 212 can be applied either on the uplink or downlink headers. By 213 specifying the direction, the LC will take into account the specific 214 field only if the direction match. 216 If the Thing is a client, the URI-Path option is only present on 217 request and not on the response. Therefore, the exact matching 218 principle to select a rule cannot apply. 220 Some options are marked unidirectional, the value (uplink or 221 downlink) depends of the scenario. A Uri-Path option will be marked 222 uplink if the Thing acts as a client and downlink if the Thing acts 223 as a server. If the Thing acts both as client and server, two 224 different rules will be defined. 226 3.2. Matching Operator 228 The Matching Operator behavior has not changed, but the value must 229 take a position value, if the entry is repeated : 231 FID TV MO CDF 233 URI-Path foo equal 1 not-sent 234 URI-Path bar equal 2 not-sent 236 Figure 1: Position entry. 238 For instance, the rule Figure 1 matches with /foo/bar, but not /bar/ 239 foo. 241 The position is added after the natural argument of the MO, for 242 example MSB (4,3) indicates a most significant bit matching of 4 bits 243 in a field located in position 3. 245 3.3. Compressed field length 247 When the length is not clearly indicated in the rule, the value 248 length must be sent with the field data, which means for CoAP to send 249 directly the CoAP option where the delta-T is set to 0. 251 For the CoMi path /c/X6?k="eth0" the rule can be set to: 253 FID TV MO CDF 255 URI-Path c equal 1 not-sent 256 URI-Path ignore 2 value-sent 257 URI-Query k= MSB (16, 1) value-sent 259 Figure 2: CoMi URI compression 261 Figure 2 shows the parsing and the compression of the URI. where c is 262 not sent. The second element is sent with the length (i.e. 0x02 X 6) 263 followed by the query option (i.e. 0x08 k="eth0"). 265 [[NOTE we don't process URI with a multiple number of path element 266 ??]]. 268 4. Application to CoAP header fields 270 This section lists the different CoAP header fields and how they can 271 be compressed. 273 4.1. CoAP version field 275 This field is bidirectional. 277 This field contains always the same value, therefore the TV may be 1, 278 the MO is set to "equal" and the CDF is set to "not-sent" 280 4.2. CoAP type field 282 This field is bidirectional or undirectional. 284 Several strategies can be applied to this field regarding the values 285 used: 287 o if only one type is sent, for example NON message, its 288 transmission can be avoided. TV is set to the value, MO is set to 289 "equal" and CDF is set to "not-sent". 291 o if two values are sent, for example CON and ACK and RST is not 292 used, this field can be reduced to one bit. TV is set to a 293 matching value {CON: 0, ACK: 1}, MO is set to match-mapping and 294 CDF is set to mapping-sent. 296 o It is also possible avoid transmission of this field by marking it 297 unidirectional. In one direction, the TV is set to CON, MO is set 298 to "equal" and CDF is set to "not-sent". On the other direction, 299 the TV is set to ACK, the MO is set to "equal" and the CDF is set 300 to "not-sent". 302 o Otherwise TV is not set, MO is set to "ignore" and CDF is set to 303 "value-sent". 305 4.3. CoAP token length field 307 This field is bi-directional. 309 Several strategies can be applied to this field regarding the values: 311 o no token or a wellknown length, the transmission can be avoided. 312 TV is set to the length, the MO is set to "equal" and CDF is set 313 to "not-sent" 315 o The length is variable from one message to another. TV is not 316 set, MO is set to "ignore" and CDF is set to "value-sent". The 317 size of the sent value must be known by ends. The size may be 4 318 bits. The receiver must take into account this value to retrieve 319 the token. A CoAP proxy may be used before the compression to 320 reduce the field size. 322 4.4. CoAP code field 324 This field is unidirectional. The client and the server do not use 325 the same values. 327 The CoAP code field defines a tricky way to ensure compatibility with 328 HTTP values. Nevertheless only 21 values are defined by [RFC7252] 329 compared to the 255 possible values. So, it could efficiently be 330 coded on 5 bits. The number of code may vary over time, some new 331 codes may be introduced or some applications use a limited number of 332 values. 334 +------+------------------------------+-----------+ 335 | Code | Description | Mapping | 336 +------+------------------------------+-----------+ 337 | 0.00 | | 0x00 | 338 | 0.01 | GET | 0x01 | 339 | 0.02 | POST | 0x02 | 340 | 0.03 | PUT | 0x03 | 341 | 0.04 | DELETE | 0x04 | 342 | 0.05 | FETCH | 0x05 | 343 | 0.06 | PATCH | 0x06 | 344 | 0.07 | iPATCH | 0x07 | 345 | 2.01 | Created | 0x08 | 346 | 2.02 | Deleted | 0x09 | 347 | 2.03 | Valid | 0x0A | 348 | 2.04 | Changed | 0x0B | 349 | 2.05 | Content | 0x0C | 350 | 4.00 | Bad Request | 0x0D | 351 | 4.01 | Unauthorized | 0x0E | 352 | 4.02 | Bad Option | 0x0F | 353 | 4.03 | Forbidden | 0x10 | 354 | 4.04 | Not Found | 0x11 | 355 | 4.05 | Method Not Allowed | 0x12 | 356 | 4.06 | Not Acceptable | 0x13 | 357 | 4.12 | Precondition Failed | 0x14 | 358 | 4.13 | Request Entity Too Large | 0x15 | 359 | 4.15 | Unsupported Content-Format | 0x16 | 360 | 5.00 | Internal Server Error | 0x17 | 361 | 5.01 | Not Implemented | 0x18 | 362 | 5.02 | Bad Gateway | 0x19 | 363 | 5.03 | Service Unavailable | 0x1A | 364 | 5.04 | Gateway Timeout | 0x1B | 365 | 5.05 | Proxying Not Supported | 0x1C | 366 +------+------------------------------+-----------+ 368 Figure 3: Example of CoAP code mapping 370 Figure 3 gives a possible mapping, it can be changed to add new codes 371 or reduced if some values are never used by both ends. 373 The field can be treated differently in upstream than in downstream. 374 If the Thing is a client an entry can be set on the uplink message 375 with a code matching for 0.0X values and another for downlink values 376 for Y.ZZ codes. It is the opposite if the thing is a server. 378 4.5. CoAP Message ID field 380 This field is bidirectional. 382 Message ID is used for two purposes: 384 o To acknowledge a CON message with an ACK. 386 o To avoid duplicate messages. 388 In LPWAN, since a message can be received by several radio gateway, 389 some LPWAN technologies include a sequence number in L2 to avoid 390 duplicate frames. Therefore if the message does not need to be 391 acknowledged (NON or RST message), the Message ID field can be 392 avoided. In that case TV is not set, MO is set to ignore and CDF is 393 set to "not-sent". The decompressor can generate a number. 395 [[Note; check id this field is not used by OSCOAP .]] 397 To optimize information sent on the LPWAN, shorter values may be used 398 during the exchange, but Message ID values generated a common CoAP 399 implementation will not take into account this limitation. Before 400 the compression, a proxy may be needed to reduce the size. In that 401 case, the TV is set to 0x0000, MO is set to "MSB(l)" and CDF is set 402 to "LSB(16-l)", where "l" is the size of the compressed header. 404 Otherwise if no compression is needed the TV is not set, MO is set to 405 ignore and CDF is set to "not-sent". 407 4.6. CoAP Token field 409 This field is bi-directional. 411 Token is used to identify transactions and varies from one 412 transaction to another. Therefore, it is usually necessary to send 413 the value of the token field on the LPWAN network. The optimization 414 will occur by using small values. 416 Common CoAP implementations may generate large tokens, even if 417 shorter tokens could be used regarding the LPWAN characteristics. A 418 proxy may be needed to reduce the size of the token before 419 compression. 421 Otherwise the TV is not set, the MO is set to ignore and CDF is set 422 to "value-sent". 424 The decompression may know the length of the token field from the 425 token length field. 427 4.7. CoAP option Content-format field. 429 This field is unidirectional and must not be set to bidirectional in 430 a rule entry. It is used only by the server to inform the client 431 about of the payload type and is never found in client requests. 433 If the value is known by both sides, the TV contains that value and 434 MO is set to "equal" and the CDF is set to "not-sent". 436 Otherwise the TV is not set, MO is set to "ignore" and CDF is set to 437 "value-sent" 439 A mapping list can also be used to reduce the size. 441 4.8. CoAP option Accept field 443 This field is unidirectional and must not be set to bidirectional in 444 a rule entry. It is used only by the client to inform of the 445 possible payload type and is never found in server response. 447 The number of accept options is not limited and can vary regarding 448 the usage. To be selected a rule must contain the exact number about 449 accept options with their positions. 451 if the accept value must be sent, the TV contains that value, MO is 452 set to "ignore x" where "x" is the accept option's position and CDF 453 is set to value-sent. Since the value length is not known, it must 454 be sent as a CoAP TLV with delta-T set to 0. 456 Otherwise the TV is not set, MO is set to "equal x" where x is the 457 accept option's position and CDF is set to "not-sent" 459 [[note: it could be more liberal and do not provide the same order 460 after decompression]] 462 4.9. CoAP option Max-Age field 464 This field is unidirectional and must not be set to bidirectional in 465 a rule entry. It is used only by the server to inform of the caching 466 duration and is never found in client requests. 468 If the duration is known by both ends, the TV is set with this 469 duration, the MO is set to "equal" and the CDF is set to "not-sent". 471 Otherwise the TV is not set, the MO is set to "ignore" and the CDF is 472 set to "value-sent". Since the value length is not known, it must be 473 sent as a CoAP TLV with delta-T set to 0. 475 [[note: we can reduce (or create a new option) the unit to minute, 476 second is small for LPWAN ]] 478 4.10. CoAP option Uri-Host and Uri-Port fields 480 This fields are unidirectional and must not be set to bidirectional 481 in a rule entry. They are used only by the client to access to a 482 specific server and are never found in server response. 484 For each option, if the value is known by both ends, the TV is set 485 with this value, the MO is set to "equal" and the CDF is set to "not- 486 sent". 488 Otherwise the TV is not set, the MO is set to "ignore" and the CDF is 489 set to "value-sent". Since the value length is not known, it must be 490 sent as a CoAP TLV with delta-T set to 0. 492 4.11. CoAP option Uri-Path and Uri-Query fields 494 This fields are unidirectional and must not be set to bidirectional 495 in a rule entry. They are used only by the client to access to a 496 specific resource and are never found in server response. 498 Path and Query option may have different formats. Section 3.2 gives 499 some examples. 501 If the URI path as well as the query is composed of 2 or more 502 elements, then the position must be set in the MO parameters. 504 If a Path or Query element is stable over the time, then TV is set 505 with its value, MO is set to "equal x" where x is the position in the 506 Path or the Query and CDF is set to "not-sent". 508 Otherwise if the value varies over time, TV is not set, MO is set to 509 "ignore x" where x is the position in the Path or in the Query and 510 CDF is set to "value-sent". Since the value length is not known, it 511 must be sent as a CoAP TLV with deltaT set to 0. 513 A Mapping list can be used to reduce size of variable Paths or 514 Queries. In that case, to optimize the compression, several elements 515 can be regrouped into a single entry. Numbering of elements do not 516 change, MO comparison is set with the first element of the matching. 518 For instance, the following Path /foo/bar/variable/stable can leads 519 to the rule defined Figure 4. 521 FID TV MO CDF 523 URI-Path {"/foo/bar":1, match-mapping 1 mapping-sent 524 "/bar/foo":2} 525 URI-Path ignore 3 value-sent 526 URI-Path stable equal 4 not-sent 528 Figure 4: complex path example 530 4.12. CoAP option Proxy-URI and Proxy-Scheme fields 532 These fields are unidirectional and must not be set to bidirectional 533 in a rule entry. They are used only by the client to access to a 534 specific resource and are never found in server response. 536 If the field value must be sent, TV is not set, MO is set to "ignore" 537 and CDF is set to "value-sent. A mapping can also be used. 539 Otherwise the TV is set to the value, MO is set to "equal" and CDF is 540 set to "not-sent" 542 4.13. CoAP option ETag, If-Match, If-None-Match, Location-Path and 543 Location-Query fields 545 These fields are unidirectional. 547 These fields values cannot be stored in a rule entry. They must 548 always be sent with the request. 550 [[Can include OSCOAP Object security in that category ]] 552 5. Other RFCs 554 5.1. Block 556 Block option should be avoided in LPWAN. The minimum size of 16 557 bytes can be incompatible with some LPWAN technologies. 559 [[Note: do we recommand LPWAN fragmentation since the smallest value 560 of 16 is too big?]] 562 5.2. Observe 564 [RFC7641] defines the Observe option. The TV is not set, MO is set 565 to "ignore" and the CDF is set to "value-sent". SCHC does not limit 566 the maximum size for this option (3 bytes). To reduce the 567 transmission size either the Thing implementation should limit the 568 value increase or a proxy can be used limit the increase. 570 Since RST message may be sent to inform a server that the client do 571 not require Observe response, a rule must allow the transmission of 572 this message. 574 5.3. No-Response 576 [RFC7967] defines an No-Response option limiting the responses made 577 by a server to a request. If the value is not by both ends, then TV 578 is set to this value, MO is set to "equal" and CDF is set to "not- 579 sent". 581 Otherwise, if the value is changing over time, TV is not set, MO is 582 set to "ignore" and CDF to "value-sent". A matching list can also be 583 used to reduce the size. 585 6. Examples of CoAP header compression 587 6.1. Mandatory header with CON message 589 In this first scenario, the LPWAN compressor receives from outside 590 client a POST message, which is immediately acknowledged by the 591 Thing. For this simple scenario, the rules are described Figure 5. 593 rule id 1 594 +-------------+------+---------+-------------+-----+----------------+ 595 | Field |TV |MO |CDF |dir | Sent | 596 +=============+======+=========+=============+=====+================+ 597 |CoAP version | 01 |equal |not-sent |bi | | 598 |CoAP Type | |ignore |value-sent |bi |TT | 599 |CoAP TKL | 0 |equal |not-sent |bi | | 600 |CoAP Code | ML1 |match-map|matching-sent|bi | CC CCC | 601 |CoAP MID | 0000 |MSB(7 ) |LSB(9) |bi | M-ID | 602 |CoAP Uri-Path| path |equal 1 |not-sent |down | | 603 +-------------+------+---------+-------------+-----+----------------+ 605 Figure 5: CoAP Context to compress header without token 607 The version and Token Length fields are elided. Code has shrunk to 5 608 bits using the matching list (as the one given Figure 3: 0.01 is 609 value 0x01 and 2.05 is value 0x0c) Message-ID has shrunk to 9 bits to 610 preserve alignment on byte boundary. The most significant bit must 611 be set to 0 through a CoAP proxy. Uri-Path contains a single element 612 indicated in the matching operator. 614 Figure 6 shows the time diagram of the exchange. A LPWAN Application 615 Server sends a CON message. Compression reduces the header sending 616 only the Type, a mapped code and the least 9 significant bits of 617 Message ID. The receiver decompresses the header. . 619 The CON message is a request, therefore the LC process to a dynamic 620 mapping. When the ES receives the ACK message, this will not 621 initiate locally a message ID mapping since it is a response. The LC 622 receives the ACK and uncompressed it to restore the original value. 623 Dynamic Mapping context lifetime follows the same rules as message ID 624 duration. 626 End System LPWA LC 627 | | 628 | rule id=1 |<---------------------- 629 |<--------------------| +-+-+--+----+--------+ 630 <-------------------- | TTCC CCCM MMMM MMMM| |1|0| 4|0.01| 0x0034 | 631 +-+-+--+----+--------+ | 0000 0010 0011 0100| | 0xb4 p a t | 632 |1|0| 1|0.01| 0x0034 | | | | h | 633 | 0xb4 p a t | | | +------+ 634 | h | | | 635 +------+ | | 636 | | 637 | | 638 ----------------------->| rule id=1 | 639 +-+-+--+----+--------+ |-------------------->| 640 |1|2| 0|2.05| 0x0034 | | TTCC CCCM MMMM MMMM|------------------------> 641 +-+-+--+----+--------+ | 1001 1000 0011 0100| +-+-+--+----+--------+ 642 | | |1|2| 0|2.05| 0x0034 | 643 v v +-+-+--+----+--------+ 645 Figure 6: Compression with global addresses 647 The message can be further optimized by setting some fields 648 unidirectional, as described in Figure 7. Note that Type is no more 649 sent in the compressed format, Compressed Code size in not changed in 650 that example (8 values are needed to code all the requests and 21 to 651 code all the responses in the matching list Figure 3) 652 rule id 1 653 +-------------+------+---------+-------------+---+----------------+ 654 | Field |TV |MO |CDF |dir| Sent | 655 +=============+======+=========+=============+===+================+ 656 |CoAP version | 01 |equal |not-sent |bi | | 657 |CoAP Type | CON |equal |not-sent |dw | | 658 |CoAP Type | ACK |equal |not-sent |up | | 659 |CoAP TKL | 0 |equal |not-sent |bi | | 660 |CoAP Code | ML2 |match-map|matching-sent|dw |CCCC C | 661 |CoAP Code | ML3 |match-map|matching-sent|up |CCCC C | 662 |CoAP MID | 0000 |MSB(5) |LSB(11) |bi | M-ID | 663 |CoAP Uri-Path| path |equal 1 |not-sent |dw | | 664 +-------------+------+---------+-------------+---+----------------+ 666 ML1 = {CON : 0, ACK:1} ML2 = {POST:0, 2.04:1, 0.00:3} 668 Figure 7: CoAP Context to compress header without token 670 6.2. Complete exchange 672 In that example, the Thing is using CoMi and sends queries for 2 SID. 674 CON 675 MID=0x0012 | | 676 POST | | 677 Accept X | | 678 /c/k=AS |------------------------>| 679 | | 680 | | 681 |<------------------------| ACK MID=0x0012 682 | | 0.00 683 | | 684 | | 685 |<------------------------| CON 686 | | MID=0X0034 687 | | Content-Format X 688 ACK MID=0x0034 |------------------------>| 689 0.00 691 rule id 3 692 +-------------+------+---------+-------------+---+----------------+ 693 | Field |TV |MO |CDF |dir| Sent | 694 +=============+======+=========+=============+===+================+ 695 |CoAP version | 01 |equal |not-sent |bi | | 696 |CoAP Type | CON |equal |not-sent |up | | 697 |CoAP Type | ACK |equal |not-sent |dw | | 698 |CoAP TKL | 1 |equal |not-sent |bi | | 699 |CoAP Code | POST |equal |not-sent |up | | 700 |CoAP Code | 0.00 |equal |not-sent |dw | | 701 |CoAP MID | 0000 |MSB(8) |LSB(8) |bi |MMMMMMMM | 702 |CoAP Token | |ignore |send-value |up |TTTTTTTT | 703 |CoAP Uri-Path| /c |equal 1 |not-sent |dw | | 704 |CoAP Uri-query ML4 |equal 1 |not-sent |dw |P | 705 |CoAP Content | X |equal |not-sent |up | | 706 +-------------+------+---------+-------------+---+----------------+ 708 rule id 4 709 +-------------+------+---------+-------------+---+----------------+ 710 | Field |TV |MO |CDF |dir| Sent | 711 +=============+======+=========+=============+===+================+ 712 |CoAP version | 01 |equal |not-sent |bi | | 713 |CoAP Type | CON |equal |not-sent |dw | | 714 |CoAP Type | ACK |equal |not-sent |up | | 715 |CoAP TKL | 1 |equal |not-sent |bi | | 716 |CoAP Code | 2.05 |equal |not-sent |dw | | 717 |CoAP Code | 0.00 |equal |not-sent |up | | 718 |CoAP MID | 0000 |MSB(8) |LSB(8) |bi |MMMMMMMM | 719 |CoAP Token | |ignore |send-value |dw |TTTTTTTT | 720 |COAP Accept | X |equal |not-sent |dw | | 721 +-------------+------+---------+-------------+---+----------------+ 723 alternative rule: 725 rule id 4 726 +-------------+------+---------+-------------+---+----------------+ 727 | Field |TV |MO |CDF |dir| Sent | 728 +=============+======+=========+=============+===+================+ 729 |CoAP version | 01 |equal |not-sent |bi | | 730 |CoAP Type | ML1 |equal |match-sent(1)|bi |t | 731 |CoAP TKL | 1 |equal |not-sent |bi | | 732 |CoAP Code | ML2 |equal |match-sent(1)|up | cc | 733 |CoAP Code | ML3 |equal |match-sent(2)|dw | cc | 734 |CoAP MID | 0000 |MSB(8) |LSB(8) |bi |MMMMMMMM | 735 |CoAP Token | |ignore |send-value |dw |TTTTTTTT | 736 |CoAP Uri-Path| /c |equal 1 |not-sent |dw | | 737 |CoAP Uri-query ML4 |equal 1 |not-sent |dw |P | 738 |CoAP Content | X |equal |not-sent |up | | 739 |COAP Accept | x |equal |not-sent |dw | | 740 +-------------+------+---------+-------------+---+----------------+ 742 ML1 {CON:0, ACK:1} ML2 {POST:0, 0.00: 1} ML3 {2.05:0, 0.00:1} 743 ML4 {NULL:0, k=AS:1, K=AZE:2} 745 7. Normative References 747 [I-D.ietf-core-comi] 748 Stok, P., Bierman, A., Veillette, M., and A. Pelov, "CoAP 749 Management Interface", draft-ietf-core-comi-00 (work in 750 progress), January 2017. 752 [I-D.toutain-lpwan-ipv6-static-context-hc] 753 Minaburo, A. and L. Toutain, "LPWAN Static Context Header 754 Compression (SCHC) for IPv6 and UDP", draft-toutain-lpwan- 755 ipv6-static-context-hc-00 (work in progress), September 756 2016. 758 [RFC1332] McGregor, G., "The PPP Internet Protocol Control Protocol 759 (IPCP)", RFC 1332, DOI 10.17487/RFC1332, May 1992, 760 . 762 [RFC3095] Bormann, C., Burmeister, C., Degermark, M., Fukushima, H., 763 Hannu, H., Jonsson, L-E., Hakenberg, R., Koren, T., Le, 764 K., Liu, Z., Martensson, A., Miyazaki, A., Svanbro, K., 765 Wiebke, T., Yoshimura, T., and H. Zheng, "RObust Header 766 Compression (ROHC): Framework and four profiles: RTP, UDP, 767 ESP, and uncompressed", RFC 3095, DOI 10.17487/RFC3095, 768 July 2001, . 770 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, 771 "Transmission of IPv6 Packets over IEEE 802.15.4 772 Networks", RFC 4944, DOI 10.17487/RFC4944, September 2007, 773 . 775 [RFC4997] Finking, R. and G. Pelletier, "Formal Notation for RObust 776 Header Compression (ROHC-FN)", RFC 4997, 777 DOI 10.17487/RFC4997, July 2007, 778 . 780 [RFC5225] Pelletier, G. and K. Sandlund, "RObust Header Compression 781 Version 2 (ROHCv2): Profiles for RTP, UDP, IP, ESP and 782 UDP-Lite", RFC 5225, DOI 10.17487/RFC5225, April 2008, 783 . 785 [RFC6282] Hui, J., Ed. and P. Thubert, "Compression Format for IPv6 786 Datagrams over IEEE 802.15.4-Based Networks", RFC 6282, 787 DOI 10.17487/RFC6282, September 2011, 788 . 790 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 791 Application Protocol (CoAP)", RFC 7252, 792 DOI 10.17487/RFC7252, June 2014, 793 . 795 [RFC7641] Hartke, K., "Observing Resources in the Constrained 796 Application Protocol (CoAP)", RFC 7641, 797 DOI 10.17487/RFC7641, September 2015, 798 . 800 [RFC7967] Bhattacharyya, A., Bandyopadhyay, S., Pal, A., and T. 801 Bose, "Constrained Application Protocol (CoAP) Option for 802 No Server Response", RFC 7967, DOI 10.17487/RFC7967, 803 August 2016, . 805 Authors' Addresses 807 Ana Minaburo 808 Acklio 809 2bis rue de la Chataigneraie 810 35510 Cesson-Sevigne Cedex 811 France 813 Email: ana@ackl.io 815 Laurent Toutain 816 Institut MINES TELECOM ; IMT Atlantique 817 2 rue de la Chataigneraie 818 CS 17607 819 35576 Cesson-Sevigne Cedex 820 France 822 Email: Laurent.Toutain@imt-atlantique.fr