<?xml version='1.0' encoding='utf-8'?>
<!-- This template is for creating an Internet Draft using xml2rfc,
    which is available here: http://xml.resource.org. -->
<?xml-model href="rfc7991bis.rnc"?>  <!-- Required for schema validation and schema-aware editing -->
<!-- <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?> -->
<!-- This third-party XSLT can be enabled for direct transformations in XML processors, including most browsers -->

<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<!-- If further character entities are required then they should be added to the DOCTYPE above.
     Use of an external entity file is not recommended. -->

<rfc
      xmlns:xi="http://www.w3.org/2001/XInclude"
      category="info"
      docName="draft-lampin-lpwan-schc-considerations-00"
      ipr="trust200902"
      obsoletes=""
      updates=""
      submissionType="IETF"
      xml:lang="en"
      tocInclude="true"
      tocDepth="4"
      symRefs="true"
      sortRefs="true"
      version="3">
  <!-- xml2rfc v2v3 conversion 2.38.1 -->
  <!-- category values: std, bcp, info, exp, and historic
    ipr values: trust200902, noModificationTrust200902, noDerivativesTrust200902,
       or pre5378Trust200902
    you can add the attributes updates="NNNN" and obsoletes="NNNN" 
    they will automatically be output with "(if approved)" -->

 <!-- ***** FRONT MATTER ***** -->

<front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
        full title is longer than 39 characters -->

  <title abbrev="SCHC considerations">SCHC design and implementation considerations</title>
  <seriesInfo name="Internet-Draft" value="draft-lampin-lpwan-schc-considerations-00"/>

  <!-- add 'role="editor"' below for the editors if appropriate -->
  <!--author fullname="Dominique Barthel" initials="D." role="editor" surname="Barthel"-->
  <author fullname="Quentin Lampin" initials="Q." surname="Lampin">
    <organization>Orange</organization>
    <address>
      <postal>
        <street>22 chemin du Vieux Chene</street>
        <!-- Reorder these if your country does things differently -->
        <city>Meylan</city>
        <code>38240</code>
        <country>France</country>
      </postal>
      <email>quentin.lampin@orange.com</email>
    </address>
  </author>

  <date year="2022"/>
  <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
        in the current day for you. If only the current year is specified, xml2rfc will fill 
	in the current day and month for you. If the year is not the current one, it is 
	necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	specify just the year. -->

  <!-- Meta-data Declarations -->

  <area>Internet</area>
  <workgroup>lpwan Working Group</workgroup>
  <!-- WG name at the upperleft corner of the doc,
        IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
        which is used by the RFC Editor as a nod to the history of the IETF. -->

  <keyword>template</keyword>
  <!-- Keywords will be incorporated into HTML output
        files in a meta tag but they have no effect on text or nroff
        output. If you submit your draft to the RFC Editor, the
        keywords will be used for the search engine. -->

  <abstract>
    <t>Taking the opportunity of a fresh implementation of SCHC by a newcomer to SCHC to reflect on the
	design principles and the implications on the implication of SCHC.</t>

    <t>Topics addressed:</t>

    <ul>
      <li>The parser, as described in SCHC specification.</li>
      <li>A discussion on parsing and interpretation.</li>
      <li>Practical implications of the specification of the parser of SCHC.</li>
      <li>the challenge and opportunity of a generic parser implementation able to handle any protocol stack and rules design to enable it.</li>
    </ul>

 
  </abstract>
</front>

<middle>
<section anchor="introduction" numbered="true" toc="default">
    <name>Introduction</name>

<t>This is a reflexion on SCHC <xref target="RFC8724"/> and its use for LPWANs <xref target="RFC8376"/>.</t>
<t>This document captures the author's reflections during its implementation of the SCHC protocol (C/D) in microSCHC. This is a work-in-progress and might contain mistakes or misinterpretations.</t>
</section>

<section anchor="terminology" numbered="true" toc="default">
<name>Terminology</name>

<t>This draft re-uses the Terminology defined in <xref target="RFC8724"/>.</t>

<t>The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, 
“SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, 
and “OPTIONAL” in this document are to be interpreted as 
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they 
appear in all capitals, as shown here.</t>

</section>

<section anchor="parser-description">
<name>Parser description in RFC8724</name>

<t>
    SCHC C/D assumes that both ends of a SCHC communication implement a parser alongside the implementation 
    of the rule matching, compression and decompression procedures. This parser, whose specification is out 
    of scope of the RFC, "is able to identify all the fields encountered in the headers to be compressed, and 
    to label them with a Field ID. Rules only describe the compression/decompression behavior for each header
    field, after it has been identified." (Section 7.1 of  <xref target="RFC8724"/>).
</t>
<t>
    Sections 7.1 and 10 and Appendix A provide further insights as to what the parser is expected to output for a field:
</t>
<ul>
    <li>Field ID (FID) [string | integer | ...] unique identifier for a given ruleset.</li>
    <li>Field Length (FL) [integer | type].</li>
    <li>Field Position (FP) [integer].</li>
    <li>Field Value (FV) [type]</li>
</ul>
<t>
    where type can be anything: integers, bytes, arrays, etc.
</t>
</section>

<section anchor="packet-field">
    <name>What is a packet field?</name>

    <t>
        <xref target="RFC8724"/> does not provide a formal definition of a packet field but the examples provided in Appendix A,
        figures 26 to 28, suggest the use of the colloquial definition, i.e. a sequence of continuous bits of 
        the frame provided by the underlying layer. For example, the following IPv6 packet would be parsed as 8 
        fields : IPv6 Version, Traffic Class, etc.
    </t>

    <figure title="IPv6 header format" anchor="ipv6-header-format"><artwork><![CDATA[
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |Version| Traffic Class |           Flow Label                  |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |         Payload Length        |  Next Header  |   Hop Limit   |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                                                               +
    |                                                               |
    +                         Source Address                        +
    |                                                               |
    +                                                               +
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                                                               +
    |                                                               |
    +                      Destination Address                      +
    |                                                               |
    +                                                               +
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    ]]></artwork></figure>

    <t>
        Furthermore, parts of the RFC suggest that <em>fields</em> might be seen in a broader sense. Section 7.1 and <xref target="RFC8824"/> 
        refer to the "CoAP URI Path" option as a field and this is further confirmed in <xref target="I-D.ietf-lpwan-schc-yang-data-model" />,
        where <em>subfields</em> are introduced.
    </t>

    <t>
    The case of "CoAP URI Path" is an interesting one, as it is not a <em>on-the-wire</em> field but an abstract construct based on the 
    decoding and interpretation of <em>on-the-wire</em> fields, namely "CoAP Option Delta", "CoAP Option Length", "CoAP Option Delta Extended" 
    (if any), "CoAP Option Length Extended" (if any) and "CoAP Option Value", illustrated below <xref target="coap-option-header-format"/>.
    </t>

    <figure title="CoAP option header format" anchor="coap-option-header-format"><artwork><![CDATA[

    0   1   2   3   4   5   6   7
    +---------------+---------------+
    |               |               |
    |  Option Delta | Option Length |   1 byte
    |               |               |
    +---------------+---------------+
    |                               |
    |         Option Delta          |   0-2 bytes
    |          (extended)           |
    +-------------------------------+
    |                               |
    |         Option Length         |   0-2 bytes
    |          (extended)           |
    +-------------------------------+
    |                               |
    |                               |
    |                               |
    |         Option Value          |   0 or more bytes
    |                               |
    |                               |
    |                               |
    +-------------------------------+
    ]]></artwork></figure>

</section>

<section anchor="tpdi" title="Tokenization, Parsing, Decoding, Interpretation?">

    <t>
        As illustrated in the previous section, some level of interpretation is expected 
        from the <em>parser</em> which raises the question of its roles and expected capabilities.
    </t>

    <t>
        Depending on the protocol to parse, the <em>parser</em> might be required to execute:
    </t>
    <ul>
        <li><strong>tokenization</strong>: the tokenization consists in extracting sequential bits from the <em>on-the-wire</em> 
        packet buffer and expose those as <em>tokens</em> or <em>raw fields</em>.</li>
        <li> <strong>parsing</strong>: parsing adds labels and meta-data to <em>raw</em> fields, in SCHC such labels and meta-data 
        include the Field ID, Field Length, Position Indicator, etc.</li>
        <li><strong>decoding</strong>: decoding consists in processing a number of <em>raw</em> fields to extract information needed for
        processing the packet further, e.g., determine the length of a variable length field.</li>
        <li><strong>interpretation</strong>: interpretation consists in providing an alternative representation of the information carried by 
        one or several <em>raw</em> fields, a good example of this is the representation of CoAP options as fields.</li>
    </ul>

</section>

<section anchor="implications" title="Implication of interpreted fields in the SCHC data model">

    <t>
        <xref target="I-D.ietf-lpwan-schc-yang-data-model" /> provides YANG data models to describe the IPv6, UDP and CoAP headers 
        and those models determine the itemization or, practically speaking, the list of <em>fields</em>, their IDs, the type and encoding 
        of the internal representation used by C/D and so forth.
    </t>

    <t>
    In particular, the CoAP model provided in <xref target="I-D.ietf-lpwan-schc-yang-data-model" /> lists CoAP Options as fields but
    not the <em>raw</em> fields constituting the CoAP Option header <em>on-the-wire</em>. A SCHC parser implementation must therefore
    include some level of <strong>interpretation</strong>.
    </t>

    <section anchor="d1" title="Discussion #1: On supporting multiple interpretations of the same on-the-wire header fields">
        <t>
            Depending on the characteristics of the packets to be compressed between two SCHC endpoints, one set of fields
            representations might provide better compression performance than another. This yields the question of the support
            of multiple interpretations of the same <em>on-the-wire</em> frame and how to enable it. In particular, does it require to
            list fields representations in the SCHC data model?
        </t>
    </section>

    <section anchor="d2" title="Discussion #2: On supporting new protocols or protocol extensions">
        <t>
        Supporting new protocols in SCHC, or extensions of them (e.g. new CoAP Options) requires updating the data model of
        <xref target="I-D.ietf-lpwan-schc-yang-data-model" />. 
        Assuming <xref target="I-D.ietf-lpwan-schc-yang-data-model" /> becomes an RFC, it would require updates every now and then. 
        Limiting this need for updates is certainly beneficial.
        </t>
    </section>

    <section anchor="q1" title="Question: Would it be beneficial to include CoAP Options raw fields in the data model?">
        <t>
            More specifically, should the data model include: CoAP Option Delta, CoAP Option Length, CoAP Option Delta Extended,
            CoAP Option Length Extended, CoAP Option Value, CoAP Payload Marker?
        </t>
        <t>
            A study on the complexity (memory, code, ...) vs compression efficiency of rules on <em>interpreted</em> fields compared to 
            <em>equivalent</em> rules on <em>raw</em> fields would be interesting.
        </t>
    </section>
    <section anchor="arbitrary-types" title="Arbitrary types and matching operators">

    <t>TBD.</t>

    </section>
</section>

<section anchor="security-considerations" title="Security considerations">

<t>N/A</t>

</section>
<section anchor="iana-considerations" title="IANA Considerations">

<t>N/A</t>

</section>


</middle>

<!--  *****BACK MATTER ***** -->
<back>
<!-- References split into informative and normative -->

<!-- There are 2 ways to insert reference entries from the citation libraries:
  1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
  2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
     (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

  Both are cited textually in the same manner: by using xref elements.
  If you use the PI option, xml2rfc will, by default, try to find included files in the same
  directory as the including file. You can also define the XML_LIBRARY environment variable
  with a value containing a set of directories to search.  These can be either in the local
  filing system or remote ones accessed by http (http://domain/dir/... ).-->

  <references>
    <name>References</name>
    <references>
      <name>Normative References</name>
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?>\
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml"?>\
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.8724.xml"?>\
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.8824.xml"?>
    </references>

    <references>
      <name>Informative References</name>
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.8376.xml"?>
      <xi:include href='https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-lpwan-schc-yang-data-model.xml'/>
    </references>

<!-- the following is the minimum to make xml2rfc happy
      <reference anchor="min_ref">
        <front>
          <title>Minimal Reference</title>
          <author initials="authInitials" surname="authSurName">
              <organization/>
          </author>
          <date year="2006"/>
        </front>
      </reference>

-->
</references>

<!-- Appendix
<section anchor="app-additional" numbered="true" toc="default">
  <name>Additional Stuff</name>
  <t>This becomes an Appendix.</t>
</section>
-->

</back>
</rfc>
