RFC 5511 PROPOSED STANDARD SYNTAX · ROUTING · BNF

Routing Backus-Naur Form (RBNF): A Syntax Used to Form Encoding Rules in Various Routing Protocol Specifications

A formal definition of the Backus-Naur notation that routing protocol specifications have been using without one.

On rfc-editor.org ↗
PUBLISHED
April 2009
AUTHORS
A. Farrel
STREAM
IETF
NAME OF THE NOTATION
Routing BNF (RBNF)
OPERATORS
6
KINDS OF RULE
3 (objects, constructs, messages)
PROTOCOLS ALREADY USING IT
5 (RSVP, RSVP-TE, GMPLS, LMP, PCEP)
PRECEDENCE ORDER
Objects and constructs, repetition, grouping and optional, concatenation, alternative
AUTOMATED VALIDATION TOOLS
None known at the time of writing
DOI
10.17487/RFC5511

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Network Working Group                                          A. Farrel
Request for Comments: 5511                            Old Dog Consulting
Category: Standards Track                                     April 2009


         Routing Backus-Naur Form (RBNF): A Syntax Used to Form
       Encoding Rules in Various Routing Protocol Specifications

Status of This Memo

   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.  Please refer to the current edition of the "Internet
   Official Protocol Standards" (STD 1) for the standardization state
   and status of this protocol.  Distribution of this memo is unlimited.

Copyright Notice

   Copyright (c) 2009 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents in effect on the date of
   publication of this document (http://trustee.ietf.org/license-info).
   Please review these documents carefully, as they describe your rights
   and restrictions with respect to this document.

   This document may contain material from IETF Documents or IETF
   Contributions published or made publicly available before November
   10, 2008.  The person(s) controlling the copyright in some of this
   material may not have granted the IETF Trust the right to allow
   modifications of such material outside the IETF Standards Process.
   Without obtaining an adequate license from the person(s) controlling
   the copyright in such materials, this document may not be modified
   outside the IETF Standards Process, and derivative works of it may
   not be created outside the IETF Standards Process, except to format
   it for publication as an RFC or to translate it into languages other
   than English.

Abstract

   Several protocols have been specified in the Routing Area of the IETF
   using a common variant of the Backus-Naur Form (BNF) of representing
   message syntax.  However, there is no formal definition of this
   version of BNF.

   There is value in using the same variant of BNF for the set of
   protocols that are commonly used together.  This reduces confusion
   and simplifies implementation.

   Updating existing documents to use some other variant of BNF that is
   already formally documented would be a substantial piece of work.

   This document provides a formal definition of the variant of BNF that
   has been used (that we call Routing BNF) and makes it available for
   use by new protocols.

Table of Contents

   1. Introduction ....................................................3
      1.1. Terminology ................................................3
      1.2. Existing Uses ..............................................3
      1.3. Applicability Statement ....................................4
   2. Formal Definitions ..............................................4
      2.1. Rule Definitions ...........................................5
           2.1.1. Rule Name Delimitation ..............................5
           2.1.2. Objects .............................................5
           2.1.3. Constructs ..........................................6
           2.1.4. Messages ............................................6
      2.2. Operators ..................................................6
           2.2.1. Assignment ..........................................6
           2.2.2. Concatenation .......................................7
           2.2.3. Optional Presence ...................................7
           2.2.4. Alternatives ........................................8
           2.2.5. Repetition ..........................................9
           2.2.6. Grouping ...........................................10
      2.3. Editorial Conventions .....................................11
           2.3.1. White Space ........................................11
           2.3.2. Line Breaks ........................................11
           2.3.3. Ordering ...........................................11
      2.4. Precedence ................................................11
   3. Automated Validation ...........................................13
   4. Security Considerations ........................................13
   5. Acknowledgments ................................................13
   6. References .....................................................13
      6.1. Normative References ......................................13
      6.2. Informative References ....................................13

1.  Introduction

   Backus-Naur Form (BNF) has been used to specify the message formats
   of several protocols within the Routing Area of the IETF.
   Unfortunately, these specifications are not based on any specific
   formal definition of BNF, and they differ slightly from the
   definitions provided in other places.

   It is clearly valuable to have a formal definition of the syntax-
   defining language that is used.  It would be possible to convert all
   existing specifications to use an established specification of BNF
   (for example, Augmented BNF or ABNF [RFC5234]); however, this would
   require a lot of work.  It should be noted that in ABNF the terminals
   are integers (characters/bytes), while in the BNF form used to define
   message formats, the terminals are "objects" (some kind of message
   elements, but not individual bytes or characters) or entire
   "messages".  This means that converting existing specifications to
   use an established BNF specification would also require extensions to
   that BNF specification.

   On the other hand, the variant of BNF used by the specifications in
   question (which is similar to a subset of Extended BNF [EBNF]) is
   consistent and has only a small number of constructs.  It makes
   sense, therefore, to provide a definition of this variant of BNF to
   allow ease of interpretation of existing documents and to facilitate
   the development of new protocol specifications using the same variant
   of BNF.  A specification will also facilitate automated verification
   of the formal definitions used in future documents.

   This document provides such a specification and names the BNF variant
   Routing BNF (RBNF).

1.1.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [RFC2119].

1.2.  Existing Uses

   The first notable use of the variant of BNF that concerns us is in
   the specification of the Resource Reservation Protocol (RSVP)
   [RFC2205].  RSVP has been extended for use in Multiprotocol Label
   Switching (MPLS) networks to provide signaling for Traffic
   Engineering (TE) [RFC3209], and this has been developed for use as
   the signaling protocol in Generalized MPLS (GMPLS) networks
   [RFC3473].

   Each of these three uses of RSVP has given rise to a large number of
   specifications of protocol extensions to provide additional features
   over and above those in the base documents.  Each new feature is
   defined in its own document using the common variant of BNF.

   New protocols have also been specified using the same variant of BNF.
   This has arisen partly because the developers were familiar with the
   BNF used in [RFC2205], etc., but also because of the overlap between
   the protocols, especially with respect to the network objects
   controlled and operated.

   Notable among these additional protocols are the Link Management
   Protocol (LMP) [RFC4204] and the Path Computation Element Protocol
   (PCEP) [RFC5440].  In both cases, further documents that specify
   protocol extensions also use the same variant of BNF.

1.3.  Applicability Statement

   RBNF as defined in this document is primarily applicable for the
   protocols listed in the previous section.  The specification may be
   used to facilitate the interpretation of the pre-existing RFCs that
   are referenced.  It should also be used in the specification of
   extensions to those protocols.

   RBNF could also be used for the specification of new protocols.  This
   is most appropriate for the development of new protocols that are
   closely related to those that already use RBNF.  For example, PCEP is
   closely related to RSVP-TE, and when it was developed, the PCE
   working group chose to use the same form of BNF as was already used
   in the RSVP-TE specifications.

   If a wholly new protocol is being developed and is not related to a
   protocol that already uses RBNF, the working group should consider
   carefully whether to use RBNF or to use a more formally specified and
   broader form of BNF such as ABNF [RFC5234].

   The use of RBNF to specify extensions to protocols that do not
   already use RBNF (i.e., that use some other form of BNF) is not
   recommended.

2.  Formal Definitions

   The basic building blocks of BNF are rules and operators.  At its
   simplest form, a rule in the context we are defining is a protocol
   object that is traditionally defined by a bit diagram in the protocol
   specification.  Further and more complex rules are constructed by
   combining other rules using operators.  The most complex rule is the
   message that is constructed from an organization of protocol objects
   as specified by the operators.

   An RBNF specification consists of a sequence of rule definitions
   using the operators defined in Section 2.2.  One rule may be
   constructed from a set of other rules using operators.  The order of
   definition of rules does not matter.  That is, the subordinate rules
   MAY be defined first and then used in subsequent definitions of
   further rules, or the top-level rules MAY be defined first followed
   by a set of definitions of the subordinate rules.

   Rule definitions are read left-to-right on any line, and the lines
   are read top-to-bottom on the page.  This becomes particularly
   important when considering sequences of rules and operators.

2.1.  Rule Definitions

   No semantics should be assumed from special characters used in rule
   names.  For example, it would be wrong to assume that a rule carries
   a decimal number because the rule name begins or ends with the letter
   "d".  However, individual specifications MAY choose to assign rule
   names in any way that makes the human interpretation of the rule
   easier.

2.1.1.  Rule Name Delimitation

   All rule names are enclosed by angle brackets ("<" and ">").  Rule
   names MAY include any printable characters, but MUST NOT include tabs
   or line feeds/breaks.

   Example:
     <Path Message>

2.1.2.  Objects

   The most basic (indivisible) rule is termed an object.  The
   definition of an object is derived from its context.

   Objects are typically named in uppercase.  They do not usually use
   spaces within the name, favoring underbars ("_").

   Example:
     <SENDER_TEMPLATE>

2.1.3.  Constructs

   Rules that are constructed from other rules using operators are
   termed constructs.

   Constructs are named in lowercase, although capitals are commonly
   used to indicate acronyms.  Spaces and hyphens are used between words
   within names.

   Example:
     <sender descriptor>

2.1.4.  Messages

   The final objective is the definition of messages.  These are rules
   that are constructed from objects and constructs using operators.
   The only syntactic difference between a message and a construct is
   that no other rule is typically constructed from a message.

   Messages are typically named in title case.

   Example:
     <Path Message>

2.2.  Operators

   Operators are used to build constructs and messages from objects and
   constructs.

2.2.1.  Assignment

   Assignment is used to form constructs and messages.

   Meaning:
     The named construct or message on the left-hand side is defined to
     be set equal to the right-hand side of the assignment.

   Encoding:
     colon, colon, equal sign ("::=")

   Example:
     <WF flow descriptor> ::= <FLOWSPEC>

   Note:
     The left-hand side of the assignment and the assignment operator
     MUST be present on the same line.

2.2.2.  Concatenation

   Objects and constructs can be combined as a sequence to form a new
   construct or a message.

   Meaning:
     The objects or constructs MUST be present in the order specified.
     The order of reading RBNF is stated in Section 2.

   Encoding:
     A sequence of objects and constructs usually separated by spaces.
     The objects in a sequence MAY be separated by line breaks.

   Example:
     <SE flow descriptor> ::= <FLOWSPEC> <filter spec list>

   Note:
     See Section 2.3.3 for further comments on the ordering of objects
     and constructs.

2.2.3.  Optional Presence

   Objects and constructs can be marked as optionally present.

   Meaning:
     The optional objects or constructs MAY be present or absent within
     the assignment.  Unless indicated as optional, objects and
     constructs are mandatory and MUST be present.  The optional
     operator can also be nested to give a hierarchical dependency of
     presence as shown in the example below.

   Encoding:
     Contained in square brackets ("[" and "]").

   Example:
     <PathTear Message> ::= <Common Header> [ <INTEGRITY> ]
                            <SESSION> <RSVP_HOP>
                            [ <sender descriptor> ]

   Example of nesting:
     The optional operator can be nested.  For example,

       <construct> ::= <MAND> [ <OPT_1> [ <OPT_2> ] ]

     In this construction, the object OPT_2 can only be present if OPT_1
     is also present.

   Note:
     The set of objects and constructs within the same pair of square
     brackets is treated as a unit (an unnamed construct).  This means
     that when multiple objects and constructs are included within the
     same pair of square brackets, all MUST be included when one is
     included, unless nested square brackets are used as in the previous
     example.

2.2.4.  Alternatives

   Choices can be indicated within assignments.

   Meaning:
     Either one rule or the other MUST be present.

   Encoding:
     The pipe symbol ("|") is used between the objects or constructs
     that are alternatives.

   Example:
     <flow descriptor list> ::= <FF flow descriptor list>
                                | <SE flow descriptor>

   Notes:
     1. Use of explicit grouping (Section 2.2.6) is RECOMMENDED to avoid
        confusion.  Implicit grouping using line breaks (Section 2.3.2)
        is often used, but gives rise to potential misinterpretation and
        SHOULD be avoided in new definitions.

     2. Multiple members of alternate sets can give rise to confusion.
        For example:

        <flow descriptor list> ::=  <empty> |
                             <flow descriptor list> <flow descriptor>

        could be read to mean that an instance of <flow descriptor> must
        be present or that it is optional.

        To avoid this type of issue, explicit grouping (see Section
        2.2.6), or an intermediary MUST be used in all new documents
        (existing uses are not deprecated, and automatic parsers need to
        handle existing RFCs).  See also Section 2.4 for a description
        of precedence rules.

        Thus:

          <construct> ::= <ALT_A> <ALT_B> | <ALT_C> <ALT_D>
        is not allowed in new documents and MUST be presented using
        grouping or using an intermediary construct.  For example, and
        depending on intended meaning:

          <construct> ::= ( <ALT_A> <ALT_B> ) | ( <ALT_C> <ALT_D> )

          or

          <construct> ::= <ALT_A> ( <ALT_B> | <ALT_C> ) <ALT_D>

        or

          <intermediary X> ::= <ALT_A> <ALT_B>
          <intermediary Y> ::= <ALT_C> <ALT_D>
          <construct> ::= <intermediary X> | <intermediary Y>

          or

          <intermediary Z> ::= <ALT_B> | <ALT_C>
          <construct> ::= <ALT_A> <intermediary Z> <ALT_D>

2.2.5.  Repetition

   It could be the case that a sequence of identical objects or
   constructs is required within an assignment.

   Meaning:
     MAY repeat the preceding object, intermediate construct, or
     construct.

   Encoding:
     Three dots ("...").

   Example:
     <Path Message> ::= <Common Header> [ <INTEGRITY> ]
                        <SESSION> <RSVP_HOP>
                        <TIME_VALUES>
                        [ <POLICY_DATA> ... ]
                        [ <sender descriptor> ]

   Notes:
     1. A set of zero or more objects or constructs can be achieved by
        combining with the Optional concept as shown in the example
        above.

     2. Sequences can also be encoded by building a recursive construct
        using the Alternative operator.  For example:

          <sequence> ::= <OBJECT> |
                         ( <OBJECT> <sequence> )

     3. Repetition can also be applied to a component of an assignment
        to indicate the optional repetition of that component.  For
        example, the Notify message in [RFC3473] is defined as follows:

         <Notify message> ::=
                          <Common Header> [<INTEGRITY>]
                          [ [<MESSAGE_ID_ACK> | <MESSAGE_ID_NACK>] ... ]
                          [ <MESSAGE_ID> ]
                          <ERROR_SPEC> <notify session list>

        In this example, there is a sequence of zero or more instances
        of [<MESSAGE_ID_ACK> | <MESSAGE_ID_NACK>].  One could argue that
        the use of grouping (see Section 2.2.6) or a recursive construct
        (see Note 2, above) would be more clear.

2.2.6.  Grouping

   Meaning:
     A group of objects or constructs to be treated together.  This
     notation is not mandatory but is RECOMMENDED for clarity.  See
     Section 2.4 on Precedence.

   Encoding:
     Round brackets ("(" and ")") enclosing a set of objects,
     constructs, and operators.

   Example:
     <group> ::= ( <this> <that> )

   Notes:
     1. The precedence rule in Section 2.4 means that the use of
        grouping is not necessary for the formal interpretation of the
        BNF representation.  However, grouping can make the BNF easier
        to parse unambiguously.  Either grouping or an intermediate
        construct MUST be used for multi-alternates (Section 2.2.4).

     2. Line breaks (Section 2.3.2) are often used to clarify grouping
        as can be seen in the definition of <sequence> in Section 2.2.5,
        but these are open to misinterpretation, and explicit grouping
        is RECOMMENDED.

     3. A practical alternative to grouping is the definition of
        intermediate constructs as illustrated in Note 2 of Section
        2.2.4.

2.3.  Editorial Conventions

2.3.1.  White Space

   White space (that is space characters) between operators, objects,
   and constructs is ignored but SHOULD be used for readability.

2.3.2.  Line Breaks

   Line breaks within an assignment are ignored but SHOULD be used for
   readability.

   Line breaks are often used to imply grouping within the precedence
   rules set out in Section 2.4, but explicit grouping (Section 2.2.6)
   or intermediary constructs (Section 2.2.4) SHOULD be used in new
   definitions.

   A line break MUST NOT be present between the left-hand side of an
   assignment and the assignment operator (see Section 2.2.1).

   New assignments (i.e., new construct or message definitions) MUST
   begin on a new line.

2.3.3.  Ordering

   The ordering of objects and constructs in an assignment is explicit.

   Protocol specifications MAY opt to state that ordering is only
   RECOMMENDED.  In this case, elements of a list of objects and
   constructs MAY be received in any order.

2.4.  Precedence

   Precedence is the main opportunity for confusion in the use of this
   BNF.  In particular, the use of alternatives mixed with
   concatenations can give rise to different interpretations of the BNF.
   Although precedence can be deduced from a "proper" reading of the BNF
   using the rules defined above and the precedence ordering shown
   below, authors are strongly RECOMMENDED to use grouping (Section
   2.2.6) and ordering (Section 2.3.3) to avoid cases where the reader
   would otherwise be required to understand the precedence rules.

   Automated readers are REQUIRED to parse rules correctly with or
   without this use of grouping.

   The various mechanisms described in the previous sections have the
   following precedence, from highest (binding tightest) at the top, to
   lowest (and loosest) at the bottom:

      objects, constructs
      repetition
      grouping, optional
      concatenation
      alternative

   Note:
     Precedence is the main opportunity for confusion in the use of BNF.
     Authors are strongly RECOMMENDED to use grouping (Section 2.2.6) in
     all places where there is any scope for misinterpretation even when
     the meaning is obvious to the authors.

   Example:

     An example of the confusion in precedence can be found in Section
     3.1.4 of [RFC2205] and is mentioned in Section 2.2.4.

     <flow descriptor list> ::=  <empty> |
                      <flow descriptor list> <flow descriptor>

     The implementer MUST decide which of the following is intended:

     a.  <flow descriptor list> ::= <empty> |
                            ( <flow descriptor list> <flow descriptor> )

     b.  <flow descriptor list> ::= ( <empty> | <flow descriptor list> )
                                    <flow descriptor>

     The line break MAY be interpreted as implying grouping, but that is
     not an explicit rule.  However, the precedence rules say that
     concatenation has higher precedence than the Alternative operator.
     Thus, the text in [RFC2205] SHOULD be interpreted as shown in
     formulation a.

     Similarly (from the same section of [RFC2205]):

       <flow descriptor list> ::=
                        <FLOWSPEC>  <FILTER_SPEC>  |
                        <flow descriptor list> <FF flow descriptor>

     SHALL be interpreted as:

       <flow descriptor list> ::=
                      ( <FLOWSPEC> <FILTER_SPEC> ) |
                      ( <flow descriptor list> <FF flow descriptor> )

     The use of explicit grouping or intermediary constructs is strongly
     RECOMMENDED in new text to avoid confusion.

3.  Automated Validation

   RBNF would be appropriate for verification using automated validation
   tools.  Validation tools need to be able to check for close
   conformance to the rules expressed in this document to be useful for
   verifying new documents, but should also be able to parse RBNF as
   used in existing RFCs.  No tools are known at this time.

4.  Security Considerations

   This document does not define any network behavior and does not
   introduce or seek to solve any security issues.

   It may be noted that clear and unambiguous protocol specifications
   reduce the likelihood of incompatible or defective implementations
   that might be exploited in security attacks.

5.  Acknowledgments

   Thanks to Magnus Westerlund, Nic Neate, Chris Newman, Alfred Hoenes,
   Lou Berger, Julien Meuric, Stuart Venters, Tom Petch, Sam Hartman,
   and Pasi Eronen for review and useful comments.

6.  References

6.1.  Normative References

   [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
             Requirement Levels", BCP 14, RFC 2119, March 1997.

6.2.  Informative References

   [RFC2205] Braden, R., Ed., Zhang, L., Berson, S., Herzog, S., and S.
             Jamin, "Resource ReSerVation Protocol (RSVP) -- Version 1
             Functional Specification", RFC 2205, September 1997.

   [RFC3209] Awduche, D., Berger, L., Gan, D., Li, T., Srinivasan, V.,
             and G. Swallow, "RSVP-TE: Extensions to RSVP for LSP
             Tunnels", RFC 3209, December 2001.

   [RFC3473] Berger, L., Ed., "Generalized Multi-Protocol Label
             Switching (GMPLS) Signaling Resource ReserVation Protocol-
             Traffic Engineering (RSVP-TE) Extensions", RFC 3473,
             January 2003.

   [RFC4204] Lang, J., Ed., "Link Management Protocol (LMP)", RFC 4204,
             October 2005.

   [RFC5234] Crocker, D., Ed., and P. Overell, "Augmented BNF for Syntax
             Specifications: ABNF", STD 68, RFC 5234, January 2008.

   [RFC5440] Vasseur, JP., Ed., and JL. Le Roux, Ed., "Path Computation
             Element (PCE) Communication Protocol (PCEP)", RFC 5440,
             March 2009.

   [EBNF]    ISO/IEC 14977, "Information technology -- Syntactic
             metalanguage -- Extended BNF", 1996.

Author's Address

   Adrian Farrel
   Old Dog Consulting

   EMail: adrian@olddog.co.uk

ISO Plain Language

On this page
PROBLEMSeveral routing area protocols describe their message formats in a variant of Backus-Naur Form, but no formal definition of that variant exists, so the same text can be read in more than one way and implementers have to guess.
MECHANISMThe RFC gives the variant a name, Routing BNF, and defines it: the kinds of rule, the six operators, the editorial conventions and the order in which the operators bind. It also says where the notation may and may not be used, and how a specification should be written to avoid the ambiguity the RFC found in the existing documents.
WHY IT MATTERSThe result is that the many documents already written in this notation can be read unambiguously, and that new extensions to those protocols can be written in a way machines can check. The RFC notes that no automated validation tool existed when it was written.

§1Introduction

Backus-Naur Form has been used to specify the message formats of several protocols within the Routing Area of the IETF. Those specifications are not based on any specific formal definition of BNF, and they differ slightly from the definitions provided in other places.

It is clearly valuable to have a formal definition of the syntax-defining language that is used. It would be possible to convert all the existing specifications to use an established specification of BNF, for example Augmented BNF, but that would require a lot of work, and there is a further obstacle. In ABNF the terminals are integers, that is characters or bytes, while in the BNF form used to define message formats the terminals are objects, some kind of message element rather than an individual byte or character, or entire messages. Converting the existing specifications to an established BNF specification would therefore also require extensions to that specification.

The variant used by the specifications in question, which is similar to a subset of Extended BNF, is consistent and has only a small number of constructs. This document therefore provides a specification of that variant, names it Routing BNF, and makes it available for new protocols. A formal definition also allows the formal definitions used in future documents to be verified automatically.

Several routing protocols write their message formats in a notation that nobody had written down properly. This RFC writes it down, so that two people reading the same rule cannot reasonably read it two different ways.

ROUTING BNF AND AUGMENTED BNF
AspectRouting BNFAugmented BNF
What a terminal isAn object, a message element rather than an individual byte, or an entire messageAn integer, that is a character or a byte
Status before this RFCUsed by several routing area protocols with no formal definitionFormally defined in RFC 5234
Converting existing documentsNot neededWould require rewriting the documents and extending ABNF itself

§1.2Where the Notation Is Used

The first notable use of the variant is in the specification of the Resource Reservation Protocol, RSVP. RSVP was extended for use in Multiprotocol Label Switching networks to provide signalling for traffic engineering, and that extension was developed further for use as the signalling protocol in Generalized MPLS networks.

Each of those uses of RSVP gave rise to a large number of specifications of protocol extensions that provide additional features over and above the base documents, and each new feature is defined in its own document using the common variant of BNF. New protocols have also been specified in the same variant, partly because their developers were familiar with the BNF used by RSVP, and partly because of the overlap between the protocols, especially with respect to the network objects they control and operate. Notable among these additional protocols are the Link Management Protocol, for which further extension documents also use the same variant, and the Path Computation Element Protocol, again with extension documents in the same variant.

As for applicability, RBNF is primarily applicable to the protocols just listed. It may be used to help interpret the pre-existing RFCs that use it, and it should be used in the specification of extensions to those protocols. It could also be used for new protocols, which is most appropriate for protocols closely related to those that already use RBNF: PCEP is closely related to RSVP-TE, and when it was developed, the PCE working group chose the same form of BNF as the RSVP-TE specifications already used. If a wholly new protocol is being developed that is not related to a protocol that already uses RBNF, the working group should consider carefully whether to use RBNF or a more formally specified and broader form such as ABNF. Using RBNF to specify extensions to protocols that do not already use it is not recommended.

The notation came from RSVP, spread through its traffic engineering extensions into Generalized MPLS, and was then adopted by two later protocols. New documents should use it when they extend those protocols, and should think twice before using it for something unrelated.

§2.1Rules: Objects, Constructs and Messages

The basic building blocks of BNF are rules and operators. At its simplest, a rule in this context is a protocol object that would traditionally be defined by a bit diagram in the protocol specification. Further and more complex rules are constructed by combining other rules using operators, and the most complex rule is the message, which is constructed from an organisation of protocol objects as specified by the operators.

An RBNF specification consists of a sequence of rule definitions using the operators. One rule may be constructed from a set of other rules using operators, and the order of definition of rules does not matter: the subordinate rules may be defined first and then used in subsequent definitions, or the top-level rules may be defined first followed by the definitions of the subordinate rules. Rule definitions are read left to right on any line, and the lines are read top to bottom on the page, which becomes particularly important when considering sequences of rules and operators.

No semantics should be assumed from special characters used in rule names. It would be wrong, for example, to assume that a rule carries a decimal number because its name begins or ends with the letter d, though individual specifications may choose to assign rule names in any way that makes the human interpretation of the rule easier. All rule names are enclosed by angle brackets, may include any printable characters, and must not include tabs or line breaks.

Three kinds of rule are distinguished, and each has a customary naming style. An object is the most basic, indivisible rule, and its definition is derived from its context; objects are typically named in uppercase and do not usually use spaces within the name, favouring underbars. A construct is a rule constructed from other rules using operators; constructs are named in lowercase, although capitals are commonly used to indicate acronyms, and spaces and hyphens are used between words within names. A message is the final objective, a rule constructed from objects and constructs using operators; the only syntactic difference between a message and a construct is that no other rule is typically constructed from a message, and messages are typically named in title case.

A rule is either a single indivisible piece of a protocol, a piece built out of other pieces, or a whole message. The three are written with different styles of name, but the naming is a convention rather than a rule, and nothing may be assumed from the characters in a name.

THE THREE KINDS OF RULE
  • ObjectThe most basic indivisible rule, defined by its context. Named in uppercase, with underbars rather than spaces, for example SENDER_TEMPLATE.
  • ConstructA rule built from other rules with operators. Named in lowercase, with capitals for acronyms and spaces or hyphens between words.
  • MessageThe final objective, built from objects and constructs. Named in title case, and no other rule is typically built from a message.

§2.2The Six Operators

Operators are used to build constructs and messages from objects and constructs. Assignment is written as a colon, a colon and an equal sign, and it means that the named construct or message on the left-hand side is set equal to the right-hand side. The left-hand side and the assignment operator must be present on the same line.

Concatenation is a sequence of objects and constructs, usually separated by spaces, which must be present in the order specified. The objects in a sequence may be separated by line breaks.

Optional presence is written in square brackets. The optional objects or constructs may be present or absent within the assignment, and unless indicated as optional, objects and constructs are mandatory and must be present. The optional operator can also be nested to give a hierarchical dependency of presence: in a construction of the form <construct> ::= <MAND> [ <OPT_1> [ <OPT_2> ] ], the object OPT_2 can only be present if OPT_1 is also present. The set of objects and constructs within the same pair of square brackets is treated as a unit, so when multiple are included within the same pair they must all be included when one is, unless nested square brackets are used.

Alternatives are written with the pipe symbol between the objects or constructs that are alternatives, and either one rule or the other must be present. The use of explicit grouping is recommended to avoid confusion, since implicit grouping using line breaks is often used but gives rise to potential misinterpretation and should be avoided in new definitions. One particular form is not allowed in new documents: a construct with two alternatives, each of which has two members, because it could be read either as requiring a member or as making one optional. It must be presented using grouping or an intermediary construct instead.

Repetition is written as three dots and means that the preceding object, intermediate construct or construct may repeat. A set of zero or more objects or constructs is achieved by combining it with the optional concept, and a sequence can also be encoded by building a recursive construct using the alternative operator. Repetition can also be applied to a component of an assignment to indicate optional repetition of that component, as in a definition that allows zero or more instances of an alternative group.

Grouping is written with round brackets enclosing a set of objects, constructs and operators, and says that they are to be treated together. The notation is not mandatory but is recommended for clarity, because the precedence rules mean that grouping is not needed for the formal interpretation of the representation, while it does make the notation easier to parse unambiguously. Either grouping or an intermediate construct must be used for multi-alternates.

Six symbols do all the work: equals signs define a rule, spaces put things in order, brackets mark what is optional, the vertical bar offers a choice, three dots mean repeated, and round brackets say that what is inside is to be read as a unit.

THE SIX OPERATORS AND HOW THEY ARE WRITTEN
  • ::=Assignment — The named construct or message on the left is set equal to the right-hand side. The left-hand side and the operator must be on the same line.
  • spaceConcatenation — A sequence of objects and constructs, which must be present in the order specified.
  • [ ]Optional presence — The contents may be present or absent. Anything not marked optional is mandatory, and the brackets can be nested.
  • |Alternatives — Either one rule or the other must be present.
  • ...Repetition — The preceding object, intermediate construct or construct may repeat.
  • ( )Grouping — The enclosed objects, constructs and operators are treated together. Recommended for clarity.
EXAMPLES FROM THE RFC (RFC 5511 SECTIONS 2.2.3 AND 2.2.5)
Optional presence and repetition
<PathTear Message> ::= <Common Header> [ <INTEGRITY> ]
                       <SESSION> <RSVP_HOP>
                       [ <sender descriptor> ]

<construct> ::= <MAND> [ <OPT_1> [ <OPT_2> ] ]

<Notify message> ::=
                 <Common Header> [<INTEGRITY>]
                 [ [<MESSAGE_ID_ACK> | <MESSAGE_ID_NACK>] ... ]
                 [ <MESSAGE_ID> ]
                 <ERROR_SPEC> <notify session list>

§2.3Editorial Conventions

White space between operators, objects and constructs is ignored, but should be used for readability. Line breaks within an assignment are ignored as well, and should be used for readability.

Line breaks are often used to imply grouping within the precedence rules, but explicit grouping or intermediary constructs should be used in new definitions, because the line break habit is open to misinterpretation. A line break must not be present between the left-hand side of an assignment and the assignment operator, and new assignments must begin on a new line.

The ordering of objects and constructs in an assignment is explicit. Protocol specifications may opt to state that ordering is only recommended, in which case the elements of a list of objects and constructs may be received in any order.

Spaces and line breaks do not change the meaning, but the RFC asks writers to use round brackets when they want a reader to see a group, because a line break on its own can be misread.

§2.4Precedence

Precedence is the main opportunity for confusion in the use of this notation, because the use of alternatives mixed with concatenations can give rise to different interpretations of the same text. Although precedence can be deduced from a proper reading of the notation using the rules already given, authors are strongly recommended to use grouping and ordering to avoid cases where the reader would otherwise be required to understand the precedence rules. Automated readers are required to parse rules correctly with or without this use of grouping.

The mechanisms have a fixed precedence, from highest, meaning binding tightest, to lowest: objects and constructs; repetition; grouping and optional; concatenation; and alternative.

An example of the confusion can be found in the RSVP specification. A definition written as <flow descriptor list> ::= <empty> | <flow descriptor list> <flow descriptor> can be read in two ways, and the implementer must decide which is intended: either the list is empty or it is a list followed by one descriptor, or the list is empty or not and is always followed by a descriptor. The line break may be interpreted as implying grouping, but that is not an explicit rule. The precedence rules say that concatenation has higher precedence than the alternative operator, so the text should be read in the first sense. The same applies to a second definition from the same section, where the flow specification and the filter specification belong together in the first alternative, and to any similar case in a new document, where the use of explicit grouping or intermediary constructs is strongly recommended.

When a rule mixes choices with sequences, the reader has to know which binds tighter. Here the answer is fixed: a single piece binds tightest, then repetition, then brackets and round brackets, then sequence, and the choice between alternatives binds loosest.

§3Automated Validation

RBNF would be appropriate for verification using automated validation tools. Such tools need to be able to check for close conformance to the rules expressed in this document to be useful for verifying new documents, but should also be able to parse RBNF as it is used in existing RFCs. The RFC notes that no tools are known at the time of writing.

Because the notation is now written down, a program could check that a specification follows it. The RFC says no such program existed when it was written.

§4Security Considerations

This document does not define any network behaviour, and it neither introduces nor seeks to solve any security issue. It notes that clear and unambiguous protocol specifications reduce the likelihood of incompatible or defective implementations that might be exploited in security attacks.

Nothing here changes what goes on the network. The RFC argues only that a specification people read the same way is less likely to produce an implementation with a flaw in it.

§9References