idnits 2.17.1 draft-mcquistin-augmented-ascii-diagrams-06.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 (13 July 2020) is 1355 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- == Unused Reference: 'RFC7405' is defined on line 1071, but no explicit reference was found in the text == Outdated reference: A later version (-34) exists of draft-ietf-quic-transport-27 -- Obsolete informational reference (is this intentional?): RFC 7049 (Obsoleted by RFC 8949) -- Obsolete informational reference (is this intentional?): RFC 793 (Obsoleted by RFC 9293) Summary: 0 errors (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group S. McQuistin 3 Internet-Draft V. Band 4 Intended status: Experimental D. Jacob 5 Expires: 14 January 2021 C. S. Perkins 6 University of Glasgow 7 13 July 2020 9 Describing Protocol Data Units with Augmented Packet Header Diagrams 10 draft-mcquistin-augmented-ascii-diagrams-06 12 Abstract 14 This document describes a machine-readable format for specifying the 15 syntax of protocol data units within a protocol specification. This 16 format is comprised of a consistently formatted packet header 17 diagram, followed by structured explanatory text. It is designed to 18 maintain human readability while enabling support for automated 19 parser generation from the specification document. This document is 20 itself an example of how the format can be used. 22 Status of This Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at https://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on 14 January 2021. 39 Copyright Notice 41 Copyright (c) 2020 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 46 license-info) in effect on the date of publication of this document. 47 Please review these documents carefully, as they describe your rights 48 and restrictions with respect to this document. Code Components 49 extracted from this document must include Simplified BSD License text 50 as described in Section 4.e of the Trust Legal Provisions and are 51 provided without warranty as described in the Simplified BSD License. 53 Table of Contents 55 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 56 2. Background . . . . . . . . . . . . . . . . . . . . . . . . . 4 57 2.1. Limitations of Current Packet Format Diagrams . . . . . . 4 58 2.2. Formal languages in standards documents . . . . . . . . . 7 59 3. Design Principles . . . . . . . . . . . . . . . . . . . . . . 7 60 4. Augmented Packet Header Diagrams . . . . . . . . . . . . . . 10 61 4.1. PDUs with Fixed and Variable-Width Fields . . . . . . . . 10 62 4.2. PDUs That Cross-Reference Previously Defined Fields . . . 13 63 4.3. PDUs with Non-Contiguous Fields . . . . . . . . . . . . . 15 64 4.4. PDUs with Constraints on Field Values . . . . . . . . . . 16 65 4.5. PDUs That Extend Sub-Structures . . . . . . . . . . . . . 17 66 4.6. Storing Data for Parsing . . . . . . . . . . . . . . . . 18 67 4.7. Connecting Structures with Functions . . . . . . . . . . 19 68 4.8. Specifying Enumerated Types . . . . . . . . . . . . . . . 20 69 4.9. Specifying Protocol Data Units . . . . . . . . . . . . . 21 70 4.10. Importing PDU Definitions from Other Documents . . . . . 22 71 5. Open Issues . . . . . . . . . . . . . . . . . . . . . . . . . 22 72 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 22 73 7. Security Considerations . . . . . . . . . . . . . . . . . . . 22 74 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 23 75 9. Informative References . . . . . . . . . . . . . . . . . . . 23 76 Appendix A. ABNF specification . . . . . . . . . . . . . . . . . 25 77 A.1. Constraint Expressions . . . . . . . . . . . . . . . . . 25 78 A.2. Augmented packet diagrams . . . . . . . . . . . . . . . . 25 79 Appendix B. Source code repository . . . . . . . . . . . . . . . 25 80 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 82 1. Introduction 84 Packet header diagrams have become a widely used format for 85 describing the syntax of binary protocols. In otherwise largely 86 textual documents, they allow for the visualisation of packet 87 formats, reducing human error, and aiding in the implementation of 88 parsers for the protocols that they specify. 90 Figure 1 gives an example of how packet header diagrams are used to 91 define binary protocol formats. The format has an obvious structure: 92 the diagram clearly delineates each field, showing its width and its 93 position within the header. This type of diagram is designed for 94 human readers, but is consistent enough that it should be possible to 95 develop a tool that generates a parser for the packet format from the 96 diagram. 98 : 0 1 2 3 99 : 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 100 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 101 : | Source Port | Destination Port | 102 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 103 : | Sequence Number | 104 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 105 : | Acknowledgment Number | 106 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 107 : | Data | |U|A|P|R|S|F| | 108 : | Offset| Reserved |R|C|S|S|Y|I| Window | 109 : | | |G|K|H|T|N|N| | 110 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 111 : | Checksum | Urgent Pointer | 112 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 113 : | Options | Padding | 114 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 115 : | data | 116 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 118 Figure 1: TCP's header format (from [RFC793]) 120 Unfortunately, the format of such packet diagrams varies both within 121 and between documents. This variation makes it difficult to build 122 tools to generate parsers from the specifications. Better tooling 123 could be developed if protocol specifications adopted a consistent 124 format for their packet descriptions. Indeed, this underpins the 125 format described by this draft: we want to retain the benefits that 126 packet header diagrams provide, while identifying the benefits of 127 adopting a consistent format. 129 This document describes a consistent packet header diagram format and 130 accompanying structured text constructs that allow for the parsing 131 process of protocol headers to be fully specified. This provides 132 support for the automatic generation of parser code. Broad design 133 principles, that seek to maintain the primacy of human readability 134 and flexibility in writing, are described, before the format itself 135 is given. 137 This document is itself an example of the approach that it describes, 138 with the packet header diagrams and structured text format described 139 by example. Examples that do not form part of the protocol 140 description language are marked by a colon at the beginning of each 141 line; this prevents them from being parsed by the accompanying 142 tooling. 144 This draft describes early work. As consensus builds around the 145 particular syntax of the format described, both a formal ABNF 146 specification (Appendix A) and code (Appendix B) that parses it (and, 147 as described above, this document) will be provided. 149 2. Background 151 This section begins by considering how packet header diagrams are 152 used in existing documents. This exposes the limitations that the 153 current usage has in terms of machine-readability, guiding the design 154 of the format that this document proposes. 156 While this document focuses on the machine-readability of packet 157 format diagrams, this section also discusses the use of other 158 structured or formal languages within IETF documents. Considering 159 how and why these languages are used provides an instructive contrast 160 to the relatively incremental approach proposed here. 162 2.1. Limitations of Current Packet Format Diagrams 164 : The RESET_STREAM frame is as follows: 165 : 166 : 0 1 2 3 167 : 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 168 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 169 : | Stream ID (i) ... 170 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 171 : | Application Error Code (16) | 172 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 173 : | Final Size (i) ... 174 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 175 : 176 : RESET_STREAM frames contain the following fields: 177 : 178 : Stream ID: A variable-length integer encoding of the Stream ID 179 : of the stream being terminated. 180 : 181 : Application Protocol Error Code: A 16-bit application protocol 182 : error code (see Section 20.1) which indicates why the stream 183 : is being closed. 184 : 185 : Final Size: A variable-length integer indicating the final size 186 : of the stream by the RESET_STREAM sender, in unit of bytes. 188 Figure 2: QUIC's RESET_STREAM frame format (from [QUIC-TRANSPORT]) 190 Packet header diagrams are frequently used in IETF standards to 191 describe the format of binary protocols. While there is no standard 192 for how these diagrams should be formatted, they have a broadly 193 similar structure, where the layout of a protocol data unit (PDU) or 194 structure is shown in diagrammatic form, followed by a description 195 list of the fields that it contains. An example of this format, 196 taken from the QUIC specification, is given in Figure 2. 198 These packet header diagrams, and the accompanying descriptions, are 199 formatted for human readers rather than for automated processing. As 200 a result, while there is rough consistency in how packet header 201 diagrams are formatted, there are a number of limitations that make 202 them difficult to work with programmatically: 204 Inconsistent syntax: There are two classes of consistency that are 205 needed to support automated processing of specifications: internal 206 consistency within a diagram or document, and external consistency 207 across all documents. 209 Figure 2 gives an example of internal inconsistency. Here, the 210 packet diagram shows a field labelled "Application Error Code", 211 while the accompanying description lists the field as "Application 212 Protocol Error Code". The use of an abbreviated name is suitable 213 for human readers, but makes parsing the structure difficult for 214 machines. Figure 3 gives a further example, where the description 215 includes an "Option-Code" field that does not appear in the packet 216 diagram; and where the description states that each field is 16 217 bits in length, but the diagram shows the OPTION_RELAY_PORT as 13 218 bits, and Option-Len as 19 bits. Another example is [RFC6958], 219 where the packet format diagram showing the structure of the 220 Burst/Gap Loss Metrics Report Block shows the Number of Bursts 221 field as being 12 bits wide but the corresponding text describes 222 it as 16 bits. 224 Comparing Figure 2 with Figure 3 exposes external inconsistency 225 across documents. While the packet format diagrams are broadly 226 similar, the surrounding text is formatted differently. If 227 machine parsing is to be made possible, then this text must be 228 structured consistently. 230 Ambiguous constraints: The constraints that are enforced on a 231 particular field are often described ambiguously, or in a way that 232 cannot be parsed easily. In Figure 3, each of the three fields in 233 the structure is constrained. The first two fields ("Option-Code" 234 and "Option-Len") are to be set to constant values (note the 235 inconsistency in how these constraints are expressed in the 236 description). However, the third field ("Downstream Source Port") 237 can take a value from a constrained set. This constraint is 238 expressed in prose that cannot readily by understood by machine. 240 Poor linking between sub-structures: Protocol data units and other 241 structures are often comprised of sub-structures that are defined 242 elsewhere, either in the same document, or within another 243 document. Chaining these structures together is essential for 244 machine parsing: the parsing process for a protocol data unit is 245 only fully expressed if all elements can be parsed. 247 Figure 2 highlights the difficulty that machine parsers have in 248 chaining structures together. Two fields ("Stream ID" and "Final 249 Size") are described as being encoded as variable-length integers; 250 this is a structure described elsewhere in the same document. 251 Structured text is required both alongside the definition of the 252 containing structure and with the definition of the sub-structure, 253 to allow a parser to link the two together. 255 Lack of extension and evolution syntax: Protocols are often 256 specified across multiple documents, either because the protocol 257 explicitly includes extension points (e.g., profiles and payload 258 format specifications in RTP [RFC3550]) or because definition of a 259 protocol data unit has changed and evolved over time. As a 260 result, it is essential that syntax be provided to allow for a 261 complete definition of a protocol's parsing process to be 262 constructed across multiple documents. 264 : The format of the "Relay Source Port Option" is shown below: 265 : 266 : 0 1 2 3 267 : 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 268 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 269 : | OPTION_RELAY_PORT | Option-Len | 270 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 271 : | Downstream Source Port | 272 : +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 273 : 274 : Where: 275 : 276 : Option-Code: OPTION_RELAY_PORT. 16-bit value, 135. 277 : 278 : Option-Len: 16-bit value to be set to 2. 279 : 280 : Downstream Source Port: 16-bit value. To be set by the IPv6 281 : relay either to the downstream relay agent's UDP source port 282 : used for the UDP packet, or to zero if only the local relay 283 : agent uses the non-DHCP UDP port (not 547). 285 Figure 3: DHCPv6's Relay Source Port Option (from [RFC8357]) 287 2.2. Formal languages in standards documents 289 A small proportion of IETF standards documents contain structured and 290 formal languages, including ABNF [RFC5234], ASN.1 [ASN1], C, CBOR 291 [RFC7049], JSON, the TLS presentation language [RFC8446], YANG models 292 [RFC7950], and XML. While this broad range of languages may be 293 problematic for the development of tooling to parse specifications, 294 these, and other, languages serve a range of different use cases. 295 ABNF, for example, is typically used to specify text protocols, while 296 ASN.1 is used to specify data structure serialisation. This document 297 specifies a structured language for specifying the parsing of binary 298 protocol data units. 300 3. Design Principles 302 The use of structures that are designed to support machine 303 readability might potentially interfere with the existing ways in 304 which protocol specifications are used and authored. To the extent 305 that these existing uses are more important than machine readability, 306 such interference must be minimised. 308 In this section, the broad design principles that underpin the format 309 described by this document are given. However, these principles 310 apply more generally to any approach that introduces structured and 311 formal languages into standards documents. 313 It should be noted that these are design principles: they expose the 314 trade-offs that are inherent within any given approach. Violating 315 these principles is sometimes necessary and beneficial, and this 316 document sets out the potential consequences of doing so. 318 The central tenet that underpins these design principles is a 319 recognition that the standardisation process is not broken, and so 320 does not need to be fixed. Failure to recognise this will likely 321 lead to approaches that are incompatible with the standards process, 322 or that will see limited adoption. However, the standards process 323 can be improved with appropriate approaches, as guided by the 324 following broad design principles: 326 Most readers are human: Primarily, standards documents should be 327 written for people, who require text and diagrams that they can 328 understand. Structures that cannot be easily parsed by people 329 should be avoided, and if included, should be clearly delineated 330 from human-readable content. 332 Any approach that shifts this balance -- that is, that primarily 333 targets machine readers -- is likely to be disruptive to the 334 standardisation process, which relies upon discussion centered 335 around documents written in prose. 337 Writing tools are diverse: Standards document writing is a 338 distributed process that involves a diverse set of tools and 339 workflows. The introduction of machine-readable structures into 340 specifications should not require that specific tools are used to 341 produce standards documents, to ensure that disruption to existing 342 workflows is minimised. This does not preclude the development of 343 optional, supplementary tools that aid in the authoring machine- 344 readable structures. 346 The immediate impact of requiring specific tooling is that 347 adoption is likely to be limited. A long-term impact might be 348 that authors whose workflows are incompatible might be alienated 349 from the process. 351 Canonical specifications: As far as possible, machine-readable 352 structures should not replicate the human readable specification 353 of the protocol within the same document. Machine-readable 354 structures should form part of a canonical specification of the 355 protocol. Adding supplementary machine-readable structures, in 356 parallel to the existing human readable text, is undesirable 357 because it creates the potential for inconsistency. 359 As an example, program code that describes how a protocol data 360 unit can be parsed might be provided as an appendix within a 361 standards document. This code would provide a specification of 362 the protocol that is separate to the prose description in the main 363 body of the document. This has the undesirable effect of 364 introducing the potential for the program code to specify 365 behaviour that the prose-based specification does not, and vice- 366 versa. 368 Expressiveness: Any approach should be expressive enough to capture 369 the syntax and parsing process for the majority of binary 370 protocols. If a given language is not sufficiently expressive, 371 then adoption is likely to be limited. At the limits of what can 372 be expressed by the language, authors are likely to revert to 373 defining the protocol in prose: this undermines the broad goal of 374 using structured and formal languages. Equally, though, 375 understandable specifications and ease of use are critical for 376 adoption. A tool that is simple to use and addresses the most 377 common use cases might be preferred to a complex tool that 378 addresses all use cases. 380 It may be desirable to restrict expressiveness, however, to 381 guarantee intrinsic safety, security, and computability properties 382 of both the generated parser code for the protocol, and the parser 383 of the description language itself. In much the same way as the 384 language-theoretic security ([LANGSEC]) community advocates for 385 programming language design to be informed by the desired 386 properties of the parsers for those languages, protocol designers 387 should be aware of the implications of their design choices. The 388 expressiveness of the protocol description languages that they use 389 to define their protocols can force such awareness. 391 Broadly, those languages that have grammars which are more 392 expressive tend to have parsers that are more complex and less 393 safe. As a result, while considering the other goals described in 394 this document, protocol description languages should attempt to be 395 minimally expressive, and either restrict protocol designs to 396 those for which safe and secure parsers can be generated, or as a 397 minimum, ensure that protocol designers are aware of the 398 boundaries their designs cross, in terms of computability and 399 decidability [SASSAMAN]. 401 Minimise required change: Any approach should require as few changes 402 as possible to the way that documents are formatted, authored, and 403 published. Forcing adoption of a particular structured or formal 404 language is incompatible with the IETF's standardisation process: 405 there are very few components of standards documents that are non- 406 optional. 408 4. Augmented Packet Header Diagrams 410 The design principles described in Section 3 can largely be met by 411 the existing uses of packet header diagrams. These diagrams aid 412 human readability, do not require new or specialised tools to write, 413 do not split the specification into multiple parts, can express most 414 binary protocol features, and require no changes to existing 415 publication processes. 417 However, as discussed in Section 2.1 there are limitations to how 418 packet header diagrams are used that must be addressed if they are to 419 be parsed by machine. In this section, an augmented packet header 420 diagram format is described. 422 The concept is first illustrated by example. This is appropriate, 423 given the visual nature of the language. In future drafts, these 424 examples will be parsable using provided tools, and a formal 425 specification of the augmented packet diagrams will be given in 426 Appendix A. 428 4.1. PDUs with Fixed and Variable-Width Fields 430 The simplest PDU is one that contains only a set of fixed-width 431 fields in a known order, with no optional fields or variation in the 432 packet format. 434 Some packet formats include variable-width fields, where the size of 435 a field is either derived from the value of some previous field, or 436 is unspecified and inferred from the total size of the packet and the 437 size of the other fields. 439 To ensure that there is no ambiguity, a PDU description can contain 440 only one field whose length is unspecified. The length of a single 441 field, where all other fields are of known (but perhaps variable) 442 length, can be inferred from the total size of the containing PDU. 444 A PDU description is introduced by the exact phrase "A/An _______ is 445 formatted as follows:" at the end of a paragraph. This is followed 446 by the PDU description itself, as a packet diagram within an 447 element in the XML representation, starting with a header 448 line to show the bit width of the diagram. The description of the 449 fields follows the diagram, as an XML
list, after a paragraph 450 containing the text "where:". 452 PDU names must be unique, both within a document, and across all 453 documents that are linked together (i.e., using the structured 454 language defined in Section 4.10). 456 Each field of the description starts with a
tag comprising the 457 field name and an optional short name in parenthesis. These are 458 followed by a colon, the field length, an optional presence 459 expression (described in Section 4.2), and a terminating period. The 460 following
tag contains a prose description of the field. Field 461 names cannot be the same as a previously defined PDU name, and must 462 be unique within a given structure definition. 464 For example, this can be illustrated using the IPv4 Header Format 465 [RFC791]. An IPv4 Header is formatted as follows: 467 0 1 2 3 468 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 469 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 470 |Version| IHL | DSCP |ECN| Total Length | 471 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 472 | Identification |Flags| Fragment Offset | 473 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 474 | Time to Live | Protocol | Header Checksum | 475 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 476 | Source Address | 477 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 478 | Destination Address | 479 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 480 | Options ... 481 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 482 | : 483 : Payload : 484 : | 485 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 487 where: 489 Version (V): 4 bits. This is a fixed-width field, whose full label 490 is shown in the diagram. The field's width -- 4 bits -- is given 491 in the label of the description list, separated from the field's 492 label by a colon. 494 Internet Header Length (IHL): 4 bits. This is a shorter field, whose 495 full label is too large to be shown in the diagram. A short label 496 (IHL) is used in the diagram, and this short label is provided, in 497 brackets, after the full label in the description list. 499 Differentiated Services Code Point (DSCP): 6 bits. This is a fixed- 500 width field, as previously discussed. 502 Explicit Congestion Notification (ECN): 2 bits. This is a fixed- 503 width field, as previously discussed. 505 Total Length (TL): 2 bytes. This is a fixed-width field, as 506 previously discussed. Where fields are an integral number of 507 bytes in size, the field length can be given in bytes rather than 508 in bits. 510 Identification: 2 bytes. This is a fixed-width field, as previously 511 discussed. 513 Flags: 3 bits. This is a fixed-width field, as previously discussed. 515 Fragment Offset: 13 bits. This is a fixed-width field, as previously 516 discussed. 518 Time to Live (TTL): 1 byte. This is a fixed-width field, as 519 previously discussed. 521 Protocol: 1 byte. This is a fixed-width field, as previously 522 discussed. 524 Header Checksum: 2 bytes. This is a fixed-width field, as previously 525 discussed. 527 Source Address: 32 bits. This is a fixed-width field, as previously 528 discussed. 530 Destination Address: 32 bits. This is a fixed-width field, as 531 previously discussed. 533 Options: (IHL-5)*32 bits. This is a variable-length field, whose 534 length is defined by the value of the field with short label IHL 535 (Internet Header Length). Constraint expressions can be used in 536 place of constant values: the grammar for the expression language 537 is defined in Appendix A.1. Constraints can include a previously 538 defined field's short or full label, where one has been defined. 539 Short variable-length fields are indicated by "..." instead of a 540 pipe at the end of the row. 542 Payload: TL - ((IHL*32)/8) bytes. This is a multi-row variable- 543 length field, constrained by the values of fields TL and IHL. 544 Instead of the "..." notation, ":" is used to indicate that the 545 field is variable-length. The use of ":" instead of "..." 546 indicates the field is likely to be a longer, multi-row field. 547 However, semantically, there is no difference: these different 548 notations are for the benefit of human readers. 550 4.2. PDUs That Cross-Reference Previously Defined Fields 552 Binary formats often reference sub-structures that have been defined 553 earlier in the specification. For example, in RTP [RFC3550], the 554 Contributing Source Identifiers in an RTP Data Packet are defined as 555 comprising a list of Source Identifier elements. A Source Identifier 556 is formatted as follows: 558 0 1 2 3 559 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 560 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 561 | SSRC | 562 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 564 where: 566 SSRC: 32 bits. This is a fixed-width field, as described previously. 568 The following example shows how a Source Identifier can be referenced 569 in the description of an RTP Data Packet. It also shows how the 570 presence of some fields in a format may be dependent on the values of 571 an earlier field. 573 An RTP Data Packet is formatted as follows: 575 0 1 2 3 576 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 577 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 578 | V |P|X| CC |M| PT | Sequence Number | 579 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 580 | Timestamp | 581 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 582 | Synchronization Source identifier | 583 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 584 | [Contributing Source identifiers] | 585 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 586 | Header Extension | 587 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 588 | Payload : 589 : : 590 : | 591 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 592 | Padding | Padding Count | 593 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 595 where: 597 Version (V): 2 bits. This is a fixed-width field, as described 598 previously. 600 Padding (P): 1 bit. This is a fixed-width field, as described 601 previously. 603 Extension (X): 1 bit. This is a fixed-width field, as described 604 previously. 606 CSRC count (CC): 4 bits. This is a fixed-width field, as described 607 previously. 609 Marker (M): 1 bit. This is a fixed-width field, as described 610 previously. 612 Payload Type (PT): 7 bits. This is a fixed-width field, as described 613 previously. 615 Sequence Number (PT): 16 bits. This is a fixed-width field, as 616 described previously. 618 Timestamp (PT): 32 bits. This is a fixed-width field, as described 619 previously. 621 Synchronization Source identifier: 1 Source Identifier. This is a 622 field whose structure is a previously defined PDU format (Source 623 Identifier). To indicate this, the width of the field is 624 expressed in terms of cross-referenced structure. When used in 625 constraint expressions, PDU names refer to the length of that PDU 626 structure. 628 Contributing Source identifiers: CC Source Identifier. Where a field 629 is comprised of a sequence of previously defined structures, 630 square brackets can be used to indicate this in the diagram. The 631 length of the sequence can be defined using the constraint 632 expression grammar as described earlier. Where the length is 633 unknown, the type of each element of the sequence must be given in 634 square brackets. 636 In this example, both a PDU name (Source Identifier) and a field 637 name (CC) are used in the constraint expression. The PDU name 638 refers to the length of the PDU, while the field name refers to 639 the value of the field. This is possible because field names 640 cannot be the same as previously defined PDU names. 642 Header Extension: 32 bits; present only when X == 1. This is a field 643 whose presence is predicated on an expression given using the 644 constraint expression grammar described earlier. Optional fields 645 can be of any previously defined format (e.g., fixed- or variable- 646 width). Optional fields are indicated by the presence of "; 647 present only when [expr]." at the end of the definition term 648 (i.e., the text contained within the
tag). 650 [Note that this example deviates from the format as described in 651 [RFC3550]. As specified in that document, the Header Extension 652 would be a cross-referenced structure. This is not shown here for 653 brevity.] 655 Payload. The length of the Payload is not specified, and hence needs 656 to be inferred from the total length of the packet and the lengths 657 of the known fields. There can only be one field of unspecified 658 size in a PDU. 660 Padding: PC bytes; present only when (P == 1) && (PC > 0). This is a 661 variable size field, with size dependent on a later field in the 662 packet. Fields can only depend on the value of a later field if 663 they follow a field with unspecified size. 665 Padding Count (PC): 1 byte; present only when P == 1. This is a 666 fixed-width field, as previously discussed. 668 4.3. PDUs with Non-Contiguous Fields 670 In some binary formats, fields are striped across multiple non- 671 contiguous bits. This is often to allow for backwards compatibility 672 with previous definitions of the same fields in earlier documents: 673 striping in this way allows for careful use of the possible range of 674 values. 676 This format is illustrated using the STUN Message Type 677 [draft-ietf-tram-stunbis-21]. A STUN Message Type is formatted as 678 follows: 680 0 1 681 0 1 2 3 4 5 6 7 8 9 0 1 2 3 682 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 683 |M|M|M|M|M|C|M|M|M|C|M|M|M|M| 684 |B|A|9|8|7|1|6|5|4|0|3|2|1|0| 685 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 687 where: 689 Method (M): 12 bits. This field is comprised of multiple sub-fields 690 (M0 through MB) as shown in the diagram. That these sub-fields 691 should be concatenated, after parsing, into a single field is 692 indicated by their being labelled using the 'M' short field name 693 followed by a single hexadecimal digit, with the least significant 694 bit labelled with 0, and subsequent bits labelled in sequence. 696 Class (C): 2 bits. This field follows the same format as M described 697 above. 699 4.4. PDUs with Constraints on Field Values 701 A PDU may be defined not only by the layout and type of its fields, 702 but also by the value of those fields. For example, field values may 703 be constrained to be of a known exact value or to be within a range. 704 More generally, our format enables a boolean expression to be 705 attached to a field, which must be true for the PDU to be parsed 706 successfully. 708 This format is illustrated using the QUIC Long Header Packet format 709 [QUIC-TRANSPORT]. A Long Header is formatted as follows: 711 0 1 2 3 712 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 713 +-+-+-+-+-+-+-+-+ 714 |1|1| T | R | P | 715 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 716 | Version | 717 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 718 | DCID Len | 719 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 720 | Destination Connection ID (DCID) ... 721 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 722 | SCID Len | 723 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 724 | Source Connection ID (SCID) ... 725 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 727 where: 729 Header Form (HF): 1 bit; HF == 1. This is a fixed-width field, 730 constrained to be a of an known, exact value. At most one field 731 value constraint may be given, and if provided, it must be given 732 as a boolean expression, separated by a semi-colon in the field 733 definition name (i.e., the text contained within the
tag). 734 If present, a value constraint must follow the name, short name, 735 and length of the field, but appear before any presence 736 constraint, if applicable. The order of the field must be the 737 same in both the diagram and description list. 739 Fixed Bit (FB): 1 bit; FB == 1. This is a fixed-width field, with a 740 value constraint, as previously described. 742 Long Packet Type (T): 2 bits. This is a fixed-width field as 743 previously described. 745 Reserved Bits (R): 2 bits. This is a fixed-width field as previously 746 described. 748 Packet Number Length (P): 2 bits. This is a fixed-width field as 749 previously described. 751 Version: 32 bits. This is a fixed-width field as previously 752 described. 754 DCID Len (DLen): 1 byte; DLen <= 20. This is a fixed-width field, 755 with a value constraint, as previously described. Note that the 756 constraint language is not limited to equality; it is defined 757 fully in Appendix A.1. 759 Destination Connection ID: DLen bytes. This is a variable-width 760 field as previously described. 762 SCID Len (SLen): 1 byte; SLen <= 20. This is a fixed-width field, 763 with a value constraint, as previously described. 765 Source Connection ID: SLen bytes. This is a variable-width field as 766 previously described. 768 4.5. PDUs That Extend Sub-Structures 770 A PDU may not only use or reference existing sub-structures, but they 771 may extend them, adding new fields, or enforcing different or 772 additional constraints. 774 Where a sub-structure is extended, the diagram may show the sub- 775 structure as a block, labelled with the sub-structure name. It may 776 also be desirable to show the sub-structure diagram in full; in this 777 case, the fields must be given in the same order and be of the same 778 length. New field constraints can be shown. Similarly, in the 779 description list, those fields inherited without change (i.e., with 780 no change to their constraints) do not need to be repeated. Those 781 with different or additional constraints must be described, and the 782 order of the fields in the description list must match that of the 783 sub-structure and the containing structure. 785 This format is illustrated using the QUIC Retry Packet format 786 [QUIC-TRANSPORT]. A Retry Packet is formatted as follows: 788 0 1 2 3 789 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 790 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 791 | : 792 : Long Header : 793 : | 794 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 795 | Retry Token ... 796 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 797 | | 798 + + 799 | | 800 + Retry Integrity Tag + 801 | | 802 + + 803 | | 804 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 806 where: 808 Long Header (LH): 1 Long Header; LH.T == 3. This field is a 809 previously defined sub-structure. Its constraints can access 810 fields in that sub-structure. In this example, the T field of the 811 Long Header must be equal to 3. 813 Retry Token. This is a variable-length field as previously defined. 815 Retry Integrity Tag: 128 bits. This is a fixed-width field as 816 previously defined. 818 As shown, the Long Header packet sub-structure is included. The 819 Retry Packet enforces a new value constraint on the Long Packet Type 820 (T) field. 822 4.6. Storing Data for Parsing 824 The parsing process may require data from previously parsed 825 structures. This means that data needs to be stored persistently 826 throughout the process. This data needs to be identified. 828 That the value of a particular field be stored upon parsing is 829 indicated by the exact phrase "On receipt, the value of 830 is stored as ." being present at the end of the 831 description of a field (i.e., at the end of the
element.) 833 An Initial Packet is formatted as follows: 835 0 1 2 3 836 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 837 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 838 | : 839 : Long Header : 840 : | 841 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 843 where: 845 Long Header (LH): 1 Long Header; LH.T == 0. This is field is a sub- 846 structure, with a constraint, as previously defined. On receipt, 847 the value of LH.DCID is stored as Initial DCID. 849 In this example, the value of the DCID field of the Long Header sub- 850 structure is stored as Initial DCID. 852 4.7. Connecting Structures with Functions 854 The parsing or serialisation of some binary formats cannot be fully 855 described without the use of functions. These functions take 856 arguments (values from another structure), perform some computation, 857 and generate a new structure. 859 Given the goal of fully capturing the parsing or serialisation of 860 binary protocols, it is necessary to include the signature of these 861 helper functions. 863 Function signatures are described in elements. They are 864 constructed as the word "func", followed by a space, then the name of 865 the function. This is immediately followed by a set of brackets 866 containing a comma separated list of the function's parameters, 867 formatted as ": ". This is followed 868 by "->" and the return type of the function, followed by a colon. 870 The body of the function is not captured, owing to the complexity of 871 both capturing and translating arbitrary code. As a result, it can 872 be described in whichever format is most suitable for the document 873 and its readership. 875 Those values that are stored persistently, as defined in Section 4.6, 876 are accessible by functions. 878 As an example, the "apply_protection" function is defined as: 880 func apply_protection(to: Unprotected Packet) 881 -> Protected Packet: 882 apply packet protection to payload 883 apply header protection to first_byte and packet_number 884 construct appropriate Protected Packet based on first_byte 885 return Protected Packet 887 In this example, 'Unprotected Packet' and 'Protected Packet' are 888 existing types. 890 To indicate that a PDU is created from another by way of a function, 891 the sentence "A/An is parsed from a using 892 the function" is used. This indicates that a PDU A 893 is generated by passing PDU B into the named function. The function 894 must take a single parameter, of the same type as PDU B, and return a 895 PDU B. 897 To indicate that a PDU can be serialised to another by way of a 898 function, the sentence "A/An is serialised to a using the function" is used. This indicates 900 that a PDU B is generated by passing PDU A into the named function. 901 The function must take a single parameter, of the same type as PDU A, 902 and return a PDU B. 904 4.8. Specifying Enumerated Types 906 In addition to the use of the sub-structures, it is desirable to be 907 able to define a type that may take the value of one of a set of 908 alternative structures. 910 The alternative structures that comprise an enumerated type are 911 identified using the exact phrase "The is one 912 of: " where the list of structure names is a 913 comma separated list (with the last element, if there is more than 914 one element, preceded by 'or'), each optionally preceded by "a" or 915 "an". The structure names must be defined within the document or a 916 linked document. 918 Where an enumerated type has only two variants, an alternative phrase 919 can be used: "The is either a 920 or ". The names of the variants must be defined 921 within the document or a linked document. 923 A Frame is either a PING Frame or a HANDSHAKE_DONE Frame. 925 A PING Frame is formatted as follows: 927 0 1 2 3 928 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 929 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 930 | 1 | 931 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 933 where: 935 Frame Type (FT): 1 byte; FT == 1. Frame type, set to 1 for PING 936 frames. 938 A HANDSHAKE_DONE Frame is formatted as follows: 940 0 1 2 3 941 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 942 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 943 | 30 | 944 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 946 where: 948 Frame Type (FT): 1 byte; FT == 30. Frame type, set to 30 for 949 HANDSHAKE_DONE frames. 951 4.9. Specifying Protocol Data Units 953 A document will set out different structures that are not, on their 954 own, protocol data units. To capture the parsing or serialisation of 955 a protocol, it is necessary to be able to identify or construct those 956 packets that are valid PDUs. As a result, it is necessary for the 957 document to identify those structures that are PDUs. 959 The PDUs that comprise a protocol are identified using the exact 960 phrase "This document describes the protocol. The 961 protocol uses " where the list of 962 PDU names is a comma separated list (with the last element, if there 963 is more than one element, preceded by 'and'), each optionally 964 preceded by "a" or "an". The PDU names must be structure names 965 defined in the document or a linked document. The PDU names are 966 pluralised in the list. A document must contain exactly one instance 967 of this phrase. 969 This document describes the Example protocol. The Example protocol 970 uses Long Headers, STUN Message Types, IPv4 Headers, and RTP Data 971 Packets. 973 4.10. Importing PDU Definitions from Other Documents 975 Protocols are often specified across multiple documents, either 976 because the specification of a protocol's data units has changed over 977 time, or because of explicit extension points contained in the 978 protocol's original specification. To allow a document to make use 979 of a previous PDU definition, it is possible to import PDU 980 definitions (written in the format described in this document) from 981 other documents. 983 A PDU definition is imported using the exact phrase "A/An ________ is 984 formatted as described in ". The document 985 identifier must refer, unambiguously, to an existing document. An 986 Internet-Draft is identified by its name. RFCs are identified by 987 "RFC" followed by their number. 989 5. Open Issues 991 * Need a simple syntax for defining a list of identical objects, and 992 a way of referring to the size of the enclosing packet. The 993 format cannot currently represent RFC 6716 section 3.2.3, and 994 should be able to (the underlying type system can do so). 996 * Need some discussion about the checks that the tooling might 997 perform, and the implications of those checks. For example, the 998 tooling checks for consistency between the diagram and the 999 description list of fields, ensuring that fields match by name and 1000 width. -01 of this draft had a field that mismatched because of 1001 case: is this something that the tooling should identify? More 1002 broadly, what is the trade-off between the rigour that the tooling 1003 can enforce, and the flexibility desired/needed by authors? 1005 * Need to describe the rules governing the import of PDU definitions 1006 from other documents. 1008 6. IANA Considerations 1010 This document contains no actions for IANA. 1012 7. Security Considerations 1014 Poorly implemented parsers are a frequent source of security 1015 vulnerabilities in protocol implementations. Structuring the 1016 description of a protocol data unit so that a parser can be 1017 automatically derived from the specification can reduce the 1018 likelihood of vulnerable implementations. 1020 As described in Section 3, the expressiveness of a protocol 1021 description language has implications for the safety, security, and 1022 computability properties of the parser for the protocol description 1023 language itself, and on the generated parser code for the protocols 1024 described using it. The language-theoretic security ([LANGSEC]) 1025 community explores the security implications of programming language 1026 design; the principles developed in that community should guide the 1027 development of protocol description languages. 1029 8. Acknowledgements 1031 The authors would like to thank Marc Petit-Huguenin for extensive 1032 feedback on the draft, including work on formalising the constraint 1033 syntax as given in Appendix A.1. 1035 The authors would like to thank David Southgate for preparing a 1036 prototype implementation of some of the ideas described here. 1038 This work has received funding from the UK Engineering and Physical 1039 Sciences Research Council under grant EP/R04144X/1. 1041 9. Informative References 1043 [RFC8357] Deering, S. and R. Hinden, "Generalized UDP Source Port 1044 for DHCP Relay", RFC 8357, March 2018, 1045 . 1047 [QUIC-TRANSPORT] 1048 Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed 1049 and Secure Transport", Work in Progress, Internet-Draft, 1050 draft-ietf-quic-transport-27, 21 February 2020, 1051 . 1054 [RFC6958] Clark, A., Zhang, S., Zhao, J., and Q. Wu, "RTP Control 1055 Protocol (RTCP) Extended Report (XR) Block for Burst/Gap 1056 Loss Metric Reporting", RFC 6958, May 2013, 1057 . 1059 [RFC7950] Bjorklund, M., "The YANG 1.1 Data Modeling Language", 1060 RFC 7950, August 2016, 1061 . 1063 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 1064 Version 1.3", RFC 8446, August 2018, 1065 . 1067 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 1068 Specifications: ABNF", RFC 5234, January 2008, 1069 . 1071 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", 1072 RFC 7405, December 2014, 1073 . 1075 [ASN1] ITU-T, "ITU-T Recommendation X.680, X.681, X.682, and 1076 X.683", ITU-T Recommendation X.680, X.681, X.682, and 1077 X.683. 1079 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 1080 Representation (CBOR)", RFC 7049, October 2013, 1081 . 1083 [RFC3550] Schulzrinne, H., Casner, S., Frederick, R., and V. 1084 Jacobson, "RTP: A Transport Protocol for Real-Time 1085 Applications", RFC 3550, July 2003, 1086 . 1088 [draft-ietf-tram-stunbis-21] 1089 Petit-Huguenin, M., Salgueiro, G., Rosenberg, J., Wing, 1090 D., Mahy, R., and P. Matthews, "Session Traversal 1091 Utilities for NAT (STUN)", Work in Progress, Internet- 1092 Draft, draft-ietf-tram-stunbis-21, 21 March 2019, 1093 . 1096 [RFC791] Postel, J., "Internet Protocol", RFC 791, September 1981, 1097 . 1099 [RFC793] Postel, J., "Transmission Control Protocol", RFC 793, 1100 September 1981, . 1102 [LANGSEC] LANGSEC, "LANGSEC: Language-theoretic Security", 1103 . 1105 [SASSAMAN] Sassaman, L., Patterson, M. L., Bratus, S., and A. 1106 Shubina, "The Halting Problems of Network Stack 1107 Insecurity", ;login: -- December 2011, Volume 36, Number 1108 6, . 1112 Appendix A. ABNF specification 1114 A.1. Constraint Expressions 1116 field-def = name ["(" short-name ")"] 1117 [":" sp ((length [";" sp (bool-expr / 1118 (bool-expr ";" sp presence-constraint))]) / 1119 (bool-expr [(";" sp presence-constraint)]) / 1120 presence-constraint)] "." 1121 presence-constraint = "present only when " bool-expr 1122 constant = %x31-39 *(%x30-39) ; natural numbers without leading 0s 1123 short-name = ALPHA *(ALPHA / DIGIT / "-" / "_") 1124 name = short-name *(" " short-name) 1125 sp = [" "] ; optional space in expression 1126 bool-expr = "(" sp bool-expr sp ")" / 1127 "!" sp bool-expr / 1128 bool-expr sp bool-op sp bool-expr / 1129 bool-expr sp "?" sp expr sp ":" sp expr / 1130 expr sp cmp-op sp expr 1131 bool-op = "&&" / "||" 1132 cmp-op = "==" / "!=" / "<" / "<=" / ">" / ">=" 1133 expr = "(" sp expr sp ")" / 1134 expr sp "^" sp expr / 1135 expr sp muldiv-op sp expr / 1136 expr sp addsub-op sp expr / 1137 bool-expr "?" expr ":" expr / 1138 name / short-name "." short-name / 1139 short-name "#" "Size" / 1140 constant 1141 muldiv-op = "*" / "/" / "%" 1142 addsub-op = "+" / "-" 1143 length = expr " " unit / "[" sp name sp "]" 1144 unit = %s"bit" / %s"bits" / %s"byte" / %s"bytes" / name 1146 A.2. Augmented packet diagrams 1148 Future revisions of this draft will include an ABNF specification for 1149 the augmented packet diagram format described in Section 4. Such a 1150 specification is omitted from this draft given that the format is 1151 likely to change as its syntax is developed. Given the visual nature 1152 of the format, it is more appropriate for discussion to focus on the 1153 examples given in Section 4. 1155 Appendix B. Source code repository 1157 The source for this draft is available from https://github.com/ 1158 glasgow-ipl/draft-mcquistin-augmented-ascii-diagrams. 1160 The source code for tooling that can be used to parse this document 1161 is available from https://github.com/glasgow-ipl/ips-protodesc-code. 1163 Authors' Addresses 1165 Stephen McQuistin 1166 University of Glasgow 1167 School of Computing Science 1168 Glasgow 1169 G12 8QQ 1170 United Kingdom 1172 Email: sm@smcquistin.uk 1174 Vivian Band 1175 University of Glasgow 1176 School of Computing Science 1177 Glasgow 1178 G12 8QQ 1179 United Kingdom 1181 Email: vivianband0@gmail.com 1183 Dejice Jacob 1184 University of Glasgow 1185 School of Computing Science 1186 Glasgow 1187 G12 8QQ 1188 United Kingdom 1190 Email: d.jacob.1@research.gla.ac.uk 1192 Colin Perkins 1193 University of Glasgow 1194 School of Computing Science 1195 Glasgow 1196 G12 8QQ 1197 United Kingdom 1199 Email: csp@csperkins.org