OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "webrtc/base/rtccertificate.h" | 22 #include "webrtc/base/rtccertificate.h" |
23 #include "webrtc/base/sigslot.h" | 23 #include "webrtc/base/sigslot.h" |
24 #include "webrtc/base/sslstreamadapter.h" | 24 #include "webrtc/base/sslstreamadapter.h" |
25 #include "webrtc/p2p/base/candidate.h" | 25 #include "webrtc/p2p/base/candidate.h" |
26 #include "webrtc/p2p/base/p2pconstants.h" | 26 #include "webrtc/p2p/base/p2pconstants.h" |
27 #include "webrtc/p2p/base/sessiondescription.h" | 27 #include "webrtc/p2p/base/sessiondescription.h" |
28 #include "webrtc/p2p/base/transportinfo.h" | 28 #include "webrtc/p2p/base/transportinfo.h" |
29 | 29 |
30 namespace cricket { | 30 namespace cricket { |
31 | 31 |
32 class DtlsTransportInternal; | 32 class TransportChannelImpl; |
| 33 class TransportChannelImpl; |
33 enum class IceCandidatePairState; | 34 enum class IceCandidatePairState; |
34 | 35 |
35 typedef std::vector<Candidate> Candidates; | 36 typedef std::vector<Candidate> Candidates; |
36 | 37 |
37 // TODO(deadbeef): Move all of these enums, POD types and utility methods to | 38 // TODO(deadbeef): Move all of these enums, POD types and utility methods to |
38 // another header file. | 39 // another header file. |
39 | 40 |
40 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState | 41 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState |
41 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming | 42 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming |
42 // style. | 43 // style. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // may be set before a local certificate is generated. | 240 // may be set before a local certificate is generated. |
240 JsepTransport(const std::string& mid, | 241 JsepTransport(const std::string& mid, |
241 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); | 242 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); |
242 | 243 |
243 // Returns the MID of this transport. | 244 // Returns the MID of this transport. |
244 const std::string& mid() const { return mid_; } | 245 const std::string& mid() const { return mid_; } |
245 | 246 |
246 // Add or remove channel that is affected when a local/remote transport | 247 // Add or remove channel that is affected when a local/remote transport |
247 // description is set on this transport. Need to add all channels before | 248 // description is set on this transport. Need to add all channels before |
248 // setting a transport description. | 249 // setting a transport description. |
249 bool AddChannel(DtlsTransportInternal* dtls, int component); | 250 bool AddChannel(TransportChannelImpl* dtls, int component); |
250 bool RemoveChannel(int component); | 251 bool RemoveChannel(int component); |
251 bool HasChannels() const; | 252 bool HasChannels() const; |
252 | 253 |
253 bool ready_for_remote_candidates() const { | 254 bool ready_for_remote_candidates() const { |
254 return local_description_set_ && remote_description_set_; | 255 return local_description_set_ && remote_description_set_; |
255 } | 256 } |
256 | 257 |
257 // Must be called before applying local session description. | 258 // Must be called before applying local session description. |
258 // Needed in order to verify the local fingerprint. | 259 // Needed in order to verify the local fingerprint. |
259 void SetLocalCertificate( | 260 void SetLocalCertificate( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // Negotiates the transport parameters based on the current local and remote | 326 // Negotiates the transport parameters based on the current local and remote |
326 // transport description, such as the ICE role to use, and whether DTLS | 327 // transport description, such as the ICE role to use, and whether DTLS |
327 // should be activated. | 328 // should be activated. |
328 // | 329 // |
329 // Called when an answer TransportDescription is applied. | 330 // Called when an answer TransportDescription is applied. |
330 bool NegotiateTransportDescription(ContentAction local_role, | 331 bool NegotiateTransportDescription(ContentAction local_role, |
331 std::string* error_desc); | 332 std::string* error_desc); |
332 | 333 |
333 // Pushes down the transport parameters from the local description, such | 334 // Pushes down the transport parameters from the local description, such |
334 // as the ICE ufrag and pwd. | 335 // as the ICE ufrag and pwd. |
335 bool ApplyLocalTransportDescription(DtlsTransportInternal* dtls_transport, | 336 bool ApplyLocalTransportDescription(TransportChannelImpl* channel, |
336 std::string* error_desc); | 337 std::string* error_desc); |
337 | 338 |
338 // Pushes down the transport parameters from the remote description to the | 339 // Pushes down the transport parameters from the remote description to the |
339 // transport channel. | 340 // transport channel. |
340 bool ApplyRemoteTransportDescription(DtlsTransportInternal* dtls_transport, | 341 bool ApplyRemoteTransportDescription(TransportChannelImpl* channel, |
341 std::string* error_desc); | 342 std::string* error_desc); |
342 | 343 |
343 // Pushes down the transport parameters obtained via negotiation. | 344 // Pushes down the transport parameters obtained via negotiation. |
344 bool ApplyNegotiatedTransportDescription( | 345 bool ApplyNegotiatedTransportDescription(TransportChannelImpl* channel, |
345 DtlsTransportInternal* dtls_transport, | 346 std::string* error_desc); |
346 std::string* error_desc); | |
347 | 347 |
348 const std::string mid_; | 348 const std::string mid_; |
349 // needs-ice-restart bit as described in JSEP. | 349 // needs-ice-restart bit as described in JSEP. |
350 bool needs_ice_restart_ = false; | 350 bool needs_ice_restart_ = false; |
351 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; | 351 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |
352 rtc::SSLRole secure_role_ = rtc::SSL_CLIENT; | 352 rtc::SSLRole secure_role_ = rtc::SSL_CLIENT; |
353 std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint_; | 353 std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint_; |
354 std::unique_ptr<TransportDescription> local_description_; | 354 std::unique_ptr<TransportDescription> local_description_; |
355 std::unique_ptr<TransportDescription> remote_description_; | 355 std::unique_ptr<TransportDescription> remote_description_; |
356 bool local_description_set_ = false; | 356 bool local_description_set_ = false; |
357 bool remote_description_set_ = false; | 357 bool remote_description_set_ = false; |
358 | 358 |
359 // Candidate component => DTLS channel | 359 // Candidate component => DTLS channel |
360 std::map<int, DtlsTransportInternal*> channels_; | 360 std::map<int, TransportChannelImpl*> channels_; |
361 | 361 |
362 RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransport); | 362 RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransport); |
363 }; | 363 }; |
364 | 364 |
365 } // namespace cricket | 365 } // namespace cricket |
366 | 366 |
367 #endif // WEBRTC_P2P_BASE_JSEPTRANSPORT_H_ | 367 #endif // WEBRTC_P2P_BASE_JSEPTRANSPORT_H_ |
OLD | NEW |