idnits 2.17.1 draft-ietf-lpwan-ipv6-static-context-hc-12.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: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** 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.) ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 166: '... most of the time and MAY receive data...' RFC 2119 keyword, line 268: '... connected to the LPWAN. A Dev SHOULD...' RFC 2119 keyword, line 483: '...east one Rule ID MAY be reserved to th...' RFC 2119 keyword, line 494: '...etworks, static contexts MAY be stored...' RFC 2119 keyword, line 496: '... contexts MUST be stored at both end...' (92 more instances...) Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1087 has weird spacing: '...long as the...' == Line 1310 has weird spacing: '... 1 byte next ...' == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: When an All-0 fragment is received, it indicates that all the SCHC Fragments have been sent in the current window. Since the sender is not obliged to always send a full window, some SCHC Fragment number not set in the receiver memory SHOULD not correspond to losses. The receiver sends the corresponding SCHC ACK, the Inactivity Timer is set and the transmission of the next window by the sender can start. -- The document date (May 18, 2018) is 2170 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- -- Looks like a reference, but probably isn't: '1' on line 2154 -- Looks like a reference, but probably isn't: '2' on line 2157 -- Looks like a reference, but probably isn't: '8' on line 2179 -- Looks like a reference, but probably isn't: '4' on line 2186 ** Obsolete normative reference: RFC 2460 (Obsoleted by RFC 8200) Summary: 3 errors (**), 0 flaws (~~), 4 warnings (==), 5 comments (--). 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: November 19, 2018 IMT-Atlantique 6 C. Gomez 7 Universitat Politecnica de Catalunya 8 May 18, 2018 10 LPWAN Static Context Header Compression (SCHC) and fragmentation for 11 IPv6 and UDP 12 draft-ietf-lpwan-ipv6-static-context-hc-12 14 Abstract 16 This document defines the Static Context Header Compression (SCHC) 17 framework, which provides header compression and fragmentation 18 functionality. SCHC has been tailored for Low Power Wide Area 19 Networks (LPWAN). 21 SCHC compression is based on a common static context stored in both 22 LPWAN devices and in the network sides. This document defines SCHC 23 header compression mechanism and its deployment for IPv6/UDP headers. 24 This document also specifies a fragmentation and reassembly mechanism 25 that is used to support the IPv6 MTU requirement over the LPWAN 26 technologies. The Fragmentation is needed for IPv6 datagrams that, 27 after SCHC compression or when it has not been possible to apply such 28 compression, still exceed the layer two maximum payload size. 30 The SCHC header compression mechanism is independent of the specific 31 LPWAN technology over which it will be used. Note that this document 32 defines generic functionalities and advisedly offers flexibility with 33 regard to parameters settings and mechanism choices, that are 34 expected to be made in other technology-specific documents. 36 Status of This Memo 38 This Internet-Draft is submitted in full conformance with the 39 provisions of BCP 78 and BCP 79. 41 Internet-Drafts are working documents of the Internet Engineering 42 Task Force (IETF). Note that other groups may also distribute 43 working documents as Internet-Drafts. The list of current Internet- 44 Drafts is at https://datatracker.ietf.org/drafts/current/. 46 Internet-Drafts are draft documents valid for a maximum of six months 47 and may be updated, replaced, or obsoleted by other documents at any 48 time. It is inappropriate to use Internet-Drafts as reference 49 material or to cite them other than as "work in progress." 51 This Internet-Draft will expire on November 19, 2018. 53 Copyright Notice 55 Copyright (c) 2018 IETF Trust and the persons identified as the 56 document authors. All rights reserved. 58 This document is subject to BCP 78 and the IETF Trust's Legal 59 Provisions Relating to IETF Documents 60 (https://trustee.ietf.org/license-info) in effect on the date of 61 publication of this document. Please review these documents 62 carefully, as they describe your rights and restrictions with respect 63 to this document. Code Components extracted from this document must 64 include Simplified BSD License text as described in Section 4.e of 65 the Trust Legal Provisions and are provided without warranty as 66 described in the Simplified BSD License. 68 Table of Contents 70 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 71 2. LPWAN Architecture . . . . . . . . . . . . . . . . . . . . . 4 72 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 73 4. SCHC overview . . . . . . . . . . . . . . . . . . . . . . . . 8 74 5. Rule ID . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 75 6. Static Context Header Compression . . . . . . . . . . . . . . 11 76 6.1. SCHC C/D Rules . . . . . . . . . . . . . . . . . . . . . 12 77 6.2. Rule ID for SCHC C/D . . . . . . . . . . . . . . . . . . 14 78 6.3. Packet processing . . . . . . . . . . . . . . . . . . . . 14 79 6.4. Matching operators . . . . . . . . . . . . . . . . . . . 16 80 6.5. Compression Decompression Actions (CDA) . . . . . . . . . 17 81 6.5.1. not-sent CDA . . . . . . . . . . . . . . . . . . . . 18 82 6.5.2. value-sent CDA . . . . . . . . . . . . . . . . . . . 18 83 6.5.3. mapping-sent CDA . . . . . . . . . . . . . . . . . . 18 84 6.5.4. LSB CDA . . . . . . . . . . . . . . . . . . . . . . . 19 85 6.5.5. DEViid, APPiid CDA . . . . . . . . . . . . . . . . . 19 86 6.5.6. Compute-* . . . . . . . . . . . . . . . . . . . . . . 19 87 7. Fragmentation . . . . . . . . . . . . . . . . . . . . . . . . 20 88 7.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 20 89 7.2. Fragmentation Tools . . . . . . . . . . . . . . . . . . . 20 90 7.3. Reliability modes . . . . . . . . . . . . . . . . . . . . 23 91 7.4. Fragmentation Formats . . . . . . . . . . . . . . . . . . 25 92 7.4.1. Fragment format . . . . . . . . . . . . . . . . . . . 25 93 7.4.2. All-1 and All-0 formats . . . . . . . . . . . . . . . 26 94 7.4.3. SCHC ACK format . . . . . . . . . . . . . . . . . . . 28 95 7.4.4. Abort formats . . . . . . . . . . . . . . . . . . . . 30 97 7.5. Baseline mechanism . . . . . . . . . . . . . . . . . . . 31 98 7.5.1. No-ACK . . . . . . . . . . . . . . . . . . . . . . . 33 99 7.5.2. ACK-Always . . . . . . . . . . . . . . . . . . . . . 33 100 7.5.3. ACK-on-Error . . . . . . . . . . . . . . . . . . . . 35 101 7.6. Supporting multiple window sizes . . . . . . . . . . . . 37 102 7.7. Downlink SCHC Fragment transmission . . . . . . . . . . . 37 103 8. Padding management . . . . . . . . . . . . . . . . . . . . . 38 104 9. SCHC Compression for IPv6 and UDP headers . . . . . . . . . . 39 105 9.1. IPv6 version field . . . . . . . . . . . . . . . . . . . 39 106 9.2. IPv6 Traffic class field . . . . . . . . . . . . . . . . 39 107 9.3. Flow label field . . . . . . . . . . . . . . . . . . . . 40 108 9.4. Payload Length field . . . . . . . . . . . . . . . . . . 40 109 9.5. Next Header field . . . . . . . . . . . . . . . . . . . . 40 110 9.6. Hop Limit field . . . . . . . . . . . . . . . . . . . . . 40 111 9.7. IPv6 addresses fields . . . . . . . . . . . . . . . . . . 41 112 9.7.1. IPv6 source and destination prefixes . . . . . . . . 41 113 9.7.2. IPv6 source and destination IID . . . . . . . . . . . 41 114 9.8. IPv6 extensions . . . . . . . . . . . . . . . . . . . . . 42 115 9.9. UDP source and destination port . . . . . . . . . . . . . 42 116 9.10. UDP length field . . . . . . . . . . . . . . . . . . . . 42 117 9.11. UDP Checksum field . . . . . . . . . . . . . . . . . . . 43 118 10. Security considerations . . . . . . . . . . . . . . . . . . . 43 119 10.1. Security considerations for header compression . . . . . 43 120 10.2. Security considerations for SCHC 121 Fragmentation/Reassembly . . . . . . . . . . . . . . . . 43 122 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 44 123 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 44 124 12.1. Normative References . . . . . . . . . . . . . . . . . . 45 125 12.2. Informative References . . . . . . . . . . . . . . . . . 45 126 Appendix A. SCHC Compression Examples . . . . . . . . . . . . . 45 127 Appendix B. Fragmentation Examples . . . . . . . . . . . . . . . 48 128 Appendix C. Fragmentation State Machines . . . . . . . . . . . . 54 129 Appendix D. SCHC Parameters - Ticket #15 . . . . . . . . . . . . 61 130 Appendix E. Note . . . . . . . . . . . . . . . . . . . . . . . . 62 131 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 62 133 1. Introduction 135 This document defines a header compression scheme and fragmentation 136 functionality, both specially tailored for Low Power Wide Area 137 Networks (LPWAN). 139 Header compression is needed to efficiently bring Internet 140 connectivity to the node within an LPWAN network. Some LPWAN 141 networks properties can be exploited to get an efficient header 142 compression: 144 o The topology is star-oriented which means that all packets follow 145 the same path. For the necessity of this draft, the architecture 146 is simple and is described as Devices (Dev) exchanging information 147 with LPWAN Application Servers (App) through Network Gateways 148 (NGW). 150 o The traffic flows can be known in advance since devices embed 151 built-in applications. New applications cannot be easily 152 installed in LPWAN devices, as they would in computers or 153 smartphones. 155 The Static Context Header Compression (SCHC) is defined for this 156 environment. SCHC uses a context, where header information is kept 157 in the header format order. This context is static: the values of 158 the header fields do not change over time. This avoids complex 159 resynchronization mechanisms, that would be incompatible with LPWAN 160 characteristics. In most cases, a small context identifier is enough 161 to represent the full IPv6/UDP headers. The SCHC header compression 162 mechanism is independent of the specific LPWAN technology over which 163 it is used. 165 LPWAN technologies impose some strict limitations on traffic. For 166 instance, devices are sleeping most of the time and MAY receive data 167 during short periods of time after transmission to preserve battery. 168 LPWAN technologies are also characterized, among others, by a very 169 reduced data unit and/or payload size [I-D.ietf-lpwan-overview]. 170 However, some of these technologies do not provide fragmentation 171 functionality, therefore the only option for them to support the IPv6 172 MTU requirement of 1280 bytes [RFC2460] is to use a fragmentation 173 protocol at the adaptation layer, below IPv6. In response to this 174 need, this document also defines a fragmentation/reassembly 175 mechanism, which supports the IPv6 MTU requirement over LPWAN 176 technologies. Such functionality has been designed under the 177 assumption that data unit out-of-sequence delivery will not happen 178 between the entity performing fragmentation and the entity performing 179 reassembly. 181 Note that this document defines generic functionality and 182 purposefully offers flexibility with regard to parameter settings and 183 mechanism choices, that are expected to be made in other, technology- 184 specific documents. 186 2. LPWAN Architecture 188 LPWAN technologies have similar network architectures but different 189 terminology. We can identify different types of entities in a 190 typical LPWAN network, see Figure 1: 192 o Devices (Dev) are the end-devices or hosts (e.g. sensors, 193 actuators, etc.). There can be a very high density of devices per 194 radio gateway. 196 o The Radio Gateway (RGW), which is the end point of the constrained 197 link. 199 o The Network Gateway (NGW) is the interconnection node between the 200 Radio Gateway and the Internet. 202 o LPWAN-AAA Server, which controls the user authentication and the 203 applications. 205 o Application Server (App) 207 +------+ 208 () () () | |LPWAN-| 209 () () () () / \ +---------+ | AAA | 210 () () () () () () / \======| ^ |===|Server| +-----------+ 211 () () () | | <--|--> | +------+ |APPLICATION| 212 () () () () / \==========| v |=============| (App) | 213 () () () / \ +---------+ +-----------+ 214 Dev Radio Gateways NGW 216 Figure 1: LPWAN Architecture 218 3. Terminology 220 This section defines the terminology and acronyms used in this 221 document. 223 o Abort. A SCHC Fragment format to signal the other end-point that 224 the on-going fragment transmission is stopped and finished. 226 o All-0. The SCHC Fragment format for the last frame of a window 227 that is not the last one of a packet (see Window in this 228 glossary). 230 o All-1. The SCHC Fragment format for the last frame of the packet. 232 o All-0 empty. An All-0 SCHC Fragment without payload. It is used 233 to request the SCHC ACK with the encoded Bitmap when the 234 Retransmission Timer expires, in a window that is not the last one 235 of a packet. 237 o All-1 empty. An All-1 SCHC Fragment without payload. It is used 238 to request the SCHC ACK with the encoded Bitmap when the 239 Retransmission Timer expires in the last window of a packet. 241 o App: LPWAN Application. An application sending/receiving IPv6 242 packets to/from the Device. 244 o APP-IID: Application Interface Identifier. Second part of the 245 IPv6 address that identifies the application server interface. 247 o Bi: Bidirectional, a rule entry that applies to headers of packets 248 travelling in both directions (Up and Dw). 250 o Bitmap: a field of bits in an acknowledgment message that tells 251 the sender which SCHC Fragments of a window were correctly 252 received. 254 o C: Checked bit. Used in an acknowledgment (SCHC ACK) header to 255 determine if the MIC locally computed by the receiver matches (1) 256 the received MIC or not (0). 258 o CDA: Compression/Decompression Action. Describes the reciprocal 259 pair of actions that are performed at the compressor to compress a 260 header field and at the decompressor to recover the original 261 header field value. 263 o Compression Residue. The bits that need to be sent after applying 264 the SCHC compression over each header field 266 o Context: A set of rules used to compress/decompress headers. 268 o Dev: Device. A node connected to the LPWAN. A Dev SHOULD 269 implement SCHC. 271 o Dev-IID: Device Interface Identifier. Second part of the IPv6 272 address that identifies the device interface. 274 o DI: Direction Indicator. This field tells which direction of 275 packet travel (Up, Dw or Bi) a rule applies to. This allows for 276 assymmetric processing. 278 o DTag: Datagram Tag. This SCHC F/R header field is set to the same 279 value for all SCHC Fragments carrying the same IPv6 datagram. 281 o Dw: Downlink direction for compression/decompression in both 282 sides, from SCHC C/D in the network to SCHC C/D in the Dev. 284 o FCN: Fragment Compressed Number. This SCHC F/R header field 285 carries an efficient representation of a larger-sized fragment 286 number. 288 o Field Description. A line in the Rule Table. 290 o FID: Field Identifier. This is an index to describe the header 291 fields in a Rule. 293 o FL: Field Length is the length of the field in bits for fixed 294 values or a type (variable, token length, ...) for length unknown 295 at the rule creation. The length of a header field is defined in 296 the specific protocol standard. 298 o FP: Field Position is a value that is used to identify the 299 position where each instance of a field appears in the header. 301 o IID: Interface Identifier. See the IPv6 addressing architecture 302 [RFC7136] 304 o Inactivity Timer. A timer used after receiving a SCHC Fragment to 305 detect when there is an error and there is no possibility to 306 continue an on-going SCHC Fragmented packet transmission. 308 o L2: Layer two. The immediate lower layer SCHC interfaces with. 309 It is provided by an underlying LPWAN technology. 311 o MIC: Message Integrity Check. A SCHC F/R header field computed 312 over an IPv6 packet before fragmentation, used for error detection 313 after IPv6 packet reassembly. 315 o MO: Matching Operator. An operator used to match a value 316 contained in a header field with a value contained in a Rule. 318 o Retransmission Timer. A timer used by the SCHC Fragment sender 319 during an on-going SCHC Fragmented packet transmission to detect 320 possible link errors when waiting for a possible incoming SCHC 321 ACK. 323 o Rule: A set of header field values. 325 o Rule entry: A column in the rule that describes a parameter of the 326 header field. 328 o Rule ID: An identifier for a rule, SCHC C/D in both sides share 329 the same Rule ID for a specific packet. A set of Rule IDs are 330 used to support SCHC F/R functionality. 332 o SCHC ACK: A SCHC acknowledgement for fragmentation, this format 333 used to report the success or unsuccess reception of a set of SCHC 334 Fragments. See Section 7 for more details. 336 o SCHC C/D: Static Context Header Compression Compressor/ 337 Decompressor. A mechanism used in both sides, at the Dev and at 338 the network to achieve Compression/Decompression of headers. SCHC 339 C/D uses SCHC rules to perform compression and decompression. 341 o SCHC F/R: Static Context Header Compression Fragmentation/ 342 Reassembly. A protocol used in both sides, at the Dev and at the 343 network to achieve Fragmentation/Reassembly of fragments. SCHC F/ 344 R has three reliability modes. 346 o SCHC Fragment: A data unit that carries a subset of a SCHC Packet. 347 SCHC F/R is needed when the size of a SCHC packet exceeds the 348 available payload size of the underlying L2 technology data unit. 349 See Section 7. 351 o SCHC Packet: A packet (e.g. an IPv6 packet) whose header has been 352 compressed as per the header compression mechanism defined in this 353 document. If the header compression process is unable to actually 354 compress the packet header, the packet with the uncompressed 355 header is still called a SCHC Packet (in this case, a Rule ID is 356 used to indicate that the packet header has not been compressed). 357 See Section 6 for more details. 359 o TV: Target value. A value contained in the Rule that will be 360 matched with the value of a header field. 362 o Up: Uplink direction for compression/decompression in both sides, 363 from the Dev SCHC C/D to the network SCHC C/D. 365 o W: Window bit. A SCHC Fragment header field used in Window mode 366 Section 7, which carries the same value for all SCHC Fragments of 367 a window. 369 o Window: A subset of the SCHC Fragments needed to carry a packet 370 Section 7. 372 4. SCHC overview 374 SCHC can be abstracted as an adaptation layer between IPv6 and the 375 underlying LPWAN technology. SCHC comprises two sublayers (i.e. the 376 Compression sublayer and the Fragmentation sublayer), as shown in 377 Figure 2. 379 +----------------+ 380 | IPv6 | 381 +- +----------------+ 382 | | Compression | 383 SCHC < +----------------+ 384 | | Fragmentation | 385 +- +----------------+ 386 |LPWAN technology| 387 +----------------+ 389 Figure 2: Protocol stack comprising IPv6, SCHC and an LPWAN 390 technology 392 As per this document, when a packet (e.g. an IPv6 packet) needs to be 393 transmitted, header compression is first applied to the packet. The 394 resulting packet after header compression (whose header may or may 395 not actually be smaller than that of the original packet) is called a 396 SCHC Packet. If the SCHC Packet size exceeds the layer 2 (L2) MTU, 397 fragmentation is then applied to the SCHC Packet. The SCHC Packet or 398 the SCHC Fragments are then transmitted over the LPWAN. The 399 reciprocal operations take place at the receiver. This process is 400 illustrated in Figure 3. 402 A packet (e.g. an IPv6 packet) 403 | ^ 404 v | 405 +-------------------+ +--------------------+ 406 | SCHC Compression | | SCHC Decompression | 407 +------------------+ +--------------------+ 408 | | 409 | If no fragmentation (*) | 410 +----------------- SCHC Packet ------------>| 411 | | 412 +--------------------+ +-----------------+ 413 | SCHC Fragmentation | | SCHC Reassembly | 414 +--------------------+ +-----------------+ 415 ^ | ^ | 416 | | | | 417 | +---------- SCHC Fragments ----------+ | 418 +-------------- SCHC ACK ------------------------+ 419 SENDER RECEIVER 421 *: see Section 7 to define the use of Fragmentation and the 422 technology-specific documents for the L2 decision. 424 Figure 3: SCHC operations taking place at the sender and the receiver 425 The SCHC Packet is composed of the Compressed Header followed by the 426 payload from the original packet (see Figure 4). The Compressed 427 Header itself is composed of a Rule ID and a Compression Residue. 428 The Compression Residue may be absent, see Section 6. Both the Rule 429 ID and the Compression Residue potentially have a variable size, and 430 generally are not a mutiple of bytes in size. 432 | Rule ID + Compression Residue | 433 +---------------------------------+--------------------+ 434 | Compressed Header | Payload | 435 +---------------------------------+--------------------+ 437 Figure 4: SCHC Packet 439 The Fragment Header size is variable and depends on the Fragmentation 440 parameters. The Fragment payload may contain: part of the SCHC 441 Packet or Payload or both and its size depends on the L2 data unit, 442 see Section 7. The SCHC Fragment has the following format: 444 | Rule ID + DTAG + W + FCN [+ MIC ] | Partial SCHC Packet | 445 +-----------------------------------+-------------------------+ 446 | Fragment Header | Fragment Payload | 447 +-----------------------------------+-------------------------+ 449 Figure 5: SCHC Fragment 451 The SCHC ACK is byte aligned and the ACK Header and the encoded 452 Bitmap both have variable size. The SCHC ACK is used only in 453 Fragmentation and has the following format: 455 |Rule ID + DTag + W| 456 +------------------+-------- ... ---------+ 457 | ACK Header | encoded Bitmap | 458 +------------------+-------- ... ---------+ 460 Figure 6: SCHC ACK 462 5. Rule ID 464 Rule ID are identifiers used to select either the correct context to 465 be used for Compression/Decompression functionalities or for 466 Fragmentation/Reassembly or after trying to do SCHC C/D and SCHC F/R 467 the packet is sent as is. The size of the Rule ID is not specified 468 in this document, as it is implementation-specific and can vary 469 according to the LPWAN technology and the number of Rules, among 470 others. 472 The Rule IDs identifiers are used: 474 o In the SCHC C/D context to keep the Field Description of the 475 header packet. 477 o In SCHC F/R to identify the specific modes and settings. In 478 bidirectional SCHC F/R at least two Rules 479 ID are needed. 481 o To identify the SCHC ACK in SCHC F/R 483 o And at least one Rule ID MAY be reserved to the case where no SCHC 484 C/D nor SCHC F/R were possible. 486 6. Static Context Header Compression 488 In order to perform header compression, this document defines a 489 mechanism called Static Context Header Compression (SCHC), which is 490 based on using context, i.e. a set of rules to compress or decompress 491 headers. SCHC avoids context synchronization, which is the most 492 bandwidth-consuming operation in other header compression mechanisms 493 such as RoHC [RFC5795]. Since the nature of packets are highly 494 predictable in LPWAN networks, static contexts MAY be stored 495 beforehand to omit transmitting some information over the air. The 496 contexts MUST be stored at both ends, and they can either be learned 497 by a provisioning protocol, by out of band means, or they can be pre- 498 provisioned. The way the contexts are provisioned on both ends is 499 out of the scope of this document. 501 Dev App 502 +----------------+ +--------------+ 503 | APP1 APP2 APP3 | |APP1 APP2 APP3| 504 | | | | 505 | UDP | | UDP | 506 | IPv6 | | IPv6 | 507 | | | | 508 |SCHC Comp / Frag| | | 509 +--------+-------+ +-------+------+ 510 | +--+ +----+ +-----------+ . 511 +~~ |RG| === |NGW | === | SCHC |... Internet .. 512 +--+ +----+ |Comp / Frag| 513 +-----------+ 515 Figure 7: Architecture 517 Figure 7 The figure represents the architecture for SCHC (Static 518 Context Header Compression) Compression/Fragmentation where SCHC C/D 519 (Compressor/Decompressor) and SCHC F/R (Fragmentation/Reassembly) are 520 performed. It is based on {{I-D.ietf- lpwan-overview}} terminology. 521 SCHC Compression/Fragmentation is located on both sides of the 522 transmission in the Dev and in the Network side. In the Uplink 523 direction, the Device application packets use IPv6 or IPv6/UDP 524 protocols. Before sending these packets, the Dev compresses their 525 headers using SCHC C/D and if the SCHC Packet resulting from the 526 compression exceeds the maximum payload size of the underlying LPWAN 527 technology, SCHC F/R is performed, see Section 7. The resulting SCHC 528 Fragments are sent as one or more L2 frames to an LPWAN Radio Gateway 529 (RG) which forwards the frame(s) to a Network Gateway (NGW). 531 The NGW sends the data to a SCHC F/R and then to the SCHC C/D for 532 decompression. The SCHC C/D in the Network side can be located in 533 the Network Gateway (NGW) or somewhere else as long as a tunnel is 534 established between the NGW and the SCHC Compression/Fragmentation. 535 Note that, for some LPWAN technologies, it MAY be suitable to locate 536 SCHC Fragmentation/Reassembly functionality nearer the NGW, in order 537 to better deal with time constraints of such technologies. The SCHC 538 C/Ds on both sides MUST share the same set of Rules. After 539 decompression, the packet can be sent over the Internet to one or 540 several LPWAN Application Servers (App). 542 The SCHC Compression/Fragmentation process is symmetrical, therefore 543 the same description applies to the reverse direction. 545 6.1. SCHC C/D Rules 547 The main idea of the SCHC compression scheme is to transmit the Rule 548 ID to the other end instead of sending known field values. This Rule 549 ID identifies a rule that provides the closest match to the original 550 packet values. Hence, when a value is known by both ends, it is only 551 necessary to send the corresponding Rule ID over the LPWAN network. 552 How Rules are generated is out of the scope of this document. The 553 rule MAY be changed but it will be specified in another document. 555 The context contains a list of rules (cf. Figure 8). Each Rule 556 contains itself a list of Fields Descriptions composed of a field 557 identifier (FID), a field length (FL), a field position (FP), a 558 direction indicator (DI), a target value (TV), a matching operator 559 (MO) and a Compression/Decompression Action (CDA). 561 /-----------------------------------------------------------------\ 562 | Rule N | 563 /-----------------------------------------------------------------\| 564 | Rule i || 565 /-----------------------------------------------------------------\|| 566 | (FID) Rule 1 ||| 567 |+-------+--+--+--+------------+-----------------+---------------+||| 568 ||Field 1|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|||| 569 |+-------+--+--+--+------------+-----------------+---------------+||| 570 ||Field 2|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|||| 571 |+-------+--+--+--+------------+-----------------+---------------+||| 572 ||... |..|..|..| ... | ... | ... |||| 573 |+-------+--+--+--+------------+-----------------+---------------+||/ 574 ||Field N|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act||| 575 |+-------+--+--+--+------------+-----------------+---------------+|/ 576 | | 577 \-----------------------------------------------------------------/ 579 Figure 8: Compression/Decompression Context 581 The Rule does not describe how to delineate each field in the 582 original packet header. This MUST be known from the compressor/ 583 decompressor. The rule only describes the compression/decompression 584 behavior for each header field. In the rule, the Fields Descriptions 585 are listed in the order in which the fields appear in the packet 586 header. 588 The Rule also describes the Compression Residue sent regarding the 589 order of the Fields Descriptions in the Rule. 591 The Context describes the header fields and its values with the 592 following entries: 594 o Field ID (FID) is a unique value to define the header field. 596 o Field Length (FL) represents the length of the field in bits for 597 fixed values or a type (variable, token length, ...) for Field 598 Description length unknown at the rule creation. The length of a 599 header field is defined in the specific protocol standard. 601 o Field Position (FP): indicating if several instances of a field 602 exist in the headers which one is targeted. The default position 603 is 1. 605 o A direction indicator (DI) indicates the packet direction(s) this 606 Field Description applies to. Three values are possible: 608 * UPLINK (Up): this Field Description is only applicable to 609 packets sent by the Dev to the App, 611 * DOWNLINK (Dw): this Field Description is only applicable to 612 packets sent from the App to the Dev, 614 * BIDIRECTIONAL (Bi): this Field Description is applicable to 615 packets travelling both Up and Dw. 617 o Target Value (TV) is the value used to make the match with the 618 packet header field. The Target Value can be of any type 619 (integer, strings, etc.). For instance, it can be a single value 620 or a more complex structure (array, list, etc.), such as a JSON or 621 a CBOR structure. 623 o Matching Operator (MO) is the operator used to match the Field 624 Value and the Target Value. The Matching Operator may require 625 some parameters. MO is only used during the compression phase. 626 The set of MOs defined in this document can be found in 627 Section 6.4. 629 o Compression Decompression Action (CDA) describes the compression 630 and decompression processes to be performed after the MO 631 is applied. The CDA MAY require some parameters to be processed. 632 CDAs are used in both the compression and the decompression 633 functions. The set of CDAs defined in this document can be found 634 in Section 6.5. 636 6.2. Rule ID for SCHC C/D 638 Rule IDs are sent by the compression function in one side and are 639 received for the decompression function in the other side. In SCHC 640 C/D, the Rule IDs are specific to a Dev. Hence, multiple Dev 641 instances MAY use the same Rule ID to define different header 642 compression contexts. To identify the correct Rule ID, the SCHC C/D 643 needs to correlate the Rule ID with the Dev identifier to find the 644 appropriate Rule to be applied. 646 6.3. Packet processing 648 The compression/decompression process follows several steps: 650 o Compression Rule selection: The goal is to identify which Rule(s) 651 will be used to compress the packet's headers. When 652 doing decompression, in the network side the SCHC C/D needs to 653 find the correct Rule based on the L2 address and in this way, it 654 can use the Dev-ID and the Rule-ID. In the Dev side, only the 655 Rule ID is needed to identify the correct Rule since the Dev only 656 holds Rules that apply to itself. The Rule will be selected by 657 matching the Fields Descriptions to the packet header as described 658 below. When the selection of a Rule is done, this Rule is used to 659 compress the header. The detailed steps for compression Rule 660 selection are the following: 662 * The first step is to choose the Fields Descriptions by their 663 direction, using the direction indicator (DI). A Field 664 Description that does not correspond to the appropriate DI will 665 be ignored, if all the fields of the packet do not have a Field 666 Description with the correct DI the Rule is discarded and SCHC 667 C/D proceeds to explore the next Rule. 669 * When the DI has matched, then the next step is to identify the 670 fields according to Field Position (FP). If the Field Position 671 does not correspond, the Rule is not used and the SCHC C/D 672 proceeds to consider the next Rule. 674 * Once the DI and the FP correspond to the header information, 675 each field's value of the packet is then compared to the 676 corresponding Target Value (TV) stored in the Rule for that 677 specific field using the matching operator (MO). 679 If all the fields in the packet's header satisfy all the 680 matching operators (MO) of a Rule (i.e. all MO results are 681 True), the fields of the header are then compressed according 682 to the Compression/Decompression Actions (CDAs) and a 683 compressed header (with possibly a Compression Residue) SHOULD 684 be obtained. Otherwise, the next Rule is tested. 686 * If no eligible Rule is found, then the header MUST be sent 687 without compression, depending on the L2 PDU size, this is one 688 of the case that MAY require the use of the SCHC F/R process. 690 o Sending: If an eligible Rule is found, the Rule ID is sent to the 691 other end followed by the Compression Residue (which could be 692 empty) and directly followed by the payload. The Compression 693 Residue is the concatenation of the Compression Residues for each 694 field according to the CDAs for that rule. The way the Rule ID is 695 sent depends on the specific LPWAN layer two technology. For 696 example, it can be either included in a Layer 2 header or sent in 697 the first byte of the L2 payload. (Cf. Figure 9). This process 698 will be specified in the LPWAN technology-specific document and is 699 out of the scope of the present document. On LPWAN technologies 700 that are byte- oriented, the compressed header concatenated with 701 the original packet payload is padded to a multiple of 8 bits, if 702 needed. See Section 8 for details. 704 o Decompression: When doing decompression, in the network side the 705 SCHC C/D needs to find the correct Rule based on the L2 address 706 and in this way, it can use the Dev-ID and the Rule-ID. In the 707 Dev side, only the Rule ID is needed to identify the correct Rule 708 since the Dev only holds Rules that apply to itself. 710 The receiver identifies the sender through its device-id (e.g. 711 MAC address, if exists) and selects the appropriate Rule 712 from the Rule ID. If a source identifier is present in the L2 713 technology, it is used to select the Rule ID. This Rule describes 714 the compressed header format and associates the values to the 715 header fields. The receiver applies the CDA action to reconstruct 716 the original header fields. The CDA application order can be 717 different from the order given by the Rule. For instance, 718 Compute-* SHOULD be applied at the end, after all the other CDAs. 720 +--- ... --+------- ... -------+------------------+~~~~~~~ 721 | Rule ID |Compression Residue| packet payload |padding 722 +--- ... --+------- ... -------+------------------+~~~~~~~ 723 (optional) 724 |----- compressed header ------| 726 Figure 9: SCHC C/D Packet Format 728 6.4. Matching operators 730 Matching Operators (MOs) are functions used by both SCHC C/D 731 endpoints involved in the header compression/decompression. They are 732 not typed and can be indifferently applied to integer, string or any 733 other data type. The result of the operation can either be True or 734 False. MOs are defined as follows: 736 o equal: The match result is True if a field value in a packet and 737 the value in the TV are equal. 739 o ignore: No check is done between a field value in a packet and a 740 TV in the Rule. The result of the matching is always true. 742 o MSB(x): A match is obtained if the most significant x bits of the 743 field value in the header packet are equal to the TV in the Rule. 744 The x parameter of the MSB Matching Operator indicates how many 745 bits are involved in the comparison. 747 o match-mapping: With match-mapping, the Target Value is a list of 748 values. Each value of the list is identified by a short ID (or 749 index). Compression is achieved by sending the index instead of 750 the original header field value. This operator matches if the 751 header field value is equal to one of the values in the target 752 list. 754 6.5. Compression Decompression Actions (CDA) 756 The Compression Decompression Action (CDA) describes the actions 757 taken during the compression of headers fields, and inversely, the 758 action taken by the decompressor to restore the original value. 760 /--------------------+-------------+----------------------------\ 761 | Action | Compression | Decompression | 762 | | | | 763 +--------------------+-------------+----------------------------+ 764 |not-sent |elided |use value stored in ctxt | 765 |value-sent |send |build from received value | 766 |mapping-sent |send index |value from index on a table | 767 |LSB |send LSB |TV, received value | 768 |compute-length |elided |compute length | 769 |compute-checksum |elided |compute UDP checksum | 770 |Deviid |elided |build IID from L2 Dev addr | 771 |Appiid |elided |build IID from L2 App addr | 772 \--------------------+-------------+----------------------------/ 773 y=size of the transmitted bits 775 Figure 10: Compression and Decompression Functions 777 Figure 10 summarizes the basic functions that can be used to compress 778 and decompress a field. The first column lists the actions name. 779 The second and third columns outline the reciprocal compression/ 780 decompression behavior for each action. 782 Compression is done in order that Fields Descriptions appear in the 783 Rule. The result of each Compression/Decompression Action is 784 appended to the working Compression Residue in that same order. The 785 receiver knows the size of each compressed field which can be given 786 by the rule or MAY be sent with the compressed header. 788 If the field is identified as being variable in the Field 789 Description, then the size of the Compression Residue value in bytes 790 MUST be sent first using the following coding: 792 o If the size is between 0 and 14 bytes, it is sent as a 4-bits 793 integer. 795 o For values between 15 and 254, the first 4 bits sent are set to 1 796 and the size is sent using 8 bits integer. 798 o For higher values of size, the first 12 bits are set to 1 and the 799 next two bytes contain the size value as a 16 bits integer. 801 o If a field does not exist in the packet but in the Rule and its FL 802 is variable, the size zero MUST be used. 804 6.5.1. not-sent CDA 806 The not-sent function is generally used when the field value is 807 specified in the Rule and therefore known by both the Compressor and 808 the Decompressor. This action is generally used with the "equal" MO. 809 If MO is "ignore", there is a risk to have a decompressed field value 810 different from the compressed field. 812 The compressor does not send any Compression Residue for a field on 813 which not-sent compression is applied. 815 The decompressor restores the field value with the Target Value 816 stored in the matched Rule identified by the received Rule ID. 818 6.5.2. value-sent CDA 820 The value-sent action is generally used when the field value is not 821 known by both Compressor and Decompressor. The value is sent in the 822 compressed message header. Both Compressor and Decompressor MUST 823 know the size of the field, either implicitly (the size is known by 824 both sides) or by explicitly indicating the length in the Compression 825 Residue, as defined in Section 6.5. This function is generally used 826 with the "ignore" MO. 828 6.5.3. mapping-sent CDA 830 The mapping-sent is used to send a smaller index (the index into the 831 Target Value list of values) instead of the original value. This 832 function is used together with the "match-mapping" MO. 834 On the compressor side, the match-mapping Matching Operator searches 835 the TV for a match with the header field value and the mapping-sent 836 CDA appends the corresponding index to the Compression Residue to be 837 sent. On the decompressor side, the CDA uses the received index to 838 restore the field value by looking up the list in the TV. 840 The number of bits sent is the minimal size for coding all the 841 possible indices. 843 6.5.4. LSB CDA 845 The LSB action is used together with the "MSB(x)" MO to avoid sending 846 the higher part of the packet field if that part is already known by 847 the receiving end. A length can be specified in the rule to indicate 848 how many bits have to be sent. If the length is not specified, the 849 number of bits sent is the original header field length minus the 850 length specified in the MSB(x) MO. 852 The compressor sends the Least Significant Bits (e.g. LSB of the 853 length field). The decompressor combines the value received with the 854 Target Value depending on the field type. 856 If this action needs to be done on a variable length field, the size 857 of the Compression Residue in bytes MUST be sent as described in 858 Section 6.5. 860 6.5.5. DEViid, APPiid CDA 862 These functions are used to process respectively the Dev and the App 863 Interface Identifiers (Deviid and Appiid) of the IPv6 addresses. 864 Appiid CDA is less common since current LPWAN technologies frames 865 contain a single address, which is the Dev's address. 867 The IID value MAY be computed from the Device ID present in the Layer 868 2 header, or from some other stable identifier. The computation is 869 specific for each LPWAN technology and MAY depend on the Device ID 870 size. 872 In the Downlink direction, these Deviid CDA is used to determine the 873 L2 addresses used by the LPWAN. 875 6.5.6. Compute-* 877 Some fields are elided during compression and reconstructed during 878 decompression. This is the case for length and Checksum, so: 880 o compute-length: computes the length assigned to this field. This 881 CDA MAY be used to compute IPv6 length or UDP length. 883 o compute-checksum: computes a checksum from the information already 884 received by the SCHC C/D. This field MAY be used to compute UDP 885 checksum. 887 7. Fragmentation 889 7.1. Overview 891 In LPWAN technologies, the L2 data unit size typically varies from 892 tens to hundreds of bytes. The SCHC Fragmentation /Reassembly MAY be 893 used either because after applying SCHC C/D or when SCHC C/D is not 894 possible the entire SCHC Packet still exceeds the L2 data unit. 896 The SCHC F/R functionality defined in this document has been designed 897 under the assumption that data unit out-of- sequence delivery will 898 not happen between the entity performing fragmentation and the entity 899 performing reassembly. This assumption allows reducing the 900 complexity and overhead of the SCHC F/R mechanism. 902 To adapt the SCHC F/R to the capabilities of LPWAN technologies is 903 required to enable optional SCHC Fragment retransmission and to allow 904 a stepper delivery for the reliability of SCHC Fragments. This 905 document does not make any decision with regard to which SCHC 906 Fragment delivery reliability mode will be used over a specific LPWAN 907 technology. These details will be defined in other technology- 908 specific documents. 910 7.2. Fragmentation Tools 912 This subsection describes the different tools that are used to enable 913 the SCHC F/R functionality defined in this document, such as fields 914 in the SCHC F/R header frames (see the related formats in 915 Section 7.4), and the different parameters supported in the 916 reliability modes such as timers and parameters. 918 o Rule ID. The Rule ID is present in the SCHC Fragment header and 919 in the SCHC ACK header format. The Rule ID in a SCHC fragment 920 header is used to identify that a SCHC Fragment is being carried, 921 which SCHC F/R reliability mode is used and which window size is 922 used. The Rule ID in the SCHC F/R header also allows interleaving 923 non-fragmented 924 packets and SCHC Fragments that carry other SCHC Packets. The 925 Rule ID in an SCHC ACK identifies the message as an SCHC ACK. 927 o Fragment Compressed Number (FCN). The FCN is included in all SCHC 928 Fragments. This field can be understood as a truncated, 929 efficient representation of a larger-sized fragment number, and 930 does not carry an absolute SCHC Fragment number. There are two 931 FCN reserved values that are used for controlling the SCHC F/R 932 process, as described next: 934 * The FCN value with all the bits equal to 1 (All-1) denotes the 935 last SCHC Fragment of a packet. The last window of a packet is 936 called an All-1 window. 938 * The FCN value with all the bits equal to 0 (All-0) denotes the 939 last SCHC Fragment of a window that is not the last one of the 940 packet. Such a window is called an All-0 window. 942 The rest of the FCN values are assigned in a sequentially 943 decreasing order, which has the purpose to avoid possible 944 ambiguity for the receiver that might arise under certain 945 conditions. In the SCHC Fragments, this field is an unsigned 946 integer, with a size of N bits. In the No-ACK mode, it is set to 947 1 bit (N=1), All-0 is used in all SCHC Fragments and All-1 for the 948 last one. For the other reliability modes, it is recommended to 949 use a number of bits (N) equal to or greater than 3. 950 Nevertheless, the appropriate value of N MUST be defined in the 951 corresponding technology-specific profile documents. For windows 952 that are not the last one from a SCHC Fragmented packet, the FCN 953 for the last SCHC Fragment in such windows is an All-0. This 954 indicates that the window is finished and communication proceeds 955 according to the reliability mode in use. The FCN for the last 956 SCHC Fragment in the last window is an All-1, indicating the last 957 SCHC Fragment of the SCHC Packet. It is also important to note 958 that, in the No-ACK mode or when N=1, the last SCHC Fragment of 959 the packet will carry a FCN equal to 1, while all previous SCHC 960 Fragments will carry a FCN to 0. For further details see 961 Section 7.5. The highest FCN in the window, denoted MAX_WIND_FCN, 962 MUST be a value equal to or smaller than 2^N-2. (Example for N=5, 963 MAX_WIND_FCN MAY be set to 23, then subsequent FCNs are set 964 sequentially and in decreasing order, and the FCN will wrap from 0 965 back to 23). 967 o Datagram Tag (DTag). The DTag field, if present, is set to the 968 same value for all SCHC Fragments carrying the same SCHC 969 packet, and to different values for different SCHC Packets. Using 970 this field, the sender can interleave fragments from different 971 SCHC Packets, while the receiver can still tell them apart. In 972 the SCHC Fragment formats, the size of the DTag field is T bits, 973 which MAY be set to a value greater than or equal to 0 bits. For 974 each new SCHC Packet processed by the sender, DTag MUST be 975 sequentially increased, from 0 to 2^T - 1 wrapping back from 2^T - 976 1 to 0. In the SCHC ACK format, DTag carries the same value as 977 the DTag field in the SCHC Fragments for which this SCHC ACK is 978 intended. When there is no Dtag, there can be only 1 SCHC Packet 979 in transist. And only after all its fragments have been 980 transmitted another SCHC Packet could be sent. The length of 981 DTag, denoted T is not given in this document because is technolgy 982 dependant, and will be defined in the corresponding technology- 983 documents. DTag is based on the number of simultaneous packets 984 supported. 986 o W (window): W is a 1-bit field. This field carries the same value 987 for all SCHC Fragments of a window, and it is complemented for the 988 next window. The initial value for this field is 0. In the SCHC 989 ACK format, this field also has a size of 1 bit. In all SCHC 990 ACKs, the W bit carries the same value as the W bit carried by the 991 SCHC Fragments whose reception is being positively or negatively 992 acknowledged by the SCHC ACK. 994 o Message Integrity Check (MIC). This field is computed by the 995 sender over the complete SCHC Packet and before SCHC 996 fragmentation. The MIC allows the receiver to check errors in the 997 reassembled packet, while it also enables compressing the UDP 998 checksum by use of SCHC compression. The CRC32 as 0xEDB88320 999 (i.e. the reverse representation of the polynomial used e.g. in 1000 the Ethernet standard [RFC3385]) is recommended as the default 1001 algorithm for computing the MIC. Nevertheless, other algorithms 1002 MAY be required and are defined in the technology-specific 1003 documents as well as the length in bits of the MIC used. 1005 o C (MIC checked): C is a 1-bit field. This field is used in the 1006 SCHC ACK packets to report the outcome of the MIC check, i.e. 1007 whether the reassembled packet was correctly received or not. A 1008 value of 1 represents a positive MIC check at the receiver side 1009 (i.e. the MIC computed by the receiver matches the received MIC). 1011 o Retransmission Timer. A SCHC Fragment sender uses it after the 1012 transmission of a window to detect a transmission error of the 1013 SCHC ACK corresponding to this window. Depending on the 1014 reliability mode, it will lead to a request an SCHC ACK 1015 retransmission (in ACK-Always mode) or it will trigger the 1016 transmission of the next window (in ACK-on-Error mode). The 1017 duration of this timer is not defined in this document and MUST be 1018 defined in the corresponding technology documents. 1020 o Inactivity Timer. A SCHC Fragment receiver uses it to take action 1021 when there is a problem in the transmission of SCHC fragments. 1022 Such a problem could be detected by the receiver not getting a 1023 single SCHC Fragment during a given period of time or not getting 1024 a given number of packets in a given period of time. When this 1025 happens, an Abort message will be sent (see related text later in 1026 this section). Initially, and each time a SCHC Fragment is 1027 received, the timer is reinitialized. The duration of this timer 1028 is not defined in this document and MUST be defined in the 1029 specific technology document. 1031 o Attempts. This counter counts the requests for a missing SCHC 1032 ACK. When it reaches the value MAX_ACK_REQUESTS, the sender 1033 assume there are recurrent SCHC Fragment transmission errors and 1034 determines that an Abort is needed. The default value offered 1035 MAX_ACK_REQUESTS is not stated in this document, and it is 1036 expected to be defined in the specific technology document. The 1037 Attempts counter is defined per window. It is initialized each 1038 time a new window is used. 1040 o Bitmap. The Bitmap is a sequence of bits carried in an SCHC ACK. 1041 Each bit in the Bitmap corresponds to a SCHC fragment of the 1042 current window, and provides feedback on whether the SCHC Fragment 1043 has been received or not. The right-most position on the Bitmap 1044 reports if the All-0 or All-1 fragment has been received or not. 1045 Feedback on the SCHC fragment with the highest FCN value is 1046 provided by the bit in the left-most position of the Bitmap. In 1047 the Bitmap, a bit set to 1 indicates that the SCHC Fragment of FCN 1048 corresponding to that bit position has been correctly sent and 1049 received. The text above describes the internal representation of 1050 the Bitmap. When inserted in the SCHC ACK for transmission from 1051 the receiver to the sender, the Bitmap MAY be truncated for 1052 energy/bandwidth optimisation, see more details in 1053 Section 7.4.3.1. 1055 o Abort. On expiration of the Inactivity timer, or when Attempts 1056 reached MAX_ACK_REQUESTS or upon an occurrence of some other 1057 error, the sender or the receiver MUST use the Abort. When the 1058 receiver needs to abort the on-going SCHC Fragmented packet 1059 transmission, it sends the Receiver-Abort format. When the sender 1060 needs to abort the transmission, it sends the Sender-Abort format. 1061 None of the Abort are acknowledged. 1063 o Padding (P). If it is needed, the number of bits used for padding 1064 is not defined and depends on the size of the Rule ID, DTag and 1065 FCN fields, and on the L2 payload size (see Section 8). Some SCHC 1066 ACKs are byte-aligned and do not need padding (see 1067 Section 7.4.3.1). 1069 7.3. Reliability modes 1071 This specification defines three reliability modes: No-ACK, ACK- 1072 Always and ACK-on-Error. ACK-Always and ACK-on-Error operate on 1073 windows of SCHC Fragments. A window of SCHC Fragments is a subset of 1074 the full set of SCHC Fragments needed to carry a packet or an SCHC 1075 Packet. 1077 o No-ACK. No-ACK is the simplest SCHC Fragment reliability mode. 1078 The receiver does not generate overhead in the form of 1079 acknowledgments (ACKs). However, this mode does not enhance 1080 reliability beyond that offered by the underlying LPWAN 1081 technology. In the No-ACK mode, the receiver MUST NOT issue SCHC 1082 ACKs. See further details in Section 7.5.1. 1084 o ACK-Always. The ACK-Always mode provides flow control using a 1085 window scheme. This mode is also able to handle long bursts of 1086 lost SCHC Fragments since detection of such events can be done 1087 before the end of the SCHC Packet transmission as long as the 1088 window size is short enough. However, such benefit comes at the 1089 expense of SCHC ACK use. In ACK-Always the receiver sends an SCHC 1090 ACK after a window of SCHC Fragments has been received, where a 1091 window of SCHC Fragments is a subset of the whole number of SCHC 1092 Fragments needed to carry a complete SCHC Packet. The SCHC ACK is 1093 used to inform the sender if a SCHC fragment in the actual window 1094 has been lost or well received. Upon an SCHC ACK reception, the 1095 sender retransmits the lost SCHC Fragments. When an SCHC ACK is 1096 lost and the sender has not received it before the expiration of 1097 the Retransmission Timer, the sender uses an SCHC ACK request by 1098 sending the All-0 empty SCHC Fragment when it is not the last 1099 windown and the ALL-1 empty Fragment when it is the last window. 1100 The maximum number of SCHC ACK requests is MAX_ACK_REQUESTS. If 1101 the MAX_ACK_REQUEST is reached the transmission needs to be 1102 Aborted. See further details in Section 7.5.2. 1104 o ACK-on-Error. The ACK-on-Error mode is suitable for links 1105 offering relatively low L2 data unit loss probability. In this 1106 mode, the SCHC Fragment receiver reduces the number of SCHC ACKs 1107 transmitted, which MAY be especially beneficial in asymmetric 1108 scenarios. Because the SCHC Fragments use the uplink of the 1109 underlying LPWAN technology, which has higher capacity than 1110 downlink. The receiver transmits an SCHC ACK only after the 1111 complete window transmission and if at least one SCHC Fragment of 1112 this window has been lost. An exception to this behavior is in 1113 the last window, where the receiver MUST transmit an SCHC ACK, 1114 including the C bit set based on the MIC checked result, even if 1115 all the SCHC Fragments of the last window have been correctly 1116 received. The SCHC ACK gives the state of all the SCHC Fragments 1117 (received or lost). Upon an SCHC ACK reception, the sender 1118 retransmits the lost SCHC Fragments. If an SCHC ACK is not 1119 transmitted back by the receiver at the end of a window, the 1120 sender assumes that all SCHC Fragments have been correctly 1121 received. When the SCHC ACK is lost, the sender assumes that all 1122 SCHC Fragments covered by the lost SCHC ACK have been successfully 1123 delivered, so the sender continues transmitting the next window of 1124 SCHC Fragments. If the next SCHC Fragments received belong to the 1125 next window, the receiver will abort the on-going fragmented 1126 packet transmission. See further details in Section 7.5.3. 1128 The same reliability mode MUST be used for all SCHC Fragments of an 1129 SCHC Packet. The decision on which reliability mode will be used and 1130 whether the same reliability mode applies to all SCHC Packets is an 1131 implementation problem and is out of the scope of this document. 1133 Note that the reliability mode choice is not necessarily tied to a 1134 particular characteristic of the underlying L2 LPWAN technology, e.g. 1135 the No-ACK mode MAY be used on top of an L2 LPWAN technology with 1136 symmetric characteristics for uplink and downlink. This document 1137 does not make any decision as to which SCHC Fragment reliability 1138 mode(s) are supported by a specific LPWAN technology. 1140 Examples of the different reliability modes described are provided in 1141 Appendix B. 1143 7.4. Fragmentation Formats 1145 This section defines the SCHC Fragment format, the All-0 and All-1 1146 formats, the SCHC ACK format and the Abort formats. 1148 7.4.1. Fragment format 1150 A SCHC Fragment comprises a SCHC Fragment header, a SCHC Fragment 1151 payload and padding bits (if needed). A SCHC Fragment conforms to 1152 the general format shown in Figure 11. The SCHC Fragment payload 1153 carries a subset of SCHC Packet. A SCHC Fragment is the payload of 1154 the L2 protocol data unit (PDU). Padding MAY be added in SCHC 1155 Fragments and in SCHC ACKs if necessary, therefore a padding field is 1156 optional (this is explicitly indicated in Figure 11 for the sake of 1157 illustration clarity. 1159 +-----------------+-----------------------+~~~~~~~~~~~~~~~ 1160 | Fragment Header | Fragment payload | padding (opt.) 1161 +-----------------+-----------------------+~~~~~~~~~~~~~~~ 1163 Figure 11: Fragment general format. Presence of a padding field is 1164 optional 1166 In ACK-Always or ACK-on-Error, SCHC Fragments except the last one 1167 SHALL conform the detailed format defined in Figure 12. The total 1168 size of the fragment header is not byte aligned. 1170 |---Fragmentation Header----| 1171 |-- T --|1|-- N --| 1172 +-- ... --+- ... -+-+- ... -+--------...-------+ 1173 | Rule ID | DTag |W| FCN | Fragment payload | 1174 +-- ... --+- ... -+-+- ... -+--------...-------+ 1176 Figure 12: Fragment Detailed Format for Fragments except the Last 1177 One, ACK-Always and ACK-on-Error 1179 In the No-ACK mode, SCHC Fragments except the last one SHALL conform 1180 to the detailed format defined in Figure 13. The total size of the 1181 fragment header is not byte aligned. 1183 |---Fragmentation Header---| 1184 |-- T --|-- N --| 1185 +-- ... --+- ... -+- ... -+--------...-------+ 1186 | Rule ID | DTag | FCN | Fragment payload | 1187 +-- ... --+- ... -+- ... -+--------...-------+ 1189 Figure 13: Fragment Detailed Format for Fragments except the Last 1190 One, No-ACK mode 1192 In all these cases, the total size of the fragment header is not byte 1193 aligned. 1195 7.4.2. All-1 and All-0 formats 1197 The All-0 format is used for sending the last SCHC Fragment of a 1198 window that is not the last window of the packet. 1200 |-- T --|1|-- N --| 1201 +-- ... --+- ... -+-+- ... -+--- ... ---+ 1202 | Rule ID | DTag |W| 0..0 | payload | 1203 +-- ... --+- ... -+-+- ... -+--- ... ---+ 1205 Figure 14: All-0 fragment detailed format 1207 The All-0 empty fragment format is used by a sender to request the 1208 retransmission of an SCHC ACK by the receiver. It is only used in 1209 ACK-Always mode. 1211 |-- T --|1|-- N --| 1212 +-- ... --+- ... -+-+- ... -+ 1213 | Rule ID | DTag |W| 0..0 | (no payload) 1214 +-- ... --+- ... -+-+- ... -+ 1216 Figure 15: All-0 empty fragment detailed format 1218 In the No-ACK mode, the last SCHC Fragment of an IPv6 datagram SHALL 1219 contain a SCHC Fragment header that conforms to the detaield format 1220 shown in Figure 16. 1222 |-- T --|-N=1-| 1223 +---- ... ---+- ... -+-----+---- ... ----+---...---+ 1224 | Rule ID | DTag | 1 | MIC | payload | 1225 +---- ... ---+- ... -+-----+---- ... ----+---...---+ 1227 Figure 16: All-1 Fragment Detailed Format for the Last Fragment, No- 1228 ACK mode 1230 In any of the Window modes, the last fragment of an IPv6 datagram 1231 SHALL contain a SCHC Fragment header that conforms to the detailed 1232 format shown in Figure 17. The total size of the SCHC Fragment 1233 header in this format is not byte aligned. 1235 |-- T --|1|-- N --| 1236 +-- ... --+- ... -+-+- ... -+---- ... ----+---...---+ 1237 | Rule ID | DTag |W| 11..1 | MIC | payload | 1238 +-- ... --+- ... -+-+- ... -+---- ... ----+---...---+ 1239 (FCN) 1241 Figure 17: All-1 Fragment Detailed Format for the Last Fragment, ACK- 1242 Always or ACK-on-Error 1244 In either ACK-Always or ACK-on-Error, in order to request a 1245 retransmission of the SCHC ACK for the All-1 window, the fragment 1246 sender uses the format shown in Figure 18. The total size of the 1247 SCHC Fragment header in not byte aligned. 1249 |-- T --|1|-- N --| 1250 +-- ... --+- ... -+-+- ... -+---- ... ----+ 1251 | Rule ID | DTag |W| 1..1 | MIC | (no payload) 1252 +-- ... --+- ... -+-+- ... -+---- ... ----+ 1254 Figure 18: All-1 for Retries format, also called All-1 empty 1256 The values for Fragmentation Header, N, T and the length of MIC are 1257 not specified in this document, and SHOULD be determined in other 1258 documents (e.g. technology-specific profile documents). 1260 7.4.3. SCHC ACK format 1262 The format of an SCHC ACK that acknowledges a window that is not the 1263 last one (denoted as All-0 window) is shown in Figure 19. 1265 |-- T --|1| 1266 +---- ... --+- ... -+-+---- ... -----+ 1267 | Rule ID | DTag |W|encoded Bitmap| (no payload) 1268 +---- ... --+- ... -+-+---- ... -----+ 1270 Figure 19: ACK format for All-0 windows 1272 To acknowledge the last window of a packet (denoted as All-1 window), 1273 a C bit (i.e. MIC checked) following the W bit is set to 1 to 1274 indicate that the MIC check computed by the receiver matches the MIC 1275 present in the All-1 fragment. If the MIC check fails, the C bit is 1276 set to 0 and the Bitmap for the All-1 window follows. 1278 |-- T --|1|1| 1279 +---- ... --+- ... -+-+-+ 1280 | Rule ID | DTag |W|1| (MIC correct) 1281 +---- ... --+- ... -+-+-+ 1283 +---- ... --+- ... -+-+-+----- ... -----+ 1284 | Rule ID | DTag |W|0|encoded Bitmap |(MIC Incorrect) 1285 +---- ... --+- ... -+-+-+----- ... -----+ 1286 C 1288 Figure 20: Format of an SCHC ACK for All-1 windows 1290 7.4.3.1. Bitmap Encoding 1292 The Bitmap is transmitted by a receiver as part of the SCHC ACK 1293 format. An SCHC ACK message MAY include padding at the end to align 1294 its number of transmitted bits to a multiple of 8 bits. 1296 Note that the SCHC ACK sent in response to an All-1 fragment includes 1297 the C bit. Therefore, the window size and thus the encoded Bitmap 1298 size need to be determined taking into account the available space in 1299 the layer two frame payload, where there will be 1 bit less for an 1300 SCHC ACK sent in response to an All-1 fragment than in other SCHC 1301 ACKs. Note that the maximum number of SCHC Fragments of the last 1302 window is one unit smaller than that of the previous windows. 1304 When the receiver transmits an encoded Bitmap with a SCHC Fragment 1305 that has not been sent during the transmission, the sender will Abort 1306 the transmission. 1308 |---- Bitmap bits ----| 1309 | Rule ID | DTag |W|1|0|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1| 1310 |--- byte boundary ----| 1 byte next | 1 byte next | 1312 Figure 21: A non-encoded Bitmap 1314 In order to reduce the resulting frame size, the encoded Bitmap is 1315 shortened by applying the following algorithm: all the right-most 1316 contiguous bytes in the encoded Bitmap that have all their bits set 1317 to 1 MUST NOT be transmitted. Because the SCHC Fragment sender knows 1318 the actual Bitmap size, it can reconstruct the original Bitmap with 1319 the trailing 1 bit optimized away. In the example shown in 1320 Figure 22, the last 2 bytes of the Bitmap shown in Figure 21 comprise 1321 bits that are all set to 1, therefore they are not sent. 1323 |-- T --|1| 1324 +---- ... --+- ... -+-+-+-+ 1325 | Rule ID | DTag |W|1|0| 1326 +---- ... --+- ... -+-+-+-+ 1327 |---- byte boundary -----| 1329 Figure 22: Optimized Bitmap format 1331 Figure 23 shows an example of an SCHC ACK with FCN ranging from 6 1332 down to 0, where the Bitmap indicates that the second and the fifth 1333 SCHC Fragments have not been correctly received. 1335 6 5 4 3 2 1 0 (*) 1336 |-- T --|1| 1337 +---------+-------+-+-+-+-+-+-+-+-----+ 1338 | Rule ID | DTag |W|1|0|1|1|0|1|all-0| Bitmap(before tx) 1339 +---------+-------+-+-+-+-+-+-+-+-----+ 1340 |<-- byte boundary ->|<---- 1 byte---->| 1341 (*)=(FCN values) 1343 +---------+------+-+-+-+-+-+-+-+-----+~~ 1344 | Rule ID | DTag |W|1|0|1|1|0|1|all-0|Padding(opt.) encoded Bitmap 1345 +---------+------+-+-+-+-+-+-+-+-----+~~ 1346 |<-- byte boundary ->|<---- 1 byte---->| 1348 Figure 23: Example of a Bitmap before transmission, and the 1349 transmitted one, in any window except the last one 1351 Figure 24 shows an example of an SCHC ACK with FCN ranging from 6 1352 down to 0, where the Bitmap indicates that the MIC check has failed 1353 but there are no missing SCHC Fragments. 1355 |-Fragmentation Header-|6 5 4 3 2 1 7 (*) 1356 |-- T --|1| 1357 | Rule ID | DTag |W|0|1|1|1|1|1|1|1|padding| Bitmap (before tx) 1358 |---- byte boundary -----| 1 byte next | 1359 C 1360 +---- ... --+-... -+-+-+-+ 1361 | Rule ID | DTag |W|0|1| encoded Bitmap 1362 +---- ... --+-... -+-+-+-+ 1363 |---- byte boundary -----| 1364 (*) = (FCN values indicating the order) 1366 Figure 24: Example of the Bitmap in ACK-Always or ACK-on-Error for 1367 the last window, for N=3) 1369 7.4.4. Abort formats 1371 Abort are coded as exceptions to the previous coding, a specific 1372 format is defined for each direction. When a SCHC Fragment sender 1373 needs to abort the transmission, it sends the Sender-Abort format 1374 Figure 25, that is an All-1 fragment with no MIC or payload. In 1375 regular cases All-1 fragment contains at least a MIC value. This 1376 absence of the MIC value indicates an Abort. 1378 When a SCHC Fragment receiver needs to abort the on-going SCHC 1379 Fragmented packet transmission, it transmits the Receiver- Abort 1380 format Figure 26, creating an exception in the encoded Bitmap coding. 1382 Encoded Bitmap avoid sending the rigth most bits of the Bitmap set to 1383 1. Abort is coded as an SCHC ACK message with a Bitmap set to 1 1384 until the byte boundary, followed by an extra 0xFF byte. Such 1385 message never occurs in a regular acknowledgement and is view as an 1386 abort. 1388 None of these messages are not acknowledged nor retransmitted. 1390 The sender uses the Sender-Abort when the MAX_ACK_REQUEST is reached. 1391 The receiver uses the Receiver-Abort when the Inactivity timer 1392 expires, or in the ACK-on-Error mode, SCHC ACK is lost and the sender 1393 transmits SCHC Fragments of a new window. Some other cases for Abort 1394 are explained in the Section 7.5 or Appendix C. 1396 |-- Fragmentation Header ---|--- 1 byte ----| 1397 +--- ... ---+- ... -+-+-...-+-+-+-+-+-+-+-+-+ 1398 | Rule ID | DTag |W| FCN | FF | (no MIC & no payload) 1399 +--- ... ---+- ... -+-+-...-+-+-+-+-+-+-+-+-+ 1401 Figure 25: Sender-Abort format. All FCN fields in this format are 1402 set to 1 1404 |----- byte boundary ------|---- 1 byte ---| 1406 +---- ... --+-... -+-+-+-+-+-+-+-+-+-+-+-+-+ 1407 | Rule ID | DTag |W| 1..1| FF | 1408 +---- ... --+-... -+-+-+-+-+-+-+-+-+-+-+-+-+ 1410 Figure 26: Receiver-Abort format 1412 7.5. Baseline mechanism 1414 If after applying SCHC header compression (or when SCHC header 1415 compression is not possible) the SCHC Packet does not fit within the 1416 payload of a single L2 data unit, the SCHC Packet SHALL be broken 1417 into SCHC Fragments and the fragments SHALL be sent to the fragment 1418 receiver. The fragment receiver needs to identify all the SCHC 1419 Fragments that belong to a given SCHC Packet. To this end, the 1420 receiver SHALL use: 1422 o The sender's L2 source address (if present), 1424 o The destination's L2 address (if present), 1426 o Rule ID, 1427 o DTag (if present). 1429 Then, the fragment receiver MAY determine the SCHC Fragment 1430 reliability mode that is used for this SCHC Fragment based on the 1431 Rule ID in that fragment. 1433 After a SCHC Fragment reception, the receiver starts constructing the 1434 SCHC Packet. It uses the FCN and the arrival order of each SCHC 1435 Fragment to determine the location of the individual fragments within 1436 the SCHC Packet. For example, the receiver MAY place the fragment 1437 payload within a payload datagram reassembly buffer at the location 1438 determined from the FCN, the arrival order of the SCHC Fragments, and 1439 the fragment payload sizes. In Window mode, the fragment receiver 1440 also uses the W bit in the received SCHC Fragments. Note that the 1441 size of the original, unfragmented packet cannot be determined from 1442 fragmentation headers. 1444 Fragmentation functionality uses the FCN value to transmit the SCHC 1445 Fragments. It has a length of N bits where the All-1 and All-0 FCN 1446 values are used to control the fragmentation transmission. The rest 1447 of the FCN numbers MUST be assigned sequentially in a decreasing 1448 order, the first FCN of a window is RECOMMENDED to be MAX_WIND_FCN, 1449 i.e. the highest possible FCN value depending on the FCN number of 1450 bits. 1452 In all modes, the last SCHC Fragment of a packet MUST contain a MIC 1453 which is used to check if there are errors or missing SCHC Fragments 1454 and MUST use the corresponding All-1 fragment format. Note that a 1455 SCHC Fragment with an All-0 format is considered the last SCHC 1456 Fragment of the current window. 1458 If the receiver receives the last fragment of a datagram (All-1), it 1459 checks for the integrity of the reassembled datagram, based on the 1460 MIC received. In No-ACK, if the integrity check indicates that the 1461 reassembled datagram does not match the original datagram (prior to 1462 fragmentation), the reassembled datagram MUST be discarded. In 1463 Window mode, a MIC check is also performed by the fragment receiver 1464 after reception of each subsequent SCHC Fragment retransmitted after 1465 the first MIC check. 1467 There are three reliability modes: No-ACK, ACK-Always and ACK-on- 1468 Error. In ACK-Always and ACK-on-Error, a jumping window protocol 1469 uses two windows alternatively, identified as 0 and 1. A SCHC 1470 Fragment with all FCN bits set to 0 (i.e. an All-0 fragment) 1471 indicates that the window is over (i.e. the SCHC Fragment is the last 1472 one of the window) and allows to switch from one window to the next 1473 one. The All-1 FCN in a SCHC Fragment indicates that it is the last 1474 fragment of the packet being transmitted and therefore there will not 1475 be another window for this packet. 1477 7.5.1. No-ACK 1479 In the No-ACK mode, there is no feedback communication from the 1480 fragment receiver. The sender will send all the SCHC fragments of a 1481 packet without any possibility of knowing if errors or losses have 1482 occurred. As, in this mode, there is no need to identify specific 1483 SCHC Fragments, a one-bit FCN MAY be used. Consequently, the FCN 1484 All-0 value is used in all SCHC fragments except the last one, which 1485 carries an All-1 FCN and the MIC. The receiver will wait for SCHC 1486 Fragments and will set the Inactivity timer. The receiver will use 1487 the MIC contained in the last SCHC Fragment to check for errors. 1488 When the Inactivity Timer expires or if the MIC check indicates that 1489 the reassembled packet does not match the original one, the receiver 1490 will release all resources allocated to reassembling this packet. 1491 The initial value of the Inactivity Timer will be determined based on 1492 the characteristics of the underlying LPWAN technology and will be 1493 defined in other documents (e.g. technology-specific profile 1494 documents). 1496 7.5.2. ACK-Always 1498 In ACK-Always, the sender transmits SCHC Fragments by using the two- 1499 jumping-windows procedure. A delay between each SCHC fragment can be 1500 added to respect local regulations or other constraints imposed by 1501 the applications. Each time a SCHC fragment is sent, the FCN is 1502 decreased by one. When the FCN reaches value 0 and there are more 1503 SCHC Fragments to be sent after, the sender transmits the last SCHC 1504 Fragment of this window using the All-0 fragment format, it starts 1505 the transmitted is the last SCHC Fragment of the SCHC Packet, the 1506 sender uses the All-1 fragment format, which includes a MIC. The 1507 sender sets the Retransmission Timer and waits for the SCHC ACK to 1508 know if transmission errors have occured. 1510 The Retransmission Timer is dimensioned based on the LPWAN technology 1511 in use. When the Retransmission Timer expires, the sender sends an 1512 All-0 empty (resp. All-1 empty) fragment to request again the SCHC 1513 ACK for the window that ended with the All-0 (resp. All-1) fragment 1514 just sent. The window number is not changed. 1516 After receiving an All-0 or All-1 fragment, the receiver sends an 1517 SCHC ACK with an encoded Bitmap reporting whether any SCHC fragments 1518 have been lost or not. When the sender receives an SCHC ACK, it 1519 checks the W bit carried by the SCHC ACK. Any SCHC ACK carrying an 1520 unexpected W bit value is discarded. If the W bit value of the 1521 received SCHC ACK is correct, the sender analyzes the rest of the 1522 SCHC ACK message, such as the encoded Bitmap and the MIC. If all the 1523 SCHC Fragments sent for this window have been well received, and if 1524 at least one more SCHC Fragment needs to be sent, the sender advances 1525 its sending window to the next window value and sends the next SCHC 1526 Fragments. If no more SCHC Fragments have to be sent, then the SCHC 1527 fragmented packet transmission is finished. 1529 However, if one or more SCHC Fragments have not been received as per 1530 the SCHC ACK (i.e. the corresponding bits are not set in the encoded 1531 Bitmap) then the sender resends the missing SCHC Fragments. When all 1532 missing SCHC Fragments have been retransmitted, the sender starts the 1533 Retransmission Timer, even if an All-0 or an All-1 has not been sent 1534 as part of this retransmission and waits for an SCHC ACK. Upon 1535 receipt of the SCHC ACK, if one or more SCHC Fragments have not yet 1536 been received, the counter Attempts is increased and the sender 1537 resends the missing SCHC Fragments again. When Attempts reaches 1538 MAX_ACK_REQUESTS, the sender aborts the on-going SCHC Fragmented 1539 packet transmission by sending an Abort message and releases any 1540 resources for transmission of the packet. The sender also aborts an 1541 on-going SCHC Fragmented packet transmission when a failed MIC check 1542 is reported by the receiver or when a SCHC Fragment that has not been 1543 sent is reported in the encoded Bitmap. 1545 On the other hand, at the beginning, the receiver side expects to 1546 receive window 0. Any SCHC Fragment received but not belonging to 1547 the current window is discarded. All SCHC Fragments belonging to the 1548 correct window are accepted, and the actual SCHC Fragment number 1549 managed by the receiver is computed based on the FCN value. The 1550 receiver prepares the encoded Bitmap to report the correctly received 1551 and the missing SCHC Fragments for the current window. After each 1552 SCHC Fragment is received the receiver initializes the Inactivity 1553 timer, if the Inactivity Timer expires the transmission is aborted. 1555 When an All-0 fragment is received, it indicates that all the SCHC 1556 Fragments have been sent in the current window. Since the sender is 1557 not obliged to always send a full window, some SCHC Fragment number 1558 not set in the receiver memory SHOULD not correspond to losses. The 1559 receiver sends the corresponding SCHC ACK, the Inactivity Timer is 1560 set and the transmission of the next window by the sender can start. 1562 If an All-0 fragment has been received and all SCHC Fragments of the 1563 current window have also been received, the receiver then expects a 1564 new Window and waits for the next SCHC Fragment. Upon receipt of a 1565 SCHC Fragment, if the window value has not changed, the received SCHC 1566 Fragments are part of a retransmission. A receiver that has already 1567 received a SCHC Fragment SHOULD discard it, otherwise, it updates the 1568 encoded Bitmap. If all the bits of the encoded Bitmap are set to 1569 one, the receiver MUST send an SCHC ACK without waiting for an All-0 1570 fragment and the Inactivity Timer is initialized. 1572 On the other hand, if the window value of the next received SCHC 1573 Fragment is set to the next expected window value, this means that 1574 the sender has received a correct encoded Bitmap reporting that all 1575 SCHC Fragments have been received. The receiver then updates the 1576 value of the next expected window. 1578 When an All-1 fragment is received, it indicates that the last SCHC 1579 Fragment of the packet has been sent. Since the last window is not 1580 always full, the MIC will be used to detect if all SCHC Fragments of 1581 the packet have been received. A correct MIC indicates the end of 1582 the transmission but the receiver MUST stay alive for an Inactivity 1583 Timer period to answer to any empty All-1 fragments the sender MAY 1584 send if SCHC ACKs sent by the receiver are lost. If the MIC is 1585 incorrect, some SCHC Fragments have been lost. The receiver sends 1586 the SCHC ACK regardless of successful SCHC Fragmented packet 1587 reception or not, the Inactitivity Timer is set. In case of an 1588 incorrect MIC, the receiver waits for SCHC Fragments belonging to the 1589 same window. After MAX_ACK_REQUESTS, the receiver will abort the on- 1590 going SCHC Fragmented packet transmission by transmitting a the 1591 Receiver-Abort format. The receiver also aborts upon Inactivity 1592 Timer expiration. 1594 7.5.3. ACK-on-Error 1596 The senders behavior for ACK-on-Error and ACK-Always are similar. 1597 The main difference is that in ACK-on-Error the SCHC ACK with the 1598 encoded Bitmap is not sent at the end of each window but only when at 1599 least one SCHC Fragment of the current window has been lost. Excepts 1600 for the last window where an SCHC ACK MUST be sent to finish the 1601 transmission. 1603 In ACK-on-Error, the Retransmission Timer expiration will be 1604 considered as a positive acknowledgment. This timer is set after 1605 sending an All-0 or an All-1 fragment. When the All-1 fragment has 1606 been sent, then the on-going SCHC F/R process is finished and the 1607 sender waits for the last SCHC ACK. If the Retransmission Timer 1608 expires while waiting for the SCHC ACK for the last window, an All-1 1609 empty MUST be sent to request the last SCHC ACK by the sender to 1610 complete the SCHC Fragmented packet transmission. When it expires 1611 the sender continue sending SCHC Fragments of the next window. 1613 If the sender receives an SCHC ACK, it checks the window value. SCHC 1614 ACKs with an unexpected window number are discarded. If the window 1615 number on the received encoded Bitmap is correct, the sender verifies 1616 if the receiver has received all SCHC fragments of the current 1617 window. When at least one SCHC Fragment has been lost, the counter 1618 Attempts is increased by one and the sender resends the missing SCHC 1619 Fragments again. When Attempts reaches MAX_ACK_REQUESTS, the sender 1620 sends an Abort message and releases all resources for the on-going 1621 SCHC Fragmented packet transmission. When the retransmission of the 1622 missing SCHC Fragments is finished, the sender starts listening for 1623 an SCHC ACK (even if an All-0 or an All-1 has not been sent during 1624 the retransmission) and initializes the Retransmission Timer. After 1625 sending an All-1 fragment, the sender listens for an SCHC ACK, 1626 initializes Attempts, and starts the Retransmission Timer. If the 1627 Retransmission Timer expires, Attempts is increased by one and an 1628 empty All-1 fragment is sent to request the SCHC ACK for the last 1629 window. If Attempts reaches MAX_ACK_REQUESTS, the sender aborts the 1630 on-going SCHC Fragmented packet transmission by transmitting the 1631 Sender-Abort fragment. 1633 Unlike the sender, the receiver for ACK-on-Error has a larger amount 1634 of differences compared with ACK-Always. First, an SCHC ACK is not 1635 sent unless there is a lost SCHC Fragment or an unexpected behavior. 1636 With the exception of the last window, where an SCHC ACK is always 1637 sent regardless of SCHC Fragment losses or not. The receiver starts 1638 by expecting SCHC Fragments from window 0 and maintains the 1639 information regarding which SCHC Fragments it receives. After 1640 receiving an SCHC Fragment, the Inactivity Timer is set. If no 1641 further SCHC Fragment are received and the Inactivity Timer expires, 1642 the SCHC Fragment receiver aborts the on-going SCHC Fragmented packet 1643 transmission by transmitting the Receiver-Abort data unit. 1645 Any SCHC Fragment not belonging to the current window is discarded. 1646 The actual SCHC Fragment number is computed based on the FCN value. 1647 When an All-0 fragment is received and all SCHC Fragments have been 1648 received, the receiver updates the expected window value and expects 1649 a new window and waits for the next SCHC Fragment. 1650 If the window value of the next SCHC Fragment has not changed, the 1651 received SCHC Fragment is a retransmission. A receiver that has 1652 already received an SCHC Fragment discard it. If all SCHC Fragments 1653 of a window (that is not the last one) have been received, the 1654 receiver does not send an SCHC ACK. While the receiver waits for the 1655 next window and if the window value is set to the next value, and if 1656 an All-1 fragment with the next value window arrived the receiver 1657 knows that the last SCHC Fragment of the packet has been sent. Since 1658 the last window is not always full, the MIC will be used to detect if 1659 all SCHC Fragments of the window have been received. A correct MIC 1660 check indicates the end of the SCHC Fragmented packet transmission. 1661 An ACK is sent by the SCHC Fragment receiver. In case of an 1662 incorrect MIC, the receiver waits for SCHC Fragments belonging to the 1663 same window or the expiration of the Inactivity Timer. The latter 1664 will lead the receiver to abort the on-going SCHC fragmented packet 1665 transmission. 1667 If after receiving an All-0 fragment the receiver missed some SCHC 1668 Fragments, the receiver uses an SCHC ACK with the encoded Bitmap to 1669 ask the retransmission of the missing fragments and expect to receive 1670 SCHC Fragments with the actual window. While waiting the 1671 retransmission an All-0 empty fragment is received, the receiver 1672 sends again the SCHC ACK with the encoded Bitmap, if the SCHC 1673 Fragments received belongs to another window or an All-1 fragment is 1674 received, the transmission is aborted by sending a Receiver-Abort 1675 fragment. Once it has received all the missing fragments it waits 1676 for the next window fragments. 1678 7.6. Supporting multiple window sizes 1680 For ACK-Always or ACK-on-Error, implementers MAY opt to support a 1681 single window size or multiple window sizes. The latter, when 1682 feasible, may provide performance optimizations. For example, a 1683 large window size SHOULD be used for packets that need to be carried 1684 by a large number of SCHC Fragments. However, when the number of 1685 SCHC Fragments required to carry a packet is low, a smaller window 1686 size, and thus a shorter Bitmap, MAY be sufficient to provide 1687 feedback on all SCHC Fragments. If multiple window sizes are 1688 supported, the Rule ID MAY be used to signal the window size in use 1689 for a specific packet transmission. 1691 Note that the same window size MUST be used for the transmission of 1692 all SCHC Fragments that belong to the same SCHC Packet. 1694 7.7. Downlink SCHC Fragment transmission 1696 In some LPWAN technologies, as part of energy-saving techniques, 1697 downlink transmission is only possible immediately after an uplink 1698 transmission. In order to avoid potentially high delay in the 1699 downlink transmission of a SCHC Fragmented datagram, the SCHC 1700 Fragment receiver MAY perform an uplink transmission as soon as 1701 possible after reception of a SCHC Fragment that is not the last one. 1702 Such uplink transmission MAY be triggered by the L2 (e.g. an L2 ACK 1703 sent in response to a SCHC Fragment encapsulated in a L2 frame that 1704 requires an L2 ACK) or it MAY be triggered from an upper layer. 1706 For downlink transmission of a SCHC Fragmented packet in ACK-Always 1707 mode, the SCHC Fragment receiver MAY support timer-based SCHC ACK 1708 retransmission. In this mechanism, the SCHC Fragment receiver 1709 initializes and starts a timer (the Inactivity Timer is used) after 1710 the transmission of an SCHC ACK, except when the SCHC ACK is sent in 1711 response to the last SCHC Fragment of a packet (All-1 fragment). In 1712 the latter case, the SCHC Fragment receiver does not start a timer 1713 after transmission of the SCHC ACK. 1715 If, after transmission of an SCHC ACK that is not an All-1 fragment, 1716 and before expiration of the corresponding Inactivity timer, the SCHC 1717 Fragment receiver receives a SCHC Fragment that belongs to the 1718 current window (e.g. a missing SCHC Fragment from the current window) 1719 or to the next window, the Inactivity timer for the SCHC ACK is 1720 stopped. However, if the Inactivity timer expires, the SCHC ACK is 1721 resent and the Inactivity timer is reinitialized and restarted. 1723 The default initial value for the Inactivity timer, as well as the 1724 maximum number of retries for a specific SCHC ACK, denoted 1725 MAX_ACK_RETRIES, are not defined in this document, and need to be 1726 defined in other documents (e.g. technology-specific profiles). The 1727 initial value of the Inactivity timer is expected to be greater than 1728 that of the Retransmission timer, in order to make sure that a 1729 (buffered) SCHC Fragment to be retransmitted can find an opportunity 1730 for that transmission. 1732 When the SCHC Fragment sender transmits the All-1 fragment, it starts 1733 its Retransmission Timer with a large timeout value (e.g. several 1734 times that of the initial Inactivity timer). If an SCHC ACK is 1735 received before expiration of this timer, the SCHC Fragment sender 1736 retransmits any lost SCHC Fragments reported by the SCHC ACK, or if 1737 the SCHC ACK confirms successful reception of all SCHC Fragments of 1738 the last window, the transmission of the SCHC Fragmented packet is 1739 considered complete. If the timer expires, and no SCHC ACK has been 1740 received since the start of the timer, the SCHC Fragment sender 1741 assumes that the All-1 fragment has been successfully received (and 1742 possibly, the last SCHC ACK has been lost: this mechanism assumes 1743 that the retransmission timer for the All-1 fragment is long enough 1744 to allow several SCHC ACK retries if the All-1 fragment has not been 1745 received by the SCHC Fragment receiver, and it also assumes that it 1746 is unlikely that several ACKs become all lost). 1748 8. Padding management 1750 Default padding is defined for L2 frame with a variable length of 1751 bytes. Padding is done twice, after compression and in the all-1 1752 fragmentation. 1754 In compression, the Compressed Header is generally not a multiple of 1755 bytes in size, but the payload following the Compressed Header is 1756 always a multiple of 8 bits (see Figure 4). If needed, padding bits 1757 can be added after the payload to reach the next byte boundary. 1758 Since the Compressed Header (through the Rule ID and the Compression 1759 Residue) tells its length and the payload is always a multiple of 8 1760 bits, the receiver can without ambiguity remove the padding bits, 1761 which never exceed 7 bits. 1763 SCHC F/R works on a byte aligned (i.e. padded SCHC Packet). 1764 Fragmentation header may not be aligned on byte boundary, but each 1765 fragment except the last one (All-1 fragment) must sent the maximum 1766 bits as possible. Only the last fragment need to introduce padding 1767 to reach the next boundary limit. Since the SCHC is known to be a 1768 multiple of 8 bits, the receiver can remove the extra bit to reach 1769 this limit. 1771 Default padding mechanism do not need to send the padding length and 1772 can lead to a maximum of 14 bits of padding. 1774 The padding is not mandatory and is optional to the technology- 1775 specific document to give a different solution. In this docuement 1776 there are some inputs on how to manage the padding. 1778 9. SCHC Compression for IPv6 and UDP headers 1780 This section lists the different IPv6 and UDP header fields and how 1781 they can be compressed. 1783 9.1. IPv6 version field 1785 This field always holds the same value. Therefore, in the rule, TV 1786 is set to 6, MO to "equal" and CDA to "not-sent". 1788 9.2. IPv6 Traffic class field 1790 If the DiffServ field does not vary and is known by both sides, the 1791 Field Descriptor in the rule SHOULD contain a TV with this well-known 1792 value, an "equal" MO and a "not-sent" CDA. 1794 Otherwise, two possibilities can be considered depending on the 1795 variability of the value: 1797 o One possibility is to not compress the field and send the original 1798 value. In the rule, TV is not set to any particular value, MO is 1799 set to "ignore" and CDA is set to "value-sent". 1801 o If some upper bits in the field are constant and known, a better 1802 option is to only send the LSBs. In the rule, TV is set to a 1803 value with the stable known upper part, MO is set to MSB(x) and 1804 CDA to LSB(y). 1806 9.3. Flow label field 1808 If the Flow Label field does not vary and is known by both sides, the 1809 Field Descriptor in the rule SHOULD contain a TV with this well-known 1810 value, an "equal" MO and a "not-sent" CDA. 1812 Otherwise, two possibilities can be considered: 1814 o One possibility is to not compress the field and send the original 1815 value. In the rule, TV is not set to any particular value, MO is 1816 set to "ignore" and CDA is set to "value-sent". 1818 o If some upper bits in the field are constant and known, a better 1819 option is to only send the LSBs. In the rule, TV is set to a 1820 value with the stable known upper part, MO is set to MSB(x) and 1821 CDA to LSB(y). 1823 9.4. Payload Length field 1825 This field can be elided for the transmission on the LPWAN network. 1826 The SCHC C/D recomputes the original payload length value. In the 1827 Field Descriptor, TV is not set, MO is set to "ignore" and CDA is 1828 "compute-IPv6-length". 1830 If the payload length needs to be sent and does not need to be coded 1831 in 16 bits, the TV can be set to 0x0000, the MO set to MSB(16-s) 1832 where 's' is the number of bits to code the maximum length, and CDA 1833 is set to LSB(s). 1835 9.5. Next Header field 1837 If the Next Header field does not vary and is known by both sides, 1838 the Field Descriptor in the rule SHOULD contain a TV with this Next 1839 Header value, the MO SHOULD be "equal" and the CDA SHOULD be "not- 1840 sent". 1842 Otherwise, TV is not set in the Field Descriptor, MO is set to 1843 "ignore" and CDA is set to "value-sent". Alternatively, a matching- 1844 list MAY also be used. 1846 9.6. Hop Limit field 1848 The field behavior for this field is different for Uplink and 1849 Downlink. In Uplink, since there is no IP forwarding between the Dev 1850 and the SCHC C/D, the value is relatively constant. On the other 1851 hand, the Downlink value depends of Internet routing and MAY change 1852 more frequently. One neat way of processing this field is to use the 1853 Direction Indicator (DI) to distinguish both directions: 1855 o in the Uplink, elide the field: the TV in the Field Descriptor is 1856 set to the known constant value, the MO is set to "equal" and the 1857 CDA is set to "not-sent". 1859 o in the Downlink, send the value: TV is not set, MO is set to 1860 "ignore" and CDA is set to "value-sent". 1862 9.7. IPv6 addresses fields 1864 As in 6LoWPAN [RFC4944], IPv6 addresses are split into two 64-bit 1865 long fields; one for the prefix and one for the Interface Identifier 1866 (IID). These fields SHOULD be compressed. To allow for a single 1867 rule being used for both directions, these values are identified by 1868 their role (DEV or APP) and not by their position in the frame 1869 (source or destination). 1871 9.7.1. IPv6 source and destination prefixes 1873 Both ends MUST be synchronized with the appropriate prefixes. For a 1874 specific flow, the source and destination prefixes can be unique and 1875 stored in the context. It can be either a link-local prefix or a 1876 global prefix. In that case, the TV for the source and destination 1877 prefixes contain the values, the MO is set to "equal" and the CDA is 1878 set to "not-sent". 1880 If the rule is intended to compress packets with different prefix 1881 values, match-mapping SHOULD be used. The different prefixes are 1882 listed in the TV, the MO is set to "match-mapping" and the CDA is set 1883 to "mapping-sent". See Figure 28 1885 Otherwise, the TV contains the prefix, the MO is set to "equal" and 1886 the CDA is set to "value-sent". 1888 9.7.2. IPv6 source and destination IID 1890 If the DEV or APP IID are based on an LPWAN address, then the IID can 1891 be reconstructed with information coming from the LPWAN header. In 1892 that case, the TV is not set, the MO is set to "ignore" and the CDA 1893 is set to "DEViid" or "APPiid". Note that the LPWAN technology 1894 generally carries a single identifier corresponding to the DEV. 1895 Therefore Appiid cannot be used. 1897 For privacy reasons or if the DEV address is changing over time, a 1898 static value that is not equal to the DEV address SHOULD be used. In 1899 that case, the TV contains the static value, the MO operator is set 1900 to "equal" and the CDF is set to "not-sent". [RFC7217] provides some 1901 methods that MAY be used to derive this static identifier. 1903 If several IIDs are possible, then the TV contains the list of 1904 possible IIDs, the MO is set to "match-mapping" and the CDA is set to 1905 "mapping-sent". 1907 It MAY also happen that the IID variability only expresses itself on 1908 a few bytes. In that case, the TV is set to the stable part of the 1909 IID, the MO is set to "MSB" and the CDA is set to "LSB". 1911 Finally, the IID can be sent in extenso on the LPWAN. In that case, 1912 the TV is not set, the MO is set to "ignore" and the CDA is set to 1913 "value-sent". 1915 9.8. IPv6 extensions 1917 No rule is currently defined that processes IPv6 extensions. If such 1918 extensions are needed, their compression/decompression rules can be 1919 based on the MOs and CDAs described above. 1921 9.9. UDP source and destination port 1923 To allow for a single rule being used for both directions, the UDP 1924 port values are identified by their role (DEV or APP) and not by 1925 their position in the frame (source or destination). The SCHC C/D 1926 MUST be aware of the traffic direction (Uplink, Downlink) to select 1927 the appropriate field. The following rules apply for DEV and APP 1928 port numbers. 1930 If both ends know the port number, it can be elided. The TV contains 1931 the port number, the MO is set to "equal" and the CDA is set to "not- 1932 sent". 1934 If the port variation is on few bits, the TV contains the stable part 1935 of the port number, the MO is set to "MSB" and the CDA is set to 1936 "LSB". 1938 If some well-known values are used, the TV can contain the list of 1939 these values, the MO is set to "match-mapping" and the CDA is set to 1940 "mapping-sent". 1942 Otherwise the port numbers are sent over the LPWAN. The TV is not 1943 set, the MO is set to "ignore" and the CDA is set to "value-sent". 1945 9.10. UDP length field 1947 The UDP length can be computed from the received data. In that case, 1948 the TV is not set, the MO is set to "ignore" and the CDA is set to 1949 "compute-length". 1951 If the payload is small, the TV can be set to 0x0000, the MO set to 1952 "MSB" and the CDA to "LSB". 1954 In other cases, the length SHOULD be sent and the CDA is replaced by 1955 "value-sent". 1957 9.11. UDP Checksum field 1959 IPv6 mandates a checksum in the protocol above IP. Nevertheless, if 1960 a more efficient mechanism such as L2 CRC or MIC is carried by or 1961 over the L2 (such as in the LPWAN SCHC F/R process (see Section 7)), 1962 the UDP checksum transmission can be avoided. In that case, the TV 1963 is not set, the MO is set to "ignore" and the CDA is set to "compute- 1964 checksum". 1966 In other cases, the checksum SHOULD be explicitly sent. The TV is 1967 not set, the MO is set to "ignore" and the CDF is set to "value- 1968 sent". 1970 10. Security considerations 1972 10.1. Security considerations for header compression 1974 A malicious header compression could cause the reconstruction of a 1975 wrong packet that does not match with the original one. Such a 1976 corruption MAY be detected with end-to-end authentication and 1977 integrity mechanisms. Header Compression does not add more security 1978 problem than what is already needed in a transmission. For instance, 1979 to avoid an attack, never re-construct a packet bigger than some 1980 configured size (with 1500 bytes as generic default). 1982 10.2. Security considerations for SCHC Fragmentation/Reassembly 1984 This subsection describes potential attacks to LPWAN SCHC F/R and 1985 suggests possible countermeasures. 1987 A node can perform a buffer reservation attack by sending a first 1988 SCHC Fragment to a target. Then, the receiver will reserve buffer 1989 space for the IPv6 packet. Other incoming SCHC Fragmented packets 1990 will be dropped while the reassembly buffer is occupied during the 1991 reassembly timeout. Once that timeout expires, the attacker can 1992 repeat the same procedure, and iterate, thus creating a denial of 1993 service attack. The (low) cost to mount this attack is linear with 1994 the number of buffers at the target node. However, the cost for an 1995 attacker can be increased if individual SCHC Fragments of multiple 1996 packets can be stored in the reassembly buffer. To further increase 1997 the attack cost, the reassembly buffer can be split into SCHC 1998 Fragment-sized buffer slots. Once a packet is complete, it is 1999 processed normally. If buffer overload occurs, a receiver can 2000 discard packets based on the sender behavior, which MAY help identify 2001 which SCHC Fragments have been sent by an attacker. 2003 In another type of attack, the malicious node is required to have 2004 overhearing capabilities. If an attacker can overhear a SCHC 2005 Fragment, it can send a spoofed duplicate (e.g. with random payload) 2006 to the destination. If the LPWAN technology does not support 2007 suitable protection (e.g. source authentication and frame counters to 2008 prevent replay attacks), a receiver cannot distinguish legitimate 2009 from spoofed SCHC Fragments. Therefore, the original IPv6 packet 2010 will be considered corrupt and will be dropped. To protect resource- 2011 constrained nodes from this attack, it has been proposed to establish 2012 a binding among the SCHC Fragments to be transmitted by a node, by 2013 applying content-chaining to the different SCHC Fragments, based on 2014 cryptographic hash functionality. The aim of this technique is to 2015 allow a receiver to identify illegitimate SCHC Fragments. 2017 Further attacks MAY involve sending overlapped fragments (i.e. 2018 comprising some overlapping parts of the original IPv6 datagram). 2019 Implementers SHOULD make sure that the correct operation is not 2020 affected by such event. 2022 In Window mode - ACK on error, a malicious node MAY force a SCHC 2023 Fragment sender to resend a SCHC Fragment a number of times, with the 2024 aim to increase consumption of the SCHC Fragment sender's resources. 2025 To this end, the malicious node MAY repeatedly send a fake ACK to the 2026 SCHC Fragment sender, with a Bitmap that reports that one or more 2027 SCHC Fragments have been lost. In order to mitigate this possible 2028 attack, MAX_ACK_RETRIES MAY be set to a safe value which allows to 2029 limit the maximum damage of the attack to an acceptable extent. 2030 However, note that a high setting for MAX_ACK_RETRIES benefits SCHC 2031 Fragment reliability modes, therefore the trade-off needs to be 2032 carefully considered. 2034 11. Acknowledgements 2036 Thanks to Dominique Barthel, Carsten Bormann, Philippe Clavier, 2037 Eduardo Ingles Sanchez, Arunprabhu Kandasamy, Rahul Jadhav, Sergio 2038 Lopez Bernal, Antony Markovski, Alexander Pelov, Pascal Thubert, Juan 2039 Carlos Zuniga, Diego Dujovne, Edgar Ramos, and Shoichi Sakane for 2040 useful design consideration and comments. 2042 12. References 2043 12.1. Normative References 2045 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 2046 (IPv6) Specification", RFC 2460, DOI 10.17487/RFC2460, 2047 December 1998, . 2049 [RFC3385] Sheinwald, D., Satran, J., Thaler, P., and V. Cavanna, 2050 "Internet Protocol Small Computer System Interface (iSCSI) 2051 Cyclic Redundancy Check (CRC)/Checksum Considerations", 2052 RFC 3385, DOI 10.17487/RFC3385, September 2002, 2053 . 2055 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, 2056 "Transmission of IPv6 Packets over IEEE 802.15.4 2057 Networks", RFC 4944, DOI 10.17487/RFC4944, September 2007, 2058 . 2060 [RFC5795] Sandlund, K., Pelletier, G., and L-E. Jonsson, "The RObust 2061 Header Compression (ROHC) Framework", RFC 5795, 2062 DOI 10.17487/RFC5795, March 2010, 2063 . 2065 [RFC7136] Carpenter, B. and S. Jiang, "Significance of IPv6 2066 Interface Identifiers", RFC 7136, DOI 10.17487/RFC7136, 2067 February 2014, . 2069 [RFC7217] Gont, F., "A Method for Generating Semantically Opaque 2070 Interface Identifiers with IPv6 Stateless Address 2071 Autoconfiguration (SLAAC)", RFC 7217, 2072 DOI 10.17487/RFC7217, April 2014, 2073 . 2075 12.2. Informative References 2077 [I-D.ietf-lpwan-overview] 2078 Farrell, S., "LPWAN Overview", draft-ietf-lpwan- 2079 overview-10 (work in progress), February 2018. 2081 Appendix A. SCHC Compression Examples 2083 This section gives some scenarios of the compression mechanism for 2084 IPv6/UDP. The goal is to illustrate the behavior of SCHC. 2086 The most common case using the mechanisms defined in this document 2087 will be a LPWAN Dev that embeds some applications running over CoAP. 2088 In this example, three flows are considered. The first flow is for 2089 the device management based on CoAP using Link Local IPv6 addresses 2090 and UDP ports 123 and 124 for Dev and App, respectively. The second 2091 flow will be a CoAP server for measurements done by the Device (using 2092 ports 5683) and Global IPv6 Address prefixes alpha::IID/64 to 2093 beta::1/64. The last flow is for legacy applications using different 2094 ports numbers, the destination IPv6 address prefix is gamma::1/64. 2096 Figure 27 presents the protocol stack for this Device. IPv6 and UDP 2097 are represented with dotted lines since these protocols are 2098 compressed on the radio link. 2100 Management Data 2101 +----------+---------+---------+ 2102 | CoAP | CoAP | legacy | 2103 +----||----+---||----+---||----+ 2104 . UDP . UDP | UDP | 2105 ................................ 2106 . IPv6 . IPv6 . IPv6 . 2107 +------------------------------+ 2108 | SCHC Header compression | 2109 | and fragmentation | 2110 +------------------------------+ 2111 | LPWAN L2 technologies | 2112 +------------------------------+ 2113 DEV or NGW 2115 Figure 27: Simplified Protocol Stack for LP-WAN 2117 Note that in some LPWAN technologies, only the Devs have a device ID. 2118 Therefore, when such technologies are used, it is necessary to 2119 statically define an IID for the Link Local address for the SCHC C/D. 2121 Rule 0 2122 +----------------+--+--+--+---------+--------+------------++------+ 2123 | Field |FL|FP|DI| Value | Match | Comp Decomp|| Sent | 2124 | | | | | | Opera. | Action ||[bits]| 2125 +----------------+--+--+--+---------+---------------------++------+ 2126 |IPv6 version |4 |1 |Bi|6 | equal | not-sent || | 2127 |IPv6 DiffServ |8 |1 |Bi|0 | equal | not-sent || | 2128 |IPv6 Flow Label |20|1 |Bi|0 | equal | not-sent || | 2129 |IPv6 Length |16|1 |Bi| | ignore | comp-length|| | 2130 |IPv6 Next Header|8 |1 |Bi|17 | equal | not-sent || | 2131 |IPv6 Hop Limit |8 |1 |Bi|255 | ignore | not-sent || | 2132 |IPv6 DEVprefix |64|1 |Bi|FE80::/64| equal | not-sent || | 2133 |IPv6 DEViid |64|1 |Bi| | ignore | DEViid || | 2134 |IPv6 APPprefix |64|1 |Bi|FE80::/64| equal | not-sent || | 2135 |IPv6 APPiid |64|1 |Bi|::1 | equal | not-sent || | 2136 +================+==+==+==+=========+========+============++======+ 2137 |UDP DEVport |16|1 |Bi|123 | equal | not-sent || | 2138 |UDP APPport |16|1 |Bi|124 | equal | not-sent || | 2139 |UDP Length |16|1 |Bi| | ignore | comp-length|| | 2140 |UDP checksum |16|1 |Bi| | ignore | comp-chk || | 2141 +================+==+==+==+=========+========+============++======+ 2143 Rule 1 2144 +----------------+--+--+--+---------+--------+------------++------+ 2145 | Field |FL|FP|DI| Value | Match | Action || Sent | 2146 | | | | | | Opera. | Action ||[bits]| 2147 +----------------+--+--+--+---------+--------+------------++------+ 2148 |IPv6 version |4 |1 |Bi|6 | equal | not-sent || | 2149 |IPv6 DiffServ |8 |1 |Bi|0 | equal | not-sent || | 2150 |IPv6 Flow Label |20|1 |Bi|0 | equal | not-sent || | 2151 |IPv6 Length |16|1 |Bi| | ignore | comp-length|| | 2152 |IPv6 Next Header|8 |1 |Bi|17 | equal | not-sent || | 2153 |IPv6 Hop Limit |8 |1 |Bi|255 | ignore | not-sent || | 2154 |IPv6 DEVprefix |64|1 |Bi|[alpha/64, match- |mapping-sent|| [1] | 2155 | | | | |fe80::/64] mapping| || | 2156 |IPv6 DEViid |64|1 |Bi| | ignore | DEViid || | 2157 |IPv6 APPprefix |64|1 |Bi|[beta/64,| match- |mapping-sent|| [2] | 2158 | | | | |alpha/64,| mapping| || | 2159 | | | | |fe80::64]| | || | 2160 |IPv6 APPiid |64|1 |Bi|::1000 | equal | not-sent || | 2161 +================+==+==+==+=========+========+============++======+ 2162 |UDP DEVport |16|1 |Bi|5683 | equal | not-sent || | 2163 |UDP APPport |16|1 |Bi|5683 | equal | not-sent || | 2164 |UDP Length |16|1 |Bi| | ignore | comp-length|| | 2165 |UDP checksum |16|1 |Bi| | ignore | comp-chk || | 2166 +================+==+==+==+=========+========+============++======+ 2168 Rule 2 2169 +----------------+--+--+--+---------+--------+------------++------+ 2170 | Field |FL|FP|DI| Value | Match | Action || Sent | 2171 | | | | | | Opera. | Action ||[bits]| 2172 +----------------+--+--+--+---------+--------+------------++------+ 2173 |IPv6 version |4 |1 |Bi|6 | equal | not-sent || | 2174 |IPv6 DiffServ |8 |1 |Bi|0 | equal | not-sent || | 2175 |IPv6 Flow Label |20|1 |Bi|0 | equal | not-sent || | 2176 |IPv6 Length |16|1 |Bi| | ignore | comp-length|| | 2177 |IPv6 Next Header|8 |1 |Bi|17 | equal | not-sent || | 2178 |IPv6 Hop Limit |8 |1 |Up|255 | ignore | not-sent || | 2179 |IPv6 Hop Limit |8 |1 |Dw| | ignore | value-sent || [8] | 2180 |IPv6 DEVprefix |64|1 |Bi|alpha/64 | equal | not-sent || | 2181 |IPv6 DEViid |64|1 |Bi| | ignore | DEViid || | 2182 |IPv6 APPprefix |64|1 |Bi|gamma/64 | equal | not-sent || | 2183 |IPv6 APPiid |64|1 |Bi|::1000 | equal | not-sent || | 2184 +================+==+==+==+=========+========+============++======+ 2185 |UDP DEVport |16|1 |Bi|8720 | MSB(12)| LSB || [4] | 2186 |UDP APPport |16|1 |Bi|8720 | MSB(12)| LSB || [4] | 2187 |UDP Length |16|1 |Bi| | ignore | comp-length|| | 2188 |UDP checksum |16|1 |Bi| | ignore | comp-chk || | 2189 +================+==+==+==+=========+========+============++======+ 2191 Figure 28: Context rules 2193 All the fields described in the three rules depicted on Figure 28 are 2194 present in the IPv6 and UDP headers. The DEViid-DID value is found 2195 in the L2 header. 2197 The second and third rules use global addresses. The way the Dev 2198 learns the prefix is not in the scope of the document. 2200 The third rule compresses port numbers to 4 bits. 2202 Appendix B. Fragmentation Examples 2204 This section provides examples for the different fragment reliability 2205 modes specified in this document. 2207 Figure 29 illustrates the transmission in No-ACK mode of an IPv6 2208 packet that needs 11 fragments. FCN is 1 bit wide. 2210 Sender Receiver 2211 |-------FCN=0-------->| 2212 |-------FCN=0-------->| 2213 |-------FCN=0-------->| 2214 |-------FCN=0-------->| 2215 |-------FCN=0-------->| 2216 |-------FCN=0-------->| 2217 |-------FCN=0-------->| 2218 |-------FCN=0-------->| 2219 |-------FCN=0-------->| 2220 |-------FCN=0-------->| 2221 |-----FCN=1 + MIC --->|MIC checked: success => 2223 Figure 29: Transmission in No-ACK mode of an IPv6 packet carried by 2224 11 fragments 2226 In the following examples, N (i.e. the size if the FCN field) is 3 2227 bits. Therefore, the All-1 FCN value is 7. 2229 Figure 30 illustrates the transmission in ACK-on-Error of an IPv6 2230 packet that needs 11 fragments, with MAX_WIND_FCN=6 and no fragment 2231 loss. 2233 Sender Receiver 2234 |-----W=0, FCN=6----->| 2235 |-----W=0, FCN=5----->| 2236 |-----W=0, FCN=4----->| 2237 |-----W=0, FCN=3----->| 2238 |-----W=0, FCN=2----->| 2239 |-----W=0, FCN=1----->| 2240 |-----W=0, FCN=0----->| 2241 (no ACK) 2242 |-----W=1, FCN=6----->| 2243 |-----W=1, FCN=5----->| 2244 |-----W=1, FCN=4----->| 2245 |--W=1, FCN=7 + MIC-->|MIC checked: success => 2246 |<---- ACK, W=1 ------| 2248 Figure 30: Transmission in ACK-on-Error mode of an IPv6 packet 2249 carried by 11 fragments, with MAX_WIND_FCN=6 and no loss. 2251 Figure 31 illustrates the transmission in ACK-on-Error mode of an 2252 IPv6 packet that needs 11 fragments, with MAX_WIND_FCN=6 and three 2253 lost fragments. 2255 Sender Receiver 2256 |-----W=0, FCN=6----->| 2257 |-----W=0, FCN=5----->| 2258 |-----W=0, FCN=4--X-->| 2259 |-----W=0, FCN=3----->| 2260 |-----W=0, FCN=2--X-->| 7 2261 |-----W=0, FCN=1----->| / 2262 |-----W=0, FCN=0----->| 6543210 2263 |<-----ACK, W=0-------|Bitmap:1101011 2264 |-----W=0, FCN=4----->| 2265 |-----W=0, FCN=2----->| 2266 (no ACK) 2267 |-----W=1, FCN=6----->| 2268 |-----W=1, FCN=5----->| 2269 |-----W=1, FCN=4--X-->| 2270 |- W=1, FCN=7 + MIC ->|MIC checked: failed 2271 |<-----ACK, W=1-------|C=0 Bitmap:1100001 2272 |-----W=1, FCN=4----->|MIC checked: success => 2273 |<---- ACK, W=1 ------|C=1, no Bitmap 2275 Figure 31: Transmission in ACK-on-Error mode of an IPv6 packet 2276 carried by 11 fragments, with MAX_WIND_FCN=6 and three lost 2277 fragments. 2279 Figure 32 illustrates the transmission in ACK-Always mode of an IPv6 2280 packet that needs 11 fragments, with MAX_WIND_FCN=6 and no loss. 2282 Sender Receiver 2283 |-----W=0, FCN=6----->| 2284 |-----W=0, FCN=5----->| 2285 |-----W=0, FCN=4----->| 2286 |-----W=0, FCN=3----->| 2287 |-----W=0, FCN=2----->| 2288 |-----W=0, FCN=1----->| 2289 |-----W=0, FCN=0----->| 2290 |<-----ACK, W=0-------| Bitmap:1111111 2291 |-----W=1, FCN=6----->| 2292 |-----W=1, FCN=5----->| 2293 |-----W=1, FCN=4----->| 2294 |--W=1, FCN=7 + MIC-->|MIC checked: success => 2295 |<-----ACK, W=1-------| C=1 no Bitmap 2296 (End) 2298 Figure 32: Transmission in ACK-Always mode of an IPv6 packet carried 2299 by 11 fragments, with MAX_WIND_FCN=6 and no lost fragment. 2301 Figure 33 illustrates the transmission in ACK-Always mode of an IPv6 2302 packet that needs 11 fragments, with MAX_WIND_FCN=6 and three lost 2303 fragments. 2305 Sender Receiver 2306 |-----W=1, FCN=6----->| 2307 |-----W=1, FCN=5----->| 2308 |-----W=1, FCN=4--X-->| 2309 |-----W=1, FCN=3----->| 2310 |-----W=1, FCN=2--X-->| 7 2311 |-----W=1, FCN=1----->| / 2312 |-----W=1, FCN=0----->| 6543210 2313 |<-----ACK, W=1-------|Bitmap:1101011 2314 |-----W=1, FCN=4----->| 2315 |-----W=1, FCN=2----->| 2316 |<-----ACK, W=1-------|Bitmap: 2317 |-----W=0, FCN=6----->| 2318 |-----W=0, FCN=5----->| 2319 |-----W=0, FCN=4--X-->| 2320 |--W=0, FCN=7 + MIC-->|MIC checked: failed 2321 |<-----ACK, W=0-------| C= 0 Bitmap:11000001 2322 |-----W=0, FCN=4----->|MIC checked: success => 2323 |<-----ACK, W=0-------| C= 1 no Bitmap 2324 (End) 2326 Figure 33: Transmission in ACK-Always mode of an IPv6 packet carried 2327 by 11 fragments, with MAX_WIND_FCN=6 and three lost fragments. 2329 Figure 34 illustrates the transmission in ACK-Always mode of an IPv6 2330 packet that needs 6 fragments, with MAX_WIND_FCN=6, three lost 2331 fragments and only one retry needed to recover each lost fragment. 2333 Sender Receiver 2334 |-----W=0, FCN=6----->| 2335 |-----W=0, FCN=5----->| 2336 |-----W=0, FCN=4--X-->| 2337 |-----W=0, FCN=3--X-->| 2338 |-----W=0, FCN=2--X-->| 2339 |--W=0, FCN=7 + MIC-->|MIC checked: failed 2340 |<-----ACK, W=0-------|C= 0 Bitmap:1100001 2341 |-----W=0, FCN=4----->|MIC checked: failed 2342 |-----W=0, FCN=3----->|MIC checked: failed 2343 |-----W=0, FCN=2----->|MIC checked: success 2344 |<-----ACK, W=0-------|C=1 no Bitmap 2345 (End) 2347 Figure 34: Transmission in ACK-Always mode of an IPv6 packet carried 2348 by 11 fragments, with MAX_WIND_FCN=6, three lost framents and only 2349 one retry needed for each lost fragment. 2351 Figure 35 illustrates the transmission in ACK-Always mode of an IPv6 2352 packet that needs 6 fragments, with MAX_WIND_FCN=6, three lost 2353 fragments, and the second ACK lost. 2355 Sender Receiver 2356 |-----W=0, FCN=6----->| 2357 |-----W=0, FCN=5----->| 2358 |-----W=0, FCN=4--X-->| 2359 |-----W=0, FCN=3--X-->| 2360 |-----W=0, FCN=2--X-->| 2361 |--W=0, FCN=7 + MIC-->|MIC checked: failed 2362 |<-----ACK, W=0-------|C=0 Bitmap:1100001 2363 |-----W=0, FCN=4----->|MIC checked: failed 2364 |-----W=0, FCN=3----->|MIC checked: failed 2365 |-----W=0, FCN=2----->|MIC checked: success 2366 | X---ACK, W=0-------|C= 1 no Bitmap 2367 timeout | | 2368 |--W=0, FCN=7 + MIC-->| 2369 |<-----ACK, W=0-------|C= 1 no Bitmap 2371 (End) 2373 Figure 35: Transmission in ACK-Always mode of an IPv6 packet carried 2374 by 11 fragments, with MAX_WIND_FCN=6, three lost fragments, and the 2375 second ACK lost. 2377 Figure 36 illustrates the transmission in ACK-Always mode of an IPv6 2378 packet that needs 6 fragments, with MAX_WIND_FCN=6, with three lost 2379 fragments, and one retransmitted fragment lost again. 2381 Sender Receiver 2382 |-----W=0, FCN=6----->| 2383 |-----W=0, FCN=5----->| 2384 |-----W=0, FCN=4--X-->| 2385 |-----W=0, FCN=3--X-->| 2386 |-----W=0, FCN=2--X-->| 2387 |--W=0, FCN=7 + MIC-->|MIC checked: failed 2388 |<-----ACK, W=0-------|C=0 Bitmap:1100001 2389 |-----W=0, FCN=4----->|MIC checked: failed 2390 |-----W=0, FCN=3----->|MIC checked: failed 2391 |-----W=0, FCN=2--X-->| 2392 timeout| | 2393 |--W=0, FCN=7 + MIC-->|All-0 empty 2394 |<-----ACK, W=0-------|C=0 Bitmap: 1111101 2395 |-----W=0, FCN=2----->|MIC checked: success 2396 |<-----ACK, W=0-------|C=1 no Bitmap 2397 (End) 2399 Figure 36: Transmission in ACK-Always mode of an IPv6 packet carried 2400 by 11 fragments, with MAX_WIND_FCN=6, with three lost fragments, and 2401 one retransmitted fragment lost again. 2403 Figure 37 illustrates the transmission in ACK-Always mode of an IPv6 2404 packet that needs 28 fragments, with N=5, MAX_WIND_FCN=23 and two 2405 lost fragments. Note that MAX_WIND_FCN=23 may be useful when the 2406 maximum possible Bitmap size, considering the maximum lower layer 2407 technology payload size and the value of R, is 3 bytes. Note also 2408 that the FCN of the last fragment of the packet is the one with 2409 FCN=31 (i.e. FCN=2^N-1 for N=5, or equivalently, all FCN bits set to 2410 1). 2412 Sender Receiver 2413 |-----W=0, FCN=23----->| 2414 |-----W=0, FCN=22----->| 2415 |-----W=0, FCN=21--X-->| 2416 |-----W=0, FCN=20----->| 2417 |-----W=0, FCN=19----->| 2418 |-----W=0, FCN=18----->| 2419 |-----W=0, FCN=17----->| 2420 |-----W=0, FCN=16----->| 2421 |-----W=0, FCN=15----->| 2422 |-----W=0, FCN=14----->| 2423 |-----W=0, FCN=13----->| 2424 |-----W=0, FCN=12----->| 2425 |-----W=0, FCN=11----->| 2426 |-----W=0, FCN=10--X-->| 2427 |-----W=0, FCN=9 ----->| 2428 |-----W=0, FCN=8 ----->| 2429 |-----W=0, FCN=7 ----->| 2430 |-----W=0, FCN=6 ----->| 2431 |-----W=0, FCN=5 ----->| 2432 |-----W=0, FCN=4 ----->| 2433 |-----W=0, FCN=3 ----->| 2434 |-----W=0, FCN=2 ----->| 2435 |-----W=0, FCN=1 ----->| 2436 |-----W=0, FCN=0 ----->| 2437 | |lcl-Bitmap:110111111111101111111111 2438 |<------ACK, W=0-------|encoded Bitmap:1101111111111011 2439 |-----W=0, FCN=21----->| 2440 |-----W=0, FCN=10----->| 2441 |<------ACK, W=0-------|no Bitmap 2442 |-----W=1, FCN=23----->| 2443 |-----W=1, FCN=22----->| 2444 |-----W=1, FCN=21----->| 2445 |--W=1, FCN=31 + MIC-->|MIC checked: sucess => 2446 |<------ACK, W=1-------|no Bitmap 2447 (End) 2449 Figure 37: Transmission in ACK-Always mode of an IPv6 packet carried 2450 by 28 fragments, with N=5, MAX_WIND_FCN=23 and two lost fragments. 2452 Appendix C. Fragmentation State Machines 2454 The fragmentation state machines of the sender and the receiver, one 2455 for each of the different reliability modes, are described in the 2456 following figures: 2458 +===========+ 2459 +------------+ Init | 2460 | FCN=0 +===========+ 2461 | No Window 2462 | No Bitmap 2463 | +-------+ 2464 | +========+==+ | More Fragments 2465 | | | <--+ ~~~~~~~~~~~~~~~~~~~~ 2466 +--------> | Send | send Fragment (FCN=0) 2467 +===+=======+ 2468 | last fragment 2469 | ~~~~~~~~~~~~ 2470 | FCN = 1 2471 v send fragment+MIC 2472 +============+ 2473 | END | 2474 +============+ 2476 Figure 38: Sender State Machine for the No-ACK Mode 2478 +------+ Not All-1 2479 +==========+=+ | ~~~~~~~~~~~~~~~~~~~ 2480 | + <--+ set Inactivity Timer 2481 | RCV Frag +-------+ 2482 +=+===+======+ |All-1 & 2483 All-1 & | | |MIC correct 2484 MIC wrong | |Inactivity | 2485 | |Timer Exp. | 2486 v | | 2487 +==========++ | v 2488 | Error |<-+ +========+==+ 2489 +===========+ | END | 2490 +===========+ 2492 Figure 39: Receiver State Machine for the No-ACK Mode 2493 +=======+ 2494 | INIT | FCN!=0 & more frags 2495 | | ~~~~~~~~~~~~~~~~~~~~~~ 2496 +======++ +--+ send Window + frag(FCN) 2497 W=0 | | | FCN- 2498 Clear local Bitmap | | v set local Bitmap 2499 FCN=max value | ++==+========+ 2500 +> | | 2501 +---------------------> | SEND | 2502 | +==+===+=====+ 2503 | FCN==0 & more frags | | last frag 2504 | ~~~~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~ 2505 | set local-Bitmap | | set local-Bitmap 2506 | send wnd + frag(all-0) | | send wnd+frag(all-1)+MIC 2507 | set Retrans_Timer | | set Retrans_Timer 2508 | | | 2509 |Recv_wnd == wnd & | | 2510 |Lcl_Bitmap==recv_Bitmap& | | +----------------------+ 2511 |more frag | | |lcl-Bitmap!=rcv-Bitmap| 2512 |~~~~~~~~~~~~~~~~~~~~~~ | | | ~~~~~~~~~ | 2513 |Stop Retrans_Timer | | | Attemp++ v 2514 |clear local_Bitmap v v | +=====+=+ 2515 |window=next_window +====+===+==+===+ |Resend | 2516 +---------------------+ | |Missing| 2517 +----+ Wait | |Frag | 2518 not expected wnd | | Bitmap | +=======+ 2519 ~~~~~~~~~~~~~~~~ +--->+ ++Retrans_Timer Exp | 2520 discard frag +==+=+===+=+==+=+| ~~~~~~~~~~~~~~~~~ | 2521 | | | ^ ^ |reSend(empty)All-* | 2522 | | | | | |Set Retrans_Timer | 2523 MIC_bit==1 & | | | | +--+Attemp++ | 2524 Recv_window==window & | | | +-------------------------+ 2525 Lcl_Bitmap==recv_Bitmap &| | | all missing frag sent 2526 no more frag| | | ~~~~~~~~~~~~~~~~~~~~~~ 2527 ~~~~~~~~~~~~~~~~~~~~~~~~| | | Set Retrans_Timer 2528 Stop Retrans_Timer| | | 2529 +=============+ | | | 2530 | END +<--------+ | | Attemp > MAX_ACK_REQUESTS 2531 +=============+ | | ~~~~~~~~~~~~~~~~~~ 2532 All-1 Window | v Send Abort 2533 ~~~~~~~~~~~~ | +=+===========+ 2534 MIC_bit ==0 & +>| ERROR | 2535 Lcl_Bitmap==recv_Bitmap +=============+ 2537 Figure 40: Sender State Machine for the ACK-Always Mode 2539 Not All- & w=expected +---+ +---+w = Not expected 2540 ~~~~~~~~~~~~~~~~~~~~~ | | | |~~~~~~~~~~~~~~~~ 2541 Set local_Bitmap(FCN) | v v |discard 2542 ++===+===+===+=+ 2543 +---------------------+ Rcv +--->* ABORT 2544 | +------------------+ Window | 2545 | | +=====+==+=====+ 2546 | | All-0 & w=expect | ^ w =next & not-All 2547 | | ~~~~~~~~~~~~~~~~~~ | |~~~~~~~~~~~~~~~~~~~~~ 2548 | | set lcl_Bitmap(FCN)| |expected = next window 2549 | | send local_Bitmap | |Clear local_Bitmap 2550 | | | | 2551 | | w=expct & not-All | | 2552 | | ~~~~~~~~~~~~~~~~~~ | | 2553 | | set lcl_Bitmap(FCN)+-+ | | +--+ w=next & All-0 2554 | | if lcl_Bitmap full | | | | | | ~~~~~~~~~~~~~~~ 2555 | | send lcl_Bitmap | | | | | | expct = nxt wnd 2556 | | v | v | | | Clear lcl_Bitmap 2557 | | w=expct & All-1 +=+=+=+==+=++ | set lcl_Bitmap(FCN) 2558 | | ~~~~~~~~~~~ +->+ Wait +<+ send lcl_Bitmap 2559 | | discard +--| Next | 2560 | | All-0 +---------+ Window +--->* ABORT 2561 | | ~~~~~ +-------->+========+=++ 2562 | | snd lcl_bm All-1 & w=next| | All-1 & w=nxt 2563 | | & MIC wrong| | & MIC right 2564 | | ~~~~~~~~~~~~~~~~~| | ~~~~~~~~~~~~~~~~~~ 2565 | | set local_Bitmap(FCN)| |set lcl_Bitmap(FCN) 2566 | | send local_Bitmap| |send local_Bitmap 2567 | | | +----------------------+ 2568 | |All-1 & w=expct | | 2569 | |& MIC wrong v +---+ w=expctd & | 2570 | |~~~~~~~~~~~~~~~~~~~~ +====+=====+ | MIC wrong | 2571 | |set local_Bitmap(FCN) | +<+ ~~~~~~~~~~~~~~ | 2572 | |send local_Bitmap | Wait End | set lcl_btmp(FCN)| 2573 | +--------------------->+ +--->* ABORT | 2574 | +===+====+=+-+ All-1&MIC wrong| 2575 | | ^ | ~~~~~~~~~~~~~~~| 2576 | w=expected & MIC right | +---+ send lcl_btmp | 2577 | ~~~~~~~~~~~~~~~~~~~~~~ | | 2578 | set local_Bitmap(FCN) | +-+ Not All-1 | 2579 | send local_Bitmap | | | ~~~~~~~~~ | 2580 | | | | discard | 2581 |All-1 & w=expctd & MIC right | | | | 2582 |~~~~~~~~~~~~~~~~~~~~~~~~~~~~ v | v +----+All-1 | 2583 |set local_Bitmap(FCN) +=+=+=+=+==+ |~~~~~~~~~ | 2584 |send local_Bitmap | +<+Send lcl_btmp | 2585 +-------------------------->+ END | | 2586 +==========+<---------------+ 2588 --->* ABORT 2589 ~~~~~~~ 2590 Inactivity_Timer = expires 2591 When DWN_Link 2592 IF Inactivity_Timer expires 2593 Send DWL Request 2594 Attemp++ 2596 Figure 41: Receiver State Machine for the ACK-Always Mode 2597 +=======+ 2598 | | 2599 | INIT | 2600 | | FCN!=0 & more frags 2601 +======++ +--+ ~~~~~~~~~~~~~~~~~~~~~~ 2602 W=0 | | | send Window + frag(FCN) 2603 ~~~~~~~~~~~~~~~~~~ | | | FCN- 2604 Clear local Bitmap | | v set local Bitmap 2605 FCN=max value | ++=============+ 2606 +> | | 2607 | SEND | 2608 +-------------------------> | | 2609 | ++=====+=======+ 2610 | FCN==0 & more frags| |last frag 2611 | ~~~~~~~~~~~~~~~~~~~~~~~| |~~~~~~~~~~~~~~~~~ 2612 | set local-Bitmap| |set local-Bitmap 2613 | send wnd + frag(all-0)| |send wnd+frag(all-1)+MIC 2614 | set Retrans_Timer| |set Retrans_Timer 2615 | | | 2616 |Retrans_Timer expires & | | lcl-Bitmap!=rcv-Bitmap 2617 |more fragments | | ~~~~~~~~~~~~~~~~~~~~~~ 2618 |~~~~~~~~~~~~~~~~~~~~ | | Attemp++ 2619 |stop Retrans_Timer | | +-----------------+ 2620 |clear local-Bitmap v v | v 2621 |window = next window +=====+=====+==+==+ +====+====+ 2622 +----------------------+ + | Resend | 2623 +--------------------->+ Wait Bitmap | | Missing | 2624 | +-- + | | Frag | 2625 | not expected wnd | ++=+===+===+===+==+ +======+==+ 2626 | ~~~~~~~~~~~~~~~~ | ^ | | | ^ | 2627 | discard frag +----+ | | | +-------------------+ 2628 | | | | all missing frag sent 2629 |Retrans_Timer expires & | | | ~~~~~~~~~~~~~~~~~~~~~ 2630 | No more Frag | | | Set Retrans_Timer 2631 | ~~~~~~~~~~~~~~~~~~~~~~~ | | | 2632 | Stop Retrans_Timer | | | 2633 | Send ALL-1-empty | | | 2634 +-------------------------+ | | 2635 | | 2636 Local_Bitmap==Recv_Bitmap| | 2637 ~~~~~~~~~~~~~~~~~~~~~~~~~| |Attemp > MAX_ACK_REQUESTS 2638 +=========+Stop Retrans_Timer | |~~~~~~~~~~~~~~~~~~~~~~~ 2639 | END +<------------------+ v Send Abort 2640 +=========+ +=+=========+ 2641 | ERROR | 2642 +===========+ 2644 Figure 42: Sender State Machine for the ACK-on-Error Mode 2646 Not All- & w=expected +---+ +---+w = Not expected 2647 ~~~~~~~~~~~~~~~~~~~~~ | | | |~~~~~~~~~~~~~~~~ 2648 Set local_Bitmap(FCN) | v v |discard 2649 ++===+===+===+=+ 2650 +-----------------------+ +--+ All-0 & full 2651 | ABORT *<---+ Rcv Window | | ~~~~~~~~~~~~ 2652 | +--------------------+ +<-+ w =next 2653 | | All-0 empty +->+=+=+===+======+ clear lcl_Bitmap 2654 | | ~~~~~~~~~~~ | | | ^ 2655 | | send bitmap +----+ | |w=expct & not-All & full 2656 | | | |~~~~~~~~~~~~~~~~~~~~~~~~ 2657 | | | |set lcl_Bitmap; w =nxt 2658 | | | | 2659 | | All-0 & w=expect | | w=next 2660 | | & no_full Bitmap | | ~~~~~~~~ +========+ 2661 | | ~~~~~~~~~~~~~~~~~ | | Send abort| Error/ | 2662 | | send local_Bitmap | | +---------->+ Abort | 2663 | | | | | +-------->+========+ 2664 | | v | | | all-1 ^ 2665 | | All-0 empty +====+===+==+=+=+ ~~~~~~~ | 2666 | | ~~~~~~~~~~~~~ +--+ Wait | Send abort | 2667 | | send lcl_btmp +->| Missing Fragm.| | 2668 | | +==============++ | 2669 | | +--------------+ 2670 | | Uplink Only & 2671 | | Inactivity_Timer = expires 2672 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 2673 | | Send Abort 2674 | |All-1 & w=expect & MIC wrong 2675 | |~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-+ All-1 2676 | |set local_Bitmap(FCN) | v ~~~~~~~~~~ 2677 | |send local_Bitmap +===========+==+ snd lcl_btmp 2678 | +--------------------->+ Wait End +-+ 2679 | +=====+=+====+=+ | w=expct & 2680 | w=expected & MIC right | | ^ | MIC wrong 2681 | ~~~~~~~~~~~~~~~~~~~~~~ | | +---+ ~~~~~~~~~ 2682 | set & send local_Bitmap(FCN) | | set lcl_Bitmap(FCN) 2683 | | | 2684 |All-1 & w=expected & MIC right | +-->* ABORT 2685 |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ v 2686 |set & send local_Bitmap(FCN) +=+==========+ 2687 +---------------------------->+ END | 2688 +============+ 2689 --->* ABORT 2690 Only Uplink 2691 Inactivity_Timer = expires 2692 ~~~~~~~~~~~~~~~~~~~~~~~~~~ 2693 Send Abort 2695 Figure 43: Receiver State Machine for the ACK-on-Error Mode 2697 Appendix D. SCHC Parameters - Ticket #15 2699 This section gives the list of parameters that need to be defined in 2700 the technology-specific documents, technology developers must 2701 evaluate that L2 has strong enough integrity checking to match SCHC's 2702 assumption: 2704 o LPWAN Architecture. Explain the SCHC entities (Compression and 2705 Fragmentation), how/where are they be represented in the 2706 corresponding technology architecture. 2708 o L2 fragmentation decision 2710 o Rule ID number of rules 2712 o Size of the Rule ID 2714 o The way the Rule ID is sent (L2 or L3) and how (describe) 2716 o Fragmentation delivery reliability mode used in which cases 2718 o Define the number of bits FCN (N) and DTag (T) 2720 o The MIC algorithm to be used and the size if different from the 2721 default CRC32 2723 o Retransmission Timer duration 2725 o Inactivity Timer duration 2727 o Define the MAX_ACK_REQUEST (number of attempts) 2729 o Use of padding or not and how and when to use it 2731 o Take into account that the length of rule-id + N + T + W when 2732 possible is good to have a multiple of 8 bits to complete a byte 2733 and avoid padding 2735 o In the ACK format to have a length for Rule-ID + T + W bit into a 2736 complete number of byte to do optimization more easily 2738 o The technology documents will describe if Rule ID is constrained 2739 by any alignment 2741 And the following parameters need to be addressed in another document 2742 but not forcely in the technology-specific one: 2744 o The way the contexts are provisioning 2746 o The way the Rules as generated 2748 Appendix E. Note 2750 Carles Gomez has been funded in part by the Spanish Government 2751 (Ministerio de Educacion, Cultura y Deporte) through the Jose 2752 Castillejo grant CAS15/00336, and by the ERDF and the Spanish 2753 Government through project TEC2016-79988-P. Part of his contribution 2754 to this work has been carried out during his stay as a visiting 2755 scholar at the Computer Laboratory of the University of Cambridge. 2757 Authors' Addresses 2759 Ana Minaburo 2760 Acklio 2761 2bis rue de la Chataigneraie 2762 35510 Cesson-Sevigne Cedex 2763 France 2765 Email: ana@ackl.io 2767 Laurent Toutain 2768 IMT-Atlantique 2769 2 rue de la Chataigneraie 2770 CS 17607 2771 35576 Cesson-Sevigne Cedex 2772 France 2774 Email: Laurent.Toutain@imt-atlantique.fr 2776 Carles Gomez 2777 Universitat Politecnica de Catalunya 2778 C/Esteve Terradas, 7 2779 08860 Castelldefels 2780 Spain 2782 Email: carlesgo@entel.upc.edu