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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // may be set before a local certificate is generated. | 238 // may be set before a local certificate is generated. |
240 JsepTransport(const std::string& mid, | 239 JsepTransport(const std::string& mid, |
241 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); | 240 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); |
242 | 241 |
243 // Returns the MID of this transport. | 242 // Returns the MID of this transport. |
244 const std::string& mid() const { return mid_; } | 243 const std::string& mid() const { return mid_; } |
245 | 244 |
246 // Add or remove channel that is affected when a local/remote transport | 245 // 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 | 246 // description is set on this transport. Need to add all channels before |
248 // setting a transport description. | 247 // setting a transport description. |
249 bool AddChannel(TransportChannelImpl* dtls, int component); | 248 bool AddChannel(DtlsTransportInternal* dtls, int component); |
250 bool RemoveChannel(int component); | 249 bool RemoveChannel(int component); |
251 bool HasChannels() const; | 250 bool HasChannels() const; |
252 | 251 |
253 bool ready_for_remote_candidates() const { | 252 bool ready_for_remote_candidates() const { |
254 return local_description_set_ && remote_description_set_; | 253 return local_description_set_ && remote_description_set_; |
255 } | 254 } |
256 | 255 |
257 // Must be called before applying local session description. | 256 // Must be called before applying local session description. |
258 // Needed in order to verify the local fingerprint. | 257 // Needed in order to verify the local fingerprint. |
259 void SetLocalCertificate( | 258 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 | 324 // Negotiates the transport parameters based on the current local and remote |
326 // transport description, such as the ICE role to use, and whether DTLS | 325 // transport description, such as the ICE role to use, and whether DTLS |
327 // should be activated. | 326 // should be activated. |
328 // | 327 // |
329 // Called when an answer TransportDescription is applied. | 328 // Called when an answer TransportDescription is applied. |
330 bool NegotiateTransportDescription(ContentAction local_role, | 329 bool NegotiateTransportDescription(ContentAction local_role, |
331 std::string* error_desc); | 330 std::string* error_desc); |
332 | 331 |
333 // Pushes down the transport parameters from the local description, such | 332 // Pushes down the transport parameters from the local description, such |
334 // as the ICE ufrag and pwd. | 333 // as the ICE ufrag and pwd. |
335 bool ApplyLocalTransportDescription(TransportChannelImpl* channel, | 334 bool ApplyLocalTransportDescription(DtlsTransportInternal* dtls_transport, |
336 std::string* error_desc); | 335 std::string* error_desc); |
337 | 336 |
338 // Pushes down the transport parameters from the remote description to the | 337 // Pushes down the transport parameters from the remote description to the |
339 // transport channel. | 338 // transport channel. |
340 bool ApplyRemoteTransportDescription(TransportChannelImpl* channel, | 339 bool ApplyRemoteTransportDescription(DtlsTransportInternal* dtls_transport, |
341 std::string* error_desc); | 340 std::string* error_desc); |
342 | 341 |
343 // Pushes down the transport parameters obtained via negotiation. | 342 // Pushes down the transport parameters obtained via negotiation. |
344 bool ApplyNegotiatedTransportDescription(TransportChannelImpl* channel, | 343 bool ApplyNegotiatedTransportDescription( |
345 std::string* error_desc); | 344 DtlsTransportInternal* dtls_transport, |
| 345 std::string* error_desc); |
346 | 346 |
347 const std::string mid_; | 347 const std::string mid_; |
348 // needs-ice-restart bit as described in JSEP. | 348 // needs-ice-restart bit as described in JSEP. |
349 bool needs_ice_restart_ = false; | 349 bool needs_ice_restart_ = false; |
350 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; | 350 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |
351 rtc::SSLRole secure_role_ = rtc::SSL_CLIENT; | 351 rtc::SSLRole secure_role_ = rtc::SSL_CLIENT; |
352 std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint_; | 352 std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint_; |
353 std::unique_ptr<TransportDescription> local_description_; | 353 std::unique_ptr<TransportDescription> local_description_; |
354 std::unique_ptr<TransportDescription> remote_description_; | 354 std::unique_ptr<TransportDescription> remote_description_; |
355 bool local_description_set_ = false; | 355 bool local_description_set_ = false; |
356 bool remote_description_set_ = false; | 356 bool remote_description_set_ = false; |
357 | 357 |
358 // Candidate component => DTLS channel | 358 // Candidate component => DTLS channel |
359 std::map<int, TransportChannelImpl*> channels_; | 359 std::map<int, DtlsTransportInternal*> channels_; |
360 | 360 |
361 RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransport); | 361 RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransport); |
362 }; | 362 }; |
363 | 363 |
364 } // namespace cricket | 364 } // namespace cricket |
365 | 365 |
366 #endif // WEBRTC_P2P_BASE_JSEPTRANSPORT_H_ | 366 #endif // WEBRTC_P2P_BASE_JSEPTRANSPORT_H_ |
OLD | NEW |