xref: /aosp_15_r20/external/webrtc/pc/g3doc/sctp_transport.md (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker
2*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.reviewed = '2021-04-13' %?>
3*d9f75844SAndroid Build Coastguard Worker<?% config.freshness.owner = 'hta' %?>
4*d9f75844SAndroid Build Coastguard Worker
5*d9f75844SAndroid Build Coastguard Worker# SctpTransport
6*d9f75844SAndroid Build Coastguard Worker
7*d9f75844SAndroid Build Coastguard Worker## webrtc::SctpTransport
8*d9f75844SAndroid Build Coastguard Worker
9*d9f75844SAndroid Build Coastguard WorkerThe [`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
10*d9f75844SAndroid Build Coastguard Workerfew properties of this association to the WebRTC user (such as Chrome).
11*d9f75844SAndroid Build Coastguard Worker
12*d9f75844SAndroid Build Coastguard WorkerThe SctpTransport is used to support Datachannels, as described in the [WebRTC
13*d9f75844SAndroid Build Coastguard Workerspecification for the Peer-to-peer Data
14*d9f75844SAndroid Build Coastguard WorkerAPI](https://w3c.github.io/webrtc-pc/#peer-to-peer-data-api).
15*d9f75844SAndroid Build Coastguard Worker
16*d9f75844SAndroid Build Coastguard WorkerThe 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
17*d9f75844SAndroid Build Coastguard Workerinterface where the user can define a callback to be called whenever the state
18*d9f75844SAndroid Build Coastguard Workerof an SctpTransport changes; this callback is called on the network thread (as
19*d9f75844SAndroid Build Coastguard Workerset during PeerConnectionFactory initialization).
20*d9f75844SAndroid Build Coastguard Worker
21*d9f75844SAndroid Build Coastguard WorkerThe implementation of this object lives in pc/sctp_transport.{h,cc}, and is
22*d9f75844SAndroid Build Coastguard Workerbasically a wrapper around a `cricket::SctpTransportInternal`, hiding its
23*d9f75844SAndroid Build Coastguard Workerimplementation details and APIs that shoudldn't be accessed from the user.
24*d9f75844SAndroid Build Coastguard Worker
25*d9f75844SAndroid Build Coastguard WorkerThe `webrtc::SctpTransport` is a ref counted object; it should be regarded
26*d9f75844SAndroid Build Coastguard Workeras owned by the PeerConnection, and will be closed when the PeerConnection
27*d9f75844SAndroid Build Coastguard Workercloses, but the object itself may survive longer than the PeerConnection.
28*d9f75844SAndroid Build Coastguard Worker
29*d9f75844SAndroid Build Coastguard Worker## cricket::SctpTransportInternal
30*d9f75844SAndroid Build Coastguard Worker
31*d9f75844SAndroid Build Coastguard Worker[`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
32*d9f75844SAndroid Build Coastguard Workerand the DTLS transport, which is the object used to send and receive messages
33*d9f75844SAndroid Build Coastguard Workeras emitted from or consumed by the sctp library.
34*d9f75844SAndroid Build Coastguard Worker
35*d9f75844SAndroid Build Coastguard WorkerIt communicates state changes and events using sigslot.
36*d9f75844SAndroid Build Coastguard Worker
37*d9f75844SAndroid Build Coastguard WorkerSee header files for details.
38*d9f75844SAndroid Build Coastguard Worker
39*d9f75844SAndroid Build Coastguard Worker
40*d9f75844SAndroid Build Coastguard Worker
41*d9f75844SAndroid Build Coastguard Worker
42*d9f75844SAndroid Build Coastguard Worker
43*d9f75844SAndroid Build Coastguard Worker
44