Chromium Code Reviews| 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 |
| 11 #ifndef WEBRTC_P2P_BASE_SESSION_H_ | 11 #ifndef WEBRTC_P2P_BASE_SESSION_H_ |
| 12 #define WEBRTC_P2P_BASE_SESSION_H_ | 12 #define WEBRTC_P2P_BASE_SESSION_H_ |
| 13 | 13 |
| 14 #include <list> | 14 #include <list> |
| 15 #include <map> | 15 #include <map> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/p2p/base/candidate.h" | 19 #include "webrtc/p2p/base/candidate.h" |
| 20 #include "webrtc/p2p/base/port.h" | 20 #include "webrtc/p2p/base/port.h" |
| 21 #include "webrtc/p2p/base/transport.h" | 21 #include "webrtc/p2p/base/transport.h" |
| 22 #include "webrtc/base/refcount.h" | 22 #include "webrtc/base/refcount.h" |
| 23 #include "webrtc/base/rtccertificate.h" | |
| 23 #include "webrtc/base/scoped_ptr.h" | 24 #include "webrtc/base/scoped_ptr.h" |
| 24 #include "webrtc/base/scoped_ref_ptr.h" | 25 #include "webrtc/base/scoped_ref_ptr.h" |
| 25 #include "webrtc/base/socketaddress.h" | 26 #include "webrtc/base/socketaddress.h" |
| 26 | 27 |
| 27 namespace cricket { | 28 namespace cricket { |
| 28 | 29 |
| 29 class BaseSession; | 30 class BaseSession; |
| 30 class P2PTransportChannel; | 31 class P2PTransportChannel; |
| 31 class Transport; | 32 class Transport; |
| 32 class TransportChannel; | 33 class TransportChannel; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 // Start the connection process for any channels, creating impls if needed. | 94 // Start the connection process for any channels, creating impls if needed. |
| 94 void ConnectChannels(); | 95 void ConnectChannels(); |
| 95 // Hook up impls to the proxy channels. Doesn't change connect state. | 96 // Hook up impls to the proxy channels. Doesn't change connect state. |
| 96 void CompleteNegotiation(); | 97 void CompleteNegotiation(); |
| 97 | 98 |
| 98 // Mux this proxy onto the specified proxy's transport. | 99 // Mux this proxy onto the specified proxy's transport. |
| 99 bool SetupMux(TransportProxy* proxy); | 100 bool SetupMux(TransportProxy* proxy); |
| 100 | 101 |
| 101 // Simple functions that thunk down to the same functions on Transport. | 102 // Simple functions that thunk down to the same functions on Transport. |
| 102 void SetIceRole(IceRole role); | 103 void SetIceRole(IceRole role); |
| 103 void SetIdentity(rtc::SSLIdentity* identity); | 104 void SetCertificate( |
| 105 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); | |
| 104 bool SetLocalTransportDescription(const TransportDescription& description, | 106 bool SetLocalTransportDescription(const TransportDescription& description, |
| 105 ContentAction action, | 107 ContentAction action, |
| 106 std::string* error_desc); | 108 std::string* error_desc); |
| 107 bool SetRemoteTransportDescription(const TransportDescription& description, | 109 bool SetRemoteTransportDescription(const TransportDescription& description, |
| 108 ContentAction action, | 110 ContentAction action, |
| 109 std::string* error_desc); | 111 std::string* error_desc); |
| 110 void OnSignalingReady(); | 112 void OnSignalingReady(); |
| 111 bool OnRemoteCandidates(const Candidates& candidates, std::string* error); | 113 bool OnRemoteCandidates(const Candidates& candidates, std::string* error); |
| 112 | 114 |
| 113 // Called when a transport signals that it has new candidates. | 115 // Called when a transport signals that it has new candidates. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 virtual TransportChannel* GetChannel(const std::string& content_name, | 310 virtual TransportChannel* GetChannel(const std::string& content_name, |
| 309 int component); | 311 int component); |
| 310 | 312 |
| 311 // Destroys the channel with the given names. | 313 // Destroys the channel with the given names. |
| 312 // This will usually be called from the worker thread, but that | 314 // This will usually be called from the worker thread, but that |
| 313 // shouldn't be an issue since the main thread will be blocked in | 315 // shouldn't be an issue since the main thread will be blocked in |
| 314 // Send when doing so. | 316 // Send when doing so. |
| 315 virtual void DestroyChannel(const std::string& content_name, | 317 virtual void DestroyChannel(const std::string& content_name, |
| 316 int component); | 318 int component); |
| 317 | 319 |
| 318 rtc::SSLIdentity* identity() { return identity_; } | 320 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() { |
| 321 return certificate_; | |
|
tommi
2015/08/25 10:28:08
thread safe?
hbos
2015/08/25 15:45:44
Only used for testing, moved to "protected" and ad
tommi
2015/08/25 16:34:53
I see. Maybe we should instead rename it to certi
hbos
2015/08/26 10:10:29
Done.
| |
| 322 } | |
| 319 | 323 |
| 320 // Set the ice connection receiving timeout. | 324 // Set the ice connection receiving timeout. |
| 321 void SetIceConnectionReceivingTimeout(int timeout_ms); | 325 void SetIceConnectionReceivingTimeout(int timeout_ms); |
| 322 | 326 |
| 323 protected: | 327 protected: |
| 324 // Specifies the identity to use in this session. | 328 // Specifies the identity to use in this session. |
| 325 bool SetIdentity(rtc::SSLIdentity* identity); | 329 bool SetCertificate( |
| 330 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); | |
| 326 | 331 |
| 327 bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version); | 332 bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version); |
| 328 | 333 |
| 329 bool PushdownTransportDescription(ContentSource source, | 334 bool PushdownTransportDescription(ContentSource source, |
| 330 ContentAction action, | 335 ContentAction action, |
| 331 std::string* error_desc); | 336 std::string* error_desc); |
| 332 void set_initiator(bool initiator) { initiator_ = initiator; } | 337 void set_initiator(bool initiator) { initiator_ = initiator; } |
| 333 | 338 |
| 334 const TransportMap& transport_proxies() const { return transports_; } | 339 const TransportMap& transport_proxies() const { return transports_; } |
| 335 // Get a TransportProxy by content_name or transport. NULL if not found. | 340 // Get a TransportProxy by content_name or transport. NULL if not found. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 static bool GetTransportDescription(const SessionDescription* description, | 442 static bool GetTransportDescription(const SessionDescription* description, |
| 438 const std::string& content_name, | 443 const std::string& content_name, |
| 439 TransportDescription* info); | 444 TransportDescription* info); |
| 440 | 445 |
| 441 rtc::Thread* const signaling_thread_; | 446 rtc::Thread* const signaling_thread_; |
| 442 rtc::Thread* const worker_thread_; | 447 rtc::Thread* const worker_thread_; |
| 443 PortAllocator* const port_allocator_; | 448 PortAllocator* const port_allocator_; |
| 444 const std::string sid_; | 449 const std::string sid_; |
| 445 const std::string content_type_; | 450 const std::string content_type_; |
| 446 bool initiator_; | 451 bool initiator_; |
| 447 rtc::SSLIdentity* identity_; | 452 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |
| 448 rtc::SSLProtocolVersion ssl_max_version_; | 453 rtc::SSLProtocolVersion ssl_max_version_; |
| 449 rtc::scoped_ptr<const SessionDescription> local_description_; | 454 rtc::scoped_ptr<const SessionDescription> local_description_; |
| 450 rtc::scoped_ptr<SessionDescription> remote_description_; | 455 rtc::scoped_ptr<SessionDescription> remote_description_; |
| 451 uint64 ice_tiebreaker_; | 456 uint64 ice_tiebreaker_; |
| 452 // This flag will be set to true after the first role switch. This flag | 457 // This flag will be set to true after the first role switch. This flag |
| 453 // will enable us to stop any role switch during the call. | 458 // will enable us to stop any role switch during the call. |
| 454 bool role_switch_; | 459 bool role_switch_; |
| 455 TransportMap transports_; | 460 TransportMap transports_; |
| 456 | 461 |
| 457 // Timeout value in milliseconds for which no ICE connection receives | 462 // Timeout value in milliseconds for which no ICE connection receives |
| 458 // any packets. | 463 // any packets. |
| 459 int ice_receiving_timeout_; | 464 int ice_receiving_timeout_; |
| 460 }; | 465 }; |
| 461 | 466 |
| 462 } // namespace cricket | 467 } // namespace cricket |
| 463 | 468 |
| 464 #endif // WEBRTC_P2P_BASE_SESSION_H_ | 469 #endif // WEBRTC_P2P_BASE_SESSION_H_ |
| OLD | NEW |