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 TransportChannelImpl; | 32 class DtlsTransportInternal; |
33 class TransportChannelImpl; | |
34 enum class IceCandidatePairState; | 33 enum class IceCandidatePairState; |
35 | 34 |
36 typedef std::vector<Candidate> Candidates; | 35 typedef std::vector<Candidate> Candidates; |
37 | 36 |
38 // TODO(deadbeef): Move all of these enums, POD types and utility methods to | 37 // TODO(deadbeef): Move all of these enums, POD types and utility methods to |
39 // another header file. | 38 // another header file. |
40 | 39 |
41 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState | 40 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState |
42 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming | 41 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming |
43 // style. | 42 // style. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // may be set before a local certificate is generated. | 239 // may be set before a local certificate is generated. |
241 JsepTransport(const std::string& mid, | 240 JsepTransport(const std::string& mid, |
242 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); | 241 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); |
243 | 242 |
244 // Returns the MID of this transport. | 243 // Returns the MID of this transport. |
245 const std::string& mid() const { return mid_; } | 244 const std::string& mid() const { return mid_; } |
246 | 245 |
247 // Add or remove channel that is affected when a local/remote transport | 246 // Add or remove channel that is affected when a local/remote transport |
248 // description is set on this transport. Need to add all channels before | 247 // description is set on this transport. Need to add all channels before |
249 // setting a transport description. | 248 // setting a transport description. |
250 bool AddChannel(TransportChannelImpl* dtls, int component); | 249 bool AddChannel(DtlsTransportInternal* dtls, int component); |
251 bool RemoveChannel(int component); | 250 bool RemoveChannel(int component); |
252 bool HasChannels() const; | 251 bool HasChannels() const; |
253 | 252 |
254 bool ready_for_remote_candidates() const { | 253 bool ready_for_remote_candidates() const { |
255 return local_description_set_ && remote_description_set_; | 254 return local_description_set_ && remote_description_set_; |
256 } | 255 } |
257 | 256 |
258 // Must be called before applying local session description. | 257 // Must be called before applying local session description. |
259 // Needed in order to verify the local fingerprint. | 258 // Needed in order to verify the local fingerprint. |
260 void SetLocalCertificate( | 259 void SetLocalCertificate( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 // Negotiates the transport parameters based on the current local and remote | 325 // Negotiates the transport parameters based on the current local and remote |
327 // transport description, such as the ICE role to use, and whether DTLS | 326 // transport description, such as the ICE role to use, and whether DTLS |
328 // should be activated. | 327 // should be activated. |
329 // | 328 // |
330 // Called when an answer TransportDescription is applied. | 329 // Called when an answer TransportDescription is applied. |
331 bool NegotiateTransportDescription(ContentAction local_role, | 330 bool NegotiateTransportDescription(ContentAction local_role, |
332 std::string* error_desc); | 331 std::string* error_desc); |
333 | 332 |
334 // Pushes down the transport parameters from the local description, such | 333 // Pushes down the transport parameters from the local description, such |
335 // as the ICE ufrag and pwd. | 334 // as the ICE ufrag and pwd. |
336 bool ApplyLocalTransportDescription(TransportChannelImpl* channel, | 335 bool ApplyLocalTransportDescription(DtlsTransportInternal* dtls_transport, |
337 std::string* error_desc); | 336 std::string* error_desc); |
338 | 337 |
339 // Pushes down the transport parameters from the remote description to the | 338 // Pushes down the transport parameters from the remote description to the |
340 // transport channel. | 339 // transport channel. |
341 bool ApplyRemoteTransportDescription(TransportChannelImpl* channel, | 340 bool ApplyRemoteTransportDescription(DtlsTransportInternal* dtls_transport, |
342 std::string* error_desc); | 341 std::string* error_desc); |
343 | 342 |
344 // Pushes down the transport parameters obtained via negotiation. | 343 // Pushes down the transport parameters obtained via negotiation. |
345 bool ApplyNegotiatedTransportDescription(TransportChannelImpl* channel, | 344 bool ApplyNegotiatedTransportDescription( |
346 std::string* error_desc); | 345 DtlsTransportInternal* dtls_transport, |
| 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, TransportChannelImpl*> channels_; | 360 std::map<int, DtlsTransportInternal*> 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 |