RFC 8832
WebRTC Data Channel Establishment Protocol
RFC 8832: WebRTC Data Channel Establishment Protocol ๐
okay bestie, RFC 8832 is giving main character energy ๐ It's a Standards Track doc from the IETF (Request for Comments: 8832, ISSN 2070-1721), dated January 2021. The authors are R. Jesup (Mozilla), S. Loreto (Ericsson), and M. Tรผxen (Mรผnster Univ. of Appl. Sciences) ๐ฆ
Abstract ๐
so the WebRTC framework is what lets two browsers do direct, interactive, rich comms using audio, video, and data ๐ธ this doc is about a simple protocol for setting up symmetric data channels between the two peers. it uses a two-way handshake, and you can send user data without waiting for that handshake to finish. iconic โจ
Status of This Memo ๐
ngl this part is kinda formal, but we're getting through it together ๐
This is an Internet Standards Track document.
It's a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community, got public review, and was approved for publication by the Internet Engineering Steering Group (IESG). If you want more on Internet Standards, check Section 2 of RFC 7841.
For the current status, any errata, and how to give feedback, head to https://www.rfc-editor.org/info/rfc8832 โจ
Copyright Notice โ๏ธ
Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved.
This doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as in effect on the date of publication. Please review those carefully, since they spell out your rights and restrictions. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they're provided without warranty as described in the Simplified BSD License ๐ซถ
Table of Contents ๐บ๏ธ
1. Introduction
2. Conventions
3. Terminology
4. Protocol Overview
5. Message Formats
5.1. DATA_CHANNEL_OPEN Message
5.2. DATA_CHANNEL_ACK Message
6. Procedures
7. Security Considerations
8. IANA Considerations
8.1. SCTP Payload Protocol Identifier
8.2. New Standalone Registry for DCEP
8.2.1. New Message Type Registry
8.2.2. New Channel Type Registry
9. References
9.1. Normative References
9.2. Informative References
Acknowledgements
Authors' Addresses
1. Introduction ๐
the Data Channel Establishment Protocol (DCEP) is designed to give you, in the WebRTC data channel context [RFC8831], a simple in-band way to open symmetric data channels ๐ as [RFC8831] explains, the protocol runs on the Stream Control Transmission Protocol (SCTP) [RFC4960], which is encapsulated in Datagram Transport Layer Security (DTLS) (described in [RFC8261]). so DCEP gets to borrow the already standardized transport and security features of SCTP and DTLS, which is so efficient ๐ง
DTLS 1.0 is defined in [RFC4347]. The present latest version, DTLS 1.2, is defined in [RFC6347]. And an upcoming version, DTLS 1.3, is defined in [TLS-DTLS13] ๐ฆ
2. Conventions ๐
okay, this one's important ๐ the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this doc get read as described in BCP 14 [RFC2119] [RFC8174], but only when, and only when, they show up in ALL CAPS, exactly like shown here. lowercase versions are just regular words ๐
3. Terminology ๐
this doc uses the following terms:
- Association: An SCTP association.
- Stream: A unidirectional stream of an SCTP association. It's uniquely identified by an SCTP stream identifier (0-65534). Note: The SCTP stream identifier 65535 is reserved, because SCTP INIT and INIT-ACK chunks only allow a maximum of 65535 streams to be negotiated (0-65534).
- Stream Identifier: The SCTP stream identifier uniquely identifying a stream.
- Data Channel: Two streams with the same stream identifier, one in each direction, which are managed together ๐
4. Protocol Overview ๐งฉ
DCEP is a simple, low-overhead way to establish bidirectional data channels over an SCTP association, with a consistent set of properties โจ
The set of consistent properties includes:
- reliable or unreliable message transmission. In case of unreliable transmissions, the same level of unreliability is used.
- in-order or out-of-order message delivery.
- the priority of the data channel.
- an optional label for the data channel.
- an optional protocol for the data channel.
- the streams.
this protocol uses a two-way handshake to open a data channel ๐ค the handshake pairs one incoming and one outgoing stream, both with the same stream identifier, into a single bidirectional data channel. the peer that starts opening a data channel picks a stream identifier whose incoming and outgoing streams are unused, then sends a DATA_CHANNEL_OPEN message on the outgoing stream. the other peer replies with a DATA_CHANNEL_ACK message on its corresponding outgoing stream. then the data channel is open ๐ DCEP messages travel on the same stream as the user messages belonging to that data channel. the demultiplexing is based on the SCTP Payload Protocol Identifier (PPID), since DCEP uses a specific PPID.
Note: The opening side MAY send user messages before the DATA_CHANNEL_ACK is received. ๐
to avoid collisions where both sides try to open a data channel with the same stream identifiers, each side MUST use streams with either even or odd stream identifiers when sending a DATA_CHANNEL_OPEN message ๐ when using SCTP over DTLS [RFC8261], which side gets odd or even is based on the underlying DTLS connection role. the side acting as the DTLS client MUST use streams with even stream identifiers, and the side acting as the DTLS server MUST use streams with odd stream identifiers.
Note: There is no attempt to ensure uniqueness for the label. If both sides open a data channel labeled"x"at the same time, there will be two data channels labeled"x", one on an even stream pair and one on an odd pair ๐ฏ
the purpose of the protocol field is to ease cross-application interoperation ("federation") by identifying the user data being passed, using an IANA-registered string from the "WebSocket Subprotocol Name Registry" defined in [RFC6455] ๐ธ the field may be useful for homogeneous applications that create more than one type of data channel. note that there is no attempt to ensure uniqueness for the protocol field.
5. Message Formats ๐จ
every DCEP message starts with a one-byte field called "Message Type" that tells you what kind of message it is. The corresponding values are managed by IANA (see Section 8.2.1) ๐ง
5.1. DATA_CHANNEL_OPEN Message ๐
okay so this is the big one ๐ the DATA_CHANNEL_OPEN message gets sent over the data channel itself, on the same stream the user messages use ๐ฆ here's the layout:
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message Type | Channel Type | Priority |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reliability Parameter |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Label Length | Protocol Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\ /
| Label |
/ \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\ /
| Protocol |
/ \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Message Type: 1 byte (unsigned integer) ๐ This is the IANA-defined message type for DATA_CHANNEL_OPEN. Its value is 0x03, as specified in Section 8.2.1.
Channel Type: 1 byte (unsigned integer) ๐ This picks what kind of data channel you're opening. The values are managed by IANA (see Section 8.2.2):
DATA_CHANNEL_RELIABLE(0x00): a reliable, in-order, bidirectional channel ๐DATA_CHANNEL_RELIABLE_UNORDERED(0x80): a reliable, unordered, bidirectional channel ๐ฆDATA_CHANNEL_PARTIAL_RELIABLE_REXMIT(0x01): partially reliable and in-order, bidirectional. User messages won't be retransmitted more times than the Reliability Parameter says ๐DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT_UNORDERED(0x81): partially reliable and unordered, bidirectional. Same retransmission cap as above โจDATA_CHANNEL_PARTIAL_RELIABLE_TIMED(0x02): partially reliable and in-order, bidirectional. User messages might not get sent or retransmitted after a lifetime given in milliseconds in the Reliability Parameter. That lifetime starts when the user message is handed to the protocol stack โฐDATA_CHANNEL_PARTIAL_RELIABLE_TIMED_UNORDERED(0x82): partially reliable and unordered, bidirectional. Same timed lifetime rules as above ๐ง
Priority: 2 bytes (unsigned integer) ๐ The priority of the data channel, as described in [RFC8831].
Reliability Parameter: 4 bytes (unsigned integer) ๐ For reliable data channels, this field MUST be set to 0 on the sending side and MUST be ignored on the receiving side. If you're using a partially reliable channel with a limited number of retransmissions, this field is the number of retransmissions. If you're using a partially reliable channel with a limited lifetime, this field is the maximum lifetime in milliseconds. Here's the cheat sheet:
+================================================+=============+
| Channel Type | Reliability |
| | Parameter |
+================================================+=============+
| DATA_CHANNEL_RELIABLE | Ignored |
+------------------------------------------------+-------------+
| DATA_CHANNEL_RELIABLE_UNORDERED | Ignored |
+------------------------------------------------+-------------+
| DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT | Number of |
| | RTX |
+------------------------------------------------+-------------+
| DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT_UNORDERED | Number of |
| | RTX |
+------------------------------------------------+-------------+
| DATA_CHANNEL_PARTIAL_RELIABLE_TIMED | Lifetime in |
| | ms |
+------------------------------------------------+-------------+
| DATA_CHANNEL_PARTIAL_RELIABLE_TIMED_UNORDERED | Lifetime in |
| | ms |
+------------------------------------------------+-------------+
Table 1
Label Length: 2 bytes (unsigned integer) ๐ท๏ธ How long the label field is, in bytes.
Protocol Length: 2 bytes (unsigned integer) ๐ฎ How long the protocol field is, in bytes.
Label: Variable length (sequence of characters) ๐ The name of the data channel, as a UTF-8-encoded string per [RFC3629]. It's allowed to be an empty string ๐
Protocol: Variable length (sequence of characters) ๐ง If this is an empty string, the protocol is unspecified. If it isn't empty, it names a protocol registered in the "WebSocket Subprotocol Name Registry" created in [RFC6455]. This string is UTF-8 encoded, as specified in [RFC3629].
5.2. DATA_CHANNEL_ACK Message ๐ซถ
this one is the reply to a DATA_CHANNEL_OPEN_RESPONSE message ๐ it goes out on the user-message stream over the data channel, and when the opener gets it, that's the sign the data channel setup handshake is officially done โจ
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message Type |
+-+-+-+-+-+-+-+-+
Message Type: 1 byte (unsigned integer) ๐ This is the IANA-defined message type for DATA_CHANNEL_ACK. Its value is 0x02, as specified in Section 8.2.1.
6. Procedures ๐
okay the procedures are where the rules live, so pay attention bestie ๐
All DCEP messages MUST be sent using ordered delivery and reliable transmission. They MUST be sent on the same outgoing stream as the user messages belonging to the corresponding data channel. Multiplexing and demultiplexing happens through the SCTP PPID ๐ฆ so a DCEP message MUST be sent with the assigned PPID for the Data Channel Establishment Protocol (see Section 8.1). Other messages MUST NOT be sent using this PPID ๐ซ
The peer that starts opening a data channel picks a stream identifier whose incoming and outgoing streams are both unused. If the side is acting as the DTLS client, it MUST choose an even stream identifier. If it's acting as the DTLS server, it MUST choose an odd one. The initiating peer then fills in the DATA_CHANNEL_OPEN parameters and sends it on the chosen stream ๐
If a DATA_CHANNEL_OPEN message shows up on an unused stream, the stream identifier matches the peer's role, and all the parameters are valid, then a matching DATA_CHANNEL_ACK message gets sent on the same stream identifier the DATA_CHANNEL_OPEN message arrived on ๐
If the DATA_CHANNEL_OPEN message doesn't meet those conditions, the receiver MUST close the corresponding data channel using the procedure described in [RFC8831], and MUST NOT send a DATA_CHANNEL_ACK message in response. This could happen if, for example, a DATA_CHANNEL_OPEN message arrives on a stream that's already in use, there's a problem with its parameters, the odd/even rule gets broken, or the DATA_CHANNEL_OPEN message isn't well formed ๐ญ That's why getting an SCTP stream-reset request for a stream where no DATA_CHANNEL_ACK has been received tells the sender of that DATA_CHANNEL_OPEN message that the setup failed ๐ Once the corresponding outgoing stream is also reset successfully, which wraps up the closing the peer started, a new DATA_CHANNEL_OPEN message can be sent on that stream ๐
After the DATA_CHANNEL_OPEN message has been sent, the sender MAY start sending user data without waiting for the DATA_CHANNEL_ACK message. Heads up though: until a DATA_CHANNEL_ACK or any other message has been received on that data channel, every user-data message for the channel MUST be sent ordered, even if the channel itself is unordered ๐ซ Once a DATA_CHANNEL_ACK or any other message has come back, user-data messages MUST be sent ordered on ordered data channels and MUST be sent unordered on unordered data channels. So if you get a user-data message on an unused stream, that's an error ๐จ The corresponding data channel MUST be closed, as described in [RFC8831].
7. Security Considerations ๐ก๏ธ
โ ๏ธ this section is serious business, no cap. read it all.
The DATA_CHANNEL_OPEN message has two variable-length fields: the protocol and the label. A receiver must be prepared to get DATA_CHANNEL_OPEN messages where those fields are the maximum length of 65535 bytes. Error cases like inconsistent field lengths, unknown parameter values, or breaking the odd/even rule must also be handled by closing the corresponding data channel. An endpoint must also be ready for its peer to open the maximum number of data channels ๐ค
This protocol does not provide privacy, integrity, or authentication ๐ It needs to be used as part of a protocol suite that has all of those things. That kind of suite is specified in [RFC8261].
For general considerations, check out [RFC8826] and [RFC8827] ๐
8. IANA Considerations ๐โจ
IANA has updated the reference on an existing SCTP PPID assignment (Section 8.1) and created a brand new standalone registry, with its own URL, for DCEP (Section 8.2). That registry has two new registration tables (Sections 8.2.1 and 8.2.2) ๐ธ
8.1. SCTP Payload Protocol Identifier ๐ข
This document uses an SCTP Payload Protocol Identifier (PPID) that was previously registered as "WebRTC Control". [RFC4960] created the "SCTP Payload Protocol Identifiers" registry, where this identifier was assigned. IANA has changed the PPID name from "WebRTC Control" to "WebRTC DCEP" and updated the reference to point to this document. The date stays the same ๐๏ธ
So this assignment now looks like this:
+=============+===========+===========+============+
| Value | SCTP PPID | Reference | Date |
+=============+===========+===========+============+
| WebRTC DCEP | 50 | RFC 8832 | 2013-09-20 |
+-------------+-----------+-----------+------------+
Table 2
8.2. New Standalone Registry for DCEP โจ
okay so IANA made a brand new registry called "Data Channel Establishment Protocol (DCEP) Parameters" ๐ and it holds the two tables in Sections 8.2.1 and 8.2.2 ๐
8.2.1. New Message Type Registry ๐ฆ
IANA made the "Message Types" registry for DCEP so it can manage the one-byte "Message Type" field in DCEP messages (see Section 5) ๐ this one is a subregistry of the registry from Section 8.2, so it's like a little sis under it ๐ง
adding new message types is an RFC Required action, as defined in [RFC8126] ๐ and whoever documents a new message type MUST include these two things:
- A name for the new message type.
- A detailed procedural description of how each message type is used within DCEP.
here are the initial registrations, and yes the table is giving very neat ๐ธ
+===================+===========+===========+
| Name | Type | Reference |
+===================+===========+===========+
| Reserved | 0x00 | RFC 8832 |
+-------------------+-----------+-----------+
| Reserved | 0x01 | RFC 8832 |
+-------------------+-----------+-----------+
| DATA_CHANNEL_ACK | 0x02 | RFC 8832 |
+-------------------+-----------+-----------+
| DATA_CHANNEL_OPEN | 0x03 | RFC 8832 |
+-------------------+-----------+-----------+
| Unassigned | 0x04-0xfe | |
+-------------------+-----------+-----------+
| Reserved | 0xff | RFC 8832 |
+-------------------+-----------+-----------+
Table 3
ngl 0x00 and 0x01 are reserved on purpose ๐ they were used in draft versions of the document, so reusing them could cause interoperability chaos ๐ and 0xff is held back for future extensibility โจ the whole range is 0x00 to 0xff, so you know exactly what's out there ๐
8.2.2. New Channel Type Registry ๐
IANA made the "Channel Types" registry for DCEP so it can manage the one-byte "Channel Type" field in DATA_CHANNEL_OPEN messages (see Section 5.1) ๐ this is also a subregistry inside the registry from Section 8.2 ๐
small aside: the original says "new message types" in this paragraph, not "new Channel Types", so I'm keeping that exactly as written ๐ the rule itself is the same: an RFC Required action, as defined in [RFC8126].
anyway, documenting a new Channel Type MUST include these two things:
- A name for the new Channel Type.
- A detailed procedural description of the user message handling for data channels using this new Channel Type.
if a new Channel Type supports both ordered and unordered message delivery, the high-order bit MUST be used to say whether the delivery is unordered ๐ฅ that's the 0x80 bit doing all the work, periodt ๐
here are the initial registrations ๐
+================================================+======+===========+
| Name | Type | Reference |
+================================================+======+===========+
| DATA_CHANNEL_RELIABLE | 0x00 | RFC 8832 |
+------------------------------------------------+------+-----------+
| DATA_CHANNEL_RELIABLE_UNORDERED | 0x80 | RFC 8832 |
+------------------------------------------------+------+-----------+
| DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT | 0x01 | RFC 8832 |
+------------------------------------------------+------+-----------+
| DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT_UNORDERED | 0x81 | RFC 8832 |
+------------------------------------------------+------+-----------+
| DATA_CHANNEL_PARTIAL_RELIABLE_TIMED | 0x02 | RFC 8832 |
+------------------------------------------------+------+-----------+
| DATA_CHANNEL_PARTIAL_RELIABLE_TIMED_UNORDERED | 0x82 | RFC 8832 |
+------------------------------------------------+------+-----------+
| Reserved | 0x7f | RFC 8832 |
+------------------------------------------------+------+-----------+
| Reserved | 0xff | RFC 8832 |
+------------------------------------------------+------+-----------+
| Unassigned | rest | |
+------------------------------------------------+------+-----------+
Table 4
values 0x7f and 0xff are reserved for future extensibility ๐ฆ and the full range is still 0x00 to 0xff, so nothing is hiding from you ๐ง
9. References ๐
9.1. Normative References ๐
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 2003, <https://www.rfc-editor.org/info/rfc3629>.
[RFC4960] Stewart, R., Ed., "Stream Control Transmission Protocol", RFC 4960, DOI 10.17487/RFC4960, September 2007, <https://www.rfc-editor.org/info/rfc4960>.
[RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 8126, DOI 10.17487/RFC8126, June 2017, <https://www.rfc-editor.org/info/rfc8126>.
[RFC8261] Tuexen, M., Stewart, R., Jesup, R., and S. Loreto, "Datagram Transport Layer Security (DTLS) Encapsulation of SCTP Packets", RFC 8261, DOI 10.17487/RFC8261, November 2017, <https://www.rfc-editor.org/info/rfc8261>.
[RFC8831] Jesup, R., Loreto, S., and M. Tรผxen, "WebRTC Data Channels", RFC 8831, DOI 10.17487/RFC8831, January 2021, <https://www.rfc-editor.org/info/rfc8831>.
9.2. Informative References ๐ธ
[RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security", RFC 4347, DOI 10.17487/RFC4347, April 2006, <https://www.rfc-editor.org/info/rfc4347>.
[RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, January 2012, <https://www.rfc-editor.org/info/rfc6347>.
[RFC6455] Fette, I. and A. Melnikov, "The WebSocket Protocol", RFC 6455, DOI 10.17487/RFC6455, December 2011, <https://www.rfc-editor.org/info/rfc6455>.
[RFC8826] Rescorla, E., "Security Considerations for WebRTC", RFC 8826, DOI 10.17487/RFC8826, January 2021, <https://www.rfc-editor.org/info/rfc8826>.
[RFC8827] Rescorla, E., "WebRTC Security Architecture", RFC 8827, DOI 10.17487/RFC8827, January 2021, <https://www.rfc-editor.org/info/rfc8827>.
[TLS-DTLS13] Rescorla, E., Tschofenig, H., and N. Modadugu, "The Datagram Transport Layer Security (DTLS) Protocol Version 1.3", Work in Progress, Internet-Draft, draft-ietf-tls-dtls13-39, 2 November 2020, <https://tools.ietf.org/html/draft-ietf-tls-dtls13-39>.
Acknowledgements ๐ซถ
The authors wish to thank Harald Alvestrand, Richard Barnes, Adam Bergkvist, Spencer Dawkins, Barry Dingle, Stefan Hรฅkansson, Cullen Jennings, Paul Kyzivat, Doug Leonard, Alexey Melnikov, Pete Resnick, Irene Rรผngeler, Randall Stewart, Peter Thatcher, Martin Thomson, Justin Uberti, and many others for their invaluable comments ๐ the whole squad got a shoutout, iconic โจ
Authors' Addresses ๐
Randell Jesup Mozilla United States of America
Email: randell-ietf@jesup.org
Salvatore Loreto Ericsson Hirsalantie 11 FI-02420 Jorvas Finland
Email: salvatore.loreto@ericsson.com
Michael Tรผxen Mรผnster University of Applied Sciences Stegerwaldstrasse 39 48565 Steinfurt Germany
Email: tuexen@fh-muenster.de
๐ฆ where this page comes from
- ietf: rfc8832 2021-01
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms