idnits 2.17.00 (12 Aug 2021) /tmp/idnits29079/draft-mcquistin-augmented-ascii-diagrams-04.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 == Line 1104 has weird spacing: '...r eq-op bool...' == Line 1105 has weird spacing: '...rd-expr bool-...' == Line 1106 has weird spacing: '...dd-expr ord-o...' == Line 1108 has weird spacing: '...ul-expr add-o...' == Line 1109 has weird spacing: '... mul-op expr...' -- The document date (24 April 2020) is 756 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- == Outdated reference: draft-ietf-quic-transport has been published as RFC 9000 -- Obsolete informational reference (is this intentional?): RFC 7049 (Obsoleted by RFC 8949) Summary: 0 errors (**), 0 flaws (~~), 7 warnings (==), 2 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: 26 October 2020 C. S. Perkins 6 University of Glasgow 7 24 April 2020 9 Describing Protocol Data Units with Augmented Packet Header Diagrams 10 draft-mcquistin-augmented-ascii-diagrams-04 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 26 October 2020. 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 . . . . . 21 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 . . . . . . . . . . . . . . . . . 24 77 A.1. Constraint Expressions . . . . . . . . . . . . . . . . . 24 78 A.2. Augmented packet diagrams . . . . . . . . . . . . . . . . 25 79 Appendix B. Source code repository . . . . . . . . . . . . . . . 25 80 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 25 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 629 field 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. 634 In this example, both a PDU name (Source Identifier) and a field 635 name (CC) are used in the constraint expression. The PDU name 636 refers to the length of the PDU, while the field name refers to 637 the value of the field. This is possible because field names 638 cannot be the same as previously defined PDU names. 640 Header Extension: 32 bits; present only when X == 1. This is a field 641 whose presence is predicated on an expression given using the 642 constraint expression grammar described earlier. Optional fields 643 can be of any previously defined format (e.g., fixed- or variable- 644 width). Optional fields are indicated by the presence of "; 645 present only when [expr]." at the end of the definition term 646 (i.e., the text contained within the
tag). 648 [Note that this example deviates from the format as described in 649 [RFC3550]. As specified in that document, the Header Extension 650 would be a cross-referenced structure. This is not shown here for 651 brevity.] 653 Payload. The length of the Payload is not specified, and hence needs 654 to be inferred from the total length of the packet and the lengths 655 of the known fields. There can only be one field of unspecified 656 size in a PDU. 658 Padding: Padding Count bytes; present only when (P == 1) and 659 (Padding Count > 0). 660 This is a variable size field, with size dependent on a later 661 field in the packet. Fields can only depend on the value of a 662 later field if they follow a field with unspecified size. 664 Padding Count: 1 byte; present only when P == 1. This is a fixed- 665 width field, as previously discussed. 667 4.3. PDUs with Non-Contiguous Fields 669 In some binary formats, fields are striped across multiple non- 670 contiguous bits. This is often to allow for backwards compatibility 671 with previous definitions of the same fields in earlier documents: 672 striping in this way allows for careful use of the possible range of 673 values. 675 This format is illustrated using the STUN Message Type 676 [draft-ietf-tram-stunbis-21]. A STUN Message Type is formatted as 677 follows: 679 0 1 680 0 1 2 3 4 5 6 7 8 9 0 1 2 3 681 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 682 |M|M|M|M|M|C|M|M|M|C|M|M|M|M| 683 |B|A|9|8|7|1|6|5|4|0|3|2|1|0| 684 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 686 where: 688 Method (M): 12 bits. This field is comprised of multiple sub-fields 689 (M0 through MB) as shown in the diagram. That these sub-fields 690 should be concatenated, after parsing, into a single field is 691 indicated by their being labelled using the 'M' short field name 692 followed by a single hexadecimal digit, with the least significant 693 bit labelled with 0, and subsequent bits labelled in sequence. 695 Class (C): 2 bits. This field follows the same format as M described 696 above. 698 4.4. PDUs with Constraints on Field Values 700 A PDU may be defined not only by the layout and type of its fields, 701 but also by the value of those fields. For example, field values may 702 be constrained to be of a known exact value or to be within a range. 703 More generally, our format enables a boolean expression to be 704 attached to a field, which must be true for the PDU to be parsed 705 successfully. 707 This format is illustrated using the QUIC Long Header Packet format 708 [QUIC-TRANSPORT]. A Long Header is formatted as follows: 710 0 1 2 3 711 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 712 +-+-+-+-+-+-+-+-+ 713 |1|1| T | R | P | 714 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 715 | Version | 716 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 717 | DCID Len | 718 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 719 | Destination Connection ID (DCID) ... 720 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 721 | SCID Len | 722 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 723 | Source Connection ID (SCID) ... 724 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 726 where: 728 Header Form (HF): 1 bit; HF == 1. This is a fixed-width field, 729 constrained to be a of an known, exact value. At most one field 730 value constraint may be given, and if provided, it must be given 731 as a boolean expression, separated by a semi-colon in the field 732 definition name (i.e., the text contained within the
tag). 733 If present, a value constraint must follow the name, short name, 734 and length of the field, but appear before any presence 735 constraint, if applicable. 737 The order of the field must be the same in both the diagram and 738 description list. 740 Fixed Bit (FB): 1 bit; FB == 1. This is a fixed-width field, with a 741 value constraint, as previously described. 743 Long Packet Type (T): 2 bits. This is a fixed-width field as 744 previously described. 746 Reserved Bits (R): 2 bits. This is a fixed-width field as previously 747 described. 749 Packet Number Length (P): 2 bits. This is a fixed-width field as 750 previously described. 752 Version: 32 bits. This is a fixed-width field as previously 753 described. 755 DCID Len (DLen): 1 byte; DLen <= 20. This is a fixed-width field, 756 with a value constraint, as previously described. Note that the 757 constraint language is not limited to equality; it is defined 758 fully in Appendix A.1. 760 Destination Connection ID: DLen bytes. This is a variable-width 761 field as previously described. 763 SCID Len (SLen): 1 byte; SLen <= 20. This is a fixed-width field, 764 with a value constraint, as previously described. 766 Source Connection ID: SLen bytes. This is a variable-width field as 767 previously described. 769 4.5. PDUs That Extend Sub-Structures 771 A PDU may not only use or reference existing sub-structures, but they 772 may extend them, adding new fields, or enforcing different or 773 additional constraints. 775 Where a sub-structure is extended, the diagram may show the sub- 776 structure as a block, labelled with the sub-structure name. It may 777 also be desirable to show the sub-structure diagram in full; in this 778 case, the fields must be given in the same order and be of the same 779 length. New field constraints can be shown. Similarly, in the 780 description list, those fields inherited without change (i.e., with 781 no change to their constraints) do not need to be repeated. Those 782 with different or additional constraints must be described, and the 783 order of the fields in the description list must match that of the 784 sub-structure and the containing structure. 786 This format is illustrated using the QUIC Retry Packet format 787 [QUIC-TRANSPORT]. A Retry Packet is formatted as follows: 789 0 1 2 3 790 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 791 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 792 | : 793 : Long Header : 794 : | 795 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 796 | Retry Token ... 797 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 798 | | 799 + + 800 | | 801 + Retry Integrity Tag + 802 | | 803 + + 804 | | 805 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 807 where: 809 Long Header (LH): 1 Long Header; LH.T == 3. This field is a 810 previously defined sub-structure. Its constraints can access 811 fields in that sub-structure. In this example, the T field of the 812 Long Header must be equal to 3. 814 Retry Token This is a variable-length field as previously defined. 816 Retry Integrity Tag: 128 bits. This is a fixed-width field as 817 previously defined. 819 As shown, the Long Header packet sub-structure is included. The 820 Retry Packet enforces a new value constraint on the Long Packet Type 821 (T) field. 823 4.6. Storing Data for Parsing 825 The parsing process may require data from previously parsed 826 structures. This means that data needs to be stored persistently 827 throughout the process. This data needs to be identified. 829 That the value of a particular field be stored upon parsing is 830 indicated by the exact phrase "On receipt, the value of 831 is stored as ." being present at the end of the 832 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 structure is created from another by way of a 891 function: "A/An is constructed from a using the () function.". This 893 indicates that a structure of type A is generated using the named 894 function. The parameters in the function call are named fields from 895 structure type B. They must match the function signature, both in 896 number and type. 898 4.8. Specifying Enumerated Types 900 In addition to the use of the sub-structures, it is desirable to be 901 able to define a type that may take the value of one of a set of 902 alternative structures. 904 The alternative structures that comprise an enumerated type are 905 identified using the exact phrase "The is one 906 of: " where the list of structure names is a 907 comma separated list (with the last element, if there is more than 908 one element, preceded by 'or'), each optionally preceded by "a" or 909 "an". The structure names must be defined within the document or a 910 linked document. 912 Where an enumerated type has only two variants, an alternative phrase 913 can be used: "The is either a 914 or ". The names of the variants must be defined 915 within the document or a linked document. 917 A PING Frame is formatted as follows: 919 0 1 2 3 920 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 921 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 922 | 1 | 923 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 925 where: 927 Frame Type (FT): 1 * Variable-Length Integer Encoding; FT == 1. 928 Frame type, set to 1 for PING frames. 930 A HANDSHAKE_DONE Frame is formatted as follows: 932 0 1 2 3 933 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 934 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 935 | 30 | 936 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 938 where: 940 Frame Type (FT): 1 * Variable-Length Integer Encoding; FT == 30. 941 Frame type, set to 30 for HANDSHAKE_DONE frames. 943 A Frame is either a PING Frame or a HANDSHAKE_DONE Frame. 945 4.9. Specifying Protocol Data Units 947 A document will set out different structures that are not, on their 948 own, protocol data units. To capture the parsing or serialisation of 949 a protocol, it is necessary to be able to identify or construct those 950 packets that are valid PDUs. As a result, it is necessary for the 951 document to identify those structures that are PDUs. 953 The PDUs that comprise a protocol are identified using the exact 954 phrase "This document describes the protocol, The 955 protocol uses " where the list of 956 PDU names is a comma separated list (with the last element, if there 957 is more than one element, preceded by 'and'), each optionally 958 preceded by "a" or "an". The PDU names must be structure names 959 defined in the document or a linked document. The PDU names are 960 pluralised in the list. A document must contain exactly one instance 961 of this phrase. 963 The Example protocol uses Long Headers, STUN Message Types, IPv4 964 Headers, and RTP Data Packets. 966 4.10. Importing PDU Definitions from Other Documents 968 Protocols are often specified across multiple documents, either 969 because the specification of a protocol's data units has changed over 970 time, or because of explicit extension points contained in the 971 protocol's original specification. To allow a document to make use 972 of a previous PDU definition, it is possible to import PDU 973 definitions (written in the format described in this document) from 974 other documents. 976 A PDU definition is imported using the exact phrase "A/An ________ is 977 formatted as described in ". The document 978 identifier must refer, unambiguously, to an existing document. An 979 Internet-Draft is identified by its name. RFCs are identified by 980 "RFC" followed by their number. 982 5. Open Issues 984 * Need a simple syntax for defining a list of identical objects, and 985 a way of referring to the size of the enclosing packet. The 986 format cannot currently represent RFC 6716 section 3.2.3, and 987 should be able to (the underlying type system can do so). 989 * Need some discussion about the checks that the tooling might 990 perform, and the implications of those checks. For example, the 991 tooling checks for consistency between the diagram and the 992 description list of fields, ensuring that fields match by name and 993 width. -01 of this draft had a field that mismatched because of 994 case: is this something that the tooling should identify? More 995 broadly, what is the trade-off between the rigour that the tooling 996 can enforce, and the flexibility desired/needed by authors? 998 * Need to describe the rules governing the import of PDU definitions 999 from other documents. 1001 6. IANA Considerations 1003 This document contains no actions for IANA. 1005 7. Security Considerations 1007 Poorly implemented parsers are a frequent source of security 1008 vulnerabilities in protocol implementations. Structuring the 1009 description of a protocol data unit so that a parser can be 1010 automatically derived from the specification can reduce the 1011 likelihood of vulnerable implementations. 1013 As described in Section 3, the expressiveness of a protocol 1014 description language has implications for the safety, security, and 1015 computability properties of the parser for the protocol description 1016 language itself, and on the generated parser code for the protocols 1017 described using it. The language-theoretic security ([LANGSEC]) 1018 community explores the security implications of programming language 1019 design; the principles developed in that community should guide the 1020 development of protocol description languages. 1022 8. Acknowledgements 1024 The authors would like to thank David Southgate for preparing a 1025 prototype implementation of some of the ideas described here. 1027 The authors would like to thank Marc Petit-Huguenin for feedback on 1028 the draft. 1030 This work has received funding from the UK Engineering and Physical 1031 Sciences Research Council under grant EP/R04144X/1. 1033 9. Informative References 1035 [RFC8357] Deering, S. and R. Hinden, "Generalized UDP Source Port 1036 for DHCP Relay", RFC 8357, March 2018, 1037 . 1039 [QUIC-TRANSPORT] 1040 Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed 1041 and Secure Transport", Work in Progress, Internet-Draft, 1042 draft-ietf-quic-transport-27, 21 February 2020, 1043 . 1046 [RFC6958] Clark, A., Zhang, S., Zhao, J., and Q. Wu, "RTP Control 1047 Protocol (RTCP) Extended Report (XR) Block for Burst/Gap 1048 Loss Metric Reporting", RFC 6958, May 2013, 1049 . 1051 [RFC7950] Bjorklund, M., "The YANG 1.1 Data Modeling Language", 1052 RFC 7950, August 2016, 1053 . 1055 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 1056 Version 1.3", RFC 8446, August 2018, 1057 . 1059 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 1060 Specifications: ABNF", RFC 5234, January 2008, 1061 . 1063 [ASN1] ITU-T, "ITU-T Recommendation X.680, X.681, X.682, and 1064 X.683", ITU-T Recommendation X.680, X.681, X.682, and 1065 X.683. 1067 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 1068 Representation (CBOR)", RFC 7049, October 2013, 1069 . 1071 [RFC3550] Schulzrinne, H., Casner, S., Frederick, R., and V. 1072 Jacobson, "RTP: A Transport Protocol for Real-Time 1073 Applications", RFC 3550, July 2003, 1074 . 1076 [draft-ietf-tram-stunbis-21] 1077 Petit-Huguenin, M., Salgueiro, G., Rosenberg, J., Wing, 1078 D., Mahy, R., and P. Matthews, "Session Traversal 1079 Utilities for NAT (STUN)", Work in Progress, Internet- 1080 Draft, draft-ietf-tram-stunbis-21, 21 March 2019, 1081 . 1084 [RFC791] Postel, J., "Internet Protocol", RFC 791, September 1981, 1085 . 1087 [RFC793] Postel, J., "Transmission Control Protocol", RFC 793, 1088 September 1981, . 1090 [LANGSEC] LANGSEC, "LANGSEC: Language-theoretic Security", 1091 . 1093 [SASSAMAN] Sassaman, L., Patterson, M. L., Bratus, S., and A. 1094 Shubina, "The Halting Problems of Network Stack 1095 Insecurity", ;login: -- December 2011, Volume 36, Number 1096 6, . 1100 Appendix A. ABNF specification 1102 A.1. Constraint Expressions 1103 cond-expr = eq-expr "?" cond-expr ":" eq-expr 1104 eq-expr = bool-expr eq-op bool-expr 1105 bool-expr = ord-expr bool-op ord-expr 1106 ord-expr = add-expr ord-op add-expr 1108 add-expr = mul-expr add-op mul-expr 1109 mul-expr = expr mul-op expr 1110 expr = *DIGIT / field-name / 1111 field-name-ws / "(" expr ")" 1113 field-name = *ALPHA 1114 field-name-ws = *(field-name " ") 1116 mul-op = "*" / "/" / "%" 1117 add-op = "+" / "-" 1118 ord-op = "<=" / "<" / ">=" / ">" 1119 bool-op = "&&" / "||" / "!" 1120 eq-op = "==" / "!=" 1122 A.2. Augmented packet diagrams 1124 Future revisions of this draft will include an ABNF specification for 1125 the augmented packet diagram format described in Section 4. Such a 1126 specification is omitted from this draft given that the format is 1127 likely to change as its syntax is developed. Given the visual nature 1128 of the format, it is more appropriate for discussion to focus on the 1129 examples given in Section 4. 1131 Appendix B. Source code repository 1133 The source for this draft is available from https://github.com/ 1134 glasgow-ipl/draft-mcquistin-augmented-ascii-diagrams. 1136 The source code for tooling that can be used to parse this document 1137 is available from https://github.com/glasgow-ipl/ips-protodesc-code. 1139 Authors' Addresses 1141 Stephen McQuistin 1142 University of Glasgow 1143 School of Computing Science 1144 Glasgow 1145 G12 8QQ 1146 United Kingdom 1148 Email: sm@smcquistin.uk 1149 Vivian Band 1150 University of Glasgow 1151 School of Computing Science 1152 Glasgow 1153 G12 8QQ 1154 United Kingdom 1156 Email: vivianband0@gmail.com 1158 Dejice Jacob 1159 University of Glasgow 1160 School of Computing Science 1161 Glasgow 1162 G12 8QQ 1163 United Kingdom 1165 Email: d.jacob.1@research.gla.ac.uk 1167 Colin Perkins 1168 University of Glasgow 1169 School of Computing Science 1170 Glasgow 1171 G12 8QQ 1172 United Kingdom 1174 Email: csp@csperkins.org