One document matched: draft-ietf-6lo-6lobac-01.xml


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  <!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
  <!ENTITY RFC2460 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2460.xml">
  <!ENTITY RFC2469 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2469.xml">
  <!ENTITY RFC4291 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4291.xml">
  <!ENTITY RFC4861 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4861.xml">
  <!ENTITY RFC4862 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4862.xml">
  <!ENTITY RFC4944 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4944.xml">
  <!ENTITY RFC6282 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6282.xml">
  <!ENTITY RFC6775 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6775.xml">
  <!ENTITY RFC7136 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7136.xml">
  <!ENTITY I-D.ietf-6man-default-iids SYSTEM
    "http://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-6man-default-iids.xml">
]>
<!-- Use with the following tips & tools:
      http://xml.resource.org/authoring/draft-mrose-writing-rfcs.html
      http://xml.resource.org/
      http://fenron.net/~fenner/ietf/xml2rfc-valid/
      http://tools.ietf.org/tools/idnits/
      http://tools.ietf.org/rfcdiff
      https://datatracker.ietf.org/submit/
  -->
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.35) -->
<!-- give errors regarding ID-nits and DTD validation -->
<?rfc strict="yes"?>
<!-- control the table of contents (ToC) -->
<!-- generate a ToC -->
<?rfc toc="yes"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<?rfc tocdepth="1"?>
<!-- control references -->
<!-- use anchors instead of numbers for refs, i.e, [RFC2119] instead of [1] -->
<?rfc symrefs="yes"?>
<!-- sort the reference entries alphabetically -->
<?rfc sortrefs="yes" ?>
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<!-- do not start each main section on a new page -->
<?rfc compact="yes" ?>
<!-- "no" to keep one blank line between list items (rfced) -->
<?rfc subcompact="no" ?>
<?rfc autobreaks="no" ?>
<!-- encourage use of "xml2rfc" tool -->
<?rfc rfcprocack="yes" ?>
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" ipr="trust200902" docName="draft-ietf-6lo-6lobac-01">
  <front>
    <title abbrev=" IPv6 over MS/TP "> Transmission of IPv6 over MS/TP Networks </title>

    <author fullname="Kerry Lynn" initials="K.E." surname="Lynn" role="editor">
      <organization> Verizon </organization>
      <address>
        <postal>
          <street> 50 Sylvan Rd </street>
          <city> Waltham </city>
          <region> MA </region>
          <code> 02451 </code>
          <country> USA </country>
        </postal>
        <phone> +1 781 296 9722 </phone>
        <email> kerlyn@ieee.org </email>
      </address>
    </author>

    <author fullname="Jerry Martocci" initials="J.P." surname="Martocci">
      <organization abbrev="Johnson Controls"> Johnson Controls, Inc. </organization>
      <address>
        <postal>
          <street> 507 E. Michigan St </street>
          <city> Milwaukee </city>
          <region> WI </region>
          <code> 53202 </code>
          <country> USA </country>
        </postal>
        <phone> +1 414 524 4010 </phone>
        <email> jerald.p.martocci@jci.com </email>
      </address>
    </author>

    <author fullname="Carl Neilson" initials="C." surname="Neilson">
      <organization abbrev="Delta Controls"> Delta Controls, Inc. </organization>
      <address>
        <postal>
          <street> 17850 56th Ave </street>
          <city> Surrey </city>
          <region> BC </region>
          <code> V3S 1C7 </code>
          <country> Canada </country>
        </postal>
        <phone> +1 604 575 5913 </phone>
        <email> cneilson@deltacontrols.com </email>
      </address>
    </author>

    <author fullname="Stuart Donaldson" initials="S." surname="Donaldson">
      <organization abbrev="Honeywell"> Honeywell Automation & Control Solutions </organization>
      <address>
        <postal>
          <street> 6670 185th Ave NE </street>
          <city> Redmond </city>
          <region> WA </region>
          <code> 98052 </code>
          <country> USA </country>
        </postal>
        <email> stuart.donaldson@honeywell.com </email>
      </address>
    </author>

    <date day="9" month="March" year="2015"/>
    <area> Internet </area>
    <workgroup> 6Lo Working Group </workgroup>
    <abstract>
      <t>
      Master-Slave/Token-Passing (MS/TP) is a contention-free access method
      for the RS-485 physical layer, which is used extensively in building
      automation networks.  This specification defines the frame format for
      transmission of IPv6 packets and the method of forming link-local
      and statelessly autoconfigured IPv6 addresses on MS/TP networks.
      </t>
    </abstract>
  </front>
  <middle>
    <!-- section anchor="sec-1" title="Introduction" -->
    <section title="Introduction">
      <t>
      Master-Slave/Token-Passing (MS/TP) is a contention-free access method
      for the RS-485 <xref target="TIA-485-A"/> physical layer, which is used extensively
      in building automation networks.  This specification defines the
      frame format for transmission of IPv6 <xref target="RFC2460"/> packets and the
      method of forming link-local and statelessly autoconfigured IPv6
      addresses on MS/TP networks.  The general approach is to adapt
      elements of the 6LoWPAN <xref target="RFC4944"/> specification to constrained wired
      networks.
      </t><t>
      An MS/TP device is typically based on a low-cost microcontroller with
      limited processing power and memory.  Together with low data rates
      and a small address space, these constraints are similar to those
      faced in 6LoWPAN networks and suggest some elements of that solution
      might be leveraged.  MS/TP differs significantly from 6LoWPAN in at
      least three respects: a) MS/TP devices typically have a continuous
      source of power, b) all MS/TP devices on a segment can communicate
      directly so there are no hidden node or mesh routing issues, and c)
      recent changes to MS/TP provide support for large payloads,
      eliminating the need for link-layer fragmentation and reassembly.
      </t><t>
      The following sections provide a brief overview of MS/TP, then
      describe how to form IPv6 addresses and encapsulate IPv6 packets in
      MS/TP frames.  This document also specifies a header compression
      mechanism, based on <xref target="RFC6282"/>, that is RECOMMENDED in
      order to make IPv6 practical on low speed MS/TP networks.
      </t>
      <!-- section anchor="sec-1.1" title="Requirements Language" -->
      <section title="Requirements Language">
        <t>
        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  <xref target="RFC2119"/>.
        </t>
      </section>
      <!-- section anchor="sec-1.2" title="Abbreviations Used" -->
      <section title="Abbreviations Used">
        <figure>
          <artwork>
ASHRAE:  American Society of Heating, Refrigerating, and Air-
         Conditioning Engineers (http://www.ashrae.org)

BACnet:  An ISO/ANSI/ASHRAE Standard Data Communication Protocol
         for Building Automation and Control Networks

CRC:     Cyclic Redundancy Check

MAC:     Medium Access Control

MSDU:    MAC Service Data Unit (MAC client data)

MTU:     Maximum Transmission Unit

UART:    Universal Asynchronous Transmitter/Receiver
          </artwork>
        </figure>
      </section>
      <section anchor="sec-1.3" title="MS/TP Overview" >
      <!-- section title="MS/TP Overview" -->
        <t>
        This section provides a brief overview of MS/TP, which is specified
        in ANSI/ASHRAE 135-2012 (BACnet) Clause 9 <xref target="Clause9"/> and included
        herein by reference.  BACnet <xref target="Clause9"/> also covers physical layer
        deployment options.
        </t><t>
        MS/TP is designed to enable multidrop networks over shielded twisted
        pair wiring.  It can support a data rate of 115,200 baud on segments
        up to 1000 meters in length, or segments up to 1200 meters in length
        at lower baud rates.  An MS/TP link requires only a UART, an RS-485
        <xref target="TIA-485-A"/> transceiver with a driver that can be disabled, and a 5ms
        resolution timer.  These features make MS/TP a cost-effective field
        bus for the most numerous and least expensive devices in a building
        automation network.
        </t><t>
        The differential signaling used by <xref target="TIA-485-A"/> requires a contention-
        free MAC.  MS/TP uses a token to control access to a multidrop bus.
        A master node may initiate the transmission of a data frame when it
        holds the token.  After sending at most a configured maximum number
        of data frames, a master node passes the token to the next master
        node (as determined by node address).  Slave nodes transmit only when
        polled and SHALL NOT be considered part of this specification.
        </t><t>
        MS/TP COBS-encoded* frames have the following format:
        </t>
        <figure title="Figure 1: MS/TP COBS-Encoded Frame Format" align="center">
          <artwork>
0                   1                   2                   3
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      0x55     |      0xFF     |  Frame Type*  |      DA       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      SA       |    Length (MS octet first)    |   Header CRC  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                                                               .
.                Encoded Data* (2 - 1507 octets)                .
.                                                               .
+                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |  Encoded CRC-32K* (5 octets)  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +-+-+-+-+-+-+-+-+
|                                               | optional 0xFF |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          </artwork>
        </figure>
        <figure>
          <artwork>
*Note: BACnet Addendum 135-2012an [Addendum_an] defines a range of
 Frame Type values to designate frames that contain data and data CRC
 fields encoded using Consistent Overhead Byte Stuffing [COBS] (see
 Appendix B).  The purpose of COBS encoding is to eliminate preamble
 sequences from the Encoded Data and Encoded CRC-32K fields.  The
 maximum length of an MSDU as defined by this specification is 1501
 octets (before encoding).  The Encoded Data is covered by a 32-bit
 CRC [CRC32K] (see Appendix C), which is then itself COBS encoded.
 
          </artwork>
        </figure>
        <t>
        MS/TP COBS-encoded frame fields have the following descriptions:
        </t>
        <figure>
          <artwork>
  Preamble              two octet preamble: 0x55, 0xFF
  Frame Type            one octet
  Destination Address   one octet address
  Source Address        one octet address
  Length                two octets, most significant octet first
  Header CRC            one octet
  Encoded Data          2 - 1512 octets (see Appendix B)
  Encoded CRC-32K       five octets (see Appendix C)
  (pad)                 (optional) at most one octet of trailer: 0xFF

          </artwork>
        </figure>
        <figure>
          <artwork>
The Frame Type is used to distinguish between different types of MAC
frames.  The types relevant to this specification (in decimal) are:

   0  Token
   1  Poll For Master
   2  Reply To Poll For Master
      ...
  34  IPv6 over MS/TP (LoBAC) Encapsulation
  
          </artwork>
        </figure>
        <t>
        Frame Types 8 through 127 are reserved for assignment by ASHRAE.
        Frame Types 32 through 127 designate COBS-encoded frames and MUST
        convey Encoded Data and Encoded CRC-32K fields.  All master nodes
        MUST understand Token, Poll For Master, and Reply to Poll For Master
        control frames.  See <xref target="sec-2"/> for additional details.
        </t><t>
        The Destination and Source Addresses are each one octet in length.
        See <xref target="sec-3"/> for additional details.
        </t><t>
        For COBS-encoded frames, the Length field specifies the combined
        length of the <xref target="COBS"/> Encoded Data and Encoded CRC-32K fields in
        octets, minus two.  (This adjustment is required for backward
        compatibility with legacy MS/TP devices.)  See <xref target="sec-4"/> and
        Appendices for additional details.
        </t><t>
        The Header CRC field covers the Frame Type, Destination Address,
        Source Address, and Length fields.  The Header CRC generation and
        check procedures are specified in BACnet <xref target="Clause9"/>.
        </t>
      </section>
      <!-- section anchor="sec-1.4" title="Goals and Non-goals" -->
      <section title="Goals and Non-goals">
        <t>
        The primary goal of this specification is to enable IPv6 directly on
        wired end devices in building automation and control networks by
        leveraging existing standards to the greatest extent possible.  A
        secondary goal is to co-exist with legacy MS/TP implementations.
        Only the minimum changes necessary to support IPv6 over MS/TP are
        specified in BACnet <xref target="Addendum_an"/> (see Note in <xref target="sec-1.3"/>).
        </t><t>
        Non-goals include making changes to the MS/TP frame header format,
        control frames, Master Node state machine, or addressing modes.
        Also, while the techniques described here may be applicable to other
        data links, no attempt is made to define a general design pattern.
        </t>
      </section>
    </section>
    <section anchor="sec-2" title="MS/TP Mode for IPv6">
      <!-- section title="MS/TP Mode for IP" -->
      <t>
      ASHRAE must assign a new MS/TP Frame Type to indicate IPv6 over MS/TP
      Encapsulation from the range reserved for designating COBS-encoded
      frames.  The Frame Type requested for IPv6 over MS/TP Encapsulation
      is 34 (0x22).
      </t><t>
      All MS/TP master nodes (including those that support IPv6) must
      understand Token, Poll For Master, and Reply to Poll For Master
      control frames and support the Master Node state machine as specified
      in BACnet <xref target="Clause9"/>.  MS/TP master nodes that support IPv6 must also
      support the Receive Frame state machine as specified in <xref target="Clause9"/> and
      extended by BACnet <xref target="Addendum_an"/>.
      </t>
    </section>
    <section anchor="sec-3" title="Addressing Modes">
      <!-- section title="Addressing Modes" -->
      <t>
      MS/TP link-layer (node) addresses are one octet in length.  The
      method of assigning a node address is outside the scope of this
      document.  However, each MS/TP node on the link MUST have a unique
      address or a mis-configuration condition exists.
      </t><t>
      BACnet <xref target="Clause9"/> specifies that addresses 0 through 127 are valid for master
      nodes.  The method specified in <xref target="sec-6"/> for creating the Interface
      Identifier (IID) ensures that an IID of all zeros can never result.
      </t><t>
      A Destination Address of 255 (0xFF) denotes a link-level broadcast
      (all nodes).  A Source Address of 255 MUST NOT be used.  MS/TP
      does not support multicast, therefore all IPv6 multicast packets
      MUST be sent as link-level broadcasts and filtered at the IPv6 layer.
      </t><t>
      This specification assumes that a unique IPv6 subnet prefix is
      assigned to each MS/TP segment.  Hosts learn IPv6 prefixes via router
      advertisements according to <xref target="RFC4861"/>.
      </t>
    </section>
    <section anchor="sec-4" title="Maximum Transmission Unit (MTU)">
      <!--section title="Maximum Transmission Unit (MTU)"-->
      <t>
      BACnet <xref target="Addendum_an"/> supports MSDUs up to 2032 octets in length.
      This specification defines an MSDU length of at least 1281 octets and
      at most 1501 octets.  This is sufficient to convey the minimum MTU
      required by IPv6 <xref target="RFC2460"/> without the need for link-layer
      fragmentation and reassembly.
      </t><t>
      The relatively low data rates of MS/TP, however, still make a
      compelling case for header compression.  An adaptation layer to
      indicate compressed or uncompressed IPv6 headers is specified in
      <xref target="sec-5"/> and the compression scheme is specified in <xref target="sec-10"/>.
      </t>
    </section>
    <section anchor="sec-5" title="LoBAC Adaptation Layer">
      <!-- section title="LoBAC Adaptation Layer" -->
      <t>
      The encapsulation formats defined in this section (subsequently
      referred to as the "LoBAC" encapsulation) comprise the MSDU (payload)
      of an MS/TP frame.  The LoBAC payload (i.e., an IPv6 packet) follows
      an encapsulation header stack.  LoBAC is a subset of the LoWPAN
      encapsulation defined in <xref target="RFC4944"/>, therefore the use of "LOWPAN"
      in literals below is intentional.  The primary differences between
      LoBAC and LoWPAN are: a) omission of the Fragmentation, Mesh, and
      Broadcast headers, and b) use of LOWPAN_IPHC <xref target="RFC6282"/> in place of
      LOWPAN_HC1 header compression (which is deprecated by <xref target="RFC6282"/>).
      </t><t>
      All LoBAC encapsulated datagrams transmitted over MS/TP are prefixed
      by an encapsulation header stack.  Each header in the stack consists
      of a header type followed by zero or more header fields.  Whereas in
      an IPv6 header the stack would contain, in the following order,
      addressing, hop-by-hop options, routing, fragmentation, destination
      options, and finally payload <xref target="RFC2460"/>; in a LoBAC encapsulation the
      analogous sequence is (optional) header compression and payload.  The
      header stacks that are valid in a LoBAC network are shown below.
      </t>
      <figure align="left">
        <artwork>
   A LoBAC encapsulated IPv6 datagram:

     +---------------+-------------+---------+
     | IPv6 Dispatch | IPv6 Header | Payload |
     +---------------+-------------+---------+

   A LoBAC encapsulated LOWPAN_IPHC compressed IPv6 datagram:

     +---------------+-------------+---------+
     | IPHC Dispatch | IPHC Header | Payload |
     +---------------+-------------+---------+
        </artwork>
      </figure>
      <t>
      All protocol datagrams (i.e., IPv6 or compressed IPv6 headers)
      SHALL be preceded by one of the valid LoBAC encapsulation headers.
      This permits uniform software treatment of datagrams without regard
      to their mode of transmission.
      </t><t>
      The definition of LoBAC headers consists of the dispatch value, the
      definition of the header fields that follow, and their ordering
      constraints relative to all other headers.  Although the header stack
      structure provides a mechanism to address future demands on the LoBAC
      (LoWPAN) adaptation layer, it is not intended to provided general
      purpose extensibility.  This format document specifies a small set of
      header types using the header stack for clarity, compactness, and
      orthogonality.
      </t>

      <!-- section anchor="sec-5.1" title="Dispatch Value and Header" -->
      <section title="Dispatch Value and Header">
        <t>
        The LoBAC Dispatch value begins with a "0" bit followed by a "1" bit.
        The Dispatch value and header are shown here:
        </t>
        <figure>
          <artwork>
    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0|1| Dispatch  |  Type-specific header
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Dispatch               6-bit selector.  Identifies the type of header
                          immediately following the Dispatch value.

   Type-specific header   A header determined by the Dispatch value.

                    Figure 2: Dispatch Value and Header


   The Dispatch value may be treated as an unstructured namespace.  Only
   a few symbols are required to represent current LoBAC functionality.
   Although some additional savings could be achieved by encoding
   additional functionality into the dispatch value, these measures
   would tend to constrain the ability to address future alternatives.

      Pattern      Header Type
    +------------+-----------------------------------------------------+
    | 00  xxxxxx | NALP        - Not a LoWPAN (LoBAC) frame            |
    | 01  000000 | ESC         - Additional Dispatch octet follows     |
    | 01  000001 | IPv6        - Uncompressed IPv6 Addresses           |
    |   ...      | reserved    - Defined or reserved by [RFC4944]      |
    | 01  1xxxxx | LOWPAN_IPHC - LOWPAN_IPHC compressed IPv6 [RFC6282] |
    | 1x  xxxxxx | reserved    - Defined or reserved by [RFC4944]      |
    +------------+-----------------------------------------------------+

                   Figure 3: Dispatch Value Bit Patterns


   NALP:  Specifies that the following bits are not a part of the LoBAC
      encapsulation, and any LoBAC node that encounters a Dispatch
      value of 00xxxxxx shall discard the packet.  Non-LoBAC protocols
      that wish to coexist with LoBAC nodes should include an octet
      matching this pattern immediately following the MS/TP header.

   ESC:  Specifies that the following header is a single 8-bit field for
      the Dispatch value.  It allows support for Dispatch values larger
      than 127 (see Section 5 of [RFC6282]).

   IPv6:  Specifies that the following header is an uncompressed IPv6
      header [RFC2460].

   LOWPAN_IPHC:  A value of 011xxxxx specifies a LOWPAN_IPHC compression
      header (see Section 10.)

   Reserved: A LoBAC node that encounters a Dispatch value in the range
      01000010 through 01011111 or 1xxxxxxx SHALL discard the packet.
          </artwork>
        </figure>
      </section>
    </section>

    <section anchor="sec-6" title="Stateless Address Autoconfiguration">
    <!-- section title="Stateless Address Autoconfiguration" -->
      <t>
      This section defines how to obtain an IPv6 Interface Identifier.  The
      general procedure is described in Appendix A of <xref target="RFC4291"/>, "Creating
      Modified EUI-64 Format Interface Identifiers", as updated by <xref target="RFC7136"/>.
      </t><t>
      The Interface Identifier MAY be based on an <xref target="EUI-64"/> identifier
      assigned to the device but this is not typical for MS/TP.  In this
      case, the EUI-64 to IID transformation defined in the IPv6 addressing
      architecture <xref target="RFC4291"/> MUST be used.  This will
      result in a globally unique Interface Identifier.
      </t><t>
      If the device does not have an EUI-64, then the Interface Identifier
      SHOULD be formed by concatenating its 8-bit MS/TP node address to the
      seven octets 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00.  For example,
      an MS/TP node address of hexadecimal value 0x4F results in the
      following Interface Identifier:
      </t>
      <figure align="center">
        <artwork>
|0              1|1              3|3              4|4              6|
|0              5|6              1|2              7|8              3|
+----------------+----------------+----------------+----------------+
|0000000000000000|0000000011111111|1111111000000000|0000000001001111|
+----------------+----------------+----------------+----------------+
        </artwork>
      </figure>
      <t>
      This is the RECOMMENDED method of forming an IID, as it supports the
      most efficient header compression provided by the LOWPAN_IPHC
      <xref target="RFC6282"/> scheme specified in <xref target="sec-10"/>.
      </t><t>
      Optionally, an opaque 64-bit IID (for non-link-local addresses) MAY
      be formed by the technique discussed in <xref target="I-D.ietf-6man-default-iids"/>
      or alternate method.  A node that generates a non-link-local address
      IID MUST register it with its local router(s) by sending a Neighbor
      Solicitation (NS) message with the Address Registration Option (ARO)
      and process Neighbor Advertisements (NA) according to <xref target="RFC6775"/>.
      </t><t>
      An IPv6 address prefix used for stateless autoconfiguration <xref target="RFC4862"/> of an MS/TP
      interface MUST have a length of 64 bits.
      </t><t>
        <vspace blankLines='100' />  <!-- page break -->
      </t>
    </section>
    <!-- section anchor="sec-7" title="IPv6 Link Local Address" -->
    <section title="IPv6 Link Local Address">
      <t>
      The IPv6 link-local address <xref target="RFC4291"/> for an MS/TP interface is
      formed by appending the Interface Identifier, as defined above, to
      the prefix FE80::/64.
      </t>
      <figure align="center">
        <artwork>
  10 bits           54 bits                   64 bits
+----------+-----------------------+----------------------------+
|1111111010|        (zeros)        |    Interface Identifier    |
+----------+-----------------------+----------------------------+
        </artwork>
      </figure>
    </section>

    <!-- section anchor="sec-8" title="Unicast Address Mapping" -->
    <section title="Unicast Address Mapping">
      <t>
      The address resolution procedure for mapping IPv6 non-multicast
      addresses into MS/TP link-layer addresses follows the general
      description in Section 7.2 of <xref target="RFC4861"/>, unless otherwise specified.
      </t><t>
      The Source/Target Link-layer Address option has the following form
      when the addresses are 8-bit MS/TP link-layer (node) addresses.
      </t>
      <figure align="center">
        <artwork>
 0                   1
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |    Length=1   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               |
+      Padding (all zeros)      +
|                               |
+               +-+-+-+-+-+-+-+-+
|               | MS/TP Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        </artwork>
      </figure>
      <figure>
        <artwork>
Option fields:

Type:

  1: for Source Link-layer address.

  2: for Target Link-layer address.

Length:  This is the length of this option (including the type and
  length fields) in units of 8 octets.  The value of this field is 1
  for 8-bit MS/TP node addresses.

MS/TP Address:  The 8-bit address in canonical bit order [RFC2469].
  This is the unicast address the interface currently responds to.
        </artwork>
      </figure>
    </section>

    <!-- section anchor="sec-9" title="Multicast Address Mapping" -->
    <section title="Multicast Address Mapping">
      <t>
      All IPv6 multicast packets MUST be sent to MS/TP Destination Address
      255 (broadcast) and filtered at the IPv6 layer.  When represented as
      a 16-bit address in a compressed header (see <xref target="sec-10"/>), it MUST be
      formed by padding on the left with a zero:
      </t>
      <figure align="center">
        <artwork>
 0                   1
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     0x00      |     0xFF      |
+-+-+-+-+-+-+-+-+---------------+
        </artwork>
      </figure>
    </section>

    <section anchor="sec-10" title="Header Compression">
      <!-- section title="Header Compression" -->
      <t>
      LoBAC uses LOWPAN_IPHC IPv6 compression, which is specified in
      <xref target="RFC6282"/> and included herein by
      reference.  This section will simply identify substitutions that
      should be made when interpreting the text of <xref target="RFC6282"/>.
      </t><t>
      In general the following substitutions should be made:
      </t><t>
        <list style="hanging">
          <t hangText=" -">Replace instances of "6LoWPAN" with "MS/TP network"</t>
          <t hangText=" -">Replace instances of "IEEE 802.15.4 address" with "MS/TP address"</t>
        </list>
      </t><t>
      When a 16-bit address is called for (i.e., an IEEE 802.15.4 "short
      address") it MUST be formed by padding the MS/TP address to the
      left with a zero:
      </t>
      <figure align="center">
        <artwork>
 0                   1
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     0x00      | MS/TP address |
+-+-+-+-+-+-+-+-+---------------+
        </artwork>
      </figure>
      <t>
      If LOWPAN_IPHC compression <xref target="RFC6282"/> is used with context, the border
      router(s) directly attached to the MS/TP segment MUST disseminate the
      6LoWPAN Context Option (6CO) as specified in <xref target="RFC6775"/>.
      </t>
    </section>

    <!-- section anchor="IANA" title="IANA Considerations" -->
    <section title="IANA Considerations">
      <t>
      This document uses values previously reserved by <xref target="RFC4944"/> and 
      <xref target="RFC6282"/> and makes no further requests of IANA.
      </t><t>
      Note to RFC Editor: this section may be removed upon publication.
      </t>
    </section>

    <!-- section anchor="Security" title="Security Considerations" -->
    <section title="Security Considerations">
      <t>
      The method of deriving Interface Identifiers from MAC addresses is
      intended to preserve global uniqueness when possible.  However, there
      is no protection from duplication through accident or forgery.
      </t>
    </section>

    <!-- section anchor="Acknowledgments" title="Acknowledgments" -->
    <section title="Acknowledgments">
      <t>
      We are grateful to the authors of <xref target="RFC4944"/> and members of the IETF
      6LoWPAN working group; this document borrows liberally from their
      work.
      </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      &RFC2119;
      &RFC2460;
      &RFC4291;
      &RFC4861;
      &RFC4862;
      &RFC4944;
      &RFC6282;
      &RFC6775;
      &RFC7136;

      <reference anchor="Clause9">
        <front>
          <title>
            BACnet - A Data Communication Protocol for Building Automation and Control Networks
          </title>
          <author>
            <organization>American Society of Heating, Refrigerating, and Air-Conditioning Engineers</organization>
          </author>
          <date month="March" year="2013"/>
        </front>
        <seriesInfo name="ANSI/ASHRAE" value="135-2012 (Clause 9)"/>
      </reference>

      <reference anchor="Addendum_an" target="https://www.ashrae.org/File%20Library/docLib/StdsAddenda/135_2012_an_at_au_av_aw_ax_az_Final.pdf">
        <front>
          <title>
            ANSI/ASHRAE Addenda an, at, au, av, aw, ax, and az to ANSI/ASHRAE Standard 135-2012, BACnet - A Data Communication Protocol for Building Automation and Control Networks
          </title>
          <author>
            <organization>ASHRAE</organization>
          </author>
          <date month="July" year="2014"/>
        </front>
      </reference>
    </references>
    <?rfc compact="no" ?>

    <references title="Informative References">
      <reference anchor="COBS" target="http://www.stuartcheshire.org/papers/COBSforToN.pdf">
        <front>
          <title>Consistent Overhead Byte Stuffing</title>
          <author initials="S." surname="Cheshire" fullname="Stuart Cheshire"/>
          <author initials="M." surname="Baker" fullname="Mary Baker"/>
          <date year="1999" month="April"/>
        </front>
        <seriesInfo name="IEEE/ACM TRANSACTIONS ON NETWORKING, VOL.7, NO.2" value=""/>
      </reference>

      <reference anchor="CRC32K" target="http://www.ece.cmu.edu/~koopman/networks/dsn02/dsn02_koopman.pdf">
        <front>
          <title>32-Bit Cyclic Redundancy Codes for Internet Applications</title>
          <author initials="P." surname="Koopman" fullname="Philip Koopman"/>
          <date year="2002" month="June"/>
        </front>
        <seriesInfo name="IEEE/IFIP International Conference on Dependable Systems and Networks (DSN 2002)" value=""/>
      </reference>

      <reference anchor="EUI-64" target="http://standards.ieee.org/regauth/oui/tutorials/EUI64.html">
        <front>
          <title>
            Guidelines for 64-bit Global Identifier (EUI-64) Registration Authority
          </title>
          <author>
            <organization>IEEE</organization>
          </author>
          <date month="March" year="1997"/>
        </front>
      </reference>
      
			&I-D.ietf-6man-default-iids;

      <!-- Patterned after http://xml.resource.org/public/rfc/bibxml2/_reference.IEEE.802-3.1998.xml -->
      <reference anchor="IEEE.802.3" target="http://standards.ieee.org/getieee802/802.3.html">
        <front>
          <title>
            Information technology - Telecommunications and information exchange between systems -
            Local and metropolitan area networks - Specific requirements -
            Part 3: Carrier Sense Multiple Access with Collision Detection (CMSA/CD) Access Method and Physical Layer Specifications
          </title>
          <author/>
          <date year="2008" month="December"/>
        </front>
        <seriesInfo name="IEEE" value="Std 802.3-2008"/>
      </reference>

      &RFC2469;
      
      <reference anchor="TIA-485-A">
        <front>
          <title>
            TIA-485-A, Electrical Characteristics of Generators and Receivers for Use in Balanced Digital Multipoint Systems (ANSI/TIA/EIA-485-A-98) (R2003)
          </title>
          <author>
            <organization>Telecommunications Industry Association</organization>
          </author>
          <date month="March" year="2003"/>
        </front>
      </reference>
    </references>

    <section anchor="app-a" title="Abstract MAC Interface">
      <t>
      This Appendix is informative and not part of the standard.
      </t><t>
      BACnet <xref target="Clause9"/> defines support for MAC-layer clients through its
      SendFrame and ReceivedDataNoReply procedures.  However, it does not
      define a protocol independent abstract interface for the data link.
      This is provided below as an aid to implementation.
      </t>
      <section title="MA-DATA.request">
        <section title="Function">
          <t>
          This primitive defines the transfer of data from a MAC client entity
          to a single peer entity or multiple peer entities in the case of a
          broadcast address.
          </t>
        </section>
        <section title="Semantics of the Service Primitive">
          <figure>
            <artwork>
The semantics of the primitive are as follows:

  MA-DATA.request (
                   destination_address,
                   source_address,
                   data,
                   priority,
                   type
                  )
            </artwork>
          </figure>
          <t>
          The 'destination_address' parameter may specify either an individual
          or a broadcast MAC entity address.  It must contain sufficient
          information to create the Destination Address field (see <xref target="sec-1.3"/>) that is
          prepended to the frame by the local MAC sublayer entity.  The
          'source_address' parameter, if present, must specify an individual
          MAC address.  If the source_address parameter is omitted, the local
          MAC sublayer entity will insert a value associated with that entity.
          </t><t>
          The 'data' parameter specifies the MAC service data unit (MSDU) to be
          transferred by the MAC sublayer entity. There is sufficient
          information associated with the MSDU for the MAC sublayer entity to
          determine the length of the data unit.
          </t><t>
          The 'priority' parameter specifies the priority desired for the data
          unit transfer. The priority parameter is ignored by MS/TP.
          </t><t>
          The 'type' parameter specifies the value of the MS/TP Frame Type
          field that is prepended to the frame by the local MAC sublayer entity.
          </t>
        </section>

        <section title="When Generated">
          <t>
          This primitive is generated by the MAC client entity whenever data
          shall be transferred to a peer entity or entities.  This can be in
          response to a request from higher protocol layers or from data
          generated internally to the MAC client, such as a Token frame.
          </t>
        </section>
        
        <section title="Effect on Receipt">
          <t>
          Receipt of this primitive will cause the MAC entity to insert all MAC
          specific fields, including Destination Address, Source Address, Frame
          Type, and any fields that are unique to the particular media access
          method, and pass the properly formed frame to the lower protocol
          layers for transfer to the peer MAC sublayer entity or entities.
          </t>
        </section>
      </section>
      
      <section title="MA-DATA.indication">
        <section title="Function">
          <t>
          This primitive defines the transfer of data from the MAC sublayer
          entity to the MAC client entity or entities in the case of a broadcast
          address.
          </t>
        </section>
        <section title="Semantics of the Service Primitive">
          <figure>
            <artwork>
The semantics of the primitive are as follows:

  MA-DATA.indication (
                      destination_address,
                      source_address,
                      data,
                      priority,
                      type
                     )
            </artwork>
          </figure>
          <t>
          The 'destination_address' parameter may be either an individual or a
          broadcast address as specified by the Destination Address field of
          the incoming frame. The 'source_address' parameter is an individual
          address as specified by the Source Address field of the incoming
          frame.
          </t><t>
          The 'data' parameter specifies the MAC service data unit (MSDU) as
          received by the local MAC entity.  There is sufficient information
          associated with the MSDU for the MAC sublayer client to determine the
          length of the data unit.
          </t><t>
          The 'priority' parameter specifies the priority desired for the data
          unit transfer. The priority parameter is ignored by MS/TP.
          </t><t>
          The 'type' parameter is the value of the MS/TP Frame Type field of
          the incoming frame.
          </t>
        </section>
      
        <section title="When Generated">
          <t>
          The MA_DATA.indication is passed from the MAC sublayer entity to the
          MAC client entity or entities to indicate the arrival of a frame to
          the local MAC sublayer entity that is destined for the MAC client.
          Such frames are reported only if they are validly formed, received
          without error, and their destination address designates the local MAC
          entity.  Frames destined for the MAC Control sublayer are not passed
          to the MAC client.
          </t>
        </section>

        <section title="Effect on Receipt">
          <t>
          The effect of receipt of this primitive by the MAC client is unspecified.
          </t>
        </section>
      </section>
    </section>
    
    <section anchor="app-b" title="Consistent Overhead Byte Stuffing [COBS]">
      <t>
      This Appendix is informative and not part of the standard.
      </t><t>
      BACnet <xref target="Addendum_an"/> corrects a long-standing
      issue with the MS/TP specification; namely that preamble sequences
      were not escaped whenever they appeared in the Data or Data CRC
      fields.  In rare cases, this resulted in dropped frames due to loss
      of frame synchronization.  The solution is to encode the Data and
      32-bit Data CRC fields before transmission using Consistent Overhead
      Byte Stuffing <xref target="COBS"/> and decode these fields upon reception.
      </t><t>
      COBS is a run-length encoding method that nominally removes '0x00'
      octets from its input.  Any selected octet value may be removed by
      XOR'ing that value with each octet of the COBS output.  BACnet <xref target="Addendum_an"/> specifies
      the preamble octet '0x55' for removal.
      </t><t>
      The minimum overhead of COBS is one ectet per encoded field.  The
      worst-case overhead is bounded to one octet in 254, or less than
      0.5%, as described in <xref target="COBS"/>.
      </t><t>
      Frame encoding proceeds logically in two passes.  The Encoded Data
      field is prepared by passing the MSDU through the COBS encoder and
      XOR'ing the preamble octet '0x055' with each octet of the output.
      The Encoded CRC-32K field is then prepared by calculating a CRC-32K
      over the Encoded Data field and formatting it for transmission as
      described in <xref target="app-c"/>.  The combined length of these
      fields, minus two octets for compatibility with existing MS/TP devices,
      is placed in the MS/TP header Length field before transmission.
      </t><t>
      Example COBS encoder and decoder functions are shown below for
      illustration.  Complete examples of use and test vectors are provided in
      BACnet <xref target="Addendum_an"/>.
      </t>
      <figure>
        <artwork><![CDATA[
#include <stddef.h>
#include <stdint.h>

#define CRC32K_INITIAL_VALUE (0xFFFFFFFF)
#define MSTP_PREAMBLE_X55 (0x55)

/*
 * Encodes 'length' octets of data located at 'from' and
 * writes one or more COBS code blocks at 'to', removing any
 * 'mask' octets that may present be in the encoded data.
 * Returns the length of the encoded data.
 */

size_t
cobs_encode (uint8_t *to, const uint8_t *from, size_t length,
             uint8_t mask)
{
  size_t code_index = 0;
  size_t read_index = 0;
  size_t write_index = 1;
  uint8_t code = 1;
  uint8_t data, last_code;

  while (read_index < length) {
    data = from[read_index++];
    /*
     * In the case of encountering a non-zero octet in the data,
     * simply copy input to output and increment the code octet.
     */
    if (data != 0) {
      to[write_index++] = data ^ mask;
      code++;
      if (code != 255)
        continue;
    }
    /*
     * In the case of encountering a zero in the data or having
     * copied the maximum number (254) of non-zero octets, store
     * the code octet and reset the encoder state variables.
     */
    last_code = code;
    to[code_index] = code ^ mask;
    code_index = write_index++;
    code = 1;
  }
  /*
   * If the last chunk contains exactly 254 non-zero octets, then
   * this exception is handled above (and returned length must be
   * adjusted). Otherwise, encode the last chunk normally, as if
   * a "phantom zero" is appended to the data.
   */
  if ((last_code == 255) && (code == 1))
    write_index--;
  else
    to[code_index] = code ^ mask;

  return write_index;
}
        ]]></artwork>
      </figure>
      <t>
       <vspace blankLines='2' />  <!-- page break -->
      </t>
      <figure>
        <artwork><![CDATA[
#include <stddef.h>
#include <stdint.h>

#define CRC32K_INITIAL_VALUE (0xFFFFFFFF)
#define MSTP_PREAMBLE_X55 (0x55)

/*
 * Decodes 'length' octets of data located at 'from' and
 * writes the original client data at 'to', restoring any
 * 'mask' octets that may present in the encoded data.
 * Returns the length of the encoded data or zero if error.
 */
size_t
cobs_decode (uint8_t *to, const uint8_t *from, size_t length,
             uint8_t mask)
{
  size_t read_index = 0;
  size_t write_index = 0;
  uint8_t code, last_code;

  while (read_index < length) {
    code = from[read_index] ^ mask;
    last_code = code;
    /*
     * Sanity check the encoding to prevent the while() loop below
     * from overrunning the output buffer.
     */
    if (read_index + code > length)
      return 0;

    read_index++;
    while (--code > 0)
      to[write_index++] = from[read_index++] ^ mask;
    /*
     * Restore the implicit zero at the end of each decoded block
     * except when it contains exactly 254 non-zero octets or the
     * end of data has been reached.
     */
    if ((last_code != 255) && (read_index < length))
      to[write_index++] = 0;
  }
  return write_index;
}
        ]]></artwork>
      </figure>
    </section>
    
    <section anchor="app-c" title="Encoded CRC-32K [CRC32K]">
      <t>
      This Appendix is informative and not part of the standard.
      </t><t>
      Extending the payload of MS/TP to 1501 octets required upgrading the
      Data CRC from 16 bits to 32 bits.  P.Koopman has authored several
      papers on evaluating CRC polynomials for network applications.  In
      <xref target="CRC32K"/>, he surveyed the entire 32-bit polynomial space and noted
      some that exceed the <xref target="IEEE.802.3"/> polynomial in performance.  BACnet
      <xref target="Addendum_an"/> specifies the CRC-32K (Koopman) polynomial.
      </t><t>
      The specified use of the calc_crc32K() function is as follows.
      Before a frame is transmitted, 'crc_value' is initialized to all
      ones.  After passing each octet of the <xref target="COBS"/> Encoded Data through
      the function, the ones complement of the resulting 'crc_value' is
      arranged in LSB-first order and is itself <xref target="COBS"/> encoded.  The length
      of the resulting Encoded CRC-32K field is always five octets.
      </t><t>
      Upon reception of a frame, 'crc_value' is initialized to all ones.
      The octets of the Encoded Data field are accumulated
      by the calc_crc32K() function before decoding.  The Encoded CRC-32K
      field is then decoded and the resulting four octets are accumulated
      by the calc_crc32K() function.  If the result is the expected residue
      value 'CRC32K_RESIDUE', then the frame was received correctly.
      </t><t>
      An example CRC-32K function in shown below for illustration.  Complete
      examples of use and test vectors are provided in BACnet <xref target="Addendum_an"/>.
      </t>
      <figure>
        <artwork><![CDATA[
#include <stdint.h>

/* See BACnet Addendum 135-2012an, section G.3.2 */
#define CRC32K_INITIAL_VALUE (0xFFFFFFFF)
#define CRC32K_RESIDUE (0x0843323B)

/* CRC-32K polynomial, 1 + x**1 + ... + x**30 (+ x**32) */
#define CRC32K_POLY (0xEB31D82E)

/*
 * Accumulate 'data_value' into the CRC in 'crc_value'.
 * Return updated CRC.
 *
 * Note: crcValue must be set to CRC32K_INITIAL_VALUE
 * before initial call.
 */
uint32_t
calc_crc32K (uint8_t data_value, uint32_t crc_value)
{
  int b;
  
  for (b = 0; b < sizeof(uint8_t); b++) {
    if ((data_value & 1) ^ (crc_value & 1)) {
      crc_value >>= 1;
      crc_value ^= CRC32K_POLY;
    } else {
      crc_value >>= 1;
    }
    data_value >>= 1;
  }
  return crc_value;
}
        ]]></artwork>
      </figure>
      <t>
        <vspace blankLines='100' />  <!-- page break -->
      </t>
    </section>
  </back>
</rfc>

PAFTECH AB 2003-20262026-04-22 05:35:36