OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MEDIA_SCTP_SCTPTRANSPORTINTERNAL_H_ | 11 #ifndef WEBRTC_MEDIA_SCTP_SCTPTRANSPORTINTERNAL_H_ |
12 #define WEBRTC_MEDIA_SCTP_SCTPTRANSPORTINTERNAL_H_ | 12 #define WEBRTC_MEDIA_SCTP_SCTPTRANSPORTINTERNAL_H_ |
13 | 13 |
14 // TODO(deadbeef): Move SCTP code out of media/, and make it not depend on | 14 // TODO(deadbeef): Move SCTP code out of media/, and make it not depend on |
15 // anything in media/. | 15 // anything in media/. |
16 | 16 |
17 #include <memory> // for unique_ptr | 17 #include <memory> // for unique_ptr |
18 #include <string> | 18 #include <string> |
19 #include <vector> | 19 #include <vector> |
20 | 20 |
21 #include "webrtc/base/copyonwritebuffer.h" | 21 #include "webrtc/base/copyonwritebuffer.h" |
22 #include "webrtc/base/thread.h" | 22 #include "webrtc/base/thread.h" |
23 // For SendDataParams/ReceiveDataParams. | 23 // For SendDataParams/ReceiveDataParams. |
24 // TODO(deadbeef): Use something else for SCTP. It's confusing that we use an | 24 // TODO(deadbeef): Use something else for SCTP. It's confusing that we use an |
25 // SSRC field for SID. | 25 // SSRC field for SID. |
26 #include "webrtc/media/base/mediachannel.h" | 26 #include "webrtc/media/base/mediachannel.h" |
27 #include "webrtc/p2p/base/transportchannel.h" | 27 #include "webrtc/p2p/base/dtlstransportinternal.h" |
28 | 28 |
29 namespace cricket { | 29 namespace cricket { |
30 | 30 |
31 // The number of outgoing streams that we'll negotiate. Since stream IDs (SIDs) | 31 // The number of outgoing streams that we'll negotiate. Since stream IDs (SIDs) |
32 // are 0-based, the highest usable SID is 1023. | 32 // are 0-based, the highest usable SID is 1023. |
33 // | 33 // |
34 // It's recommended to use the maximum of 65535 in: | 34 // It's recommended to use the maximum of 65535 in: |
35 // https://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-13#section-6.2 | 35 // https://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-13#section-6.2 |
36 // However, we use 1024 in order to save memory. usrsctp allocates 104 bytes | 36 // However, we use 1024 in order to save memory. usrsctp allocates 104 bytes |
37 // for each pair of incoming/outgoing streams (on a 64-bit system), so 65535 | 37 // for each pair of incoming/outgoing streams (on a 64-bit system), so 65535 |
(...skipping 13 matching lines...) Expand all Loading... |
51 // Abstract SctpTransport interface for use internally (by | 51 // Abstract SctpTransport interface for use internally (by |
52 // PeerConnection/WebRtcSession/etc.). Exists to allow mock/fake SctpTransports | 52 // PeerConnection/WebRtcSession/etc.). Exists to allow mock/fake SctpTransports |
53 // to be created. | 53 // to be created. |
54 class SctpTransportInternal { | 54 class SctpTransportInternal { |
55 public: | 55 public: |
56 virtual ~SctpTransportInternal() {} | 56 virtual ~SctpTransportInternal() {} |
57 | 57 |
58 // Changes what underlying DTLS channel is uses. Used when switching which | 58 // Changes what underlying DTLS channel is uses. Used when switching which |
59 // bundled transport the SctpTransport uses. | 59 // bundled transport the SctpTransport uses. |
60 // Assumes |channel| is non-null. | 60 // Assumes |channel| is non-null. |
61 virtual void SetTransportChannel(TransportChannel* channel) = 0; | 61 virtual void SetTransportChannel(DtlsTransportInternal* channel) = 0; |
62 | 62 |
63 // When Start is called, connects as soon as possible; this can be called | 63 // When Start is called, connects as soon as possible; this can be called |
64 // before DTLS completes, in which case the connection will begin when DTLS | 64 // before DTLS completes, in which case the connection will begin when DTLS |
65 // completes. This method can be called multiple times, though not if either | 65 // completes. This method can be called multiple times, though not if either |
66 // of the ports are changed. | 66 // of the ports are changed. |
67 // | 67 // |
68 // |local_sctp_port| and |remote_sctp_port| are passed along the wire and the | 68 // |local_sctp_port| and |remote_sctp_port| are passed along the wire and the |
69 // listener and connector must be using the same port. They are not related | 69 // listener and connector must be using the same port. They are not related |
70 // to the ports at the IP level. If set to -1, we default to | 70 // to the ports at the IP level. If set to -1, we default to |
71 // kSctpDefaultPort. | 71 // kSctpDefaultPort. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 // Factory class which can be used to allow fake SctpTransports to be injected | 123 // Factory class which can be used to allow fake SctpTransports to be injected |
124 // for testing. Or, theoretically, SctpTransportInternal implementations that | 124 // for testing. Or, theoretically, SctpTransportInternal implementations that |
125 // use something other than usrsctp. | 125 // use something other than usrsctp. |
126 class SctpTransportInternalFactory { | 126 class SctpTransportInternalFactory { |
127 public: | 127 public: |
128 virtual ~SctpTransportInternalFactory() {} | 128 virtual ~SctpTransportInternalFactory() {} |
129 | 129 |
130 // Create an SCTP transport using |channel| for the underlying transport. | 130 // Create an SCTP transport using |channel| for the underlying transport. |
131 virtual std::unique_ptr<SctpTransportInternal> CreateSctpTransport( | 131 virtual std::unique_ptr<SctpTransportInternal> CreateSctpTransport( |
132 TransportChannel* channel) = 0; | 132 DtlsTransportInternal* channel) = 0; |
133 }; | 133 }; |
134 | 134 |
135 } // namespace cricket | 135 } // namespace cricket |
136 | 136 |
137 #endif // WEBRTC_MEDIA_SCTP_SCTPTRANSPORTINTERNAL_H_ | 137 #endif // WEBRTC_MEDIA_SCTP_SCTPTRANSPORTINTERNAL_H_ |
OLD | NEW |