<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std"
     submissionType="IETF" docName="draft-ietf-mmusic-data-channel-sdpneg-28"
     number="8864"
     consensus="true" ipr="trust200902" tocInclude="true" symRefs="true" sortRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 2.38.0 -->
  <front>
    <title abbrev="SDP-Based Data Channel Negotiation">
Negotiation Data Channels Using the Session Description Protocol (SDP)</title>
    <seriesInfo name="RFC" value="8864"/>
    <author initials="K." surname="Drage" fullname="Keith Drage">
      <organization>Unaffiliated</organization>
      <address>
        <email>drageke@ntlworld.com</email>
      </address>
    </author>
    <author initials="M." surname="Makaraju" fullname="Maridi R. Makaraju (Raju)">
      <organization>Unaffiliated</organization>
      <address>
        <email>mmraju@gmail.com</email>
      </address>
    </author>

    <author fullname="Richard Ejzak" initials="R." surname="Ejzak">
      <organization>Unaffiliated</organization>
      <address>
        <email>richard.ejzak@gmail.com</email>
      </address>
    </author>
    <author fullname="Jerome Marcon" initials="J." surname="Marcon">
      <organization>Unaffiliated</organization>
      <address>
        <email>jeromee.marcon@free.fr</email>
      </address>
    </author>
    <author initials="R." surname="Even" fullname="Roni Even" role="editor">
      <organization></organization>
      <address>
        <email>ron.even.tlv@gmail.com</email>
      </address>
    </author>

    <date month="January" year="2021"/>

    <abstract>
      <t>  Data channel setup can be done using either the in-band Data Channel Establishment Protocol (DCEP) or some out-of-band non-DCEP protocol.  This document specifies how the SDP (Session
   Description Protocol) offer/answer exchange can be used to achieve
   an out-of-band non-DCEP negotiation for establishing a data channel.  
</t>
    </abstract>
  </front>
  <middle>
    <section anchor="introduction">
      <name>Introduction</name>
      <t>   The concept of establishing a bidirectional
   data channel running on top of the Stream Control Transmission
   Protocol (SCTP) is discussed in 
 <xref target="RFC8831"/>, allowing applications to use data channels. An in-band Data
   Channel Establishment Protocol (DCEP) is described in <xref target="RFC8832"/>;
   however, other in-band or out-of-band
   protocols may be used for establishing data channels.  Each data
   channel consists of paired SCTP streams sharing the same SCTP Stream
   Identifier.  Data channels are created by endpoint applications using
   (1)&nbsp;the WebRTC API (Application Programming Interface) <xref
   target="WebRtcAPI"/> or (2)&nbsp; other protocols
   (e.g., Controlling Multiple Streams for Telepresence (CLUE)
 <xref target="RFC8850"/>).  The protocols can be signaled 
   by the data channel 'subprotocol' parameter, conceptually similar to 
   a WebSocket subprotocol as described in <xref target="RFC6455"/>.
 However, apart from the
   "subprotocol" value transmitted to the peer, an endpoint application can agree on how to instantiate a given
   subprotocol on a data channel, and whether it is signaled in-band
   using DCEP or out-of-band using a non-DCEP protocol (or both).</t>
      <t>This document defines Session Description Protocol (SDP) offer/answer
      procedures <xref target="RFC3264"/> that enable out-of-band negotiation
for establishing data channels for transport of well-defined subprotocols.
   These procedures are based on generic SDP offer/answer negotiation rules for SCTP-based media transport as specified in <xref target="RFC8841"/> for 
   the SDP "m=" line proto values UDP/DTLS/SCTP and TCP/DTLS/SCTP. 
      </t>
      <t>This document uses MSRP (the Message Session Relay Protocol) <xref target="RFC4975"/>
   and BFCP (the Binary Floor Control Protocol) <xref target="RFC8855"/> in several examples. It does not provide a 
   complete specification of how to negotiate the use of a data channel to transport 
   MSRP. Procedures specific to each
   subprotocol would have to be documented elsewhere. For MSRP, they are documented in <xref target="RFC8873"/>. The use of MSRP in some examples is only to show how the generic 
   procedures described herein might apply to a specific subprotocol.
      </t>
    </section>
    <section>
      <name>Conventions</name>
     <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>",
     "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>",
     "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>",
     "<bcp14>SHOULD NOT</bcp14>",
     "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
     "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are
     to be interpreted as described in BCP&nbsp;14 <xref target="RFC2119"/>
     <xref target="RFC8174"/> when, and only when, they appear in all capitals,
     as shown here.</t>
    </section>
    <section anchor="terminology">
      <name>Terminology</name>
      <t>This document uses the following terms:
      </t>
      <dl newline="false" spacing="normal">
        <dt>Data channel:</dt>
         <dd>A WebRTC data channel as specified in 
     <xref target="RFC8831"/>.</dd>
        <dt>Data channel stack:</dt>
         <dd>An entity that, upon application request, 
     runs the data channel protocol to keep track of states as well as the
     sending and receiving of data. If the application is a browser-based JavaScript application,
     then this stack resides in the browser. If the application is a 
     native application, then this stack resides in the application and is accessible 
     via some sort of API or APIs.</dd>
        <dt>Data channel properties:</dt>
         <dd>Fixed properties assigned to a data 
     channel at the time of its creation. Some of these properties 
     determine the way the data channel stack transmits data on this 
     channel (e.g., stream identifier, reliability, order of delivery).</dd>
        <dt>Data channel subprotocol:</dt>
         <dd>The application protocol that is transported
     over a single data channel. Data channel subprotocol messages are sent as data 
     channel payload over an established data channel. An SDP offer/answer exchange can be used 
     as specified in this document to negotiate the establishment of data channels,
     corresponding data channel properties, associated data channel subprotocols, and data 
     channel subprotocol properties. In this case, the data channel subprotocols may be identified
     by the values of the 'subprotocol' parameters of the SDP "a=dcmap:" attribute as 
     described in <xref target="subprotocol-parameter"/>. Within this document, the term  
     "data channel subprotocol" is often abbreviated as just "subprotocol".
     </dd>
        <dt>DCEP:</dt>
         <dd>Data Channel Establishment Protocol, as defined in
     <xref target="RFC8832"/>.</dd>
        <dt>In-band:</dt>
         <dd>Transmission through the peer-to-peer SCTP association.</dd>
        <dt>Out-of-band:</dt>
         <dd>Transmission through the application signaling path.</dd>
        <dt>Peer:</dt>
         <dd>From the perspective of one of the agents in a session, its 
     peer is the other agent. Specifically, from the perspective of the 
     SDP offerer, the peer is the SDP answerer. From the perspective of 
     the SDP answerer, the peer is the SDP offerer.</dd>
        <dt>SCTP Stream Sequence Number (SSN):</dt>
         <dd>The SCTP Stream Sequence Number, as specified
     in <xref target="RFC4960"/>.</dd>
        <dt>Stream identifier:</dt>
         <dd>The identifier of the outbound and inbound 
     SCTP streams composing a data channel.</dd>
      </dl>
    </section>
    <section anchor="appl_statement">
      <name>Applicability Statement</name>
      <t> The mechanism described in this document only applies to SDP <xref target="RFC8866"/> when used together with the SDP offer/answer 
   mechanism <xref target="RFC3264"/>. Declarative usage of SDP is out of scope for this 
   document and is thus undefined.</t>
    </section>
    <section anchor="sdp_synt">
      <name>SDP Data Channel Attributes</name>
      <t>This section defines two new SDP media-level attributes that can be
      used together with the SDP Offer/Answer mechanism to negotiate
      data-channel-specific and subprotocol-specific parameters without the
      usage of DCEP <xref target="RFC8832"/>. The first attribute (<xref
      target="subsec-sdp-attr-for-dc-par-neg"/>) provides for negotiation of 
     channel-specific parameters. The second attribute (<xref target="prot_att"/>) provides for 
     negotiation of subprotocol-specific parameters.</t>
     <aside><t>
Note: <xref target="generic-out-of-band-aspects"/> provides information
regarding how data channels work in general. In particular, it
   summarizes some key aspects that should be considered
   for the negotiation of data channels if DCEP is not used.</t>
     </aside>
      <section anchor="subsec-sdp-attr-for-dc-par-neg">
        <name>SDP DCMAP Attribute</name>
        <t>This section defines a new media-level attribute, "a=dcmap:", that defines the data channel parameters for 
      each data channel to be negotiated. </t>
        <t>This attribute is used to create bidirectional SCTP data channels
   having the same set of attributes.  The data channel properties
   (reliable / partially reliable, ordered/unordered) need to be suitable per the subprotocol transport requirements.
</t>
        <section anchor="dcmap-attr-definition">
          <name>DCMAP Attribute Syntax</name>
          <t>"a=dcmap:" is a media-level attribute having the following
          definition and ABNF (Augmented Backus-Naur Form) syntax <xref target="RFC5234"/>.

          </t>
<table anchor="dcmap-attrib">
  <name>"a=dcmap:" Attribute Definition</name>
  <thead>
    <tr>
     <th colspan="2" align="center">"a=dcmap:" Attribute</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Name</td>
      <td>dcmap</td>
    </tr>
    <tr>
      <td>Value</td>
      <td>dcmap-value</td>
    </tr>
    <tr>
      <td>Usage Level</td>
      <td>media</td>
    </tr>
    <tr>
      <td>Charset Dependent</td>
      <td>No</td>
    </tr>
  </tbody>
</table>

<t>Formal syntax:</t>

<sourcecode name="abnf-1" type="abnf"><![CDATA[
dcmap-value     = dcmap-stream-id
                  [ SP dcmap-opt *(";" dcmap-opt) ]
dcmap-opt       = ordering-opt / subprotocol-opt / label-opt
                  / maxretr-opt / maxtime-opt / priority-opt
                  ; maxretr-opt and maxtime-opt are
                  ; mutually exclusive

dcmap-stream-id = 1*5DIGIT
ordering-opt    = "ordered=" ordering-value
ordering-value  = "true" / "false"
subprotocol-opt = "subprotocol=" quoted-string
label-opt       = "label=" quoted-string
maxretr-opt     = "max-retr=" maxretr-value
maxretr-value   = "0" / integer
                  ; number of retransmissions,
                  ; less than 2^32,
                  ; derived from 'Reliability Parameter' [RFC8832]
maxtime-opt     = "max-time=" maxtime-value
maxtime-value   = "0" / integer
                  ; milliseconds,
                  ; less than 2^32,
                  ; derived from 'Reliability Parameter' [RFC8832]
priority-opt    = "priority=" priority-value
priority-value  = "0" / integer
                  ; unsigned integer value indicating the priority of
                  ; the data channel,
                  ; less than 2^16,
                  ; derived from 'Priority' [RFC8832]

quoted-string   = DQUOTE *(quoted-char / escaped-char) DQUOTE
quoted-char     = SP / quoted-visible
quoted-visible  = %x21 / %x23-24 / %x26-7E ; VCHAR without " or %
escaped-char    = "%" HEXDIG HEXDIG
DQUOTE          = <from RFC 5234>
integer         = <from RFC 8866>]]></sourcecode>

<t>Examples:</t>
<sourcecode name="sdp-1" type="sdp"><![CDATA[
a=dcmap:0
a=dcmap:1 subprotocol="bfcp";max-time=60000;priority=512
a=dcmap:2 subprotocol="msrp";ordered=true;label="msrp"
a=dcmap:3 label="Label 1";ordered=false;max-retr=5;priority=128
a=dcmap:4 label="foo%09bar";ordered=true;max-time=15000]]></sourcecode>

            <aside><t>Note: The last example (a=dcmap:4) shows a 'label' parameter value
         that contains one nonprintable 'escaped-char' character 
         (the tabulator character).</t></aside>

          <t>Within an "a=dcmap:" attribute line's 'dcmap-opt' value, only one 
       'maxretr-opt' parameter or one 'maxtime-opt' parameter may be present.
       Both parameters <bcp14>MUST NOT</bcp14> be present.</t>
        </section>
        <section anchor="dcmap-stream-id-param-definition">
          <name>&apos;dcmap-stream-id&apos; Parameter</name>
          <t>The 'dcmap-stream-id' parameter indicates the SCTP stream identifier 
       within the SCTP association used to form the data channel.</t>
        </section>
        <section>
          <name>&apos;label&apos; Parameter</name>
          <t>The 'label' parameter indicates the name of the 
       channel. It represents a label that can be used to distinguish, 
       in the context of the WebRTC API <xref target="WebRtcAPI"/>, 
       an RTCDataChannel object from other RTCDataChannel objects.
       This parameter maps to the 'Label' parameter defined in 
       <xref target="RFC8832"/>.       
       The 'label' parameter is optional. If it is not
       present, then its value defaults to the empty string.
          </t>
          <t>In order to communicate with the WebRTC API, the 'label' parameter
          should
          </t>
          <ul spacing="normal">
            <li>Serialize the WebRTC label as a UTF-8 string <xref target="RFC3629"/>.</li>
            <li>Treat the UTF-8 serialization as a series of bytes.</li>
            <li>
              <t>For each byte in the serialization,
              </t>
              <ul spacing="normal">
                <li>If the byte can be expressed as a 'quoted-char', do so.</li>
                <li>Otherwise, express the byte as an 'escaped-char'.</li>
              </ul>
            </li>
          </ul>
          <aside><t>Note: The empty string can also be explicitly used as a 'label' value,
       such that 'label=""' is equivalent to the 'label' parameter not being
       present at all.
       <xref target="RFC8832"/> allows the DATA_CHANNEL_OPEN 
       message's 'Label' value to be an empty string.</t></aside>
        </section>
        <section anchor="subprotocol-parameter">
          <name>&apos;subprotocol&apos; Parameter</name>
          <t>The 'subprotocol' parameter indicates which protocol the 
       client expects to exchange via the channel.
       This parameter maps to the 'Protocol' parameter defined in 
       <xref target="RFC8832"/>.
       <xref target="IANA_subproto_ids"/> specifies how values for new subprotocol parameters are registered.
       'subprotocol' is an optional parameter. 
       If the 'subprotocol' parameter is not present, then its value 
       defaults to an empty string.</t>
          <aside><t> Note: The empty string can also be
          explicitly used as a 'subprotocol' value,
       such that 'subprotocol=""' is equivalent to the 'subprotocol' parameter not being
       present at all. <xref target="RFC8832"/> allows the 
       DATA_CHANNEL_OPEN message's 'Protocol' value to be an empty string.
          </t></aside>
        </section>
        <section anchor="max-retr-param-definition">
          <name>&apos;max-retr&apos; Parameter</name>
          <t>This parameter indicates that the data channel is partially reliable. 
       The 'max-retr' parameter indicates the maximal number of times a user message will 
       be retransmitted. The 'max-retr' parameter is optional. If 
       the 'max-retr' parameter and the 'max-time' parameter are not present, then reliable
       transmission is performed as specified in <xref target="RFC4960"/>. 
       This parameter maps to the 'Number of RTX' parameter 
       defined in <xref target="RFC8832"/>.</t>
        </section>
        <section>
          <name>&apos;max-time&apos; Parameter</name>
          <t> This parameter indicates that the data channel is partially reliable. 
       A user message will no longer be transmitted or retransmitted after 
       a specified lifetime, given in milliseconds, in the 'max-time' 
       parameter. The lifetime starts when providing the user message to the protocol stack.
 The 'max-time' parameter is optional. If the 'max-retr' parameter and the 'max-time' parameter are not present, then reliable
       transmission is performed as specified in <xref target="RFC4960"/>. 
       This parameter maps to the 'Lifetime in ms' parameter 
       defined in <xref target="RFC8832"/>.</t>
        </section>
        <section anchor="ordered-param-description">
          <name>&apos;ordered&apos; Parameter</name>
          <t>The 'ordered' parameter with value "true" indicates that the receiver will 
       dispatch DATA chunks in the data channel to the upper layer 
       while preserving the order. The 'ordered' parameter is optional and 
       takes two values -- "true" for ordered delivery and "false" for unordered delivery --
       with "true" as the default value. 
       Any other value is ignored, and the default "ordered=true" is assumed. 
       In the absence of this parameter, "ordered=true" is assumed. 
       This parameter maps to 
       the ordered or unordered data channel types as defined in 
       <xref target="RFC8832"/>.</t>
        </section>
        <section anchor="priority-param-description">
          <name>&apos;priority&apos; Parameter</name>
          <t>The 'priority' parameter indicates the data channel's priority
       relative to the  priorities of other data channels, which may
       additionally exist over the same SCTP association.
       The 'priority' parameter maps to the 'Priority' parameter defined in
       <xref target="RFC8832"/>. 
       The 'priority' parameter is optional.
       In the absence of this parameter, "priority=256" is assumed.
          </t>
        </section>
        <section anchor="dcmap-mux-category">
          <name>DCMAP Multiplexing Category</name>
          <t>The multiplexing category <xref target="RFC8859"/> of the "a=dcmap:" attribute is SPECIAL.
          </t>
          <t>As the usage of multiple SCTP associations on top of a single DTLS
       association is outside the scope of <xref target="RFC8841"/>,
       no "a=dcmap:" attribute multiplexing rules are specified for the UDP/DTLS/SCTP and 
       TCP/DTLS/SCTP proto values.
       If future extensions of <xref target="RFC8841"/> define how to 
       negotiate multiplexing of multiple SCTP associations on top of a single DTLS 
       association or how to add multiple SCTP associations to one BUNDLE group, then 
       multiplexing rules for the "a=dcmap:" attribute need to be 
       defined as well -- for instance, in an extension of this specification.
          </t>
        </section>
      </section>
                        <section anchor="prot_att">
        <name>SDP DCSA Attribute</name>
        <t>In the SDP media description, each data channel declaration
        <bcp14>MAY</bcp14> also be followed by other SDP attributes, which
        apply to the corresponding data channel and its subprotocol. Each of
        these attributes is represented by one new "a=dcsa:" attribute line
        that references another SDP attribute defined for use with this data
        channel's subprotocol. Instructions for registering attributes for use
        with a data channel are given in <xref target="IANA-reg-data-channel-attribs"/>.</t>
        <t>Each SDP attribute that is related to the subprotocol and that would normally 
      be used to negotiate the subprotocol using the SDP offer/answer mechanism is replaced with 
      an attribute of the form "a=dcsa:stream-id original&nbhy;attribute",
      where "dcsa" stands for "data channel subprotocol attribute", 
      "stream-id" is the SCTP stream identifier assigned to this subprotocol 
      instance, and "original-attribute" represents the contents of the 
      subprotocol-related attribute to be included.</t>
        <t>The same syntax applies to any other SDP attribute required for 
      negotiation of this instance of the subprotocol.</t>
        <t>The detailed offer/answer procedures for the dcsa attribute are
        dependent on the associated subprotocol. If no offer/answer
        procedures exist for the subprotocol when used outside of the dcsa
        attribute, no specification is needed for use with dcsa. The IANA
        (Internet Assigned Numbers Authority) registration procedures for the "WebSocket Subprotocol Name Registry" (<xref target="IANA_subproto_ids"/>) do not strictly require a specification of the offer/answer procedures for the subprotocol when used with dcsa. If the subprotocol has defined offer/answer procedures when used outside of dcsa, such a specification is encouraged to ensure interoperability. If the subprotocol has defined offer/answer procedures when used outside of dcsa but no specification exists for the offer/answer procedures for the subprotocol when used with dcsa, implementations <bcp14>SHOULD</bcp14> assume the use of the default values for all otherwise-negotiable and applicable subprotocol parameters.
</t>
        <section anchor="dcsa-attribute">
          <name>DCSA Attribute Syntax</name>
<t>"a=dcsa:" is a media-level attribute having the following definition and
ABNF (Augmented Backus-Naur Form) syntax <xref target="RFC5234"/>.
</t>

<table anchor="dcsa-attrib">
  <name>"a=dcsa:" Attribute Definition</name>
  <thead>
    <tr>
     <th colspan="2" align="center">"a=dcsa:" Attribute</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Name</td>
      <td>dcsa</td>
    </tr>
    <tr>
      <td>Value</td>
      <td>dcsa-value</td>
    </tr>
    <tr>
      <td>Usage Level</td>
      <td>media</td>
    </tr>
    <tr>
      <td>Charset Dependent</td>
      <td>No</td>
    </tr>
  </tbody>
</table>

<t>Formal syntax:</t>
<sourcecode name="abnf-2" type="abnf"><![CDATA[
dcsa-value      = stream-id SP attribute
stream-id       = 1*5DIGIT
attribute       = <from RFC 8866>]]></sourcecode>

<t>Example:</t>
<sourcecode name="sdp-2" type="sdp"><![CDATA[
a=dcmap:2 subprotocol="msrp";ordered=true;label="msrp"

a=dcsa:2 accept-types:text/plain]]></sourcecode>

          <t>The reference to <xref target="RFC8866"/> defines where the 
      attribute definition can be found; 
      it does not provide any limitations on support of attributes 
      defined in other documents in accordance with this attribute 
      definition. However, not all SDP attributes are suitable 
      as an "a=dcsa:" parameter. The registry of IANA SDP parameters contains
      the lists of IANA-registered session-level and media-level or 
      media-level-only SDP attributes.
</t>
          <t>Thus, in the example above, the original attribute line 
      "a=accept&nbhy;types:text/plain" is represented by the attribute line 
      "a=dcsa:2 accept-types:text/plain", which specifies that this 
      instance of the MSRP subprotocol being transported on the SCTP association using 
      the data channel with stream id 2 accepts 
      plaintext files.</t>
          <t>As opposed to the data channel "a=dcmap:" attribute parameters, 
      these parameters 
      are subject to offer/answer negotiation, following the procedures 
      defined in the subprotocol-specific documents.</t>
          <t>It is assumed that in general the usages of subprotocol-related
      media-level attributes are independent from the subprotocol's transport protocol.
      Such transport-protocol-independent subprotocol-related attributes are
      used in the same way as defined in the original subprotocol specification,
      also if the subprotocol is transported over a data channel and if the
      attribute is correspondingly embedded in an "a=dcsa:" attribute.
          </t>
          <t>There may be cases where the usage of a subprotocol-related
      media-level
      attribute depends on the subprotocol's transport protocol.
      In such cases, the subprotocol-related usage of the attribute is expected to be
      described for the data channel transport. A data-channel-specific usage of a 
      subprotocol attribute is expected to be specified in the same document that
      registers the subprotocol's identifier for data channel usage as described in 
      <xref target="IANA_subproto_ids"/>.
          </t>
        </section>
        <section anchor="dcsa-mux-category">
          <name>DCSA Multiplexing Category</name>
          <t>The multiplexing category of the "a=dcsa:" attribute is SPECIAL.
          </t>
          <t>As the usage of multiple SCTP associations on top of a single DTLS
       association is outside the scope of <xref target="RFC8841"/>,
       no "a=dcsa:" attribute multiplexing rules are specified for the UDP/DTLS/SCTP and 
       TCP&wj;/DTLS&wj;/SCTP proto values.
       If future extensions of <xref target="RFC8841"/> define how to 
       negotiate multiplexing of multiple SCTP associations on top of a single DTLS 
       association or how to add multiple SCTP associations to one BUNDLE group, then 
       multiplexing rules for the "a=dcsa:" attribute need to be 
       defined as well -- for instance, in an extension of this specification.
          </t>
        </section>
      </section>
                </section>
                <section anchor="section_procedures">
      <name>SDP Offer/Answer Procedures</name>
      <t>This section defines how data channels can be negotiated using the SDP 
       offer/answer mechanism. A given media description can describe multiple 
       data channels (each represented by a separate SDP dcmap attribute) that 
       can be created, modified, and closed using different offer/answer exchanges. 
       The procedures in this section apply for a given data channel.
</t>
      <t>The generic offer/answer procedures for negotiating the SCTP association used to realize data channels are defined in <xref target="RFC8841"/>. This section only defines the data-channel-specific procedures.</t>
      <t> "Initial offer" refers to the offer in which a data channel is
      opened. It can be either the initial offer or a subsequent offer of the associated SDP session.</t>
      <t>The detailed offer/answer procedures for the dcsa attribute are dependent on the associated subprotocol; see <xref target="prot_att"/>.
</t>
      <section anchor="id_mgmt">
        <name>Managing Stream Identifiers</name>
        <t>
        In order to avoid SCTP Stream identifier collisions, in alignment with
        <xref target="RFC8832"/>, the endpoint acting as a DTLS client (for
the SCTP association used to realize data channels) <bcp14>MUST</bcp14> use even identifier values,
and the endpoint acting as a DTLS server <bcp14>MUST</bcp14> use odd identifier values. </t>
        <t>SCTP stream identifiers associated with data channels that have been negotiated using DCEP <bcp14>MUST NOT</bcp14> be included in SDP offers and answers.
        </t>
      </section>
                        <section anchor="param_negotiation">
        <name>Negotiating Data Channel Parameters</name>
        <t> 
   The data channel types defined in <xref target="RFC8832"/> are
   mapped to the dcmap SDP attribute parameters in the following manner, where "ordered=true" is the default and may be omitted:

        </t>
<sourcecode name="data-channel-items" type="sdp"><![CDATA[
DATA_CHANNEL_RELIABLE
   ordered=true

DATA_CHANNEL_RELIABLE_UNORDERED
   ordered=false

DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT
   ordered=true;max-retr=<number of retransmissions>

DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT_UNORDERED 
   ordered=false;max-retr=<number of retransmissions>

DATA_CHANNEL_PARTIAL_RELIABLE_TIMED  
   ordered=true;max-time=<lifetime in milliseconds>
          
DATA_CHANNEL_PARTIAL_RELIABLE_TIMED_UNORDERED  
   ordered=false;max-time=<lifetime in milliseconds>]]></sourcecode>

        <t>
  By definition, 'max-retr' and 'max-time' are mutually exclusive,
   so both <bcp14>MUST NOT</bcp14> be present in the "a=dcmap:" attribute
   line.  If an SDP offer contains both of these parameters, then the
   receiver of such an SDP offer <bcp14>MUST</bcp14> reject the SDP offer.  If an SDP
   answer contains both of these parameters, then the offerer <bcp14>MUST</bcp14> treat
   the associated SDP offer/answer as failed.  </t>
      </section>
                        <section anchor="opendc">
        <name>Generating the Initial Offer for a Data Channel</name>
        <t>When an offerer sends an initial offer, in order to negotiate an SCTP stream for a data channel, the offerer

        </t>
        <ul spacing="normal">
          <li><bcp14>SHALL</bcp14> include an SDP dcmap attribute
          (Sections&nbsp;<xref target="subsec-sdp-attr-for-dc-par-neg" format="counter"/> and  <xref
          target="param_negotiation" format="counter"/>) associated with the data channel in the "m=" section representing the SCTP association used to realize the data channel, and
       </li>
          <li><bcp14>MAY</bcp14> include one or more SDP dcsa attributes (<xref target="prot_att"/>) associated with the
      data channel. The value of the 'stream-id' part of each attribute <bcp14>SHALL</bcp14> match the 'dcmap-stream-id' value of the dcmap attribute.
       </li>
        </ul>
      </section>
      <section>
        <name>Generating the SDP Answer</name>
        <t>When an answerer receives an offer that includes an "m=" section
        for an SCTP association, the offer describes an SCTP stream for a data channel, if the answerer accepts the data channel, it
        </t>
        <ul spacing="normal">
          <li><bcp14>SHALL</bcp14> include an SDP dcmap attribute
          (Sections&nbsp;<xref target="subsec-sdp-attr-for-dc-par-neg" format="counter"/> and  <xref
          target="param_negotiation" format="counter"/>)
      associated
with the data channel in the "m=" section representing the SCTP association used
to realize the data channel. The value of the 'dcmap-stream-id', 'max-retr', and 'max-time'
values of the dcmap attribute <bcp14>SHALL</bcp14> be identical to the value used for the data channel
in the offer, and
</li>
          <li><bcp14>MAY</bcp14> include one or more SDP dcsa attributes (<xref target="prot_att"/>) associated with the
      data channel. 

</li>
        </ul>
      </section>
      <section>
        <name>Offerer Processing of the SDP Answer</name>
        <t>An offerer receiving an SDP answer performs the following:

        </t>
        <ul spacing="normal">
          <li>It <bcp14>SHALL</bcp14> close any created data channels as described in 
       <xref target="close-dc"/>
       for which the expected "a=dcmap:" attributes are not 
       present in the SDP answer. If the SDP answer has no "a=dcmap:" attributes, either the peer does not support "a=dcmap:" attributes or 
            it rejected all the data channels. In either case, the offerer
            closes all the data channels offered by SDP that were open at the time of the offer. 
            The DTLS association and SCTP association will still be set up. At this
   point, the offerer may use DCEP negotiation <xref target="RFC8832"/> to open data channels.</li>
        </ul>
        <t>Each agent application <bcp14>MUST</bcp14> wait to send data until it has 
     confirmation that the data channel at the peer is instantiated. 
     For WebRTC, this is when both data channel stacks have channel 
     parameters instantiated and occurs as follows:

        </t>
        <ul spacing="normal">
          <li>At both peers when a data channel is created without a previously
      established SCTP association, as soon as the SCTP association
      is successfully established.</li>
          <li>At the agent receiving an SDP offer for which there is an 
      established SCTP association, as soon as it creates the 
      negotiated data channel based on information 
      signaled in the SDP offer.</li>
          <li>At the agent sending an SDP offer to create a new data channel for which there is an established SCTP 
      association, when it receives the SDP answer confirming acceptance 
      of the data channel or when it begins to receive data on the 
      data channel from the peer, whichever occurs first.</li>
        </ul>
      </section>
                        <section>
        <name>Modifying the Session</name>
        <t>When an offerer sends a subsequent offer that includes information for
   a previously negotiated data channel, unless the offerer intends to
   close the data channel (<xref target="close-dc"/>), the offerer <bcp14>SHALL</bcp14> include the
   previously negotiated SDP attributes and attribute values associated with the
   data channel. The answerer may reject the offer. The means for rejecting an offer are dependent on
   the higher-layer protocol.  The offer/answer exchange is atomic; if the answer is rejected, the session reverts to the state prior to the
   offer <xref target="RFC3264"/>.


        </t>
        <section anchor="close-dc">
          <name>Closing a Data Channel</name>
          <t>In order to close a data channel, the endpoint that wants to
          close the data channel
   <bcp14>SHALL</bcp14> send an SCTP SSN Reset message <xref target="RFC6525"/>, following the procedure in <xref target="RFC8831" sectionFormat="of" section="6.7"/>.
In addition, if the closed data channel was negotiated using the offer/answer
mechanism (<xref target="opendc"/>), the endpoint that closed the data channel
<bcp14>SHALL</bcp14> send a subsequent offer in which it does one of the following:
</t>
          <ul spacing="normal">
            <li>Removes the SDP dcmap attribute and SDP dcsa attributes
            associated with the closed data channel. Once the endpoint
            receives a successful answer, the SCTP stream identifier value can
            later be used for a new data channel (negotiated using either SCTP
            or the offer/answer mechanism), or
</li>
            <li>After a reset has been performed, reuses the SCTP stream used for the closed data channel for a new data channel, following the procedure in <xref target="opendc"/>. The offerer <bcp14>SHALL</bcp14> use a different SDP dcmap attribute value for the data channel using the same SCTP stream. 
        </li>
          </ul>
        </section>
             </section>
      <section anchor="various_SDP_OA_considerations">
        <name>Various SDP Offer/Answer Considerations</name>
            <t>An SDP offer or answer has no "a=dcmap:" attributes but has "a=dcsa:" attributes:
            </t>
            <ul spacing="normal">
              <li>This is considered an error case. In this case, the receiver of such an
            SDP offer or answer <bcp14>MUST</bcp14> discard the "a=dcsa:" attributes.
         </li>
            </ul>
            <t>An SDP offer or answer has an "a=dcsa:" attribute whose subprotocol attribute 
       is unknown:
            </t>
            <ul spacing="normal">
              <li>The receiver of such an SDP offer or answer <bcp14>SHOULD</bcp14> ignore this 
         entire "a=dcsa:" attribute line.
         </li>
            </ul>
            <t>An SDP offer or answer has an "a=dcsa:" attribute whose subprotocol attribute 
       is known but whose subprotocol attribute semantic is not known for the 
       data channel transport case:
            </t>
            <ul spacing="normal">
              <li>The receiver of such an SDP offer or answer <bcp14>SHOULD</bcp14> ignore this 
         entire "a=dcsa:" attribute line.
         </li>
            </ul>
      </section>
                </section>
                <section anchor="examples">
      <name>Examples</name>

      <t><xref target="example1"/> shows an example of an SDP offer and answer
      where the SDP answerer rejects the data channel 
   with stream id 0 either for explicit reasons or because it does not 
   understand the "a=dcmap:" attribute. 
   As a result, the offerer will close the data channel created with the 
   SDP offer/answer negotiation option. 
   The SCTP association will still be set up over DTLS. 
   At this point, the offerer or the answerer may use DCEP negotiation to open data 
   channels.</t>

      <figure anchor="example1">
        <name>Example 1</name>
<sourcecode name="example-1-sdp-offer" type="sdp"><![CDATA[
  m=application 10001 UDP/DTLS/SCTP webrtc-datachannel
  c=IN IP6 2001:db8::3
  a=max-message-size:100000
  a=sctp-port:5000
  a=setup:actpass
  a=fingerprint:SHA-1 \
      4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB
  a=tls-id:abc3de65cddef001be82
  a=dcmap:0 subprotocol="bfcp";label="bfcp"]]></sourcecode>
<sourcecode name="example-1-sdp-answer" type="sdp"><![CDATA[ 
  m=application 10002 UDP/DTLS/SCTP webrtc-datachannel
  c=IN IP6 2001:db8::1
  a=max-message-size:100000
  a=sctp-port:5002
  a=setup:passive
  a=fingerprint:SHA-1 \
      5B:AD:67:B1:3E:82:AC:3B:90:02:B1:DF:12:5D:CA:6B:3F:E5:54:FA
  a=tls-id:dcb3ae65cddef0532d42]]></sourcecode>  </figure>

      <t><xref target="example2"/> shows an example of an SDP offer and answer
      where the SDP offer contains data channels for BFCP and
   MSRP subprotocols. The SDP answer rejects BFCP and accepts MSRP. 
   So, the offerer closes the data channel for BFCP, and both the offerer 
   and the answerer may start using the MSRP data channel 
   (after the SCTP association is set&nbsp;up).
   The data channel with stream id 0 is free and can be used for future 
   DCEP or SDP offer/answer negotiation.</t>

      <figure anchor="example2">
        <name>Example 2</name>
<sourcecode name="example-2-sdp-offer" type="sdp"><![CDATA[
  m=application 10001 UDP/DTLS/SCTP webrtc-datachannel
  c=IN IP4 192.0.2.1
  a=max-message-size:100000
  a=sctp-port:5000
  a=setup:actpass
  a=fingerprint:SHA-1 \
      4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB
  a=tls-id:abc3de65cddef001be82
  a=dcmap:0 subprotocol="bfcp";label="bfcp"
  a=dcmap:2 subprotocol="msrp";label="msrp"  
  a=dcsa:2 accept-types:message/cpim text/plain
  a=dcsa:2 path:msrp://alice.example.com:10001/2s93i93idj;dc]]></sourcecode>
<sourcecode name="example-2-sdp-answer" type="sdp"><![CDATA[
  m=application 10002 UDP/DTLS/SCTP webrtc-datachannel
  c=IN IP4 192.0.2.2
  a=max-message-size:100000
  a=sctp-port:5002
  a=setup:passive
  a=fingerprint:SHA-1 \
      5B:AD:67:B1:3E:82:AC:3B:90:02:B1:DF:12:5D:CA:6B:3F:E5:54:FA
  a=tls-id:dcb3ae65cddef0532d42
  a=dcmap:2 subprotocol="msrp";label="msrp"  
  a=dcsa:2 accept-types:message/cpim text/plain
  a=dcsa:2 path:msrp://bob.example.com:10002/si438dsaodes;dc]]></sourcecode> </figure>

      <t>The example in <xref target="example3"/> is a continuation of the example in <xref target="example2"/>. 
   The SDP offerer now removes the MSRP data channel with stream id 2
   but opens a new MSRP data channel with stream id 4. 
   The answerer accepts the entire offer. 
   As a result, the offerer closes the previously negotiated MSRP-related data channel,
   and both the offerer and the answerer may start using the new MSRP-related data
      channel.</t>

      <figure anchor="example3">
        <name>Example 3</name>
<sourcecode name="example-3-sdp-offer" type="sdp"><![CDATA[
  m=application 10001 UDP/DTLS/SCTP webrtc-datachannel
  c=IN IP4 192.0.2.1
  a=max-message-size:100000
  a=sctp-port:5000
  a=setup:actpass
  a=fingerprint:SHA-1 \
      4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB
  a=tls-id:abc3de65cddef001be82
  a=dcmap:4 subprotocol="msrp";label="msrp"
  a=dcsa:4 accept-types:message/cpim text/plain
  a=dcsa:4 path:msrp://alice.example.com:10001/2s93i93idj;dc]]></sourcecode>
<sourcecode name="example-3-sdp-answer" type="sdp"><![CDATA[
  m=application 10002 UDP/DTLS/SCTP webrtc-datachannel
  c=IN IP4 192.0.2.2
  a=max-message-size:100000
  a=sctp-port:5002
  a=setup:passive
  a=fingerprint:SHA-1 \
      5B:AD:67:B1:3E:82:AC:3B:90:02:B1:DF:12:5D:CA:6B:3F:E5:54:FA
  a=tls-id:dcb3ae65cddef0532d42
  a=dcmap:4 subprotocol="msrp";label="msrp"
  a=dcsa:4 accept-types:message/cpim text/plain
  a=dcsa:4 path:msrp://bob.example.com:10002/si438dsaodes;dc]]></sourcecode> </figure>
    </section>
                <section anchor="sec-cons">
      <name>Security Considerations</name>
      <t>This document specifies new SDP attributes used in the negotiation of data channel parameters. </t>
      <t>
These parameters are negotiated as part of opening an SCTP channel over DTLS as specified in <xref target="RFC8841"/>. Each 
subprotocol may come with its own security considerations that need to be documented as part of the subprotocol definition.
Otherwise, this document does not add any security considerations to those specified in <xref target="RFC8841"/>.
      </t>
      <t>Error cases such as the use of unknown parameter values or violations
      of the odd/even rule (<xref target="id_mgmt"/>) <bcp14>MUST</bcp14>
   be handled by closing the corresponding data channel.</t>
    </section>
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <section anchor="IANA_subproto_ids">
        <name>Subprotocol Identifiers</name>
        <t>Registration of new subprotocol identifiers is performed using the existing IANA 
    "WebSocket Subprotocol Name Registry" table.</t>
        <t>The following text has been added below the title of the table.</t>
        <t>"This table also includes subprotocol identifiers specified for usage within a 
    WebRTC data channel."</t>
        <t>This document (RFC 8864) has been added to the "Reference" list for
        the registry.</t>
        <t>This document assigns no new values to this table.</t>
        <t>A subprotocol may simultaneously be defined for data channel transport 
    and for WebSocket transport.
    In such a case, the "Subprotocol Definition" and "Reference" cells in the 
    subprotocol's row of the IANA "WebSocket Subprotocol Name Registry" table should 
    contain two entries.
    One entry in each of these cells should refer to the WebSocket-related 
    subprotocol specification, and the other entry should refer to the
    data-channel-related subprotocol specification.
        </t>
      </section>
      <section>
        <name>New SDP Attributes</name>
        <section anchor="IANA-reg-dcmap">
          <name>dcmap</name>
          <t>This document defines a new SDP media-level attribute, "a=dcmap:", as follows:
          </t>
       <table anchor="dcmap-iana">
         <name>New "a=dcmap:" Attribute</name>
           <thead>
             <tr>
               <th colspan="2" align="center">"a=dcmap:"</th>
             </tr>
           </thead>
            <tbody>
              <tr>
                <td align="left">Contact name</td>
                <td align="left">IESG</td>
              </tr>
              <tr>
                <td align="left">Contact email</td>
                <td align="left">iesg@ietf.org</td>
              </tr>
              <tr>
                <td align="left">Attribute name</td>
                <td align="left">dcmap</td>
              </tr>
              <tr>
                <td align="left">Attribute syntax</td>
                <td align="left">As per <xref target="dcmap-attr-definition"/>
                </td>
              </tr>
              <tr>
                <td align="left">Attribute semantics</td>
                <td align="left">As per <xref target="dcmap-attr-definition"/>
                </td>
              </tr>
              <tr>
                <td align="left">Usage level</td>
                <td align="left">media</td>
              </tr>
              <tr>
                <td align="left">Charset dependent</td>
                <td align="left">No</td>
              </tr>
              <tr>
                <td align="left">Purpose</td>
                <td align="left">To define data-channel-specific parameters</td>
              </tr>
              <tr>
                <td align="left">Appropriate values</td>
                <td align="left">As per <xref target="dcmap-attr-definition"/>
                </td>
              </tr>
              <tr>
                <td align="left">O/A procedures</td>
                <td align="left">SDP offer/answer procedures as per <xref target="section_procedures"/>
                </td>
              </tr>
              <tr>
                <td align="left">Mux category</td>
                <td align="left">SPECIAL. See <xref target="dcmap-mux-category"/>
                </td>
              </tr>
              <tr>
                <td align="left">Reference</td>
                <td align="left">RFC 8864</td>
              </tr>
            </tbody>
          </table>
        </section>
        <section anchor="IANA-reg-dcsa">
          <name>dcsa</name>
          <t>This document defines a new SDP media-level attribute, "a=dcsa:", as follows:
          </t>

       <table anchor="dcsa-iana">
         <name>New "a=dcsa:" Attribute</name>
           <thead>
             <tr>
               <th colspan="2" align="center">"a=dcsa:"</th>
             </tr>
           </thead>
            <tbody>
              <tr>
                <td align="left">Contact name</td>
                <td align="left">IESG</td>
              </tr>
              <tr>
                <td align="left">Contact email</td>
                <td align="left">iesg@ietf.org</td>
              </tr>
              <tr>
                <td align="left">Attribute name</td>
                <td align="left">dcsa</td>
              </tr>
              <tr>
                <td align="left">Attribute syntax</td>
                <td align="left">As per <xref target="dcsa-attribute"/>
                </td>
              </tr>
              <tr>
                <td align="left">Attribute semantics</td>
                <td align="left">As per <xref target="dcsa-attribute"/>
                </td>
              </tr>
              <tr>
                <td align="left">Usage level</td>
                <td align="left">media</td>
              </tr>
              <tr>
                <td align="left">Charset dependent</td>
                <td align="left">No</td>
              </tr>
              <tr>
                <td align="left">Purpose</td>
                <td align="left">To define attributes that are specific to data channel subprotocols</td>
              </tr>
              <tr>
                <td align="left">Appropriate values</td>
                <td align="left">As per <xref target="dcsa-attribute"/>
                </td>
              </tr>
              <tr>
                <td align="left">O/A procedures</td>
                <td align="left">SDP offer/answer procedures as per <xref target="section_procedures"/>
                </td>
              </tr>
              <tr>
                <td align="left">Mux category</td>
                <td align="left">SPECIAL. See <xref target="dcsa-mux-category"/>
                </td>
              </tr>
              <tr>
                <td align="left">Reference</td>
                <td align="left">RFC 8864</td>
              </tr>
            </tbody>
          </table>
        </section>
      </section>
     <section anchor="IANA-reg-data-channel-attribs">
          <name>Registering Attributes for Use with Data Channels</name>
        <t>When a subprotocol is defined for use over data channels with
        the SDP offer/answer mechanism, any SDP attributes that may be
        negotiated using the "a=dcsa:" attribute <bcp14>MUST</bcp14> be added to the IANA
        "attribute-name registry (formerly "att-field")", as specified in
        <xref target="RFC8866" sectionFormat="comma" section="8.2.4"/>.  This
        document specifies that new Usage Levels of the form "dcsa (foo)"
        (where "foo" is a placeholder for the subprotocol name) should be
        registered by documents that specify negotiation of particular
        subprotocols.</t>
        <t>IANA has updated the "attribute-name (formerly "att-field")"
        registry to point to this document.</t>
     </section>
    </section>
  </middle>
  <back>

    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4960.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3264.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6525.xml"/>
<xi:include
    href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3629.xml"/>

<!-- draft-ietf-rtcweb-data-channel (RFC 8831) -->
<reference anchor="RFC8831" target="https://www.rfc-editor.org/info/rfc8831">
<front>
<title>WebRTC Data Channels</title>
<author initials="R" surname="Jesup" fullname="Randell Jesup">
  <organization/>
</author>
<author initials="S" surname="Loreto" fullname="Salvatore Loreto">
  <organization/>
</author>
<author initials="M" surname="Tüxen" fullname="Michael Tüxen">
  <organization/>
</author>
<date month='January' year='2021'/>
</front>
<seriesInfo name="RFC" value="8831"/>
<seriesInfo name="DOI" value="10.17487/RFC8831"/>
</reference>

<!-- draft-ietf-mmusic-rfc4566bis (RFC 8866) -->
        <reference anchor="RFC8866" target="https://www.rfc-editor.org/info/rfc8866">
          <front>
            <title>SDP: Session Description Protocol</title>
            <author initials="A" surname="Begen" fullname="Ali Begen">
              <organization/>
            </author>
            <author initials="P" surname="Kyzivat" fullname="Paul Kyzivat">
              <organization/>
            </author>
            <author initials="C" surname="Perkins" fullname="Colin Perkins">
              <organization/>
            </author>
            <author initials="M" surname="Handley" fullname="Mark Handley">
              <organization/>
            </author>
            <date month="January" year="2021"/>
          </front>
          <seriesInfo name="RFC" value="8866"/>
          <seriesInfo name="DOI" value="10.17487/RFC8866"/>
        </reference>

<!-- draft-ietf-mmusic-sctp-sdp (RFC 8841) -->
<reference anchor="RFC8841" target="https://www.rfc-editor.org/info/rfc8841">
  <front>
    <title>Session Description Protocol (SDP) Offer/Answer Procedures for
    Stream Control Transmission Protocol (SCTP) over Datagram Transport Layer
    Security (DTLS) Transport</title>
    <author initials="C." surname="Holmberg" fullname="Christer Holmberg">
      <organization />
    </author>
    <author initials="R." surname="Shpount" fullname="Roman Shpount">
      <organization />
    </author>
    <author initials="S." surname="Loreto" fullname="Salvatore Loreto">
      <organization />
    </author>
    <author initials="G." surname="Camarillo" fullname="Gonzalo Camarillo">
      <organization />
    </author>
    <date month="January" year="2021" />
  </front>
  <seriesInfo name="RFC" value="8841" />
  <seriesInfo name="DOI" value="10.17487/RFC8841"/>
</reference>

<!-- draft-ietf-mmusic-sdp-mux-attributes (RFC 8859) -->
<reference anchor="RFC8859" target="https://www.rfc-editor.org/info/rfc8859">
  <front>
    <title>A Framework for Session Description Protocol (SDP) Attributes When Multiplexing</title>
    <author initials="S" surname="Nandakumar" fullname="Suhas Nandakumar">
      <organization/>
    </author>
    <date month="January" year="2021"/>
  </front>
    <seriesInfo name="RFC" value="8859"/>
    <seriesInfo name="DOI" value="10.17487/RFC8859"/>
</reference>

<!-- draft-ietf-rtcweb-data-protocol (RFC 8832) -->
<reference anchor="RFC8832" target="https://www.rfc-editor.org/info/rfc8832">
<front>
<title>WebRTC Data Channel Establishment Protocol</title>
<author initials='R.' surname='Jesup' fullname='Randell Jesup'>
  <organization/>
</author>
<author initials='S.' surname='Loreto' fullname='Salvatore Loreto'>
  <organization/>
</author>
<author initials='M' surname='Tüxen' fullname='Michael Tüxen'>
  <organization/>
</author>
<date month='January' year='2021'/>
</front>
<seriesInfo name="RFC" value="8832"/>
<seriesInfo name="DOI" value="10.17487/RFC8832"/>
</reference>

      </references>
      <references>
        <name>Informative References</name>

<!-- draft-ietf-bfcpbis-rfc4582bis (RFC 8855) -->
<reference anchor="RFC8855" target="https://www.rfc-editor.org/info/rfc8855">
  <front>
    <title>The Binary Floor Control Protocol (BFCP)</title>
    <author initials="G." surname="Camarillo" fullname="Gonzalo Camarillo">
      <organization />
    </author>
    <author initials="K." surname="Drage" fullname="Keith Drage">
      <organization />
    </author>
    <author initials="T." surname="Kristensen" fullname="Tom Kristensen">
      <organization />
    </author>
    <author initials="J." surname="Ott" fullname="Jörg Ott">
      <organization />
    </author>
    <author initials="C." surname="Eckel" fullname="Charles Eckel">
      <organization />
    </author>
    <date month="January" year="2021" />
  </front>
  <seriesInfo name="RFC" value="8855" />
  <seriesInfo name="DOI" value="10.17487/RFC8855"/>
</reference>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4975.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6455.xml"/>

<!-- draft-ietf-clue-datachannel (RFC 8850) -->
        <reference anchor="RFC8850" target="https://www.rfc-editor.org/info/rfc8850">
          <front>
            <title>Controlling Multiple Streams for Telepresence (CLUE) Protocol Data Channel</title>
            <author initials="C." surname="Holmberg" fullname="Christer Holmberg">
              <organization/>
            </author>
           <date month="January" year="2021"/>
          </front>
          <seriesInfo name="RFC" value="8850"/>
          <seriesInfo name="DOI" value="10.17487/RFC8850"/>
        </reference>

<!-- draft-ietf-mmusic-msrp-usage-data-channel (RFC 8873) -->
<reference anchor='RFC8873' target="https://www.rfc-editor.org/info/rfc8873">
<front>
<title>Message Session Relay Protocol (MSRP) over Data Channels</title>
<author initials='JM.' surname='Recio' fullname='Jose Recio' role='editor'>
    <organization />
</author>
<author initials='C' surname='Holmberg' fullname='Christer Holmberg'>
    <organization />
</author>
<date month='January' year='2021' />
</front>
<seriesInfo name="RFC" value="8873"/>
<seriesInfo name="DOI" value="10.17487/RFC8873"/>
</reference>

   <reference anchor="WebRtcAPI" target="https://www.w3.org/TR/webrtc/">
     <front>
       <title>WebRTC 1.0: Real-time Communication Between Browsers</title>
       <author initials="C." surname="Jennings" fullname="Cullen Jennings">
         <organization/>
       </author>
       <author initials="H." surname="Boström" fullname="Henrik Boström">
         <organization/>
       </author>
       <author initials="J-I." surname="Bruaroey" fullname="Jan-Ivar Bruaroey">
         <organization/>
       </author>
       <date/>
     </front>
       <refcontent>W3C Proposed Recommendation</refcontent>
   </reference>

  <reference anchor="T38"
  target="https://www.itu.int/rec/T-REC-T.38-201511-I/en">
  <front>
   <title>Procedures for real-time Group 3 facsimile communication over IP networks</title>
   <author>
       <organization>International Telecommunication Union</organization>
   </author>
   <date month="November" year="2015"/>
  </front>
  <seriesInfo name="ITU-T Recommendation" value="T.38"/>
  </reference>
      </references>
    </references>
    <section anchor="generic-out-of-band-aspects">
      <name>Generic Data Channel Negotiation Aspects when Not Using DCEP</name>
      <t>This appendix summarizes how data channels work in general and discusses 
   some key aspects that should be considered for the out-of-band negotiation of data 
   channels if DCEP is not used.</t>
      <t>A WebRTC application creates a data channel
   by providing a number of setup parameters (subprotocol, label, 
   maximal number of retransmissions, maximal retransmission time, order of delivery, 
   priority). The application also specifies whether
   it wants to make use of the negotiation using DCEP 
   <xref target="RFC8832"/> or 
   intends to negotiate data channels using the SDP offer/answer protocol.</t>
      <t>In any case, the SDP offer generated by the application is per 
   <xref target="RFC8841"/>. In brief, it contains one 
   "m=" line for the SCTP association on top of which the data channels will run:
</t>
<sourcecode name="app-a-sdp-example" type="sdp"><![CDATA[
m=application 54111 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 192.0.2.1
a=max-message-size:100000
a=sctp-port:5000
a=tls-id:abc3de65cddef001be82
a=setup:actpass
a=fingerprint:SHA-1 \
    4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB]]></sourcecode>

      <aside><t>Note: A WebRTC application will only use the "m=" line format "webrtc-datachannel"
   and will not use other formats in the "m=" line for other protocols 
   such as T.38 <xref target="T38"/>.
   <xref target="RFC8841"/> supports only one SCTP
   association to be established on top of a DTLS association. 
      </t></aside>
      <aside><t>Note: The above SDP media description does not contain any channel-specific 
   information.</t></aside>
      <section anchor="si_num">
        <name>Stream Identifier Numbering</name>
        <t>Independently from the requested type of negotiation, the application 
    creating a data channel can either (1)&nbsp;pass the stream identifier to the data channel stack to assign
    to the data channel or (2)&nbsp;let the data channel stack pick 
    one identifier from the unused ones.</t>
        <t>Moreover, to avoid glare situations <xref target="RFC3264"/>, each endpoint can own an 
    exclusive set of stream identifiers, in which case an endpoint can 
    only create a data channel with a stream identifier it owns.</t>
        <t>Which set of stream identifiers is owned by which endpoint is 
    determined by convention or other means.

        </t>
          <aside><t>Note: For data channels negotiated with DCEP, one endpoint owns by 
      convention the even stream identifiers, whereas the other owns the 
      odd stream identifiers, as defined in 
      <xref target="RFC8832"/>.</t></aside>

        <aside><t>Note: For data channels negotiated via a protocol other than DCEP, 
      no convention is defined by default.</t></aside>
      </section>
      <section anchor="sec-gen-ext-neg">
        <name>Generic Data Channel Negotiation Not Using DCEP</name>
        <section>
          <name>Overview</name>
          <t>DCEP negotiation only provides for negotiation of data channel 
     transport parameters and does not provide for negotiation of
     subprotocol-specific parameters. Non-DCEP data channel negotiation can be defined to 
     allow negotiation of parameters beyond those handled by DCEP, 
     e.g., parameters specific to the subprotocol instantiated on a 
     particular data channel.</t>
          <t>The following procedures are common to all methods of data channel
     negotiation not using DCEP, whether in-band (communicated using proprietary means on 
     an already-established data channel) or out-of-band (using the SDP
     offer/answer mechanism or 
     some other protocol associated with the signaling channel).</t>
        </section>
        <section anchor="ext_open">
          <name>Opening a Data Channel</name>
          <t>In the case of non-DCEP negotiation, the endpoint application has the 
     option to fully control the stream identifier assignments. However,
     these assignments have to coexist with the assignments controlled by 
     the data channel stack for data channels negotiated using DCEP (if 
     any). It is the responsibility of the application to ensure consistent 
     assignment of stream identifiers.</t>
          <t>When the application requests that the creation of a new data channel 
     be set up via non-DCEP negotiation, the data channel stack creates 
     the data channel locally without sending any DATA_CHANNEL_OPEN messages
     in-band. 
     However, even if the ICE (Interactive Connectivity Establishment), 
     DTLS, and SCTP procedures were already successfully 
     completed, the application can't send data on this data channel until the 
     negotiation with the peer is complete. This is because the peer needs 
     to be aware of and accept the usage of this data channel. The 
     peer, after accepting the data channel offer, can start sending data 
     immediately. This implies that the offerer may receive data channel 
     subprotocol messages 
     before the negotiation is complete, and the application should be 
     ready to handle it.</t>
          <t>If the peer rejects the data channel part of the offer, then it 
     doesn't have to do anything, as the data channel was not created using 
     the stack. The offerer, on the other hand, needs to close the data 
     channel that was opened by invoking relevant data channel stack API 
     procedures.</t>
          <t>It is also worth noting that a data channel stack implementation may 
     not provide any APIs to create and close data channels; instead, the 
     data channels may be used on the fly as needed, just by communicating 
     via non-DCEP means or even by having some local configuration/assumptions 
     on both of the peers.</t>
          <t>The application then negotiates the data channel 
     properties and subprotocol properties with the peer's application 
     using a mechanism different from DCEP.</t>
          <t>The peer then symmetrically creates a data channel 
     with these negotiated data channel properties. This is the only way 
     for the peer's data channel stack to know which properties to apply 
     when transmitting data on this channel. 
     The data channel stack must 
     allow data channel creation with any nonconflicting stream identifier 
     so that both peers can create the data channel with the same 
     stream identifier.
          </t>
        </section>
        <section>
          <name>Closing a Data Channel</name>
          <t>When the application requests the closing of a 
     data channel negotiated without DCEP, 
     the data channel stack always performs an SCTP SSN 
     Reset for this channel.</t>
          <t>Depending upon the method used for non-DCEP negotiation and the 
     subprotocol associated with the data channel, the closing of the data channel might also be signaled to the peer via SDP offer/answer negotiation.</t>
        </section>
      </section>
                </section>
    <section anchor="acknowledgements" numbered="false">
      <name>Acknowledgements</name>
      <t>The authors wish to acknowledge the borrowing of ideas from other 
   draft documents by <contact fullname="Salvatore Loreto"/>, <contact
   fullname="Gonzalo Camarillo"/>, <contact fullname="Peter Dunkley"/>, and
   <contact fullname="Gavin Llewellyn"/>. The authors also wish to thank <contact
   fullname="Flemming Andreasen"/>, <contact fullname="Christian Groves"/>, 
   <contact fullname="Gunnar Hellström"/>, <contact fullname="Paul
   Kyzivat"/>, <contact fullname="Jonathan Lennox"/>, 
   <contact fullname="Uwe Rauschenbach"/>, and <contact fullname="Roman Shpount"/> for their invaluable comments.</t>
      <t>Special thanks to <contact fullname="Christer Holmberg"/> for helping
      finish the document and cleaning up <xref target="section_procedures"/>.
</t>
    </section>
    <section anchor="contributors" numbered="false">
      <name>Contributors</name>
      <t><contact fullname="Juergen Stoetzer-Bradler"/> made significant
      contributions to this document and should be considered a coauthor.</t>
    </section>
        </back>
</rfc>
