idnits 2.17.1 draft-ietf-lpwan-ipv6-static-context-hc-23.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (November 28, 2019) is 1608 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Downref: Normative reference to an Informational RFC: RFC 8376 Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 lpwan Working Group A. Minaburo 3 Internet-Draft Acklio 4 Intended status: Standards Track L. Toutain 5 Expires: May 31, 2020 IMT-Atlantique 6 C. Gomez 7 Universitat Politecnica de Catalunya 8 D. Barthel 9 Orange Labs 10 JC. Zuniga 11 SIGFOX 12 November 28, 2019 14 Static Context Header Compression (SCHC) and fragmentation for LPWAN, 15 application to UDP/IPv6 16 draft-ietf-lpwan-ipv6-static-context-hc-23 18 Abstract 20 This document defines the Static Context Header Compression (SCHC) 21 framework, which provides both a header compression mechanism and an 22 optional fragmentation mechanism. SCHC has been designed for Low 23 Power Wide Area Networks (LPWAN). 25 SCHC compression is based on a common static context stored both in 26 the LPWAN device and in the network infrastructure side. This 27 document defines a generic header compression mechanism and its 28 application to compress IPv6/UDP headers. 30 This document also specifies an optional fragmentation and reassembly 31 mechanism. It can be used to support the IPv6 MTU requirement over 32 the LPWAN technologies. Fragmentation is needed for IPv6 datagrams 33 that, after SCHC compression or when such compression was not 34 possible, still exceed the layer-2 maximum payload size. 36 The SCHC header compression and fragmentation mechanisms are 37 independent of the specific LPWAN technology over which they are 38 used. This document defines generic functionalities and offers 39 flexibility with regard to parameter settings and mechanism choices. 40 This document standardizes the exchange over the LPWAN between two 41 SCHC entities. Settings and choices specific to a technology or a 42 product are expected to be grouped into profiles, which are specified 43 in other documents. Data models for the context and profiles are out 44 of scope. 46 Status of This Memo 48 This Internet-Draft is submitted in full conformance with the 49 provisions of BCP 78 and BCP 79. 51 Internet-Drafts are working documents of the Internet Engineering 52 Task Force (IETF). Note that other groups may also distribute 53 working documents as Internet-Drafts. The list of current Internet- 54 Drafts is at https://datatracker.ietf.org/drafts/current/. 56 Internet-Drafts are draft documents valid for a maximum of six months 57 and may be updated, replaced, or obsoleted by other documents at any 58 time. It is inappropriate to use Internet-Drafts as reference 59 material or to cite them other than as "work in progress." 61 This Internet-Draft will expire on May 31, 2020. 63 Copyright Notice 65 Copyright (c) 2019 IETF Trust and the persons identified as the 66 document authors. All rights reserved. 68 This document is subject to BCP 78 and the IETF Trust's Legal 69 Provisions Relating to IETF Documents 70 (https://trustee.ietf.org/license-info) in effect on the date of 71 publication of this document. Please review these documents 72 carefully, as they describe your rights and restrictions with respect 73 to this document. Code Components extracted from this document must 74 include Simplified BSD License text as described in Section 4.e of 75 the Trust Legal Provisions and are provided without warranty as 76 described in the Simplified BSD License. 78 Table of Contents 80 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 81 2. Requirements Notation . . . . . . . . . . . . . . . . . . . . 5 82 3. LPWAN Architecture . . . . . . . . . . . . . . . . . . . . . 5 83 4. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 6 84 5. SCHC overview . . . . . . . . . . . . . . . . . . . . . . . . 8 85 5.1. SCHC Packet format . . . . . . . . . . . . . . . . . . . 10 86 5.2. Functional mapping . . . . . . . . . . . . . . . . . . . 11 87 6. Rule ID . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 88 7. Compression/Decompression . . . . . . . . . . . . . . . . . . 12 89 7.1. SCHC C/D Rules . . . . . . . . . . . . . . . . . . . . . 13 90 7.2. Rule ID for SCHC C/D . . . . . . . . . . . . . . . . . . 15 91 7.3. Packet processing . . . . . . . . . . . . . . . . . . . . 15 92 7.4. Matching operators . . . . . . . . . . . . . . . . . . . 17 93 7.5. Compression Decompression Actions (CDA) . . . . . . . . . 18 94 7.5.1. processing fixed-length fields . . . . . . . . . . . 19 95 7.5.2. processing variable-length fields . . . . . . . . . . 19 96 7.5.3. not-sent CDA . . . . . . . . . . . . . . . . . . . . 20 97 7.5.4. value-sent CDA . . . . . . . . . . . . . . . . . . . 20 98 7.5.5. mapping-sent CDA . . . . . . . . . . . . . . . . . . 20 99 7.5.6. LSB CDA . . . . . . . . . . . . . . . . . . . . . . . 21 100 7.5.7. DevIID, AppIID CDA . . . . . . . . . . . . . . . . . 21 101 7.5.8. Compute-* . . . . . . . . . . . . . . . . . . . . . . 21 102 8. Fragmentation/Reassembly . . . . . . . . . . . . . . . . . . 22 103 8.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 22 104 8.2. SCHC F/R Protocol Elements . . . . . . . . . . . . . . . 22 105 8.2.1. Messages . . . . . . . . . . . . . . . . . . . . . . 22 106 8.2.2. Tiles, Windows, Bitmaps, Timers, Counters . . . . . . 23 107 8.2.3. Integrity Checking . . . . . . . . . . . . . . . . . 25 108 8.2.4. Header Fields . . . . . . . . . . . . . . . . . . . . 26 109 8.3. SCHC F/R Message Formats . . . . . . . . . . . . . . . . 28 110 8.3.1. SCHC Fragment format . . . . . . . . . . . . . . . . 28 111 8.3.2. SCHC ACK format . . . . . . . . . . . . . . . . . . . 30 112 8.3.3. SCHC ACK REQ format . . . . . . . . . . . . . . . . . 32 113 8.3.4. SCHC Sender-Abort format . . . . . . . . . . . . . . 33 114 8.3.5. SCHC Receiver-Abort format . . . . . . . . . . . . . 33 115 8.4. SCHC F/R modes . . . . . . . . . . . . . . . . . . . . . 34 116 8.4.1. No-ACK mode . . . . . . . . . . . . . . . . . . . . . 34 117 8.4.2. ACK-Always mode . . . . . . . . . . . . . . . . . . . 36 118 8.4.3. ACK-on-Error mode . . . . . . . . . . . . . . . . . . 43 119 9. Padding management . . . . . . . . . . . . . . . . . . . . . 51 120 10. SCHC Compression for IPv6 and UDP headers . . . . . . . . . . 52 121 10.1. IPv6 version field . . . . . . . . . . . . . . . . . . . 52 122 10.2. IPv6 Traffic class field . . . . . . . . . . . . . . . . 52 123 10.3. Flow label field . . . . . . . . . . . . . . . . . . . . 52 124 10.4. Payload Length field . . . . . . . . . . . . . . . . . . 53 125 10.5. Next Header field . . . . . . . . . . . . . . . . . . . 53 126 10.6. Hop Limit field . . . . . . . . . . . . . . . . . . . . 53 127 10.7. IPv6 addresses fields . . . . . . . . . . . . . . . . . 53 128 10.7.1. IPv6 source and destination prefixes . . . . . . . . 54 129 10.7.2. IPv6 source and destination IID . . . . . . . . . . 54 130 10.8. IPv6 extension headers . . . . . . . . . . . . . . . . . 54 131 10.9. UDP source and destination ports . . . . . . . . . . . . 55 132 10.10. UDP length field . . . . . . . . . . . . . . . . . . . . 55 133 10.11. UDP Checksum field . . . . . . . . . . . . . . . . . . . 55 134 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 56 135 12. Security considerations . . . . . . . . . . . . . . . . . . . 56 136 12.1. Security considerations for SCHC 137 Compression/Decompression . . . . . . . . . . . . . . . 56 138 12.1.1. Forged SCHC Packet . . . . . . . . . . . . . . . . . 56 139 12.1.2. Compressed packet size as a side channel to guess a 140 secret token . . . . . . . . . . . . . . . . . . . . 57 141 12.1.3. decompressed packet different from the original 142 packet . . . . . . . . . . . . . . . . . . . . . . . 58 143 12.2. Security considerations for SCHC 144 Fragmentation/Reassembly . . . . . . . . . . . . . . . . 58 145 12.2.1. Buffer reservation attack . . . . . . . . . . . . . 58 146 12.2.2. Corrupt Fragment attack . . . . . . . . . . . . . . 59 147 12.2.3. Fragmentation as a way to bypass Network Inspection 59 148 12.2.4. Privacy issues associated with SCHC header fields . 59 149 13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 60 150 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 60 151 14.1. Normative References . . . . . . . . . . . . . . . . . . 60 152 14.2. Informative References . . . . . . . . . . . . . . . . . 61 153 Appendix A. Compression Examples . . . . . . . . . . . . . . . . 61 154 Appendix B. Fragmentation Examples . . . . . . . . . . . . . . . 64 155 Appendix C. Fragmentation State Machines . . . . . . . . . . . . 72 156 Appendix D. SCHC Parameters . . . . . . . . . . . . . . . . . . 78 157 Appendix E. Supporting multiple window sizes for fragmentation . 80 158 Appendix F. ACK-Always and ACK-on-Error on quasi-bidirectional 159 links . . . . . . . . . . . . . . . . . . . . . . . 80 160 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 82 162 1. Introduction 164 This document defines the Static Context Header Compression (SCHC) 165 framework, which provides both a header compression mechanism and an 166 optional fragmentation mechanism. SCHC has been designed for Low 167 Power Wide Area Networks (LPWAN). 169 LPWAN technologies impose some strict limitations on traffic. For 170 instance, devices sleep most of the time and may only receive data 171 during short periods of time after transmission, in order to preserve 172 battery. LPWAN technologies are also characterized by a greatly 173 reduced data unit and/or payload size (see [RFC8376]). 175 Header compression is needed for efficient Internet connectivity to a 176 node within an LPWAN network. The following properties of LPWAN 177 networks can be exploited to get an efficient header compression: 179 o The network topology is star-oriented, which means that all 180 packets between the same source-destination pair follow the same 181 path. For the needs of this document, the architecture can simply 182 be described as Devices (Dev) exchanging information with LPWAN 183 Application Servers (App) through a Network Gateway (NGW). 185 o Because devices embed built-in applications, the traffic flows to 186 be compressed are known in advance. Indeed, new applications are 187 less frequently installed in an LPWAN device, than they are in a 188 general-purpose computer or smartphone. 190 SCHC compression uses a Context (a set of Rules) in which information 191 about header fields is stored. This Context is static: the values of 192 the header fields and the actions to do compression/decompression do 193 not change over time. This avoids the need for complex 194 resynchronization mechanisms. Indeed, a return path may be more 195 restricted/expensive, sometimes completely unavailable [RFC8376]. A 196 compression protocol that relies on feedback is not compatible with 197 the characteristics of such LPWANs. 199 In most cases, a small Rule identifier is enough to represent the 200 full IPv6/UDP headers. The SCHC header compression mechanism is 201 independent of the specific LPWAN technology over which it is used. 203 Furthermore, some LPWAN technologies do not provide a fragmentation 204 functionality; to support the IPv6 MTU requirement of 1280 bytes 205 [RFC8200], they require a fragmentation protocol at the adaptation 206 layer below IPv6. Accordingly, this document defines an optional 207 fragmentation/reassembly mechanism for LPWAN technologies to support 208 the IPv6 MTU requirement. 210 This document defines generic functionality and offers flexibility 211 with regard to parameters settings and mechanism choices. 212 Technology-specific settings are expected to be grouped into Profiles 213 specified in other documents. 215 2. Requirements Notation 217 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 218 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 219 "OPTIONAL" in this document are to be interpreted as described in BCP 220 14 [RFC2119] [RFC8174] when, and only when, they appear in all 221 capitals, as shown here. 223 3. LPWAN Architecture 225 LPWAN network architectures are similar among them, but each LPWAN 226 technology names architecture elements differently. In this 227 document, we use terminology from [RFC8376], which identifies the 228 following entities in a typical LPWAN network (see Figure 1): 230 o Devices (Dev) are the end-devices or hosts (e.g. sensors, 231 actuators, etc.). There can be a very high density of devices per 232 radio gateway. 234 o The Radio Gateway (RGW) is the end point of the constrained link. 236 o The Network Gateway (NGW) is the interconnection node between the 237 Radio Gateway and the Internet. 239 o Application Server (App) is the end point of the application level 240 protocol on the Internet side. 242 () () () | 243 () () () () / \ +---------+ 244 () () () () () () / \======| ^ | +-----------+ 245 () () () | | <--|--> | |Application| 246 () () () () / \==========| v |=============| (App) | 247 () () () / \ +---------+ +-----------+ 248 Dev Radio Gateways NGW 250 Figure 1: LPWAN Architecture, simplified from that shown in RFC8376 252 4. Terminology 254 This section defines the terminology and acronyms used in this 255 document. It extends the terminology of [RFC8376]. 257 The SCHC acronym is pronounced like "sheek" in English (or "chic" in 258 French). Therefore, this document writes "a SCHC Packet" instead of 259 "an SCHC Packet". 261 o App: LPWAN Application, as defined by [RFC8376]. An application 262 sending/receiving packets to/from the Dev. 264 o AppIID: Application Interface Identifier. The IID that identifies 265 the application server interface. 267 o Bi: Bidirectional. Characterizes a Field Descriptor that applies 268 to headers of packets traveling in either direction (Up and Dw, 269 see this glossary). 271 o CDA: Compression/Decompression Action. Describes the pair of 272 inverse actions that are performed at the compressor to compress a 273 header field and at the decompressor to recover the original value 274 of the header field. 276 o Compression Residue. The bits that remain to be sent (beyond the 277 Rule ID itself) after applying the SCHC compression. 279 o Context: A set of Rules used to compress/decompress headers. 281 o Dev: Device, as defined by [RFC8376]. 283 o DevIID: Device Interface Identifier. The IID that identifies the 284 Dev interface. 286 o DI: Direction Indicator. This field tells which direction of 287 packet travel (Up, Dw or Bi) a Field Description applies to. This 288 allows for asymmetric processing, using the same Rule. 290 o Dw: Downlink direction for compression/decompression, from SCHC C/ 291 D in the network to SCHC C/D in the Dev. 293 o Field Description. A tuple containing identifier, value, matching 294 operator and actions to be applied to a field. 296 o FID: Field Identifier. This identifies the protocol and field a 297 Field Description applies to. 299 o FL: Field Length is the length of the packet header field. It is 300 expressed in bits for header fields of fixed lengths or as a type 301 (e.g. variable, token length, ...) for field lengths that are 302 unknown at the time of Rule creation. The length of a header 303 field is defined in the corresponding protocol specification (such 304 as IPv6 or UDP). 306 o FP: when a Field is expected to appear multiple times in a header, 307 Field Position specifies the occurrence this Field Description 308 applies to (for example, first uri-path option, second uri-path, 309 etc. in a CoAP header). 311 o IID: Interface Identifier. See the IPv6 addressing architecture 312 [RFC7136] 314 o L2: Layer two. The immediate lower layer SCHC interfaces with. 315 It is provided by an underlying LPWAN technology. It does not 316 necessarily correspond to the OSI model definition of Layer 2. 318 o L2 Word: this is the minimum subdivision of payload data that the 319 L2 will carry. In most L2 technologies, the L2 Word is an octet. 320 In bit-oriented radio technologies, the L2 Word might be a single 321 bit. The L2 Word size is assumed to be constant over time for 322 each device. 324 o MO: Matching Operator. An operator used to match a value 325 contained in a header field with a value contained in a Rule. 327 o Padding (P). Extra bits that may be appended by SCHC to a data 328 unit that it passes to the underlying Layer 2 for transmission. 329 SCHC itself operates on bits, not bytes, and does not have any 330 alignment prerequisite. See Section 9. 332 o Profile: SCHC offers variations in the way it is operated, with a 333 number of parameters listed in Appendix D. A Profile indicates a 334 particular setting of all these parameters. Both ends of a SCHC 335 communication must be provisioned with the same Profile 336 information and with the same set of Rules before the 337 communication starts, so that there is no ambiguity in how they 338 expect to communicate. 340 o Rule: A set of Field Descriptions. 342 o Rule ID (Rule Identifier): An identifier for a Rule. SCHC C/D on 343 both sides share the same Rule ID for a given packet. A set of 344 Rule IDs are used to support SCHC F/R functionality. 346 o SCHC C/D: SCHC Compressor/Decompressor. A mechanism used on both 347 sides, at the Dev and at the network, to achieve Compression/ 348 Decompression of headers. 350 o SCHC F/R: SCHC Fragmentation / Reassembly. A mechanism used on 351 both sides, at the Dev and at the network, to achieve 352 Fragmentation / Reassembly of SCHC Packets. 354 o SCHC Packet: A packet (e.g. an IPv6 packet) whose header has been 355 compressed as per the header compression mechanism defined in this 356 document. If the header compression process is unable to actually 357 compress the packet header, the packet with the uncompressed 358 header is still called a SCHC Packet (in this case, a Rule ID is 359 used to indicate that the packet header has not been compressed). 360 See Section 7 for more details. 362 o TV: Target value. A value contained in a Rule that will be 363 matched with the value of a header field. 365 o Up: Uplink direction for compression/decompression, from the Dev 366 SCHC C/D to the network SCHC C/D. 368 Additional terminology for the optional SCHC Fragmentation / 369 Reassembly mechanism (SCHC F/R) is found in Section 8.2. 371 5. SCHC overview 373 SCHC can be characterized as an adaptation layer between an upper 374 layer (typically, IPv6) and an underlying layer (typically, an LPWAN 375 technology). SCHC comprises two sublayers (i.e. the Compression 376 sublayer and the Fragmentation sublayer), as shown in Figure 2. 378 +----------------+ 379 | IPv6 | 380 +- +----------------+ 381 | | Compression | 382 SCHC < +----------------+ 383 | | Fragmentation | 384 +- +----------------+ 385 |LPWAN technology| 386 +----------------+ 388 Figure 2: Protocol stack comprising IPv6, SCHC and an LPWAN 389 technology 391 Before an upper layer packet (e.g. an IPv6 packet) is transmitted to 392 the underlying layer, header compression is first attempted. The 393 resulting packet is called a SCHC Packet, whether or not any 394 compression is performed. If needed by the underlying layer, the 395 optional SCHC Fragmentation MAY be applied to the SCHC Packet. The 396 inverse operations take place at the receiver. This process is 397 illustrated in Figure 3. 399 A packet (e.g. an IPv6 packet) 400 | ^ 401 v | 402 +------------------+ +--------------------+ 403 | SCHC Compression | | SCHC Decompression | 404 +------------------+ +--------------------+ 405 | ^ 406 | If no fragmentation (*) | 407 +-------------- SCHC Packet -------------->| 408 | | 409 v | 410 +--------------------+ +-----------------+ 411 | SCHC Fragmentation | | SCHC Reassembly | 412 +--------------------+ +-----------------+ 413 | ^ | ^ 414 | | | | 415 | +---------- SCHC ACK (+) -------------+ | 416 | | 417 +-------------- SCHC Fragments -------------------+ 419 Sender Receiver 421 *: the decision to not use SCHC Fragmentation is left to each Profile. 422 +: optional, depends on Fragmentation mode. 424 Figure 3: SCHC operations at the Sender and the Receiver 426 5.1. SCHC Packet format 428 The SCHC Packet is composed of the Compressed Header followed by the 429 payload from the original packet (see Figure 4). The Compressed 430 Header itself is composed of the Rule ID and a Compression Residue, 431 which is the output of compressing the packet header with that Rule 432 (see Section 7). The Compression Residue may be empty. Both the 433 Rule ID and the Compression Residue potentially have a variable size, 434 and are not necessarily a multiple of bytes in size. 436 |------- Compressed Header -------| 437 +---------------------------------+--------------------+ 438 | Rule ID | Compression Residue | Payload | 439 +---------------------------------+--------------------+ 441 Figure 4: SCHC Packet 443 5.2. Functional mapping 445 Figure 5 maps the functional elements of Figure 3 onto the LPWAN 446 architecture elements of Figure 1. 448 Dev App 449 +----------------+ +----+ +----+ +----+ 450 | App1 App2 App3 | |App1| |App2| |App3| 451 | | | | | | | | 452 | UDP | |UDP | |UDP | |UDP | 453 | IPv6 | |IPv6| |IPv6| |IPv6| 454 | | | | | | | | 455 |SCHC C/D and F/R| | | | | | | 456 +--------+-------+ +----+ +----+ +----+ 457 | +---+ +---+ +----+ +----+ . . . 458 +~ |RGW| === |NGW| == |SCHC| == |SCHC|...... Internet .... 459 +---+ +---+ |F/R | |C/D | 460 +----+ +----+ 462 Figure 5: Architecture 464 SCHC C/D and SCHC F/R are located on both sides of the LPWAN 465 transmission, hereafter called "the Dev side" and "the Network 466 infrastructure side". 468 The operation in the Uplink direction is as follows. The Device 469 application uses IPv6 or IPv6/UDP protocols. Before sending the 470 packets, the Dev compresses their headers using SCHC C/D and, if the 471 SCHC Packet resulting from the compression needs to be fragmented by 472 SCHC, SCHC F/R is performed (see Section 8). The resulting SCHC 473 Fragments are sent to an LPWAN Radio Gateway (RGW) which forwards 474 them to a Network Gateway (NGW). The NGW sends the data to a SCHC F/ 475 R for re-assembly (if needed) and then to the SCHC C/D for 476 decompression. After decompression, the packet can be sent over the 477 Internet to one or several LPWAN Application Servers (App). 479 The SCHC F/R and C/D on the Network infrastructure side can be part 480 of the NGW, or located in the Internet as long as a tunnel is 481 established between them and the NGW. For some LPWAN technologies, 482 it may be suitable to locate the SCHC F/R functionality nearer the 483 NGW, in order to better deal with time constraints of such 484 technologies. 486 The SCHC C/Ds on both sides MUST share the same set of Rules. So 487 MUST the SCHC F/Rs on both sides. 489 The operation in the Downlink direction is similar to that in the 490 Uplink direction, only reversing the order in which the architecture 491 elements are traversed. 493 6. Rule ID 495 Rule IDs identify the Rules used for Compression/Decompression or for 496 Fragmentation/Reassembly. 498 The scope of the Rule ID of a Compression/Decompression Rule is the 499 link between the SCHC C/D in a given Dev and the corresponding SCHC 500 C/D in the Network insfractructure side. The scope of the Rule ID of 501 a Fragmentation/Reassembly Rule is the link between the SCHC F/R in a 502 given Dev and the corresponding SCHC F/R in the Network 503 insfractructure side. If such a link is bidirectional, the scope 504 includes both directions. 506 Inside their scopes, Rules for Compression/Decompression and Rules 507 for Fragmentation/Reassembly share the same Rule ID space. 509 The size of the Rule IDs is not specified in this document, as it is 510 implementation-specific and can vary according to the LPWAN 511 technology and the number of Rules, among others. It is defined in 512 Profiles. 514 The Rule IDs are used: 516 o For SCHC C/D, to identify the Rule (i.e., the set of Field 517 Descriptions) that is used to compress a packet header. 519 * At least one Rule ID MUST be allocated to tagging packets for 520 which SCHC compression was not possible (no matching 521 compression Rule was found). 523 o In SCHC F/R, to identify the specific mode and settings of F/R for 524 one direction of traffic (Up or Dw). 526 * When F/R is used for both communication directions, at least 527 two Rule ID values are needed for F/R, one per direction of 528 traffic. This is because F/R may entail control messages 529 flowing in the reverse direction compared to data traffic. 531 7. Compression/Decompression 533 Compression with SCHC is based on using a set of Rules, called the 534 Context, to compress or decompress headers. SCHC avoids Context 535 synchronization traffic, which consumes considerable bandwidth in 536 other header compression mechanisms such as RoHC [RFC5795]. Since 537 the content of packets is highly predictable in LPWAN networks, 538 static Contexts may be stored beforehand. The Contexts MUST be 539 stored at both ends, and they can be learned by a provisioning 540 protocol or by out of band means, or they can be pre-provisioned. 541 The way the Contexts are provisioned is out of the scope of this 542 document. 544 7.1. SCHC C/D Rules 546 The main idea of the SCHC compression scheme is to transmit the Rule 547 ID to the other end instead of sending known field values. This Rule 548 ID identifies a Rule that matches the original packet values. Hence, 549 when a value is known by both ends, it is only necessary to send the 550 corresponding Rule ID over the LPWAN network. The manner by which 551 Rules are generated is out of the scope of this document. The Rules 552 MAY be changed at run-time but the mechanism is out of scope of this 553 document. 555 The Context is a set of Rules. See Figure 6 for a high level, 556 abstract representation of the Context. The formal specification of 557 the representation of the Rules is outside the scope of this 558 document. 560 Each Rule itself contains a list of Field Descriptions composed of a 561 Field Identifier (FID), a Field Length (FL), a Field Position (FP), a 562 Direction Indicator (DI), a Target Value (TV), a Matching Operator 563 (MO) and a Compression/Decompression Action (CDA). 565 /-----------------------------------------------------------------\ 566 | Rule N | 567 /-----------------------------------------------------------------\| 568 | Rule i || 569 /-----------------------------------------------------------------\|| 570 | (FID) Rule 1 ||| 571 |+-------+--+--+--+------------+-----------------+---------------+||| 572 ||Field 1|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|||| 573 |+-------+--+--+--+------------+-----------------+---------------+||| 574 ||Field 2|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act|||| 575 |+-------+--+--+--+------------+-----------------+---------------+||| 576 ||... |..|..|..| ... | ... | ... |||| 577 |+-------+--+--+--+------------+-----------------+---------------+||/ 578 ||Field N|FL|FP|DI|Target Value|Matching Operator|Comp/Decomp Act||| 579 |+-------+--+--+--+------------+-----------------+---------------+|/ 580 | | 581 \-----------------------------------------------------------------/ 583 Figure 6: A Compression/Decompression Context 585 A Rule does not describe how the compressor parses a packet header to 586 find and identify each field (e.g. the IPv6 Source Address, the UDP 587 Destination Port or a CoAP URI path option). It is assumed that 588 there is a protocol parser alongside SCHC that is able to identify 589 all the fields encountered in the headers to be compressed, and to 590 label them with a Field ID. Rules only describe the compression/ 591 decompression behavior for each header field, after it has been 592 identified. 594 In a Rule, the Field Descriptions are listed in the order in which 595 the fields appear in the packet header. The Field Descriptions 596 describe the header fields with the following entries: 598 o Field ID (FID) designates a protocol and field (e.g. UDP 599 Destination Port), unambiguously among all protocols that a SCHC 600 compressor processes. In the presence of protocol nesting, the 601 Field ID also identifies the nesting. 603 o Field Length (FL) represents the length of the field. It can be 604 either a fixed value (in bits) if the length is known when the 605 Rule is created or a type if the length is variable. The length 606 of a header field is defined by its own protocol specification 607 (e.g. IPv6 or UDP). If the length is variable, the type defines 608 the process to compute the length and its unit (bits, bytes...). 610 o Field Position (FP): most often, a field only occurs once in a 611 packet header. However, some fields may occur multiple times. An 612 example is the uri-path of CoAP. FP indicates which occurrence 613 this Field Description applies to. If FP is not specified in the 614 Field Description, it takes the default value of 1. The value 1 615 designates the first occurrence. The value 0 is special. It 616 means "don't care", see Section 7.3. 618 o A Direction Indicator (DI) indicates the packet direction(s) this 619 Field Description applies to. Three values are possible: 621 * UPLINK (Up): this Field Description is only applicable to 622 packets sent by the Dev to the App, 624 * DOWNLINK (Dw): this Field Description is only applicable to 625 packets sent from the App to the Dev, 627 * BIDIRECTIONAL (Bi): this Field Description is applicable to 628 packets traveling both Up and Dw. 630 o Target Value (TV) is the value used to match against the packet 631 header field. The Target Value can be a scalar value of any type 632 (integer, strings, etc.) or a more complex structure (array, list, 633 etc.). The types and representations are out of scope for this 634 document. 636 o Matching Operator (MO) is the operator used to match the Field 637 Value and the Target Value. The Matching Operator may require 638 some parameters. MO is only used during the compression phase. 639 The set of MOs defined in this document can be found in 640 Section 7.4. 642 o Compression Decompression Action (CDA) describes the compression 643 and decompression processes to be performed after the MO is 644 applied. Some CDAs might use parameter values for their 645 operation. CDAs are used in both the compression and the 646 decompression functions. The set of CDAs defined in this document 647 can be found in Section 7.5. 649 7.2. Rule ID for SCHC C/D 651 Rule IDs are sent by the compression function in one side and are 652 received for the decompression function in the other side. In SCHC 653 C/D, the Rule IDs are specific to the Context related to one Dev. 654 Hence, multiple Dev instances, which refer to different header 655 compression Contexts, MAY reuse the same Rule ID for different Rules. 656 On the Network infrastructure side, in order to identify the correct 657 Rule to be applied, the SCHC Decompressor needs to associate the Rule 658 ID with the Dev identifier. Similarly, the SCHC Compressor on the 659 Network infrastructure side first identifies the destination Dev 660 before looking for the appropriate compression Rule (and associated 661 Rule ID) in the Context of that Dev. 663 7.3. Packet processing 665 The compression/decompression process follows several phases: 667 o Compression Rule selection: the general idea is to browse the Rule 668 set to find a Rule that has a matching Field Descriptor (given the 669 DI and FP) for all and only those header fields that appear in the 670 packet being compressed. The detailed algorithm is the following: 672 * The first step is to check the Field Identifiers (FID). If any 673 header field of the packet being examined cannot be matched 674 with a Field Description with the correct FID, the Rule MUST be 675 disregarded. If any Field Description in the Rule has a FID 676 that cannot be matched to one of the header fields of the 677 packet being examined, the Rule MUST be disregarded. 679 * The next step is to match the Field Descriptions by their 680 direction, using the Direction Indicator (DI). If any field of 681 the packet header cannot be matched with a Field Description 682 with the correct FID and DI, the Rule MUST be disregarded. 684 * Then the Field Descriptions are further selected according to 685 Field Position (FP). If any field of the packet header cannot 686 be matched with a Field Description with the correct FID, DI 687 and FP, the Rule MUST be disregarded. 689 The value 0 for FP means "don't care", i.e. the comparison of 690 this Field Description's FP with the position of the field of 691 the packet header being compressed returns True, whatever that 692 position. FP=0 can be useful to build compression Rules for 693 protocols headers in which some fields order is irrelevant. An 694 example could be uri-queries in CoAP. Care needs to be 695 exercised when writing Rules containing FP=0 values. Indeed, 696 it may result in decompressed packets having fields ordered 697 differently compared to the original packet. 699 * Once each header field has been associated with a Field 700 Description with matching FID, DI and FP, each packet field's 701 value is then compared to the corresponding Target Value (TV) 702 stored in the Rule for that specific field, using the matching 703 operator (MO). If every field in the packet header satisfies 704 the corresponding matching operators (MO) of a Rule (i.e. all 705 MO results are True), that Rule is valid for use to compress 706 the header. Otherwise, the Rule MUST be disregarded. 708 This specification does not prevent multiple Rules from 709 matching the above steps and therefore being valid for use. 710 Whether multiple valid Rules are allowed or not and what to do 711 in the case of multiple valid Rules are left to the 712 implementation. As long as the same Rule set is installed at 713 both ends, this degree of freedom does not constitute an 714 interoperability issue. 716 * If no valid compression Rule is found, then the header MUST be 717 sent in its entirety using the Rule ID of the "default" Rule 718 dedicated to this purpose. Sending an uncompressed header is 719 likely to require SCHC F/R. 721 o Compression: if a valid Rule was found, each field of the header 722 is compressed according to the Compression/Decompression Actions 723 (CDAs) of the Rule. The fields are compressed in the order that 724 the Field Descriptions appear in the Rule. The compression of 725 each field results in a residue, which may be empty. The 726 Compression Residue for the packet header is the concatenation of 727 the non-empty residues for each field of the header, in the order 728 the Field Descriptions appear in the Rule. The order in which the 729 Field Descriptions appear in the Rule is therefore semantically 730 important. 732 |------------------- Compression Residue -------------------| 733 +-----------------+-----------------+-----+-----------------+ 734 | field 1 residue | field 2 residue | ... | field N residue | 735 +-----------------+-----------------+-----+-----------------+ 737 Figure 7: Compression Residue structure 739 o Sending: The Rule ID is sent to the other end followed by the 740 Compression Residue (which could be empty) or the uncompressed 741 header, and directly followed by the payload (see Figure 4). The 742 way the Rule ID is sent will be specified in the Profile and is 743 out of the scope of the present document. For example, it could 744 be included in an L2 header or sent as part of the L2 payload. 746 o Decompression: when decompressing, on the Network infrastructure 747 side the SCHC C/D needs to find the correct Rule based on the L2 748 address of the Dev; in this way, it can use the DevIID and the 749 Rule ID. On the Dev side, only the Rule ID is needed to identify 750 the correct Rule since the Dev typically only holds Rules that 751 apply to itself. 753 This Rule describes the compressed header format. From this, the 754 decompressor determines the order of the residues, the fixed-sized 755 or variable-sized nature of each residue (see Section 7.5.2), and 756 the size of the fixed-sized residues. 758 From the received compressed header, it can therefore retrieve all 759 the residue values and associate them to the corresponding header 760 fields. 762 For each field in the header, the receiver applies the CDA action 763 associated to that field in order to reconstruct the original 764 header field value. The CDA application order can be different 765 from the order in which the fields are listed in the Rule. In 766 particular, Compute-* MUST be applied after the application of the 767 CDAs of all the fields it computes on. 769 7.4. Matching operators 771 Matching Operators (MOs) are functions used by both SCHC C/D 772 endpoints. They are not typed and can be applied to integer, string 773 or any other data type. The result of the operation can either be 774 True or False. MOs are defined as follows: 776 o equal: The match result is True if the field value in the packet 777 matches the TV. 779 o ignore: No matching is attempted between the field value in the 780 packet and the TV in the Rule. The result is always true. 782 o MSB(x): A match is obtained if the most significant (leftmost) x 783 bits of the packet header field value are equal to the TV in the 784 Rule. The x parameter of the MSB MO indicates how many bits are 785 involved in the comparison. If the FL is described as variable, 786 the x parameter must be a multiple of the FL unit. For example, x 787 must be multiple of 8 if the unit of the variable length is bytes. 789 o match-mapping: With match-mapping, the Target Value is a list of 790 values. Each value of the list is identified by an index. 791 Compression is achieved by sending the index instead of the 792 original header field value. This operator matches if the header 793 field value is equal to one of the values in the target list. 795 7.5. Compression Decompression Actions (CDA) 797 The Compression Decompression Action (CDA) describes the actions 798 taken during the compression of header fields and the inverse action 799 taken by the decompressor to restore the original value. 801 +--------------+-------------+-------------------------------+ 802 | Action | Compression | Decompression | 803 +--------------+-------------+-------------------------------+ 804 | | | | 805 | not-sent | elided | use TV stored in Rule | 806 | value-sent | send | use received value | 807 | mapping-sent | send index | retrieve value from TV list | 808 | LSB | send LSB | concat. TV and received value | 809 | compute-* | elided | recompute at decompressor | 810 | DevIID | elided | build IID from L2 Dev addr | 811 | AppIID | elided | build IID from L2 App addr | 812 +--------------+-------------+-------------------------------+ 814 Table 1: Compression and Decompression Actions 816 Table 1 summarizes the basic actions that can be used to compress and 817 decompress a field. The first column shows the action's name. The 818 second and third columns show the compression and decompression 819 behaviors for each action. 821 7.5.1. processing fixed-length fields 823 If the field is identified in the Field Description as being of fixed 824 length, then applying the CDA to compress this field results in a 825 fixed amount of bits. The residue for that field is simply the bits 826 resulting from applying the CDA to the field. This value may be 827 empty (e.g. not-sent CDA), in which case the field residue is absent 828 from the Compression Residue. 830 |- field residue -| 831 +-----------------+ 832 | value | 833 +-----------------+ 835 Figure 8: fixed sized field residue structure 837 7.5.2. processing variable-length fields 839 If the field is identified in the Field Description as being of 840 variable length, then applying the CDA to compress this field may 841 result in a value of fixed size (e.g. not-sent or mapping-sent) or of 842 variable size (e.g. value-sent or LSB). In the latter case, the 843 residue for that field is the bits that result from applying the CDA 844 to the field, preceded with the size of the value. The most 845 significant bit of the size is stored to the left (leftmost bit of 846 the residue field). 848 |--- field residue ---| 849 +-------+-------------+ 850 | size | value | 851 +-------+-------------+ 853 Figure 9: variable sized field residue structure 855 The size (using the unit defined in the FL) is encoded on 4, 12 or 28 856 bits as follows: 858 o If the size is between 0 and 14, it is encoded as a 4 bits 859 unsigned integer. 861 o Sizes between 15 and 254 are encoded as 0b1111 followed by the 8 862 bits unsigned integer. 864 o Larger sizes are encoded as 0xfff followed by the 16 bits unsigned 865 integer. 867 If the field is identified in the Field Description as being of 868 variable length and this field is not present in the packet header 869 being compressed, size 0 MUST be sent to denote its absence. 871 7.5.3. not-sent CDA 873 The not-sent action can be used when the field value is specified in 874 a Rule and therefore known by both the Compressor and the 875 Decompressor. This action SHOULD be used with the "equal" MO. If MO 876 is "ignore", there is a risk to have a decompressed field value 877 different from the original field that was compressed. 879 The compressor does not send any residue for a field on which not- 880 sent compression is applied. 882 The decompressor restores the field value with the Target Value 883 stored in the matched Rule identified by the received Rule ID. 885 7.5.4. value-sent CDA 887 The value-sent action can be used when the field value is not known 888 by both the Compressor and the Decompressor. The field is sent in 889 its entirety, using the same bit order as in the original packet 890 header. 892 If this action is performed on a variable length field, the size of 893 the residue value (using the units defined in FL) MUST be sent as 894 described in Section 7.5.2. 896 This action is generally used with the "ignore" MO. 898 7.5.5. mapping-sent CDA 900 The mapping-sent action is used to send an index (the index into the 901 Target Value list of values) instead of the original value. This 902 action is used together with the "match-mapping" MO. 904 On the compressor side, the match-mapping Matching Operator searches 905 the TV for a match with the header field value. The mapping-sent CDA 906 then sends the corresponding index as the field residue. The most 907 significant bit of the index is stored to the left (leftmost bit of 908 the residue field). 910 On the decompressor side, the CDA uses the received index to restore 911 the field value by looking up the list in the TV. 913 The number of bits sent is the minimal size for coding all the 914 possible indices. 916 The first element in the list MUST be represented by index value 0, 917 and successive elements in the list MUST have indices incremented by 918 1. 920 7.5.6. LSB CDA 922 The LSB action is used together with the "MSB(x)" MO to avoid sending 923 the most significant part of the packet field if that part is already 924 known by the receiving end. 926 The compressor sends the Least Significant Bits as the field residue 927 value. The number of bits sent is the original header field length 928 minus the length specified in the MSB(x) MO. The bits appear in the 929 residue in the same bit order as in the original packet header. 931 The decompressor concatenates the x most significant bits of Target 932 Value and the received residue value. 934 If this action is performed on a variable length field, the size of 935 the residue value (using the units defined in FL) MUST be sent as 936 described in Section 7.5.2. 938 7.5.7. DevIID, AppIID CDA 940 These actions are used to process respectively the Dev and the App 941 Interface Identifiers (DevIID and AppIID) of the IPv6 addresses. 942 AppIID CDA is less common since most current LPWAN technologies 943 frames contain a single L2 address, which is the Dev's address. 945 The IID value MAY be computed from the Device ID present in the L2 946 header, or from some other stable identifier. The computation is 947 specific to each Profile and MAY depend on the Device ID size. 949 In the downlink direction (Dw), at the compressor, the DevIID CDA may 950 be used to generate the L2 addresses on the LPWAN, based on the 951 packet's Destination Address. 953 7.5.8. Compute-* 955 Some fields can be elided at the compressor and recomputed locally at 956 the decompressor. 958 Because the field is uniquely identified by its Field ID (e.g. UDP 959 length), the relevant protocol specification unambiguously defines 960 the algorithm for such computation. 962 Examples of fields that know how to recompute themselves are UDP 963 length, IPv6 length and UDP checksum. 965 8. Fragmentation/Reassembly 967 8.1. Overview 969 In LPWAN technologies, the L2 MTU typically ranges from tens to 970 hundreds of bytes. Some of these technologies do not have an 971 internal fragmentation/reassembly mechanism. 973 The optional SCHC Fragmentation/Reassembly (SCHC F/R) functionality 974 enables such LPWAN technologies to comply with the IPv6 MTU 975 requirement of 1280 bytes [RFC8200]. It is OPTIONAL to implement per 976 this specification, but Profiles may specify that it is REQUIRED. 978 This specification includes several SCHC F/R modes, which allow for a 979 range of reliability options such as optional SCHC Fragment 980 retransmission. More modes may be defined in the future. 982 The same SCHC F/R mode MUST be used for all SCHC Fragments of a given 983 SCHC Packet. This document does not specify which mode(s) must be 984 implemented and used over a specific LPWAN technology. That 985 information will be given in Profiles. 987 SCHC allows transmitting non-fragmented SCHC Packet concurrently with 988 fragmented SCHC Packets. In addition, SCHC F/R provides protocol 989 elements that allow transmitting several fragmented SCHC Packets 990 concurrently, i.e. interleaving the transmission of fragments from 991 different fragmented SCHC Packets. A Profile MAY restrict the latter 992 behavior. 994 The L2 Word size (see Section 4) determines the encoding of some 995 messages. SCHC F/R usually generates SCHC Fragments and SCHC ACKs 996 that are multiples of L2 Words. 998 8.2. SCHC F/R Protocol Elements 1000 This subsection describes the different elements that are used to 1001 enable the SCHC F/R functionality defined in this document. These 1002 elements include the SCHC F/R messages, tiles, windows, bitmaps, 1003 counters, timers and header fields. 1005 The elements are described here in a generic manner. Their 1006 application to each SCHC F/R mode is found in Section 8.4. 1008 8.2.1. Messages 1010 SCHC F/R defines the following messages: 1012 o SCHC Fragment: A message that carries part of a SCHC Packet from 1013 the sender to the receiver. 1015 o SCHC ACK: An acknowledgement for fragmentation, by the receiver to 1016 the sender. This message is used to indicate whether or not the 1017 reception of pieces of, or the whole of the fragmented SCHC 1018 Packet, was successful. 1020 o SCHC ACK REQ: A request by the sender for a SCHC ACK from the 1021 receiver. 1023 o SCHC Sender-Abort: A message by the sender telling the receiver 1024 that it has aborted the transmission of a fragmented SCHC Packet. 1026 o SCHC Receiver-Abort: A message by the receiver to tell the sender 1027 to abort the transmission of a fragmented SCHC Packet. 1029 The format of these messages is provided in Section 8.3. 1031 8.2.2. Tiles, Windows, Bitmaps, Timers, Counters 1033 8.2.2.1. Tiles 1035 The SCHC Packet is fragmented into pieces, hereafter called tiles. 1036 The tiles MUST be non-empty and pairwise disjoint. Their union MUST 1037 be equal to the SCHC Packet. 1039 See Figure 10 for an example. 1041 SCHC Packet 1042 +----+--+-----+---+----+-+---+---+-----+...-----+----+---+------+ 1043 Tiles | | | | | | | | | | | | | | 1044 +----+--+-----+---+----+-+---+---+-----+...-----+----+---+------+ 1046 Figure 10: a SCHC Packet fragmented in tiles 1048 Modes (see Section 8.4) MAY place additional constraints on tile 1049 sizes. 1051 Each SCHC Fragment message carries at least one tile in its Payload, 1052 if the Payload field is present. 1054 8.2.2.2. Windows 1056 Some SCHC F/R modes may handle successive tiles in groups, called 1057 windows. 1059 If windows are used 1061 o all the windows of a SCHC Packet, except the last one, MUST 1062 contain the same number of tiles. This number is WINDOW_SIZE. 1064 o WINDOW_SIZE MUST be specified in a Profile. 1066 o the windows are numbered. 1068 o their numbers MUST increment by 1 from 0 upward, from the start of 1069 the SCHC Packet to its end. 1071 o the last window MUST contain WINDOW_SIZE tiles or less. 1073 o tiles are numbered within each window. 1075 o the tile indices MUST decrement by 1 from WINDOW_SIZE - 1 1076 downward, looking from the start of the SCHC Packet toward its 1077 end. 1079 o each tile of a SCHC Packet is therefore uniquely identified by a 1080 window number and a tile index within this window. 1082 See Figure 11 for an example. 1084 +---------------------------------------------...-------------+ 1085 | SCHC Packet | 1086 +---------------------------------------------...-------------+ 1088 Tile # | 4 | 3 | 2 | 1 | 0 | 4 | 3 | 2 | 1 | 0 | 4 | | 0 | 4 | 3 | 1089 Window # |-------- 0 --------|-------- 1 --------|- 2 ... 27 -|-- 28 -| 1091 Figure 11: a SCHC Packet fragmented in tiles grouped in 29 windows, 1092 with WINDOW_SIZE = 5 1094 Appendix E discusses the benefits of selecting one among multiple 1095 window sizes depending on the size of the SCHC Packet to be 1096 fragmented. 1098 When windows are used 1100 o Bitmaps (see Section 8.2.2.3) MAY be sent back by the receiver to 1101 the sender in a SCHC ACK message. 1103 o A Bitmap corresponds to exactly one Window. 1105 8.2.2.3. Bitmaps 1107 Each bit in the Bitmap for a window corresponds to a tile in the 1108 window. Each Bitmap has therefore WINDOW_SIZE bits. The bit at the 1109 left-most position corresponds to the tile numbered WINDOW_SIZE - 1. 1110 Consecutive bits, going right, correspond to sequentially decreasing 1111 tile indices. In Bitmaps for windows that are not the last one of a 1112 SCHC Packet, the bit at the right-most position corresponds to the 1113 tile numbered 0. In the Bitmap for the last window, the bit at the 1114 right-most position corresponds either to the tile numbered 0 or to a 1115 tile that is sent/received as "the last one of the SCHC Packet" 1116 without explicitly stating its number (see Section 8.3.1.2). 1118 At the receiver 1120 o a bit set to 1 in the Bitmap indicates that a tile associated with 1121 that bit position has been correctly received for that window. 1123 o a bit set to 0 in the Bitmap indicates that there has been no tile 1124 correctly received, associated with that bit position, for that 1125 window. Possible reasons include that the tile was not sent at 1126 all, not received, or received with errors. 1128 8.2.2.4. Timers and counters 1130 Some SCHC F/R modes can use the following timers and counters 1132 o Inactivity Timer: a SCHC Fragment receiver uses this timer to 1133 abort waiting for a SCHC F/R message. 1135 o Retransmission Timer: a SCHC Fragment sender uses this timer to 1136 abort waiting for an expected SCHC ACK. 1138 o Attempts: this counter counts the requests for SCHC ACKs, up to 1139 MAX_ACK_REQUESTS. 1141 8.2.3. Integrity Checking 1143 The integrity of the fragmentation-reassembly process of a SCHC 1144 Packet MUST be checked at the receive end. By default, integrity 1145 checking is performed by computing a Reassembly Check Sequence (RCS) 1146 based on the SCHC Packet at the sender side and transmitting it to 1147 the receiver for comparison with the RCS locally computed after 1148 reassembly. 1150 The RCS supports UDP checksum elision by SCHC C/D (see 1151 Section 10.11). 1153 The CRC32 polynomial 0xEDB88320 (i.e. the reversed polynomial 1154 representation, which is used e.g. in the Ethernet standard 1155 [ETHERNET]) is RECOMMENDED as the default algorithm for computing the 1156 RCS. Nevertheless, other RCS lengths or other algorithms MAY be 1157 required by the Profile. 1159 The RCS MUST be computed on the full SCHC Packet concatenated with 1160 the padding bits, if any, of the SCHC Fragment carrying the last 1161 tile. The rationale is that the SCHC reassembler has no way of 1162 knowing the boundary between the last tile and the padding bits. 1163 Indeed, this requires decompressing the SCHC Packet, which is out of 1164 the scope of the SCHC reassembler. 1166 Note that the concatenation of the complete SCHC Packet and any 1167 padding bits, if present, of the last SCHC Fragment does not 1168 generally constitute an integer number of bytes. For implementers to 1169 be able to use byte-oriented CRC libraries, it is RECOMMENDED that 1170 the concatenation of the complete SCHC Packet and any last fragment 1171 padding bits be zero-extended to the next byte boundary and that the 1172 RCS be computed on that byte array. A Profile MAY specify another 1173 behavior. 1175 8.2.4. Header Fields 1177 The SCHC F/R messages contain the following fields (see the formats 1178 in Section 8.3): 1180 o Rule ID: this field is present in all the SCHC F/R messages. It 1181 is used to identify 1183 * that a SCHC F/R message is being carried, as opposed to an 1184 unfragmented SCHC Packet, 1186 * which SCHC F/R mode is used 1188 * in case this mode uses windows, what the value of WINDOW_SIZE 1189 is, 1191 * what other optional fields are present and what the field sizes 1192 are. 1194 The Rule ID tells apart a non-fragmented SCHC Packet from SCHC 1195 Fragments. It will also tell apart SCHC Fragments of fragmented 1196 SCHC Packets that use different SCHC F/R modes or different 1197 parameters. Interleaved transmission of these is therefore 1198 possible. 1200 All SCHC F/R messages pertaining to the same SCHC Packet MUST bear 1201 the same Rule ID. 1203 o Datagram Tag (DTag). This field allows differentiating SCHC F/R 1204 messages belonging to different SCHC Packets that may be using the 1205 same Rule ID simultaneously. Hence, it allows interleaving 1206 fragments of a new SCHC Packet with fragments of a previous SCHC 1207 Packet under the same Rule ID. 1209 The size of the DTag field (called T, in bits) is defined by each 1210 Profile for each Rule ID. When T is 0, the DTag field does not 1211 appear in the SCHC F/R messages and the DTag value is defined as 1212 0. 1214 When T is 0, there can be no more than one fragmented SCHC Packet 1215 in transit for each fragmentation Rule ID. 1217 If T is not 0, DTag 1219 * MUST be set to the same value for all the SCHC F/R messages 1220 related to the same fragmented SCHC Packet, 1222 * MUST be set to different values for SCHC F/R messages related 1223 to different SCHC Packets that are being fragmented under the 1224 same Rule ID, and whose transmission may overlap. 1226 o W: The W field is optional. It is only present if windows are 1227 used. Its presence and size (called M, in bits) is defined by 1228 each SCHC F/R mode and each Profile for each Rule ID. 1230 This field carries information pertaining to the window a SCHC F/R 1231 message relates to. If present, W MUST carry the same value for 1232 all the SCHC F/R messages related to the same window. Depending 1233 on the mode and Profile, W may carry the full window number, or 1234 just the least significant bit or any other partial representation 1235 of the window number. 1237 o Fragment Compressed Number (FCN). The FCN field is present in the 1238 SCHC Fragment Header. Its size (called N, in bits) is defined by 1239 each Profile for each Rule ID. 1241 This field conveys information about the progress in the sequence 1242 of tiles being transmitted by SCHC Fragment messages. For 1243 example, it can contain a partial, efficient representation of a 1244 larger-sized tile index. The description of the exact use of the 1245 FCN field is left to each SCHC F/R mode. However, two values are 1246 reserved for special purposes. They help control the SCHC F/R 1247 process: 1249 * The FCN value with all the bits equal to 1 (called All-1) 1250 signals that the very last tile of a SCHC Packet has been 1251 transmitted. By extension, if windows are used, the last 1252 window of a packet is called the All-1 window. 1254 * If windows are used, the FCN value with all the bits equal to 0 1255 (called All-0) signals the last tile of a window that is not 1256 the last one of the SCHC packet. By extension, such a window 1257 is called an All-0 window. 1259 o Reassembly Check Sequence (RCS). This field only appears in the 1260 All-1 SCHC Fragments. Its size (called U, in bits) is defined by 1261 each Profile for each Rule ID. 1263 See Section 8.2.3 for the RCS default size, default polynomial and 1264 details on RCS computation. 1266 o C (integrity Check): C is a 1-bit field. This field is used in 1267 the SCHC ACK message to report on the reassembled SCHC Packet 1268 integrity check (see Section 8.2.3). 1270 A value of 1 tells that the integrity check was performed and is 1271 successful. A value of 0 tells that the integrity check was not 1272 performed, or that is was a failure. 1274 o Compressed Bitmap. The Compressed Bitmap is used together with 1275 windows and Bitmaps (see Section 8.2.2.3). Its presence and size 1276 is defined for each F/R mode for each Rule ID. 1278 This field appears in the SCHC ACK message to report on the 1279 receiver Bitmap (see Section 8.3.2.1). 1281 8.3. SCHC F/R Message Formats 1283 This section defines the SCHC Fragment formats, the SCHC ACK format, 1284 the SCHC ACK REQ format and the SCHC Abort formats. 1286 8.3.1. SCHC Fragment format 1288 A SCHC Fragment conforms to the general format shown in Figure 12. 1289 It comprises a SCHC Fragment Header and a SCHC Fragment Payload. The 1290 SCHC Fragment Payload carries one or several tile(s). 1292 +-----------------+-----------------------+~~~~~~~~~~~~~~~~~~~~~ 1293 | Fragment Header | Fragment Payload | padding (as needed) 1294 +-----------------+-----------------------+~~~~~~~~~~~~~~~~~~~~~ 1296 Figure 12: SCHC Fragment general format 1298 8.3.1.1. Regular SCHC Fragment 1300 The Regular SCHC Fragment format is shown in Figure 13. Regular SCHC 1301 Fragments are generally used to carry tiles that are not the last one 1302 of a SCHC Packet. The DTag field and the W field are OPTIONAL, their 1303 presence is specified by each mode and Profile. 1305 |--- SCHC Fragment Header ----| 1306 |-- T --|-M-|-- N --| 1307 +-- ... --+- ... -+---+- ... -+--------...-------+~~~~~~~~~~~~~~~~~~~~~ 1308 | Rule ID | DTag | W | FCN | Fragment Payload | padding (as needed) 1309 +-- ... --+- ... -+---+- ... -+--------...-------+~~~~~~~~~~~~~~~~~~~~~ 1311 Figure 13: Detailed Header Format for Regular SCHC Fragments 1313 The FCN field MUST NOT contain all bits set to 1. 1315 The Fragment Payload of a SCHC Fragment with FCN equal to 0 (called 1316 an All-0 SCHC Fragment) MUST be distinguishable by size from a SCHC 1317 ACK REQ message (see Section 8.3.3) that has the same T, M and N 1318 values, even in the presence of padding. This condition is met if 1319 the Payload is at least the size of an L2 Word. This condition is 1320 also met if the SCHC Fragment Header is a multiple of L2 Words. 1322 8.3.1.2. All-1 SCHC Fragment 1324 The All-1 SCHC Fragment format is shown in Figure 14. The sender 1325 uses the All-1 SCHC Fragment format for the message that completes 1326 the emission of a fragmented SCHC Packet. The DTag field, the W 1327 field, the RCS field and the Payload are OPTIONAL, their presence is 1328 specified by each mode and Profile. At least one of RCS field or 1329 Payload MUST be present. The FCN field is all ones. 1331 |-------- SCHC Fragment Header -------| 1332 |-- T --|-M-|-- N --|-- U --| 1333 +-- ... --+- ... -+---+- ... -+- ... -+------...-----+~~~~~~~~~~~~~~~~~~ 1334 | Rule ID | DTag | W | 11..1 | RCS | Frag Payload | pad. (as needed) 1335 +-- ... --+- ... -+---+- ... -+- ... -+------...-----+~~~~~~~~~~~~~~~~~~ 1336 (FCN) 1338 Figure 14: Detailed Header Format for the All-1 SCHC Fragment 1340 The All-1 SCHC Fragment message MUST be distinguishable by size from 1341 a SCHC Sender-Abort message (see Section 8.3.4) that has the same T, 1342 M and N values, even in the presence of padding. This condition is 1343 met if the RCS is present and is at least the size of an L2 Word, or 1344 if the Payload is present and at least the size an L2 Word. This 1345 condition is also met if the SCHC Sender-Abort Header is a multiple 1346 of L2 Words. 1348 8.3.2. SCHC ACK format 1350 The SCHC ACK message is shown in Figure 15. The DTag field and the W 1351 field are OPTIONAL, their presence is specified by each mode and 1352 Profile. The Compressed Bitmap field MUST be present in SCHC F/R 1353 modes that use windows, and MUST NOT be present in other modes. 1355 |---- SCHC ACK Header ----| 1356 |-- T --|-M-| 1 | 1357 +--- ... -+- ... -+---+---+~~~~~~~~~~~~~~~~~~ 1358 | Rule ID | DTag | W |C=1| padding as needed (success) 1359 +--- ... -+- ... -+---+---+~~~~~~~~~~~~~~~~~~ 1361 +--- ... -+- ... -+---+---+------ ... ------+~~~~~~~~~~~~~~~ 1362 | Rule ID | DTag | W |C=0|Compressed Bitmap| pad. as needed (failure) 1363 +--- ... -+- ... -+---+---+------ ... ------+~~~~~~~~~~~~~~~ 1365 Figure 15: Format of the SCHC ACK message 1367 The SCHC ACK Header contains a C bit (see Section 8.2.4). 1369 If the C bit is set to 1 (integrity check successful), no Bitmap is 1370 carried. 1372 If the C bit is set to 0 (integrity check not performed or failed) 1373 and if windows are used, a Compressed Bitmap for the window referred 1374 to by the W field is transmitted as specified in Section 8.3.2.1. 1376 8.3.2.1. Bitmap Compression 1378 For transmission, the Compressed Bitmap in the SCHC ACK message is 1379 defined by the following algorithm (see Figure 16 for a follow-along 1380 example): 1382 o Build a temporary SCHC ACK message that contains the Header 1383 followed by the original Bitmap (see Section 8.2.2.3 for a 1384 description of Bitmaps). 1386 o Position scissors at the end of the Bitmap, after its last bit. 1388 o While the bit on the left of the scissors is 1 and belongs to the 1389 Bitmap, keep moving left, then stop. When this is done, 1391 o While the scissors are not on an L2 Word boundary of the SCHC ACK 1392 message and there is a Bitmap bit on the right of the scissors, 1393 keep moving right, then stop. 1395 o At this point, cut and drop off any bits to the right of the 1396 scissors 1398 When one or more bits have effectively been dropped off as a result 1399 of the above algorithm, the SCHC ACK message is a multiple of L2 1400 Words, no padding bits will be appended. 1402 Because the SCHC Fragment sender knows the size of the original 1403 Bitmap, it can reconstruct the original Bitmap from the Compressed 1404 Bitmap received in the SCH ACK message. 1406 Figure 16 shows an example where L2 Words are actually bytes and 1407 where the original Bitmap contains 17 bits, the last 15 of which are 1408 all set to 1. 1410 |---- SCHC ACK Header ----|-------- Bitmap --------| 1411 |-- T --|-M-| 1 | 1412 +--- ... -+- ... -+---+---+---------------------------------+ 1413 | Rule ID | DTag | W |C=0|1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1| 1414 +--- ... -+- ... -+---+---+---------------------------------+ 1415 next L2 Word boundary ->| 1417 Figure 16: SCHC ACK Header plus uncompressed Bitmap 1419 Figure 17 shows that the last 14 bits are not sent. 1421 |---- SCHC ACK Header ----|CpBmp| 1422 |-- T --|-M-| 1 | 1423 +--- ... -+- ... -+---+---+-----+ 1424 | Rule ID | DTag | W |C=0|1 0 1| 1425 +--- ... -+- ... -+---+---+-----+ 1426 next L2 Word boundary ->| 1428 Figure 17: Resulting SCHC ACK message with Compressed Bitmap 1430 Figure 18 shows an example of a SCHC ACK with tile indices ranging 1431 from 6 down to 0, where the Bitmap indicates that the second and the 1432 fourth tile of the window have not been correctly received. 1434 |---- SCHC ACK Header ----|--- Bitmap --| 1435 |-- T --|-M-| 1 |6 5 4 3 2 1 0| (tile #) 1436 +---------+-------+---+---+-------------+ 1437 | Rule ID | DTag | W |C=0|1 0 1 0 1 1 1| uncompressed Bitmap 1438 +---------+-------+---+---+-------------+ 1439 next L2 Word boundary ->|<-- L2 Word -->| 1441 +---------+-------+---+---+-------------+~~~+ 1442 | Rule ID | DTag | W |C=0|1 0 1 0 1 1 1|Pad| transmitted SCHC ACK 1443 +---------+-------+---+---+-------------+~~~+ 1444 next L2 Word boundary ->|<-- L2 Word -->| 1446 Figure 18: Example of a SCHC ACK message, missing tiles 1448 Figure 19 shows an example of a SCHC ACK with FCN ranging from 6 down 1449 to 0, where integrity check has not been performed or has failed and 1450 the Bitmap indicates that there is no missing tile in that window. 1452 |---- SCHC ACK Header ----|--- Bitmap --| 1453 |-- T --|-M-| 1 |6 5 4 3 2 1 0| (tile #) 1454 +---------+-------+---+---+-------------+ 1455 | Rule ID | DTag | W |C=0|1 1 1 1 1 1 1| with uncompressed Bitmap 1456 +---------+-------+---+---+-------------+ 1457 next L2 Word boundary ->| 1459 +--- ... -+- ... -+---+---+-+ 1460 | Rule ID | DTag | W |C=0|1| transmitted SCHC ACK 1461 +--- ... -+- ... -+---+---+-+ 1462 next L2 Word boundary ->| 1464 Figure 19: Example of a SCHC ACK message, no missing tile 1466 8.3.3. SCHC ACK REQ format 1468 The SCHC ACK REQ is used by a sender to request a SCHC ACK from the 1469 receiver. Its format is shown in Figure 20. The DTag field and the 1470 W field are OPTIONAL, their presence is specified by each mode and 1471 Profile. The FCN field is all zero. 1473 |---- SCHC ACK REQ Header ----| 1474 |-- T --|-M-|-- N --| 1475 +-- ... --+- ... -+---+- ... -+~~~~~~~~~~~~~~~~~~~~~ 1476 | Rule ID | DTag | W | 0..0 | padding (as needed) (no payload) 1477 +-- ... --+- ... -+---+- ... -+~~~~~~~~~~~~~~~~~~~~~ 1479 Figure 20: SCHC ACK REQ format 1481 8.3.4. SCHC Sender-Abort format 1483 When a SCHC Fragment sender needs to abort an on-going fragmented 1484 SCHC Packet transmission, it sends a SCHC Sender-Abort message to the 1485 SCHC Fragment receiver. 1487 The SCHC Sender-Abort format is shown in Figure 21. The DTag field 1488 and the W field are OPTIONAL, their presence is specified by each 1489 mode and Profile. The FCN field is all ones. 1491 |---- Sender-Abort Header ----| 1492 |-- T --|-M-|-- N --| 1493 +-- ... --+- ... -+---+- ... -+~~~~~~~~~~~~~~~~~~~~~ 1494 | Rule ID | DTag | W | 11..1 | padding (as needed) 1495 +-- ... --+- ... -+---+- ... -+~~~~~~~~~~~~~~~~~~~~~ 1497 Figure 21: SCHC Sender-Abort format 1499 If the W field is present, 1501 o the fragment sender MUST set it to all ones. Other values are 1502 RESERVED. 1504 o the fragment receiver MUST check its value. If the value is 1505 different from all ones, the message MUST be ignored. 1507 The SCHC Sender-Abort MUST NOT be acknowledged. 1509 8.3.5. SCHC Receiver-Abort format 1511 When a SCHC Fragment receiver needs to abort an on-going fragmented 1512 SCHC Packet transmission, it transmits a SCHC Receiver-Abort message 1513 to the SCHC Fragment sender. 1515 The SCHC Receiver-Abort format is shown in Figure 22. The DTag field 1516 and the W field are OPTIONAL, their presence is specified by each 1517 mode and Profile. 1519 |--- Receiver-Abort Header ---| 1520 |--- T ---|-M-| 1 | 1521 +--- ... ---+-- ... --+---+---+-+-+-+-+-+-+-+-+-+-+-+ 1522 | Rule ID | DTag | W |C=1| 1..1| 1..1 | 1523 +--- ... ---+-- ... --+---+---+-+-+-+-+-+-+-+-+-+-+-+ 1524 next L2 Word boundary ->|<-- L2 Word -->| 1526 Figure 22: SCHC Receiver-Abort format 1528 If the W field is present, 1529 o the fragment receiver MUST set it to all ones. Other values are 1530 RESERVED. 1532 o if the value is different from all ones, the fragment sender MUST 1533 ignore the message. 1535 The SCHC Receiver-Abort has the same header as a SCHC ACK message. 1536 The bits that follow the SCHC Receiver-Abort Header MUST be as 1537 follows 1539 o if the Header does not end at an L2 Word boundary, append bits set 1540 to 1 as needed to reach the next L2 Word boundary 1542 o append exactly one more L2 Word with bits all set to ones 1544 Such a bit pattern never occurs in a legit SCHC ACK. This is how the 1545 fragment sender recognizes a SCHC Receiver-Abort. 1547 The SCHC Receiver-Abort MUST NOT be acknowledged. 1549 8.4. SCHC F/R modes 1551 This specification includes several SCHC F/R modes, which 1553 o allow for a range of reliability options, such as optional SCHC 1554 Fragment retransmission 1556 o support various LPWAN characteristics, such as links with variable 1557 MTU or unidirectional links. 1559 More modes may be defined in the future. 1561 Appendix B provides examples of fragmentation sessions based on the 1562 modes described hereafter. 1564 Appendix C provides examples of Finite Sate Machines implementing the 1565 SCHC F/R modes decribed hereafter. 1567 8.4.1. No-ACK mode 1569 The No-ACK mode has been designed under the assumption that data unit 1570 out-of-sequence delivery does not occur between the entity performing 1571 fragmentation and the entity performing reassembly. This mode 1572 supports LPWAN technologies that have a variable MTU. 1574 In No-ACK mode, there is no communication from the fragment receiver 1575 to the fragment sender. The sender transmits all the SCHC Fragments 1576 without expecting any acknowledgement. Therefore, No-ACK does not 1577 require bidirectional links: unidirectional links are just fine. 1579 In No-ACK mode, only the All-1 SCHC Fragment is padded as needed. 1580 The other SCHC Fragments are intrinsically aligned to L2 Words. 1582 The tile sizes are not required to be uniform. Windows are not used. 1583 The Retransmission Timer is not used. The Attempts counter is not 1584 used. 1586 Each Profile MUST specify which Rule ID value(s) correspond to SCHC 1587 F/R messages operating in this mode. 1589 The W field MUST NOT be present in the SCHC F/R messages. SCHC ACK 1590 MUST NOT be sent. SCHC ACK REQ MUST NOT be sent. SCHC Sender-Abort 1591 MAY be sent. SCHC Receiver-Abort MUST NOT be sent. 1593 The value of N (size of the FCN field) is RECOMMENDED to be 1. 1595 Each Profile, for each Rule ID value, MUST define 1597 o the size of the DTag field, 1599 o the size and algorithm for the RCS field, 1601 o the expiration time of the Inactivity Timer 1603 Each Profile, for each Rule ID value, MAY define 1605 o a value of N different from the recommended one, 1607 o the meaning of values sent in the FCN field, for values different 1608 from the All-1 value. 1610 For each active pair of Rule ID and DTag values, the receiver MUST 1611 maintain an Inactivity Timer. If the receiver is under-resourced to 1612 do this, it MUST silently drop the related messages. 1614 8.4.1.1. Sender behavior 1616 At the beginning of the fragmentation of a new SCHC Packet, the 1617 fragment sender MUST select a Rule ID and DTag value pair for this 1618 SCHC Packet. 1620 Each SCHC Fragment MUST contain exactly one tile in its Payload. The 1621 tile MUST be at least the size of an L2 Word. The sender MUST 1622 transmit the SCHC Fragments messages in the order that the tiles 1623 appear in the SCHC Packet. Except for the last tile of a SCHC 1624 Packet, each tile MUST be of a size that complements the SCHC 1625 Fragment Header so that the SCHC Fragment is a multiple of L2 Words 1626 without the need for padding bits. Except for the last one, the SCHC 1627 Fragments MUST use the Regular SCHC Fragment format specified in 1628 Section 8.3.1.1. The SCHC Fragment that carries the last tile MUST 1629 be an All-1 SCHC Fragment, described in Section 8.3.1.2. 1631 The sender MAY transmit a SCHC Sender-Abort. 1633 Figure 37 shows an example of a corresponding state machine. 1635 8.4.1.2. Receiver behavior 1637 Upon receiving each Regular SCHC Fragment, 1639 o the receiver MUST reset the Inactivity Timer, 1641 o the receiver assembles the payloads of the SCHC Fragments 1643 On receiving an All-1 SCHC Fragment, 1645 o the receiver MUST append the All-1 SCHC Fragment Payload and the 1646 padding bits to the previously received SCHC Fragment Payloads for 1647 this SCHC Packet 1649 o the receiver MUST perform the integrity check 1651 o if integrity checking fails, the receiver MUST drop the 1652 reassembled SCHC Packet 1654 o the reassembly operation concludes. 1656 On expiration of the Inactivity Timer, the receiver MUST drop the 1657 SCHC Packet being reassembled. 1659 On receiving a SCHC Sender-Abort, the receiver MAY drop the SCHC 1660 Packet being reassembled. 1662 Figure 38 shows an example of a corresponding state machine. 1664 8.4.2. ACK-Always mode 1666 The ACK-Always mode has been designed under the following assumptions 1668 o Data unit out-of-sequence delivery does not occur between the 1669 entity performing fragmentation and the entity performing 1670 reassembly 1672 o The L2 MTU value does not change while the fragments of a SCHC 1673 Packet are being transmitted. 1675 o There is a feedback path from the reassembler to the fragmenter. 1676 See Appendix F for a discussion on using ACK-Always mode on quasi- 1677 bidirectional links. 1679 In ACK-Always mode, windows are used. An acknowledgement, positive 1680 or negative, is transmitted by the fragment receiver to the fragment 1681 sender at the end of the transmission of each window of SCHC 1682 Fragments. 1684 The tiles are not required to be of uniform size. In ACK-Always 1685 mode, only the All-1 SCHC Fragment is padded as needed. The other 1686 SCHC Fragments are intrinsically aligned to L2 Words. 1688 Briefly, the algorithm is as follows: after a first blind 1689 transmission of all the tiles of a window, the fragment sender 1690 iterates retransmitting the tiles that are reported missing until the 1691 fragment receiver reports that all the tiles belonging to the window 1692 have been correctly received, or until too many attempts were made. 1693 The fragment sender only advances to the next window of tiles when it 1694 has ascertained that all the tiles belonging to the current window 1695 have been fully and correctly received. This results in a per-window 1696 lock-step behavior between the sender and the receiver. 1698 Each Profile MUST specify which Rule ID value(s) correspond to SCHC 1699 F/R messages operating in this mode. 1701 The W field MUST be present and its size M MUST be 1 bit. 1703 Each Profile, for each Rule ID value, MUST define 1705 o the value of N (size of the FCN field), 1707 o the value of WINDOW_SIZE, which MUST be strictly less than 2^N, 1709 o the size and algorithm for the RCS field, 1711 o the size of the DTag field, 1713 o the value of MAX_ACK_REQUESTS, 1715 o the expiration time of the Retransmission Timer 1717 o the expiration time of the Inactivity Timer 1718 For each active pair of Rule ID and DTag values, the sender MUST 1719 maintain 1721 o one Attempts counter 1723 o one Retransmission Timer 1725 For each active pair of Rule ID and DTag values, the receiver MUST 1726 maintain 1728 o one Inactivity Timer 1730 o one Attempts counter 1732 8.4.2.1. Sender behavior 1734 At the beginning of the fragmentation of a new SCHC Packet, the 1735 fragment sender MUST select a Rule ID and DTag value pair for this 1736 SCHC Packet. 1738 Each SCHC Fragment MUST contain exactly one tile in its Payload. All 1739 tiles with the index 0, as well as the last tile, MUST be at least 1740 the size of an L2 Word. 1742 In all SCHC Fragment messages, the W field MUST be filled with the 1743 least significant bit of the window number that the sender is 1744 currently processing. 1746 For a SCHC Fragment that carries a tile other than the last one of 1747 the SCHC Packet, 1749 o the Fragment MUST be of the Regular type specified in 1750 Section 8.3.1.1 1752 o the FCN field MUST contain the tile index 1754 o each tile MUST be of a size that complements the SCHC Fragment 1755 Header so that the SCHC Fragment is a multiple of L2 Words without 1756 the need for padding bits. 1758 The SCHC Fragment that carries the last tile MUST be an All-1 SCHC 1759 Fragment, described in Section 8.3.1.2. 1761 The fragment sender MUST start by transmitting the window numbered 0. 1763 All message receptions being discussed in the rest of this section 1764 are to be understood as "matching the RuleID and DTag pair being 1765 processed", even if not spelled out, for brevity. 1767 The sender starts by a "blind transmission" phase, in which it MUST 1768 transmit all the tiles composing the window, in decreasing tile index 1769 order. 1771 Then, it enters a "retransmission phase" in which it MUST initialize 1772 an Attempts counter to 0, it MUST start a Retransmission Timer and it 1773 MUST await a SCHC ACK. Then, 1775 o upon receiving a SCHC ACK, 1777 * if the SCHC ACK indicates that some tiles are missing at the 1778 receiver, then the sender MUST transmit all the tiles that have 1779 been reported missing, it MUST increment Attempts, it MUST 1780 reset the Retransmission Timer and MUST await the next SCHC 1781 ACK. 1783 * if the current window is not the last one and the SCHC ACK 1784 indicates that all tiles were correctly received, the sender 1785 MUST stop the Retransmission Timer, it MUST advance to the next 1786 fragmentation window and it MUST start a blind transmission 1787 phase as described above. 1789 * if the current window is the last one and the SCHC ACK 1790 indicates that more tiles were received than the sender sent, 1791 the fragment sender MUST send a SCHC Sender-Abort, and it MAY 1792 exit with an error condition. 1794 * if the current window is the last one and the SCHC ACK 1795 indicates that all tiles were correctly received yet integrity 1796 check was a failure, the fragment sender MUST send a SCHC 1797 Sender-Abort, and it MAY exit with an error condition. 1799 * if the current window is the last one and the SCHC ACK 1800 indicates that integrity checking was successful, the sender 1801 exits successfully. 1803 o on Retransmission Timer expiration, 1805 * if Attempts is strictly less that MAX_ACK_REQUESTS, the 1806 fragment sender MUST send a SCHC ACK REQ and MUST increment the 1807 Attempts counter. 1809 * otherwise the fragment sender MUST send a SCHC Sender-Abort, 1810 and it MAY exit with an error condition. 1812 At any time, 1813 o on receiving a SCHC Receiver-Abort, the fragment sender MAY exit 1814 with an error condition. 1816 o on receiving a SCHC ACK that bears a W value different from the W 1817 value that it currently uses, the fragment sender MUST silently 1818 discard and ignore that SCHC ACK. 1820 Figure 39 shows an example of a corresponding state machine. 1822 8.4.2.2. Receiver behavior 1824 On receiving a SCHC Fragment with a Rule ID and DTag pair not being 1825 processed at that time 1827 o the receiver SHOULD check if the DTag value has not recently been 1828 used for that Rule ID value, thereby ensuring that the received 1829 SCHC Fragment is not a remnant of a prior fragmented SCHC Packet 1830 transmission. If the SCHC Fragment is determined to be such a 1831 remnant, the receiver MAY silently ignore it and discard it. 1833 o the receiver MUST start a process to assemble a new SCHC Packet 1834 with that Rule ID and DTag value pair. 1836 o the receiver MUST start an Inactivity Timer for that RuleID and 1837 DTag pair. It MUST initialize an Attempts counter to 0 for that 1838 RuleID and DTag pair. It MUST initialize a window counter to 0. 1839 If the receiver is under-resourced to do this, it MUST respond to 1840 the sender with a SCHC Receiver Abort. 1842 In the rest of this section, "local W bit" means the least 1843 significant bit of the window counter of the receiver. 1845 On reception of any SCHC F/R message for the RuleID and DTag pair 1846 being processed, the receiver MUST reset the Inactivity Timer 1847 pertaining to that RuleID and DTag pair. 1849 All message receptions being discussed in the rest of this section 1850 are to be understood as "matching the RuleID and DTag pair being 1851 processed", even if not spelled out, for brevity. 1853 The receiver MUST first initialize an empty Bitmap for the first 1854 window, then enter an "acceptance phase", in which 1856 o on receiving a SCHC Fragment or a SCHC ACK REQ, either one having 1857 the W bit different from the local W bit, the receiver MUST 1858 silently ignore and discard that message. 1860 o on receiving a SCHC ACK REQ with the W bit equal to the local W 1861 bit, the receiver MUST send a SCHC ACK for this window. 1863 o on receiving a SCHC Fragment with the W bit equal to the local W 1864 bit, the receiver MUST assemble the received tile based on the 1865 window counter and on the FCN field in the SCHC Fragment and it 1866 MUST update the Bitmap. 1868 * if the SCHC Fragment received is an All-0 SCHC Fragment, the 1869 current window is determined to be a not-last window, the 1870 receiver MUST send a SCHC ACK for this window and it MUST enter 1871 the "retransmission phase" for this window. 1873 * if the SCHC Fragment received is an All-1 SCHC Fragment, the 1874 padding bits of the All-1 SCHC Fragment MUST be assembled after 1875 the received tile, the current window is determined to be the 1876 last window, the receiver MUST perform the integrity check and 1877 it MUST send a SCHC ACK for this window. Then, 1879 + If the integrity check indicates that the full SCHC Packet 1880 has been correctly reassembled, the receiver MUST enter the 1881 "clean-up phase" for this window. 1883 + If the integrity check indicates that the full SCHC Packet 1884 has not been correctly reassembled, the receiver enters the 1885 "retransmission phase" for this window. 1887 In the "retransmission phase": 1889 o if the window is a not-last window 1891 * on receiving a SCHC Fragment that is not All-0 or All-1 and 1892 that has a W bit different from the local W bit, the receiver 1893 MUST increment its window counter and allocate a fresh Bitmap, 1894 it MUST assemble the tile received and update the Bitmap and it 1895 MUST enter the "acceptance phase" for that new window. 1897 * on receiving a SCHC ACK REQ with a W bit different from the 1898 local W bit, the receiver MUST increment its window counter and 1899 allocate a fresh Bitmap, it MUST send a SCHC ACK for that new 1900 window and it MUST enter the "acceptance phase" for that new 1901 window. 1903 * on receiving a SCHC All-0 Fragment with a W bit different from 1904 the local W bit, the receiver MUST increment its window counter 1905 and allocate a fresh Bitmap, it MUST assemble the tile received 1906 and update the Bitmap, it MUST send a SCHC ACK for that new 1907 window and it MUST stay in the "retransmission phase" for that 1908 new window. 1910 * on receiving a SCHC All-1 Fragment with a W bit different from 1911 the local W bit, the receiver MUST increment its window counter 1912 and allocate a fresh Bitmap, it MUST assemble the tile 1913 received, including the padding bits, it MUST update the Bitmap 1914 and perform the integrity check, it MUST send a SCHC ACK for 1915 the new window, which is determined to be the last window. 1916 Then, 1918 + If the integrity check indicates that the full SCHC Packet 1919 has been correctly reassembled, the receiver MUST enter the 1920 "clean-up phase" for that new window. 1922 + If the integrity check indicates that the full SCHC Packet 1923 has not been correctly reassembled, the receiver enters the 1924 "retransmission phase" for that new window. 1926 * on receiving a SCHC Fragment with a W bit equal to the local W 1927 bit, 1929 + if the SCHC Fragment received is an All-1 SCHC Fragment, the 1930 receiver MUST silently ignore it and discard it. 1932 + otherwise, the receiver MUST assemble the tile received and 1933 update the Bitmap. If the Bitmap becomes fully populated 1934 with 1's or if the SCHC Fragment is an All-0, the receiver 1935 MUST send a SCHC ACK for this window. 1937 * on receiving a SCHC ACK REQ with the W bit equal to the local W 1938 bit, the receiver MUST send a SCHC ACK for this window. 1940 o if the window is the last window 1942 * on receiving a SCHC Fragment or a SCHC ACK, either one having a 1943 W bit different from the local W bit, the receiver MUST 1944 silently ignore and discard that message. 1946 * on receiving a SCHC ACK REQ with the W bit equal to the local W 1947 bit, the receiver MUST send a SCHC ACK for this window. 1949 * on receiving a SCHC Fragment with a W bit equal to the local W 1950 bit, 1952 + if the SCHC Fragment received is an All-0 SCHC Fragment, the 1953 receiver MUST silently ignore it and discard it. 1955 + otherwise, the receiver MUST update the Bitmap and it MUST 1956 assemble the tile received. If the SCHC Fragment received 1957 is an All-1 SCHC Fragment, the receiver MUST assemble the 1958 padding bits of the All-1 SCHC Fragment after the received 1959 tile, it MUST perform the integrity check and 1961 - if the integrity check indicates that the full SCHC 1962 Packet has been correctly reassembled, the receiver MUST 1963 send a SCHC ACK and it enters the "clean-up phase". 1965 - if the integrity check indicates that the full SCHC 1966 Packet has not been correctly reassembled, 1968 o if the SCHC Fragment received was an All-1 SCHC 1969 Fragment, the receiver MUST send a SCHC ACK for this 1970 window. 1972 In the "clean-up phase": 1974 o On receiving an All-1 SCHC Fragment or a SCHC ACK REQ, either one 1975 having the W bit equal to the local W bit, the receiver MUST send 1976 a SCHC ACK. 1978 o Any other SCHC Fragment received MUST be silently ignored and 1979 discarded. 1981 At any time, on expiration of the Inactivity Timer, on receiving a 1982 SCHC Sender-Abort or when Attempts reaches MAX_ACK_REQUESTS, the 1983 receiver MUST send a SCHC Receiver-Abort and it MAY exit the receive 1984 process for that SCHC Packet. 1986 Figure 40 shows an example of a corresponding state machine. 1988 8.4.3. ACK-on-Error mode 1990 The ACK-on-Error mode supports LPWAN technologies that have variable 1991 MTU and out-of-order delivery. It operates with links that provide a 1992 feedback path from the reassembler to the fragmenter. See Appendix F 1993 for a discussion on using ACK-on-Error mode on quasi-bidirectional 1994 links. 1996 In ACK-on-Error mode, windows are used. 1998 All tiles, but the last one and the penultimate one, MUST be of equal 1999 size, hereafter called "regular". The size of the last tile MUST be 2000 smaller than or equal to the regular tile size. Regarding the 2001 penultimate tile, a Profile MUST pick one of the following two 2002 options: 2004 o The penultimate tile size MUST be the regular tile size 2006 o or the penultimate tile size MUST be either the regular tile size 2007 or the regular tile size minus one L2 Word. 2009 A SCHC Fragment message carries one or several contiguous tiles, 2010 which may span multiple windows. A SCHC ACK reports on the reception 2011 of exactly one window of tiles. 2013 See Figure 23 for an example. 2015 +---------------------------------------------...-----------+ 2016 | SCHC Packet | 2017 +---------------------------------------------...-----------+ 2019 Tile # | 4 | 3 | 2 | 1 | 0 | 4 | 3 | 2 | 1 | 0 | 4 | | 0 | 4 |3| 2020 Window # |-------- 0 --------|-------- 1 --------|- 2 ... 27 -|- 28-| 2022 SCHC Fragment msg |-----------| 2024 Figure 23: a SCHC Packet fragmented in tiles, ACK-on-Error mode 2026 The W field is wide enough that it unambiguously represents an 2027 absolute window number. The fragment receiver sends SCHC ACKs to the 2028 fragment sender about windows for which tiles are missing. No SCHC 2029 ACK is sent by the fragment receiver for windows that it knows have 2030 been fully received. 2032 The fragment sender retransmits SCHC Fragments for tiles that are 2033 reported missing. It can advance to next windows even before it has 2034 ascertained that all tiles belonging to previous windows have been 2035 correctly received, and can still later retransmit SCHC Fragments 2036 with tiles belonging to previous windows. Therefore, the sender and 2037 the receiver may operate in a decoupled fashion. The fragmented SCHC 2038 Packet transmission concludes when 2040 o integrity checking shows that the fragmented SCHC Packet has been 2041 correctly reassembled at the receive end, and this information has 2042 been conveyed back to the sender, 2044 o or too many retransmission attempts were made, 2046 o or the receiver determines that the transmission of this 2047 fragmented SCHC Packet has been inactive for too long. 2049 Each Profile MUST specify which Rule ID value(s) correspond to SCHC 2050 F/R messages operating in this mode. 2052 The W field MUST be present in the SCHC F/R messages. 2054 Each Profile, for each Rule ID value, MUST define 2056 o the tile size (a tile does not need to be multiple of an L2 Word, 2057 but it MUST be at least the size of an L2 Word) 2059 o the value of M (size of the W field), 2061 o the value of N (size of the FCN field), 2063 o the value of WINDOW_SIZE, which MUST be strictly less than 2^N, 2065 o the size and algorithm for the RCS field, 2067 o the size of the DTag field, 2069 o the value of MAX_ACK_REQUESTS, 2071 o the expiration time of the Retransmission Timer 2073 o the expiration time of the Inactivity Timer 2075 o if the last tile is carried in a Regular SCHC Fragment or an All-1 2076 SCHC Fragment (see Section 8.4.3.1) 2078 o if the penultimate tile MAY be one L2 Word smaller than the 2079 regular tile size. In this case, the regular tile size MUST be at 2080 least twice the L2 Word size. 2082 For each active pair of Rule ID and DTag values, the sender MUST 2083 maintain 2085 o one Attempts counter 2087 o one Retransmission Timer 2089 For each active pair of Rule ID and DTag values, the receiver MUST 2090 maintain 2092 o one Inactivity Timer 2094 o one Attempts counter 2096 8.4.3.1. Sender behavior 2098 At the beginning of the fragmentation of a new SCHC Packet, 2100 o the fragment sender MUST select a Rule ID and DTag value pair for 2101 this SCHC Packet. A Rule MUST NOT be selected if the values of M 2102 and WINDOW_SIZE for that Rule are such that the SCHC Packet cannot 2103 be fragmented in (2^M) * WINDOW_SIZE tiles or less. 2105 o the fragment sender MUST initialize the Attempts counter to 0 for 2106 that Rule ID and DTag value pair. 2108 A Regular SCHC Fragment message carries in its payload one or more 2109 tiles. If more than one tile is carried in one Regular SCHC Fragment 2111 o the selected tiles MUST be contiguous in the original SCHC Packet 2113 o they MUST be placed in the SCHC Fragment Payload adjacent to one 2114 another, in the order they appear in the SCHC Packet, from the 2115 start of the SCHC Packet toward its end. 2117 Tiles that are not the last one MUST be sent in Regular SCHC 2118 Fragments specified in Section 8.3.1.1. The FCN field MUST contain 2119 the tile index of the first tile sent in that SCHC Fragment. 2121 In a Regular SCHC Fragment message, the sender MUST fill the W field 2122 with the window number of the first tile sent in that SCHC Fragment. 2124 Depending on the Profile, the last tile of a SCHC Packet MUST be sent 2125 either 2127 o in a Regular SCHC Fragment, alone or as part of a multi-tiles 2128 Payload 2130 o alone in an All-1 SCHC Fragment 2132 In an All-1 SCHC Fragment message, the sender MUST fill the W field 2133 with the window number of the last tile of the SCHC Packet. 2135 The fragment sender MUST send SCHC Fragments such that, all together, 2136 they contain all the tiles of the fragmented SCHC Packet. 2138 The fragment sender MUST send at least one All-1 SCHC Fragment. 2140 The fragment sender MUST listen for SCHC ACK messages after having 2141 sent 2143 o an All-1 SCHC Fragment 2144 o or a SCHC ACK REQ. 2146 A Profile MAY specify other times at which the fragment sender MUST 2147 listen for SCHC ACK messages. For example, this could be after 2148 sending a complete window of tiles. 2150 Each time a fragment sender sends an All-1 SCHC Fragment or a SCHC 2151 ACK REQ, 2153 o it MUST increment the Attempts counter 2155 o it MUST reset the Retransmission Timer 2157 On Retransmission Timer expiration 2159 o if Attempts is strictly less than MAX_ACK_REQUESTS, the fragment 2160 sender MUST send either the All-1 SCHC Fragment or a SCHC ACK REQ 2161 with the W field corresponding to the last window, 2163 o otherwise the fragment sender MUST send a SCHC Sender-Abort and it 2164 MAY exit with an error condition. 2166 All message receptions being discussed in the rest of this section 2167 are to be understood as "matching the RuleID and DTag pair being 2168 processed", even if not spelled out, for brevity. 2170 On receiving a SCHC ACK, 2172 o if the W field in the SCHC ACK corresponds to the last window of 2173 the SCHC Packet, 2175 * if the C bit is set, the sender MAY exit successfully 2177 * otherwise, 2179 + if the Profile mandates that the last tile be sent in an 2180 All-1 SCHC Fragment, 2182 - if the SCHC ACK shows no missing tile at the receiver, 2183 the sender 2185 o MUST send a SCHC Sender-Abort 2187 o MAY exit with an error condition 2189 - otherwise 2190 o the fragment sender MUST send SCHC Fragment messages 2191 containing all the tiles that are reported missing in 2192 the SCHC ACK. 2194 o if the last message in this sequence of SCHC Fragment 2195 messages is not an All-1 SCHC Fragment, then the 2196 fragment sender MUST in addition send a SCHC ACK REQ 2197 with the W field corresponding to the last window, 2198 after the sequence. 2200 + otherwise, 2202 - if the SCHC ACK shows no missing tile at the receiver, 2203 the sender MUST send the All-1 SCHC Fragment 2205 - otherwise 2207 o the fragment sender MUST send SCHC Fragment messages 2208 containing all the tiles that are reported missing in 2209 the SCHC ACK. 2211 o the fragment sender MUST then send either the All-1 2212 SCHC Fragment or a SCHC ACK REQ with the W field 2213 corresponding to the last window. 2215 o otherwise, the fragment sender 2217 * MUST send SCHC Fragment messages containing the tiles that are 2218 reported missing in the SCHC ACK 2220 * then it MAY send a SCHC ACK REQ with the W field corresponding 2221 to the last window 2223 See Figure 41 for one among several possible examples of a Finite 2224 State Machine implementing a sender behavior obeying this 2225 specification. 2227 8.4.3.2. Receiver behavior 2229 On receiving a SCHC Fragment with a Rule ID and DTag pair not being 2230 processed at that time 2232 o the receiver SHOULD check if the DTag value has not recently been 2233 used for that Rule ID value, thereby ensuring that the received 2234 SCHC Fragment is not a remnant of a prior fragmented SCHC Packet 2235 transmission. If the SCHC Fragment is determined to be such a 2236 remnant, the receiver MAY silently ignore it and discard it. 2238 o the receiver MUST start a process to assemble a new SCHC Packet 2239 with that Rule ID and DTag value pair. The receiver MUST start an 2240 Inactivity Timer for that Rule ID and DTag value pair. It MUST 2241 initialize an Attempts counter to 0 for that Rule ID and DTag 2242 value pair. If the receiver is under-resourced to do this, it 2243 MUST respond to the sender with a SCHC Receiver Abort. 2245 On reception of any SCHC F/R message for the RuleID and DTag pair 2246 being processed, the receiver MUST reset the Inactivity Timer 2247 pertaining to that RuleID and DTag pair. 2249 All message receptions being discussed in the rest of this section 2250 are to be understood as "matching the RuleID and DTag pair being 2251 processed", even if not spelled out, for brevity. 2253 On receiving a SCHC Fragment message, the receiver determines what 2254 tiles were received, based on the payload length and on the W and FCN 2255 fields of the SCHC Fragment. 2257 o if the FCN is All-1, if a Payload is present, the full SCHC 2258 Fragment Payload MUST be assembled including the padding bits. 2259 This is because the size of the last tile is not known by the 2260 receiver, therefore padding bits are indistinguishable from the 2261 tile data bits, at this stage. They will be removed by the SCHC 2262 C/D sublayer. If the size of the SCHC Fragment Payload exceeds or 2263 equals the size of one regular tile plus the size of an L2 Word, 2264 this SHOULD raise an error flag. 2266 o otherwise, tiles MUST be assembled based on the a priori known 2267 tile size. 2269 * If allowed by the Profile, the end of the payload MAY contain 2270 the last tile, which may be shorter. Padding bits are 2271 indistinguishable from the tile data bits, at this stage. 2273 * the payload may contain the penultimate tile that, if allowed 2274 by the Profile, MAY be exactly one L2 Word shorter than the 2275 regular tile size. 2277 * Otherwise, padding bits MUST be discarded. The latter is 2278 possible because 2280 + the size of the tiles is known a priori, 2282 + tiles are larger than an L2 Word 2284 + padding bits are always strictly less than an L2 Word 2286 On receiving a SCHC ACK REQ or an All-1 SCHC Fragment, 2288 o if the receiver has at least one window that it knows has tiles 2289 missing, it MUST return a SCHC ACK for the lowest-numbered such 2290 window, 2292 o otherwise, 2294 * if it has received at least one tile, it MUST return a SCHC ACK 2295 for the highest-numbered window it currently has tiles for 2297 * otherwise it MUST return a SCHC ACK for window numbered 0 2299 A Profile MAY specify other times and circumstances at which a 2300 receiver sends a SCHC ACK, and which window the SCHC ACK reports 2301 about in these circumstances. 2303 Upon sending a SCHC ACK, the receiver MUST increase the Attempts 2304 counter. 2306 After receiving an All-1 SCHC Fragment, a receiver MUST check the 2307 integrity of the reassembled SCHC Packet at least every time it 2308 prepares for sending a SCHC ACK for the last window. 2310 Upon receiving a SCHC Sender-Abort, the receiver MAY exit with an 2311 error condition. 2313 Upon expiration of the Inactivity Timer, the receiver MUST send a 2314 SCHC Receiver-Abort and it MAY exit with an error condition. 2316 On the Attempts counter exceeding MAX_ACK_REQUESTS, the receiver MUST 2317 send a SCHC Receiver-Abort and it MAY exit with an error condition. 2319 Reassembly of the SCHC Packet concludes when 2321 o a Sender-Abort has been received 2323 o or the Inactivity Timer has expired 2325 o or the Attempts counter has exceeded MAX_ACK_REQUESTS 2327 o or when at least an All-1 SCHC Fragment has been received and 2328 integrity checking of the reassembled SCHC Packet is successful. 2330 See Figure 42 for one among several possible examples of a Finite 2331 State Machine implementing a receiver behavior obeying this 2332 specification, and that is meant to match the sender Finite State 2333 Machine of Figure 41. 2335 9. Padding management 2337 SCHC C/D and SCHC F/R operate on bits, not bytes. SCHC itself does 2338 not have any alignment prerequisite. The size of SCHC Packets can be 2339 any number of bits. 2341 If the layer below SCHC constrains the payload to align to some 2342 boundary, called L2 Words (for example, bytes), the SCHC messages 2343 MUST be padded. When padding occurs, the number of appended bits 2344 MUST be strictly less than the L2 Word size. 2346 If a SCHC Packet is sent unfragmented (see Figure 24), it is padded 2347 as needed for transmission. 2349 If a SCHC Packet needs to be fragmented for transmission, it is not 2350 padded in itself. Only the SCHC F/R messages are padded as needed 2351 for transmission. Some SCHC F/R messages are intrinsically aligned 2352 to L2 Words. 2354 A packet (e.g. an IPv6 packet) 2355 | ^ (padding bits 2356 v | dropped) 2357 +------------------+ +--------------------+ 2358 | SCHC Compression | | SCHC Decompression | 2359 +------------------+ +--------------------+ 2360 | ^ 2361 | If no fragmentation | 2362 +---- SCHC Packet + padding as needed ----->| 2363 | | (integrity 2364 v | checked) 2365 +--------------------+ +-----------------+ 2366 | SCHC Fragmentation | | SCHC Reassembly | 2367 +--------------------+ +-----------------+ 2368 | ^ | ^ 2369 | | | | 2370 | +--- SCHC ACK + padding as needed --+ | 2371 | | 2372 +------- SCHC Fragments + padding as needed---------+ 2374 Sender Receiver 2376 Figure 24: SCHC operations, including padding as needed 2378 Each Profile MUST specify the size of the L2 Word. The L2 Word might 2379 actually be a single bit, in which case no padding will take place at 2380 all. 2382 A Profile MAY define the value of the padding bits. The RECOMMENDED 2383 value is 0. 2385 10. SCHC Compression for IPv6 and UDP headers 2387 This section lists the IPv6 and UDP header fields and describes how 2388 they can be compressed. An example of a set of Rules for UDP/IPv6 2389 header compression is provided in Appendix A. 2391 10.1. IPv6 version field 2393 The IPv6 version field is labeled by the protocol parser as being the 2394 "version" field of the IPv6 protocol. Therefore, it only exists for 2395 IPv6 packets. In the Rule, TV is set to 6, MO to "ignore" and CDA to 2396 "not-sent". 2398 10.2. IPv6 Traffic class field 2400 If the DiffServ field does not vary and is known by both sides, the 2401 Field Descriptor in the Rule SHOULD contain a TV with this well-known 2402 value, an "equal" MO and a "not-sent" CDA. 2404 Otherwise (e.g. ECN bits are to be transmitted), two possibilities 2405 can be considered depending on the variability of the value: 2407 o One possibility is to not compress the field and send the original 2408 value. In the Rule, TV is not set to any particular value, MO is 2409 set to "ignore" and CDA is set to "value-sent". 2411 o If some upper bits in the field are constant and known, a better 2412 option is to only send the LSBs. In the Rule, TV is set to a 2413 value with the stable known upper part, MO is set to MSB(x) and 2414 CDA to LSB. 2416 ECN functionality depends on both bits of the ECN field, which are 2417 the 2 LSBs of this field, hence sending only a single LSB of this 2418 field is NOT RECOMMENDED. 2420 10.3. Flow label field 2422 If the flow label is not set, i.e. its value is zero, the Field 2423 Descriptor in the Rule SHOULD contain a TV set to zero, an "equal" MO 2424 and a "not-sent" CDA. 2426 If the flow label is set to a pseudo-random value according to 2427 [RFC6437], in the Rule, TV is not set to any particular value, MO is 2428 set to "ignore" and CDA is set to "value-sent". 2430 If the flow label is set according to some prior agreement, i.e. by a 2431 flow state establishment method as allowed by [RFC6437], the Field 2432 Descriptor in the Rule SHOULD contain a TV with this agreed-upon 2433 value, an "equal" MO and a "not-sent" CDA. 2435 10.4. Payload Length field 2437 This field can be elided for the transmission on the LPWAN network. 2438 The SCHC C/D recomputes the original payload length value. In the 2439 Field Descriptor, TV is not set, MO is set to "ignore" and CDA is 2440 "compute-*". 2442 10.5. Next Header field 2444 If the Next Header field does not vary and is known by both sides, 2445 the Field Descriptor in the Rule SHOULD contain a TV with this Next 2446 Header value, the MO SHOULD be "equal" and the CDA SHOULD be "not- 2447 sent". 2449 Otherwise, TV is not set in the Field Descriptor, MO is set to 2450 "ignore" and CDA is set to "value-sent". Alternatively, a matching- 2451 list MAY also be used. 2453 10.6. Hop Limit field 2455 The field behavior for this field is different for uplink (Up) and 2456 downlink (Dw). In Up, since there is no IP forwarding between the 2457 Dev and the SCHC C/D, the value is relatively constant. On the other 2458 hand, the Dw value depends on Internet routing and can change more 2459 frequently. The Direction Indicator (DI) can be used to distinguish 2460 both directions: 2462 o in the Up, elide the field: the TV in the Field Descriptor is set 2463 to the known constant value, the MO is set to "equal" and the CDA 2464 is set to "not-sent". 2466 o in the Dw, the Hop Limit is elided for transmission and forced to 2467 1 at the receiver, by setting TV to 1, MO to "ignore" and CDA to 2468 "not-sent". This prevents any further forwarding. 2470 10.7. IPv6 addresses fields 2472 As in 6LoWPAN [RFC4944], IPv6 addresses are split into two 64-bit 2473 long fields; one for the prefix and one for the Interface Identifier 2474 (IID). These fields SHOULD be compressed. To allow for a single 2475 Rule being used for both directions, these values are identified by 2476 their role (Dev or App) and not by their position in the header 2477 (source or destination). 2479 10.7.1. IPv6 source and destination prefixes 2481 Both ends MUST be configured with the appropriate prefixes. For a 2482 specific flow, the source and destination prefixes can be unique and 2483 stored in the Context. In that case, the TV for the source and 2484 destination prefixes contain the values, the MO is set to "equal" and 2485 the CDA is set to "not-sent". 2487 If the Rule is intended to compress packets with different prefix 2488 values, match-mapping SHOULD be used. The different prefixes are 2489 listed in the TV, the MO is set to "match-mapping" and the CDA is set 2490 to "mapping-sent". See Figure 26. 2492 Otherwise, the TV is not set, the MO is set to "ignore" and the CDA 2493 is set to "value-sent". 2495 10.7.2. IPv6 source and destination IID 2497 If the Dev or App IID are based on an LPWAN address, then the IID can 2498 be reconstructed with information coming from the LPWAN header. In 2499 that case, the TV is not set, the MO is set to "ignore" and the CDA 2500 is set to "DevIID" or "AppIID". On LPWAN technologies where the 2501 frames carry a single identifier (corresponding to the Dev.), AppIID 2502 cannot be used. 2504 As described in [RFC8065], it may be undesirable to build the Dev 2505 IPv6 IID out of the Dev address. Another static value is used 2506 instead. In that case, the TV contains the static value, the MO 2507 operator is set to "equal" and the CDA is set to "not-sent". 2509 If several IIDs are possible, then the TV contains the list of 2510 possible IIDs, the MO is set to "match-mapping" and the CDA is set to 2511 "mapping-sent". 2513 It may also happen that the IID variability only expresses itself on 2514 a few bytes. In that case, the TV is set to the stable part of the 2515 IID, the MO is set to "MSB" and the CDA is set to "LSB". 2517 Finally, the IID can be sent in its entirety on the LPWAN. In that 2518 case, the TV is not set, the MO is set to "ignore" and the CDA is set 2519 to "value-sent". 2521 10.8. IPv6 extension headers 2523 This document does not provide recommendations on how to compress 2524 IPv6 extension headers. 2526 10.9. UDP source and destination ports 2528 To allow for a single Rule being used for both directions, the UDP 2529 port values are identified by their role (Dev or App) and not by 2530 their position in the header (source or destination). The SCHC C/D 2531 MUST be aware of the traffic direction (Uplink, Downlink) to select 2532 the appropriate field. The following Rules apply for Dev and App 2533 port numbers. 2535 If both ends know the port number, it can be elided. The TV contains 2536 the port number, the MO is set to "equal" and the CDA is set to "not- 2537 sent". 2539 If the port variation is on few bits, the TV contains the stable part 2540 of the port number, the MO is set to "MSB" and the CDA is set to 2541 "LSB". 2543 If some well-known values are used, the TV can contain the list of 2544 these values, the MO is set to "match-mapping" and the CDA is set to 2545 "mapping-sent". 2547 Otherwise the port numbers are sent over the LPWAN. The TV is not 2548 set, the MO is set to "ignore" and the CDA is set to "value-sent". 2550 10.10. UDP length field 2552 The UDP length can be computed from the received data. The TV is not 2553 set, the MO is set to "ignore" and the CDA is set to "compute-*". 2555 10.11. UDP Checksum field 2557 The UDP checksum operation is mandatory with IPv6 for most packets 2558 but there are exceptions [RFC8200]. 2560 For instance, protocols that use UDP as a tunnel encapsulation may 2561 enable zero-checksum mode for a specific port (or set of ports) for 2562 sending and/or receiving. [RFC8200] requires any node implementing 2563 zero-checksum mode to follow the requirements specified in 2564 "Applicability Statement for the Use of IPv6 UDP Datagrams with Zero 2565 Checksums" [RFC6936]. 2567 6LoWPAN Header Compression [RFC6282] also specifies that a UDP 2568 checksum can be elided by the compressor and re-computed by the 2569 decompressor when an upper layer guarantees the integrity of the UDP 2570 payload and pseudo-header. A specific example of this is when a 2571 message integrity check protects the compressed message between the 2572 compressor that elides the UDP checksum and the decompressor that 2573 computes it, with a strength that is identical or better to the UDP 2574 checksum. 2576 Similarly, a SCHC compressor MAY elide the UDP checksum when another 2577 layer guarantees at least equal integrity protection for the UDP 2578 payload and the pseudo-header. In this case, the TV is not set, the 2579 MO is set to "ignore" and the CDA is set to "compute-*". 2581 In particular, when SCHC fragmentation is used, a fragmentation RCS 2582 of 2 bytes or more provides equal or better protection than the UDP 2583 checksum; in that case, if the compressor is collocated with the 2584 fragmentation point and the decompressor is collocated with the 2585 packet reassembly point, and if the SCHC Packet is fragmented even 2586 when it would fit unfragmented in the L2 MTU, then the compressor MAY 2587 verify and then elide the UDP checksum. Whether and when the UDP 2588 Checksum is elided is to be specified in the Profile. 2590 Since the compression happens before the fragmentation, implementors 2591 should understand the risks when dealing with unprotected data below 2592 the transport layer and take special care when manipulating that 2593 data. 2595 In other cases, the checksum SHOULD be explicitly sent. The TV is 2596 not set, the MO is set to "ignore" and the CDA is set to "value- 2597 sent". 2599 11. IANA Considerations 2601 This document has no request to IANA. 2603 12. Security considerations 2605 As explained in Section 5, SCHC is expected to be implemented on top 2606 of LPWAN technologies, which are expected to implement security 2607 measures. 2609 In this section, we analyze the potential security threats that could 2610 be introduced into an LPWAN by adding the SCHC functionalities. 2612 12.1. Security considerations for SCHC Compression/Decompression 2614 12.1.1. Forged SCHC Packet 2616 Let's assume that an attacker is able to send a forged SCHC Packet to 2617 a SCHC Decompressor. 2619 Let's first consider the case where the Rule ID contained in that 2620 forged SCHC Packet does not correspond to a Rule allocated in the 2621 Rule table. An implementation should detect that the Rule ID is 2622 invalid and should silently drop the offending SCHC Packet. 2624 Let's now consider that the Rule ID corresponds to a Rule in the 2625 table. With the CDAs defined in this document, the reconstructed 2626 packet is at most a constant number of bits bigger than the SCHC 2627 Packet that was received. This assumes that the compute-* 2628 decompression actions produce a bounded number of bits, irrespective 2629 of the incoming SCHC Packet. This property is true for IPv6 Length, 2630 UDP Length and UDP Checksum, for which the compute-* CDA is 2631 recommended by this document. 2633 As a consequence, SCHC Decompression does not amplify attacks, beyond 2634 adding a bounded number of bits to the SCHC Packet received. This 2635 bound is determined by the Rule stored in the receiving device. 2637 As a general safety measure, a SCHC Decompressor should never re- 2638 construct a packet larger than MAX_PACKET_SIZE (defined in a Profile, 2639 with 1500 bytes as generic default). 2641 12.1.2. Compressed packet size as a side channel to guess a secret 2642 token 2644 Some packet compression methods are known to be victims of attacks, 2645 such as BREACH and CRIME. The attack involves injecting arbitrary 2646 data into the packet and observing the resulting compresssed packet 2647 size. The observed size potentially reflects correlation between the 2648 arbitrary data and some content that was meant to remain secret, such 2649 as a security token, thereby allowing the attacker to get at the 2650 secret. 2652 By contrast, SCHC Compression takes place header field by header 2653 field, with the SCHC Packet being a mere concatenation of the 2654 compression residues of each of the individual field. Any 2655 correlation between header fields does not result in a change in the 2656 SCHC Packet size compressed under the same Rule. 2658 If SCHC C/D is used to compress packets that include a secret 2659 information field, such as a token, the Rule set should be designed 2660 so that the size of the compression residue for the field to remain 2661 secret is the same irrespective of the value of the secret 2662 information. This is achieved by e.g. sending this field in extenso 2663 with the "ignore" MO and the "value-sent" CDA. This recommendation 2664 is disputable if it is ascertained that the Rule set itself will 2665 remain secret. 2667 12.1.3. decompressed packet different from the original packet 2669 The attention of Rule designers is drawn to situation As explained in 2670 Section 7.3, using FPs with value 0 in Field Descriptors in a Rule 2671 may result in header fields appearing in the decompressed packet in 2672 an order different from that in the original packet. Likewise, as 2673 stated in Section 7.5.3, using an "ignore" MO together with a "not- 2674 sent" CDA will result in the header field taking the TV value, which 2675 is likely to be different from the original value. 2677 Depending on the protocol, the order of header fields in the packet 2678 may be functionally significant or not. 2680 Furthermore, if the packet is protected by a checksum or a similar 2681 integrity protection mechanism, and if the checksum is transmitted 2682 instead of being recomputed as part of the decompression, these 2683 situations may result in the packet being considered corrupt and 2684 dropped. 2686 12.2. Security considerations for SCHC Fragmentation/Reassembly 2688 12.2.1. Buffer reservation attack 2690 Let's assume that an attacker is able to send a forged SCHC Fragment 2691 to a SCHC Reassembler. 2693 A node can perform a buffer reservation attack: the receiver will 2694 reserve buffer space for the SCHC Packet. If the implementation has 2695 only one buffer, other incoming fragmented SCHC Packets will be 2696 dropped while the reassembly buffer is occupied during the reassembly 2697 timeout. Once that timeout expires, the attacker can repeat the same 2698 procedure, and iterate, thus creating a denial of service attack. An 2699 implementation may have multiple reassembly buffers. The cost to 2700 mount this attack is linear with the number of buffers at the target 2701 node. Better, the cost for an attacker can be increased if 2702 individual fragments of multiple SCHC Packets can be stored in the 2703 reassembly buffer. The finer grained the reassembly buffer (downto 2704 the smallest tile size), the higher the cost of the attack. If 2705 buffer overload does occur, a smart receiver could selectively 2706 discard SCHC Packets being reassembled based on the sender behavior, 2707 which may help identify which SCHC Fragments have been sent by the 2708 attacker. Another mild counter-measure is for the target to abort 2709 the fragmentation/reassembly session as early as it detects a non- 2710 identical SCHC Fragment duplicate, anticipating for an eventual 2711 corrupt SCHC Packet, so as to save the sender the hassle of sending 2712 the rest of the fragments for this SCHC Packet. 2714 12.2.2. Corrupt Fragment attack 2716 Let's assume that an attacker is able to send a forged SCHC Fragment 2717 to a SCHC Reassembler. The malicious node is additionally assumed to 2718 be able to hear an incoming communication destined to the target 2719 node. 2721 It can then send a forged SCHC Fragment that looks like it belongs to 2722 a SCHC Packet already being reassembled at the target node. This can 2723 cause the SCHC Packet to be considered corrupt and be dropped by the 2724 receiver. The amplification happens here by a single spoofed SCHC 2725 Fragment rendering a full sequence of legit SCHC Fragments useless. 2726 If the target uses ACK-Always or ACK-on-Error mode, such a malicious 2727 node can also interfere with the acknowledgement and repetition 2728 algorithm of SCHC F/R. A single spoofed ACK, with all bitmap bits 2729 set to 0, will trigger the repetition of WINDOW_SIZE tiles. This 2730 protocol loop amplification depletes the energy source of the target 2731 node and consumes the channel bandwidth. Similarly, a spoofed ACK 2732 REQ will trigger the sending of a SCHC ACK, which may be much larger 2733 than the ACK REQ if WINDOW_SIZE is large. These consequences should 2734 be borne in mind when defining profiles for SCHC over specific LPWAN 2735 technologies. 2737 12.2.3. Fragmentation as a way to bypass Network Inspection 2739 Fragmentation is known for potentially allowing to force through a 2740 Network Inspection device (e.g. firewall) packets that would be 2741 rejected if unfragmented. This involves sending overlapping 2742 fragments to rewrite fields whose initial value led the Network 2743 Inspection device to allow the flow go through. 2745 SCHC F/R is expected to be used over one LPWAN link, where no Network 2746 Inspection device is expected to sit. As described in Section 5.2, 2747 even if the SCHC F/R on the Network infrastructure side is located in 2748 the Internet, a tunnel is to be established between it and the NGW. 2750 12.2.4. Privacy issues associated with SCHC header fields 2752 SCHC F/R allocates a DTag value to fragments belonging to the same 2753 SCHC Packet. Concerns were raised that, if DTag is a wide counter 2754 that is incremented in a predictible fashion for each new fragmented 2755 SCHC Packet, it might lead to a privacy issue, such as enabling 2756 tracking of a device across LPWANs. 2758 However, SCHC F/R is expected to be used over exactly one LPWAN link. 2759 As described in Section 5.2, even if the SCHC F/R on the Network 2760 infrastructure side is located in the Internet, a tunnel is to be 2761 established between it and the NGW. Therefore, neither the DTag 2762 field nor any other SCHC-introduced field is visible over the 2763 Internet. 2765 13. Acknowledgements 2767 Thanks to (in alphabetical order) Sergio Aguilar Romero, David Black, 2768 Carsten Bormann, Deborah Brungard, Brian Carpenter, Philippe Clavier, 2769 Alissa Cooper, Roman Danyliw, Daniel Ducuara Beltran, Diego Dujovne, 2770 Eduardo Ingles Sanchez, Rahul Jadhav, Benjamin Kaduk, 2771 Arunprabhu Kandasamy, Suresh Krishnan, Mirja Kuehlewind, Barry Leiba, 2772 Sergio Lopez Bernal, Antoni Markovski, Alexey Melnikov, 2773 Georgios Papadopoulos, Alexander Pelov, Charles Perkins, Edgar Ramos, 2774 Alvaro Retana, Adam Roach, Shoichi Sakane, Joseph Salowey, 2775 Pascal Thubert, and Eric Vyncke for useful design considerations, 2776 reviews and comments. 2778 Carles Gomez has been funded in part by the Spanish Government 2779 (Ministerio de Educacion, Cultura y Deporte) through the Jose 2780 Castillejo grant CAS15/00336, and by the ERDF and the Spanish 2781 Government through project TEC2016-79988-P. Part of his contribution 2782 to this work has been carried out during his stay as a visiting 2783 scholar at the Computer Laboratory of the University of Cambridge. 2785 14. References 2787 14.1. Normative References 2789 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2790 Requirement Levels", BCP 14, RFC 2119, 2791 DOI 10.17487/RFC2119, March 1997, 2792 . 2794 [RFC6936] Fairhurst, G. and M. Westerlund, "Applicability Statement 2795 for the Use of IPv6 UDP Datagrams with Zero Checksums", 2796 RFC 6936, DOI 10.17487/RFC6936, April 2013, 2797 . 2799 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2800 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2801 May 2017, . 2803 [RFC8200] Deering, S. and R. Hinden, "Internet Protocol, Version 6 2804 (IPv6) Specification", STD 86, RFC 8200, 2805 DOI 10.17487/RFC8200, July 2017, 2806 . 2808 [RFC8376] Farrell, S., Ed., "Low-Power Wide Area Network (LPWAN) 2809 Overview", RFC 8376, DOI 10.17487/RFC8376, May 2018, 2810 . 2812 14.2. Informative References 2814 [ETHERNET] 2815 "IEEE Standard for Ethernet", IEEE standard, 2816 DOI 10.1109/ieeestd.2018.8457469, n.d.. 2818 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, 2819 "Transmission of IPv6 Packets over IEEE 802.15.4 2820 Networks", RFC 4944, DOI 10.17487/RFC4944, September 2007, 2821 . 2823 [RFC5795] Sandlund, K., Pelletier, G., and L-E. Jonsson, "The RObust 2824 Header Compression (ROHC) Framework", RFC 5795, 2825 DOI 10.17487/RFC5795, March 2010, 2826 . 2828 [RFC6282] Hui, J., Ed. and P. Thubert, "Compression Format for IPv6 2829 Datagrams over IEEE 802.15.4-Based Networks", RFC 6282, 2830 DOI 10.17487/RFC6282, September 2011, 2831 . 2833 [RFC6437] Amante, S., Carpenter, B., Jiang, S., and J. Rajahalme, 2834 "IPv6 Flow Label Specification", RFC 6437, 2835 DOI 10.17487/RFC6437, November 2011, 2836 . 2838 [RFC7136] Carpenter, B. and S. Jiang, "Significance of IPv6 2839 Interface Identifiers", RFC 7136, DOI 10.17487/RFC7136, 2840 February 2014, . 2842 [RFC8065] Thaler, D., "Privacy Considerations for IPv6 Adaptation- 2843 Layer Mechanisms", RFC 8065, DOI 10.17487/RFC8065, 2844 February 2017, . 2846 Appendix A. Compression Examples 2848 This section gives some scenarios of the compression mechanism for 2849 IPv6/UDP. The goal is to illustrate the behavior of SCHC. 2851 The mechanisms defined in this document can be applied to a Dev that 2852 embeds some applications running over CoAP. In this example, three 2853 flows are considered. The first flow is for the device management 2854 based on CoAP using Link Local IPv6 addresses and UDP ports 123 and 2855 124 for Dev and App, respectively. The second flow will be a CoAP 2856 server for measurements done by the Dev (using ports 5683) and Global 2857 IPv6 Address prefixes alpha::IID/64 to beta::1/64. The last flow is 2858 for legacy applications using different ports numbers, the 2859 destination IPv6 address prefix is gamma::1/64. 2861 Figure 25 presents the protocol stack. IPv6 and UDP are represented 2862 with dotted lines since these protocols are compressed on the radio 2863 link. 2865 Management Data 2866 +----------+---------+---------+ 2867 | CoAP | CoAP | legacy | 2868 +----||----+---||----+---||----+ 2869 . UDP . UDP | UDP | 2870 ................................ 2871 . IPv6 . IPv6 . IPv6 . 2872 +------------------------------+ 2873 | SCHC Header compression | 2874 | and fragmentation | 2875 +------------------------------+ 2876 | LPWAN L2 technologies | 2877 +------------------------------+ 2878 Dev or NGW 2880 Figure 25: Simplified Protocol Stack for LP-WAN 2882 In some LPWAN technologies, only the Devs have a device ID. When 2883 such technologies are used, it is necessary to statically define an 2884 IID for the Link Local address for the SCHC C/D. 2886 Rule 0 2887 Special Rule ID used to tag an uncompressed UDP/IPV6 packet. 2889 Rule 1 2890 +----------------+--+--+--+---------+--------+------------++------+ 2891 | Field |FL|FP|DI| Value | Match | Comp Decomp|| Sent | 2892 | | | | | | Opera. | Action ||[bits]| 2893 +----------------+--+--+--+---------+---------------------++------+ 2894 |IPv6 Version |4 |1 |Bi|6 | ignore | not-sent || | 2895 |IPv6 DiffServ |8 |1 |Bi|0 | equal | not-sent || | 2896 |IPv6 Flow Label |20|1 |Bi|0 | equal | not-sent || | 2897 |IPv6 Length |16|1 |Bi| | ignore | compute-* || | 2898 |IPv6 Next Header|8 |1 |Bi|17 | equal | not-sent || | 2899 |IPv6 Hop Limit |8 |1 |Bi|255 | ignore | not-sent || | 2900 |IPv6 DevPrefix |64|1 |Bi|FE80::/64| equal | not-sent || | 2901 |IPv6 DevIID |64|1 |Bi| | ignore | DevIID || | 2902 |IPv6 AppPrefix |64|1 |Bi|FE80::/64| equal | not-sent || | 2903 |IPv6 AppIID |64|1 |Bi|::1 | equal | not-sent || | 2904 +================+==+==+==+=========+========+============++======+ 2905 |UDP DevPort |16|1 |Bi|123 | equal | not-sent || | 2906 |UDP AppPort |16|1 |Bi|124 | equal | not-sent || | 2907 |UDP Length |16|1 |Bi| | ignore | compute-* || | 2908 |UDP checksum |16|1 |Bi| | ignore | compute-* || | 2909 +================+==+==+==+=========+========+============++======+ 2911 Rule 2 2912 +----------------+--+--+--+---------+--------+------------++------+ 2913 | Field |FL|FP|DI| Value | Match | Action || Sent | 2914 | | | | | | Opera. | Action ||[bits]| 2915 +----------------+--+--+--+---------+--------+------------++------+ 2916 |IPv6 Version |4 |1 |Bi|6 | ignore | not-sent || | 2917 |IPv6 DiffServ |8 |1 |Bi|0 | equal | not-sent || | 2918 |IPv6 Flow Label |20|1 |Bi|0 | equal | not-sent || | 2919 |IPv6 Length |16|1 |Bi| | ignore | compute-* || | 2920 |IPv6 Next Header|8 |1 |Bi|17 | equal | not-sent || | 2921 |IPv6 Hop Limit |8 |1 |Bi|255 | ignore | not-sent || | 2922 |IPv6 DevPrefix |64|1 |Bi|[alpha/64, match- |mapping-sent|| 1 | 2923 | | | | |fe80::/64] mapping| || | 2924 |IPv6 DevIID |64|1 |Bi| | ignore | DevIID || | 2925 |IPv6 AppPrefix |64|1 |Bi|[beta/64,| match- |mapping-sent|| 2 | 2926 | | | | |alpha/64,| mapping| || | 2927 | | | | |fe80::64]| | || | 2928 |IPv6 AppIID |64|1 |Bi|::1000 | equal | not-sent || | 2929 +================+==+==+==+=========+========+============++======+ 2930 |UDP DevPort |16|1 |Bi|5683 | equal | not-sent || | 2931 |UDP AppPort |16|1 |Bi|5683 | equal | not-sent || | 2932 |UDP Length |16|1 |Bi| | ignore | compute-* || | 2933 |UDP checksum |16|1 |Bi| | ignore | compute-* || | 2934 +================+==+==+==+=========+========+============++======+ 2936 Rule 3 2937 +----------------+--+--+--+---------+--------+------------++------+ 2938 | Field |FL|FP|DI| Value | Match | Action || Sent | 2939 | | | | | | Opera. | Action ||[bits]| 2940 +----------------+--+--+--+---------+--------+------------++------+ 2941 |IPv6 Version |4 |1 |Bi|6 | ignore | not-sent || | 2942 |IPv6 DiffServ |8 |1 |Bi|0 | equal | not-sent || | 2943 |IPv6 Flow Label |20|1 |Bi|0 | equal | not-sent || | 2944 |IPv6 Length |16|1 |Bi| | ignore | compute-* || | 2945 |IPv6 Next Header|8 |1 |Bi|17 | equal | not-sent || | 2946 |IPv6 Hop Limit |8 |1 |Up|255 | ignore | not-sent || | 2947 |IPv6 Hop Limit |8 |1 |Dw| | ignore | value-sent || 8 | 2948 |IPv6 DevPrefix |64|1 |Bi|alpha/64 | equal | not-sent || | 2949 |IPv6 DevIID |64|1 |Bi| | ignore | DevIID || | 2950 |IPv6 AppPrefix |64|1 |Bi|gamma/64 | equal | not-sent || | 2951 |IPv6 AppIID |64|1 |Bi|::1000 | equal | not-sent || | 2952 +================+==+==+==+=========+========+============++======+ 2953 |UDP DevPort |16|1 |Bi|8720 | MSB(12)| LSB || 4 | 2954 |UDP AppPort |16|1 |Bi|8720 | MSB(12)| LSB || 4 | 2955 |UDP Length |16|1 |Bi| | ignore | compute-* || | 2956 |UDP checksum |16|1 |Bi| | ignore | compute-* || | 2957 +================+==+==+==+=========+========+============++======+ 2959 Figure 26: Context Rules 2961 Figure 26 describes a example of a Rule set. 2963 In this example, 0 was chosen as the special Rule ID that tags 2964 packets that cannot be compressed with any compression Rule. 2966 All the fields described in Rules 1-3 are present in the IPv6 and UDP 2967 headers. The DevIID-DID value is found in the L2 header. 2969 Rules 2-3 use global addresses. The way the Dev learns the prefix is 2970 not in the scope of the document. 2972 Rule 3 compresses each port number to 4 bits. 2974 Appendix B. Fragmentation Examples 2976 This section provides examples for the various fragment reliability 2977 modes specified in this document. In the drawings, Bitmaps are shown 2978 in their uncompressed form. 2980 Figure 27 illustrates the transmission in No-ACK mode of a SCHC 2981 Packet that needs 11 SCHC Fragments. FCN is 1 bit wide. 2983 Sender Receiver 2984 |-------FCN=0-------->| 2985 |-------FCN=0-------->| 2986 |-------FCN=0-------->| 2987 |-------FCN=0-------->| 2988 |-------FCN=0-------->| 2989 |-------FCN=0-------->| 2990 |-------FCN=0-------->| 2991 |-------FCN=0-------->| 2992 |-------FCN=0-------->| 2993 |-------FCN=0-------->| 2994 |-----FCN=1 + RCS --->| Integrity check: success 2995 (End) 2997 Figure 27: No-ACK mode, 11 SCHC Fragments 2999 In the following examples, N (the size of the FCN field) is 3 bits. 3000 The All-1 FCN value is 7. 3002 Figure 28 illustrates the transmission in ACK-on-Error mode of a SCHC 3003 Packet fragmented in 11 tiles, with one tile per SCHC Fragment, 3004 WINDOW_SIZE=7 and no lost SCHC Fragment. 3006 Sender Receiver 3007 |-----W=0, FCN=6----->| 3008 |-----W=0, FCN=5----->| 3009 |-----W=0, FCN=4----->| 3010 |-----W=0, FCN=3----->| 3011 |-----W=0, FCN=2----->| 3012 |-----W=0, FCN=1----->| 3013 |-----W=0, FCN=0----->| 3014 (no ACK) 3015 |-----W=1, FCN=6----->| 3016 |-----W=1, FCN=5----->| 3017 |-----W=1, FCN=4----->| 3018 |--W=1, FCN=7 + RCS-->| Integrity check: success 3019 |<-- ACK, W=1, C=1 ---| C=1 3020 (End) 3022 Figure 28: ACK-on-Error mode, 11 tiles, one tile per SCHC Fragment, 3023 no lost SCHC Fragment. 3025 Figure 29 illustrates the transmission in ACK-on-Error mode of a SCHC 3026 Packet fragmented in 11 tiles, with one tile per SCHC Fragment, 3027 WINDOW_SIZE=7 and three lost SCHC Fragments. 3029 Sender Receiver 3030 |-----W=0, FCN=6----->| 3031 |-----W=0, FCN=5----->| 3032 |-----W=0, FCN=4--X-->| 3033 |-----W=0, FCN=3----->| 3034 |-----W=0, FCN=2--X-->| 3035 |-----W=0, FCN=1----->| 3036 |-----W=0, FCN=0----->| 6543210 3037 |<-- ACK, W=0, C=0 ---| Bitmap:1101011 3038 |-----W=0, FCN=4----->| 3039 |-----W=0, FCN=2----->| 3040 (no ACK) 3041 |-----W=1, FCN=6----->| 3042 |-----W=1, FCN=5----->| 3043 |-----W=1, FCN=4--X-->| 3044 |- W=1, FCN=7 + RCS ->| Integrity check: failure 3045 |<-- ACK, W=1, C=0 ---| C=0, Bitmap:1100001 3046 |-----W=1, FCN=4----->| Integrity check: success 3047 |<-- ACK, W=1, C=1 ---| C=1 3048 (End) 3050 Figure 29: ACK-on-Error mode, 11 tiles, one tile per SCHC Fragment, 3051 lost SCHC Fragments. 3053 Figure 30 shows an example of a transmission in ACK-on-Error mode of 3054 a SCHC Packet fragmented in 73 tiles, with N=5, WINDOW_SIZE=28, M=2 3055 and 3 lost SCHC Fragments. 3057 Sender Receiver 3058 |-----W=0, FCN=27----->| 4 tiles sent 3059 |-----W=0, FCN=23----->| 4 tiles sent 3060 |-----W=0, FCN=19----->| 4 tiles sent 3061 |-----W=0, FCN=15--X-->| 4 tiles sent (not received) 3062 |-----W=0, FCN=11----->| 4 tiles sent 3063 |-----W=0, FCN=7 ----->| 4 tiles sent 3064 |-----W=0, FCN=3 ----->| 4 tiles sent 3065 |-----W=1, FCN=27----->| 4 tiles sent 3066 |-----W=1, FCN=23----->| 4 tiles sent 3067 |-----W=1, FCN=19----->| 4 tiles sent 3068 |-----W=1, FCN=15----->| 4 tiles sent 3069 |-----W=1, FCN=11----->| 4 tiles sent 3070 |-----W=1, FCN=7 ----->| 4 tiles sent 3071 |-----W=1, FCN=3 --X-->| 4 tiles sent (not received) 3072 |-----W=2, FCN=27----->| 4 tiles sent 3073 |-----W=2, FCN=23----->| 4 tiles sent 3074 ^ |-----W=2, FCN=19----->| 1 tile sent 3075 | |-----W=2, FCN=18----->| 1 tile sent 3076 | |-----W=2, FCN=17----->| 1 tile sent 3077 |-----W=2, FCN=16----->| 1 tile sent 3078 s |-----W=2, FCN=15----->| 1 tile sent 3079 m |-----W=2, FCN=14----->| 1 tile sent 3080 a |-----W=2, FCN=13--X-->| 1 tile sent (not received) 3081 l |-----W=2, FCN=12----->| 1 tile sent 3082 l |---W=2, FCN=31 + RCS->| Integrity check: failure 3083 e |<--- ACK, W=0, C=0 ---| C=0, Bitmap:1111111111110000111111111111 3084 r |-----W=0, FCN=15----->| 1 tile sent 3085 |-----W=0, FCN=14----->| 1 tile sent 3086 L |-----W=0, FCN=13----->| 1 tile sent 3087 2 |-----W=0, FCN=12----->| 1 tile sent 3088 |<--- ACK, W=1, C=0 ---| C=0, Bitmap:1111111111111111111111110000 3089 M |-----W=1, FCN=3 ----->| 1 tile sent 3090 T |-----W=1, FCN=2 ----->| 1 tile sent 3091 U |-----W=1, FCN=1 ----->| 1 tile sent 3092 |-----W=1, FCN=0 ----->| 1 tile sent 3093 | |<--- ACK, W=2, C=0 ---| C=0, Bitmap:1111111111111101000000000001 3094 | |-----W=2, FCN=13----->| Integrity check: success 3095 V |<--- ACK, W=2, C=1 ---| C=1 3096 (End) 3098 Figure 30: ACK-on-Error mode, variable MTU. 3100 In this example, the L2 MTU becomes reduced just before sending the 3101 "W=2, FCN=19" fragment, leaving space for only 1 tile in each 3102 forthcoming SCHC Fragment. Before retransmissions, the 73 tiles are 3103 carried by a total of 25 SCHC Fragments, the last 9 being of smaller 3104 size. 3106 Note: other sequences of events (e.g. regarding when ACKs are sent by 3107 the Receiver) are also allowed by this specification. Profiles may 3108 restrict this flexibility. 3110 Figure 31 illustrates the transmission in ACK-Always mode of a SCHC 3111 Packet fragmented in 11 tiles, with one tile per SCHC Fragment, with 3112 N=3, WINDOW_SIZE=7 and no loss. 3114 Sender Receiver 3115 |-----W=0, FCN=6----->| 3116 |-----W=0, FCN=5----->| 3117 |-----W=0, FCN=4----->| 3118 |-----W=0, FCN=3----->| 3119 |-----W=0, FCN=2----->| 3120 |-----W=0, FCN=1----->| 3121 |-----W=0, FCN=0----->| 3122 |<-- ACK, W=0, C=0 ---| Bitmap:1111111 3123 |-----W=1, FCN=6----->| 3124 |-----W=1, FCN=5----->| 3125 |-----W=1, FCN=4----->| 3126 |--W=1, FCN=7 + RCS-->| Integrity check: success 3127 |<-- ACK, W=1, C=1 ---| C=1 3128 (End) 3130 Figure 31: ACK-Always mode, 11 tiles, one tile per SCHC Fragment, no 3131 loss. 3133 Figure 32 illustrates the transmission in ACK-Always mode of a SCHC 3134 Packet fragmented in 11 tiles, with one tile per SCHC Fragment, N=3, 3135 WINDOW_SIZE=7 and three lost SCHC Fragments. 3137 Sender Receiver 3138 |-----W=0, FCN=6----->| 3139 |-----W=0, FCN=5----->| 3140 |-----W=0, FCN=4--X-->| 3141 |-----W=0, FCN=3----->| 3142 |-----W=0, FCN=2--X-->| 3143 |-----W=0, FCN=1----->| 3144 |-----W=0, FCN=0----->| 6543210 3145 |<-- ACK, W=0, C=0 ---| Bitmap:1101011 3146 |-----W=0, FCN=4----->| 3147 |-----W=0, FCN=2----->| 3148 |<-- ACK, W=0, C=0 ---| Bitmap:1111111 3149 |-----W=1, FCN=6----->| 3150 |-----W=1, FCN=5----->| 3151 |-----W=1, FCN=4--X-->| 3152 |--W=1, FCN=7 + RCS-->| Integrity check: failure 3153 |<-- ACK, W=1, C=0 ---| C=0, Bitmap:11000001 3154 |-----W=1, FCN=4----->| Integrity check: success 3155 |<-- ACK, W=1, C=1 ---| C=1 3156 (End) 3158 Figure 32: ACK-Always mode, 11 tiles, one tile per SCHC Fragment, 3159 three lost SCHC Fragments. 3161 Figure 33 illustrates the transmission in ACK-Always mode of a SCHC 3162 Packet fragmented in 6 tiles, with one tile per SCHC Fragment, N=3, 3163 WINDOW_SIZE=7, three lost SCHC Fragments and only one retry needed to 3164 recover each lost SCHC Fragment. 3166 Sender Receiver 3167 |-----W=0, FCN=6----->| 3168 |-----W=0, FCN=5----->| 3169 |-----W=0, FCN=4--X-->| 3170 |-----W=0, FCN=3--X-->| 3171 |-----W=0, FCN=2--X-->| 3172 |--W=0, FCN=7 + RCS-->| Integrity check: failure 3173 |<-- ACK, W=0, C=0 ---| C=0, Bitmap:1100001 3174 |-----W=0, FCN=4----->| Integrity check: failure 3175 |-----W=0, FCN=3----->| Integrity check: failure 3176 |-----W=0, FCN=2----->| Integrity check: success 3177 |<-- ACK, W=0, C=1 ---| C=1 3178 (End) 3180 Figure 33: ACK-Always mode, 6 tiles, one tile per SCHC Fragment, 3181 three lost SCHC Fragments. 3183 Figure 34 illustrates the transmission in ACK-Always mode of a SCHC 3184 Packet fragmented in 6 tiles, with one tile per SCHC Fragment, N=3, 3185 WINDOW_SIZE=7, three lost SCHC Fragments, and the second SCHC ACK 3186 lost. 3188 Sender Receiver 3189 |-----W=0, FCN=6----->| 3190 |-----W=0, FCN=5----->| 3191 |-----W=0, FCN=4--X-->| 3192 |-----W=0, FCN=3--X-->| 3193 |-----W=0, FCN=2--X-->| 3194 |--W=0, FCN=7 + RCS-->| Integrity check: failure 3195 |<-- ACK, W=0, C=0 ---| C=0, Bitmap:1100001 3196 |-----W=0, FCN=4----->| Integrity check: failure 3197 |-----W=0, FCN=3----->| Integrity check: failure 3198 |-----W=0, FCN=2----->| Integrity check: success 3199 |<-X-ACK, W=0, C=1 ---| C=1 3200 timeout | | 3201 |--- W=0, ACK REQ --->| ACK REQ 3202 |<-- ACK, W=0, C=1 ---| C=1 3203 (End) 3205 Figure 34: ACK-Always mode, 6 tiles, one tile per SCHC Fragment, SCHC 3206 ACK loss. 3208 Figure 35 illustrates the transmission in ACK-Always mode of a SCHC 3209 Packet fragmented in 6 tiles, with N=3, WINDOW_SIZE=7, with three 3210 lost SCHC Fragments, and one retransmitted SCHC Fragment lost again. 3212 Sender Receiver 3213 |-----W=0, FCN=6----->| 3214 |-----W=0, FCN=5----->| 3215 |-----W=0, FCN=4--X-->| 3216 |-----W=0, FCN=3--X-->| 3217 |-----W=0, FCN=2--X-->| 3218 |--W=0, FCN=7 + RCS-->| Integrity check: failure 3219 |<-- ACK, W=0, C=0 ---| C=0, Bitmap:1100001 3220 |-----W=0, FCN=4----->| Integrity check: failure 3221 |-----W=0, FCN=3----->| Integrity check: failure 3222 |-----W=0, FCN=2--X-->| 3223 timeout| | 3224 |--- W=0, ACK REQ --->| ACK REQ 3225 |<-- ACK, W=0, C=0 ---| C=0, Bitmap: 1111101 3226 |-----W=0, FCN=2----->| Integrity check: success 3227 |<-- ACK, W=0, C=1 ---| C=1 3228 (End) 3230 Figure 35: ACK-Always mode, 6 tiles, retransmitted SCHC Fragment lost 3231 again. 3233 Figure 36 illustrates the transmission in ACK-Always mode of a SCHC 3234 Packet fragmented in 28 tiles, with one tile per SCHC Fragment, N=5, 3235 WINDOW_SIZE=24 and two lost SCHC Fragments. 3237 Sender Receiver 3238 |-----W=0, FCN=23----->| 3239 |-----W=0, FCN=22----->| 3240 |-----W=0, FCN=21--X-->| 3241 |-----W=0, FCN=20----->| 3242 |-----W=0, FCN=19----->| 3243 |-----W=0, FCN=18----->| 3244 |-----W=0, FCN=17----->| 3245 |-----W=0, FCN=16----->| 3246 |-----W=0, FCN=15----->| 3247 |-----W=0, FCN=14----->| 3248 |-----W=0, FCN=13----->| 3249 |-----W=0, FCN=12----->| 3250 |-----W=0, FCN=11----->| 3251 |-----W=0, FCN=10--X-->| 3252 |-----W=0, FCN=9 ----->| 3253 |-----W=0, FCN=8 ----->| 3254 |-----W=0, FCN=7 ----->| 3255 |-----W=0, FCN=6 ----->| 3256 |-----W=0, FCN=5 ----->| 3257 |-----W=0, FCN=4 ----->| 3258 |-----W=0, FCN=3 ----->| 3259 |-----W=0, FCN=2 ----->| 3260 |-----W=0, FCN=1 ----->| 3261 |-----W=0, FCN=0 ----->| 3262 | | 3263 |<--- ACK, W=0, C=0 ---| Bitmap:110111111111101111111111 3264 |-----W=0, FCN=21----->| 3265 |-----W=0, FCN=10----->| 3266 |<--- ACK, W=0, C=0 ---| Bitmap:111111111111111111111111 3267 |-----W=1, FCN=23----->| 3268 |-----W=1, FCN=22----->| 3269 |-----W=1, FCN=21----->| 3270 |--W=1, FCN=31 + RCS-->| Integrity check: success 3271 |<--- ACK, W=1, C=1 ---| C=1 3272 (End) 3274 Figure 36: ACK-Always mode, 28 tiles, one tile per SCHC Fragment, 3275 lost SCHC Fragments. 3277 Appendix C. Fragmentation State Machines 3279 The fragmentation state machines of the sender and the receiver, one 3280 for each of the different reliability modes, are described in the 3281 following figures: 3283 +===========+ 3284 +------------+ Init | 3285 | FCN=0 +===========+ 3286 | No Window 3287 | No Bitmap 3288 | +-------+ 3289 | +========+==+ | More Fragments 3290 | | | <--+ ~~~~~~~~~~~~~~~~~~~~ 3291 +--------> | Send | send Fragment (FCN=0) 3292 +===+=======+ 3293 | last fragment 3294 | ~~~~~~~~~~~~ 3295 | FCN = 1 3296 v send fragment+RCS 3297 +============+ 3298 | END | 3299 +============+ 3301 Figure 37: Sender State Machine for the No-ACK Mode 3303 +------+ Not All-1 3304 +==========+=+ | ~~~~~~~~~~~~~~~~~~~ 3305 | + <--+ set Inactivity Timer 3306 | RCV Frag +-------+ 3307 +=+===+======+ |All-1 & 3308 All-1 & | | |RCS correct 3309 RCS wrong | |Inactivity | 3310 | |Timer Exp. | 3311 v | | 3312 +==========++ | v 3313 | Error |<-+ +========+==+ 3314 +===========+ | END | 3315 +===========+ 3317 Figure 38: Receiver State Machine for the No-ACK Mode 3318 +=======+ 3319 | INIT | FCN!=0 & more frags 3320 | | ~~~~~~~~~~~~~~~~~~~~~~ 3321 +======++ +--+ send Window + frag(FCN) 3322 W=0 | | | FCN- 3323 Clear lcl_bm | | v set lcl_bm 3324 FCN=max value | ++==+========+ 3325 +> | | 3326 +---------------------> | SEND | 3327 | +==+===+=====+ 3328 | FCN==0 & more frags | | last frag 3329 | ~~~~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~ 3330 | set lcl_bm | | set lcl_bm 3331 | send wnd + frag(all-0) | | send wnd+frag(all-1)+RCS 3332 | set Retrans_Timer | | set Retrans_Timer 3333 | | | 3334 |Recv_wnd == wnd & | | 3335 |lcl_bm==recv_bm & | | +----------------------+ 3336 |more frag | | | lcl_bm!=rcv-bm | 3337 |~~~~~~~~~~~~~~~~~~~~~~ | | | ~~~~~~~~~ | 3338 |Stop Retrans_Timer | | | Attempt++ v 3339 |clear lcl_bm v v | +=====+=+ 3340 |window=next_window +====+===+==+===+ |Resend | 3341 +---------------------+ | |Missing| 3342 +----+ Wait | |Frag | 3343 not expected wnd | | Bitmap | +=======+ 3344 ~~~~~~~~~~~~~~~~ +--->+ ++Retrans_Timer Exp | 3345 discard frag +==+=+===+=+==+=+| ~~~~~~~~~~~~~~~~~ | 3346 | | | ^ ^ |reSend(empty)All-* | 3347 | | | | | |Set Retrans_Timer | 3348 | | | | +--+Attempt++ | 3349 C_bit==1 & | | | +-------------------------+ 3350 Recv_window==window & | | | all missing frags sent 3351 no more frag| | | ~~~~~~~~~~~~~~~~~~~~~~ 3352 ~~~~~~~~~~~~~~~~~~~~~~~~| | | Set Retrans_Timer 3353 Stop Retrans_Timer| | | 3354 +=============+ | | | 3355 | END +<--------+ | | 3356 +=============+ | | Attempt > MAX_ACK_REQUESTS 3357 All-1 Window & | | ~~~~~~~~~~~~~~~~~~ 3358 C_bit ==0 & | v Send Abort 3359 lcl_bm==recv_bm | +=+===========+ 3360 ~~~~~~~~~~~~ +>| ERROR | 3361 Send Abort +=============+ 3363 Figure 39: Sender State Machine for the ACK-Always Mode 3365 Not All- & w=expected +---+ +---+w = Not expected 3366 ~~~~~~~~~~~~~~~~~~~~~ | | | |~~~~~~~~~~~~~~~~ 3367 Set lcl_bm(FCN) | v v |discard 3368 ++===+===+===+=+ 3369 +---------------------+ Rcv +--->* ABORT 3370 | +------------------+ Window | 3371 | | +=====+==+=====+ 3372 | | All-0 & w=expect | ^ w =next & not-All 3373 | | ~~~~~~~~~~~~~~~~~~ | |~~~~~~~~~~~~~~~~~~~~~ 3374 | | set lcl_bm(FCN) | |expected = next window 3375 | | send lcl_bm | |Clear lcl_bm 3376 | | | | 3377 | | w=expected & not-All | | 3378 | | ~~~~~~~~~~~~~~~~~~ | | 3379 | | set lcl_bm(FCN)+-+ | | +--+ w=next & All-0 3380 | | if lcl_bm full | | | | | | ~~~~~~~~~~~~~~~ 3381 | | send lcl_bm | | | | | | expected = nxt wnd 3382 | | v | v | | | Clear lcl_bm 3383 | |w=expected& All-1 +=+=+=+==+=++ | set lcl_bm(FCN) 3384 | | ~~~~~~~~~~~ +->+ Wait +<+ send lcl_bm 3385 | | discard +--| Next | 3386 | | All-0 +---------+ Window +--->* ABORT 3387 | | ~~~~~ +-------->+========+=++ 3388 | | snd lcl_bm All-1 & w=next| | All-1 & w=nxt 3389 | | & RCS wrong| | & RCS right 3390 | | ~~~~~~~~~~~~~~~~~| | ~~~~~~~~~~~~~~~~~~ 3391 | | set lcl_bm(FCN)| |set lcl_bm(FCN) 3392 | | send lcl_bm| |send lcl_bm 3393 | | | +----------------------+ 3394 | |All-1 & w=expected | | 3395 | |& RCS wrong v +---+ w=expected & | 3396 | |~~~~~~~~~~~~~~~~~~~~ +====+=====+ | RCS wrong | 3397 | |set lcl_bm(FCN) | +<+ ~~~~~~~~~~~~~~ | 3398 | |send lcl_bm | Wait End | set lcl_bm(FCN)| 3399 | +--------------------->+ +--->* ABORT | 3400 | +===+====+=+-+ All-1&RCS wrong| 3401 | | ^ | ~~~~~~~~~~~~~~~| 3402 | w=expected & RCS right | +---+ send lcl_bm | 3403 | ~~~~~~~~~~~~~~~~~~~~~~ | | 3404 | set lcl_bm(FCN) | +-+ Not All-1 | 3405 | send lcl_bm | | | ~~~~~~~~~ | 3406 | | | | discard | 3407 |All-1&w=expected & RCS right | | | | 3408 |~~~~~~~~~~~~~~~~~~~~~~~~~~~~ v | v +----+All-1 | 3409 |set lcl_bm(FCN) +=+=+=+=+==+ |~~~~~~~~~ | 3410 |send lcl_bm | +<+Send lcl_bm | 3411 +-------------------------->+ END | | 3412 +==========+<---------------+ 3414 --->* ABORT 3416 In any state 3417 on receiving a SCHC ACK REQ 3418 Send a SCHC ACK for the current window 3420 Figure 40: Receiver State Machine for the ACK-Always Mode 3422 +=======+ 3423 | | 3424 | INIT | 3425 | | FCN!=0 & more frags 3426 +======++ ~~~~~~~~~~~~~~~~~~~~~~ 3427 Frag RuleID trigger | +--+ Send cur_W + frag(FCN); 3428 ~~~~~~~~~~~~~~~~~~~ | | | FCN--; 3429 cur_W=0; FCN=max_value;| | | set [cur_W, cur_Bmp] 3430 clear [cur_W, Bmp_n];| | v 3431 clear rcv_Bmp | ++==+==========+ **BACK_TO_SEND 3432 +->+ | cur_W==rcv_W & 3433 **BACK_TO_SEND | SEND | [cur_W,Bmp_n]==rcv_Bmp 3434 +-------------------------->+ | & more frags 3435 | +----------------------->+ | ~~~~~~~~~~~~ 3436 | | ++===+=========+ cur_W++; 3437 | | FCN==0 & more frags| |last frag clear [cur_W, Bmp_n] 3438 | | ~~~~~~~~~~~~~~~~~~~~~~~| |~~~~~~~~~ 3439 | | set cur_Bmp; | |set [cur_W, Bmp_n]; 3440 | |send cur_W + frag(All-0);| |send cur_W + frag(All-1)+RCS; 3441 | | set Retrans_Timer| |set Retrans_Timer 3442 | | | | +-----------------------------------+ 3443 | |Retrans_Timer expires & | | |cur_W==rcv_W&[cur_W,Bmp_n]!=rcv_Bmp| 3444 | |more Frags | | | ~~~~~~~~~~~~~~~~~~~ | 3445 | |~~~~~~~~~~~~~~~~~~~~ | | | Attempts++; W=cur_W | 3446 | |stop Retrans_Timer; | | | +--------+ rcv_W==Wn &| 3447 | |[cur_W,Bmp_n]==cur_Bmp; v v | | v [Wn,Bmp_n]!=rcv_Bmp| 3448 | |cur_W++ +=====+===+=+=+==+ +=+=========+ ~~~~~~~~~~~| 3449 | +-------------------+ | | Resend | Attempts++;| 3450 +----------------------+ Wait x ACK | | Missing | W=Wn | 3451 +--------------------->+ | | Frags(W) +<-------------+ 3452 | rcv_W==Wn &+-+ | +======+====+ 3453 | [Wn,Bmp_n]!=rcv_Bmp| ++=+===+===+==+==+ | 3454 | ~~~~~~~~~~~~~~| ^ | | | ^ | 3455 | send (cur_W,+--+ | | | +-------------+ 3456 | ALL-0-empty) | | | all missing frag sent(W) 3457 | | | | ~~~~~~~~~~~~~~~~~ 3458 | Retrans_Timer expires &| | | set Retrans_Timer 3459 | No more Frags| | | 3460 | ~~~~~~~~~~~~~~| | | 3461 | stop Retrans_Timer;| | | 3462 |(re)send frag(All-1)+RCS | | | 3463 +-------------------------+ | | 3464 cur_W==rcv_W&| | 3465 [cur_W,Bmp_n]==rcv_Bmp&| | Attempts > MAX_ACK_REQUESTS 3466 No more Frags & RCS flag==OK| | ~~~~~~~~~~ 3467 ~~~~~~~~~~~~~~~~~~| | send Abort 3468 +=========+stop Retrans_Timer| | +===========+ 3469 | END +<-----------------+ +->+ ERROR | 3470 +=========+ +===========+ 3472 Figure 41: Sender State Machine for the ACK-on-Error Mode 3474 This is an example only. It is not normative. The specification in 3475 Section 8.4.3.1 allows for sequences of operations different from the 3476 one shown here. 3478 +=======+ New frag RuleID received 3479 | | ~~~~~~~~~~~~~ 3480 | INIT +-------+cur_W=0;clear([cur_W,Bmp_n]); 3481 +=======+ |sync=0 3482 | 3483 Not All* & rcv_W==cur_W+---+ | +---+ 3484 ~~~~~~~~~~~~~~~~~~~~ | | | | (E) 3485 set[cur_W,Bmp_n(FCN)]| v v v | 3486 ++===+=+=+===+=+ 3487 +----------------------+ +--+ All-0&Full[cur_W,Bmp_n] 3488 | ABORT *<---+ Rcv Window | | ~~~~~~~~~~ 3489 | +-------------------+ +<-+ cur_W++;set Inact_timer; 3490 | | +->+=+=+=+=+=+====+ clear [cur_W,Bmp_n] 3491 | | All-0 empty(Wn)| | | | ^ ^ 3492 | | ~~~~~~~~~~~~~~ +----+ | | | |rcv_W==cur_W & sync==0; 3493 | | sendACK([Wn,Bmp_n]) | | | |& Full([cur_W,Bmp_n]) 3494 | | | | | |& All* || last_miss_frag 3495 | | | | | |~~~~~~~~~~~~~~~~~~~~~~ 3496 | | All* & rcv_W==cur_W|(C)| |sendACK([cur_W,Bmp_n]); 3497 | | & sync==0| | | |cur_W++; clear([cur_W,Bmp_n]) 3498 | |&no_full([cur_W,Bmp_n])| |(E)| 3499 | | ~~~~~~~~~~~~~~~~ | | | | +========+ 3500 | | sendACK([cur_W,Bmp_n])| | | | | Error/ | 3501 | | | | | | +----+ | Abort | 3502 | | v v | | | | +===+====+ 3503 | | +===+=+=+=+===+=+ (D) ^ 3504 | | +--+ Wait x | | | 3505 | | All-0 empty(Wn)+->| Missing Frags |<-+ | 3506 | | ~~~~~~~~~~~~~~ +=============+=+ | 3507 | | sendACK([Wn,Bmp_n]) +--------------+ 3508 | | *ABORT 3509 v v 3510 (A)(B) 3511 (D) All* || last_miss_frag 3512 (C) All* & sync>0 & rcv_W!=cur_W & sync>0 3513 ~~~~~~~~~~~~ & Full([rcv_W,Bmp_n]) 3514 Wn=oldest[not full(W)]; ~~~~~~~~~~~~~~~~~~~~ 3515 sendACK([Wn,Bmp_n]) Wn=oldest[not full(W)]; 3516 sendACK([Wn,Bmp_n]);sync-- 3518 ABORT-->* Uplink Only & 3519 Inact_Timer expires 3520 (E) Not All* & rcv_W!=cur_W || Attempts > MAX_ACK_REQUESTS 3521 ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ 3522 sync++; cur_W=rcv_W; send Abort 3523 set[cur_W,Bmp_n(FCN)] 3525 (A)(B) 3526 | | 3527 | | All-1 & rcv_W==cur_W & RCS!=OK All-0 empty(Wn) 3528 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-+ ~~~~~~~~~~ 3529 | | sendACK([cur_W,Bmp_n],C=0) | v sendACK([Wn,Bmp_n]) 3530 | | +===========+=++ 3531 | +--------------------->+ Wait End +-+ 3532 | +=====+=+====+=+ | All-1 3533 | rcv_W==cur_W & RCS==OK | | ^ | & rcv_W==cur_W 3534 | ~~~~~~~~~~~~~~~~~~~~~~ | | +---+ & RCS!=OK 3535 | sendACK([cur_W,Bmp_n],C=1) | | ~~~~~~~~~~~~~~~~~~~ 3536 | | | sendACK([cur_W,Bmp_n],C=0); 3537 | | | Attempts++ 3538 |All-1 & Full([cur_W,Bmp_n]) | | 3539 |& RCS==OK & sync==0 | +-->* ABORT 3540 |~~~~~~~~~~~~~~~~~~~ v 3541 |sendACK([cur_W,Bmp_n],C=1) +=+=========+ 3542 +---------------------------->+ END | 3543 +===========+ 3545 Figure 42: Receiver State Machine for the ACK-on-Error Mode 3547 Appendix D. SCHC Parameters 3549 This section lists the information that needs to be provided in the 3550 LPWAN technology-specific documents. 3552 o Most common uses cases, deployment scenarios 3554 o Mapping of the SCHC architectural elements onto the LPWAN 3555 architecture 3557 o Assessment of LPWAN integrity checking 3559 o Various potential channel conditions for the technology and the 3560 corresponding recommended use of SCHC C/D and F/R 3562 This section lists the parameters that need to be defined in the 3563 Profile. 3565 o Rule ID numbering scheme, fixed-sized or variable-sized Rule IDs, 3566 number of Rules, the way the Rule ID is transmitted 3568 o maximum packet size that should ever be reconstructed by SCHC 3569 Decompression (MAX_PACKET_SIZE). See Section 12. 3571 o Padding: size of the L2 Word (for most LPWAN technologies, this 3572 would be a byte; for some technologies, a bit) 3574 o Decision to use SCHC fragmentation mechanism or not. If yes: 3576 * reliability mode(s) used, in which cases (e.g. based on link 3577 channel condition) 3579 * Rule ID values assigned to each mode in use 3581 * presence and number of bits for DTag (T) for each Rule ID value 3583 * support for interleaved packet transmission, to what extent 3585 * WINDOW_SIZE, for modes that use windows 3587 * number of bits for W (M) for each Rule ID value, for modes that 3588 use windows 3590 * number of bits for FCN (N) for each Rule ID value 3592 * size of RCS and algorithm for its computation, for each Rule 3593 ID, if different from the default CRC32. Byte fill-up with 3594 zeroes or other mechanism, to be specified. 3596 * Retransmission Timer duration for each Rule ID value, if 3597 applicable to the SCHC F/R mode 3599 * Inactivity Timer duration for each Rule ID value, if applicable 3600 to the SCHC F/R mode 3602 * MAX_ACK_REQUESTS value for each Rule ID value, if applicable to 3603 the SCHC F/R mode 3605 o if L2 Word is wider than a bit and SCHC fragmentation is used, 3606 value of the padding bits (0 or 1). This is needed because the 3607 padding bits of the last fragment are included in the RCS 3608 computation. 3610 A Profile may define a delay to be added after each SCHC message 3611 transmission for compliance with local regulations or other 3612 constraints imposed by the applications. 3614 o In some LPWAN technologies, as part of energy-saving techniques, 3615 downlink transmission is only possible immediately after an uplink 3616 transmission. In order to avoid potentially high delay in the 3617 downlink transmission of a fragmented SCHC Packet, the SCHC 3618 Fragment receiver may perform an uplink transmission as soon as 3619 possible after reception of a SCHC Fragment that is not the last 3620 one. Such uplink transmission may be triggered by the L2 (e.g. an 3621 L2 ACK sent in response to a SCHC Fragment encapsulated in a L2 3622 PDU that requires an L2 ACK) or it may be triggered from an upper 3623 layer. 3625 o the following parameters need to be addressed in documents other 3626 than this one but not necessarily in the LPWAN technology-specific 3627 documents: 3629 * The way the Contexts are provisioned 3631 * The way the Rules are generated 3633 Appendix E. Supporting multiple window sizes for fragmentation 3635 For ACK-Always or ACK-on-Error, implementers may opt to support a 3636 single window size or multiple window sizes. The latter, when 3637 feasible, may provide performance optimizations. For example, a 3638 large window size should be used for packets that need to be split 3639 into a large number of tiles. However, when the number of tiles 3640 required to carry a packet is low, a smaller window size, and thus a 3641 shorter Bitmap, may be sufficient to provide reception status on all 3642 tiles. If multiple window sizes are supported, the Rule ID signals 3643 the window size in use for a specific packet transmission. 3645 Appendix F. ACK-Always and ACK-on-Error on quasi-bidirectional links 3647 The ACK-Always and ACK-on-Error modes of SCHC F/R are bidirectional 3648 protocols: they require a feedback path from the reassembler to the 3649 fragmenter. 3651 Some LPWAN technologies provide quasi-bidirectional connectivity, 3652 whereby a downlink transmission from the Network Infrastructure can 3653 only take place right after an uplink transmission by the Dev. 3655 When using SCHC F/R to send fragmented SCHC Packets downlink over 3656 these quasi-bidirectional links, the following situation may arise: 3657 if an uplink SCHC ACK is lost, the SCHC ACK REQ message by the sender 3658 could be stuck indefinitely in the downlink queue at the Network 3659 Infrastructure, waiting for a transmission opportunity. 3661 There are many ways by which this deadlock can be avoided. The Dev 3662 application might be sending recurring uplink messages such as keep- 3663 alive, or the Dev application stack might be sending other recurring 3664 uplink messages as part of its operation. However, these are out of 3665 the control of this generic SCHC specification. 3667 In order to cope with quasi-bidirectional links, a SCHC-over-foo 3668 specification may want to amend the SCHC F/R specification to add a 3669 timer-based retransmission of the SCHC ACK. Below is an example of 3670 the suggested behavior for ACK-Always mode. Because it is an 3671 example, [RFC2119] language is deliberately not used here. 3673 For downlink transmission of a fragmented SCHC Packet in ACK-Always 3674 mode, the SCHC Fragment receiver may support timer-based SCHC ACK 3675 retransmission. In this mechanism, the SCHC Fragment receiver 3676 initializes and starts a timer (the UplinkACK Timer) after the 3677 transmission of a SCHC ACK, except when the SCHC ACK is sent in 3678 response to the last SCHC Fragment of a packet (All-1 fragment). In 3679 the latter case, the SCHC Fragment receiver does not start a timer 3680 after transmission of the SCHC ACK. 3682 If, after transmission of a SCHC ACK that is not an All-1 fragment, 3683 and before expiration of the corresponding UplinkACK timer, the SCHC 3684 Fragment receiver receives a SCHC Fragment that belongs to the 3685 current window (e.g. a missing SCHC Fragment from the current window) 3686 or to the next window, the UplinkACK timer for the SCHC ACK is 3687 stopped. However, if the UplinkACK timer expires, the SCHC ACK is 3688 resent and the UplinkACK timer is reinitialized and restarted. 3690 The default initial value for the UplinkACK Timer, as well as the 3691 maximum number of retries for a specific SCHC ACK, denoted 3692 MAX_ACK_REQUESTS, is to be defined in a Profile. The initial value 3693 of the UplinkACK timer is expected to be greater than that of the 3694 Retransmission timer, in order to make sure that a (buffered) SCHC 3695 Fragment to be retransmitted finds an opportunity for that 3696 transmission. One exception to this recommendation is the special 3697 case of the All-1 SCHC Fragment transmission. 3699 When the SCHC Fragment sender transmits the All-1 SCHC Fragment, it 3700 starts its Retransmission Timer with a large timeout value (e.g. 3701 several times that of the initial UplinkACK Timer). If a SCHC ACK is 3702 received before expiration of this timer, the SCHC Fragment sender 3703 retransmits any lost SCHC Fragments as reported by the SCHC ACK, or 3704 if the SCHC ACK confirms successful reception of all SCHC Fragments 3705 of the last window, the transmission of the fragmented SCHC Packet is 3706 considered complete. If the timer expires, and no SCHC ACK has been 3707 received since the start of the timer, the SCHC Fragment sender 3708 assumes that the All-1 SCHC Fragment has been successfully received 3709 (and possibly, the last SCHC ACK has been lost: this mechanism 3710 assumes that the Retransmission Timer for the All-1 SCHC Fragment is 3711 long enough to allow several SCHC ACK retries if the All-1 SCHC 3712 Fragment has not been received by the SCHC Fragment receiver, and it 3713 also assumes that it is unlikely that several ACKs become all lost). 3715 Authors' Addresses 3717 Ana Minaburo 3718 Acklio 3719 1137A avenue des Champs Blancs 3720 35510 Cesson-Sevigne Cedex 3721 France 3723 Email: ana@ackl.io 3725 Laurent Toutain 3726 IMT-Atlantique 3727 2 rue de la Chataigneraie 3728 CS 17607 3729 35576 Cesson-Sevigne Cedex 3730 France 3732 Email: Laurent.Toutain@imt-atlantique.fr 3734 Carles Gomez 3735 Universitat Politecnica de Catalunya 3736 C/Esteve Terradas, 7 3737 08860 Castelldefels 3738 Spain 3740 Email: carlesgo@entel.upc.edu 3742 Dominique Barthel 3743 Orange Labs 3744 28 chemin du Vieux Chene 3745 38243 Meylan 3746 France 3748 Email: dominique.barthel@orange.com 3750 Juan Carlos Zuniga 3751 SIGFOX 3752 425 rue Jean Rostand 3753 Labege 31670 3754 France 3756 Email: JuanCarlos.Zuniga@sigfox.com