xref: /aosp_15_r20/external/webrtc/pc/g3doc/sctp_transport.md (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1
2<?% config.freshness.reviewed = '2021-04-13' %?>
3<?% config.freshness.owner = 'hta' %?>
4
5# SctpTransport
6
7## webrtc::SctpTransport
8
9The [`webrtc::SctpTransport`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/pc/sctp_transport.h;l=33?q=class%20webrtc::SctpTransport) class encapsulates an SCTP association, and exposes a
10few properties of this association to the WebRTC user (such as Chrome).
11
12The SctpTransport is used to support Datachannels, as described in the [WebRTC
13specification for the Peer-to-peer Data
14API](https://w3c.github.io/webrtc-pc/#peer-to-peer-data-api).
15
16The public interface ([`webrtc::SctpTransportInterface`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/api/sctp_transport_interface.h?q=webrtc::SctpTransportInterface)) exposes an observer
17interface where the user can define a callback to be called whenever the state
18of an SctpTransport changes; this callback is called on the network thread (as
19set during PeerConnectionFactory initialization).
20
21The implementation of this object lives in pc/sctp_transport.{h,cc}, and is
22basically a wrapper around a `cricket::SctpTransportInternal`, hiding its
23implementation details and APIs that shoudldn't be accessed from the user.
24
25The `webrtc::SctpTransport` is a ref counted object; it should be regarded
26as owned by the PeerConnection, and will be closed when the PeerConnection
27closes, but the object itself may survive longer than the PeerConnection.
28
29## cricket::SctpTransportInternal
30
31[`cricket::SctpTransportInternal`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/media/sctp/sctp_transport_internal.h?q=cricket::SctpTransportInternal) owns two objects: The SCTP association object
32and the DTLS transport, which is the object used to send and receive messages
33as emitted from or consumed by the sctp library.
34
35It communicates state changes and events using sigslot.
36
37See header files for details.
38
39
40
41
42
43
44