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_; } | |
319 | |
320 // Set the ice connection receiving timeout. | 320 // Set the ice connection receiving timeout. |
321 void SetIceConnectionReceivingTimeout(int timeout_ms); | 321 void SetIceConnectionReceivingTimeout(int timeout_ms); |
322 | 322 |
| 323 // For testing. |
| 324 const rtc::scoped_refptr<rtc::RTCCertificate>& |
| 325 certificate_for_testing() const { |
| 326 return certificate_; |
| 327 } |
| 328 |
323 protected: | 329 protected: |
324 // Specifies the identity to use in this session. | 330 // Specifies the identity to use in this session. |
325 bool SetIdentity(rtc::SSLIdentity* identity); | 331 bool SetCertificate( |
| 332 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); |
326 | 333 |
327 bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version); | 334 bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version); |
328 | 335 |
329 bool PushdownTransportDescription(ContentSource source, | 336 bool PushdownTransportDescription(ContentSource source, |
330 ContentAction action, | 337 ContentAction action, |
331 std::string* error_desc); | 338 std::string* error_desc); |
332 void set_initiator(bool initiator) { initiator_ = initiator; } | 339 void set_initiator(bool initiator) { initiator_ = initiator; } |
333 | 340 |
334 const TransportMap& transport_proxies() const { return transports_; } | 341 const TransportMap& transport_proxies() const { return transports_; } |
335 // Get a TransportProxy by content_name or transport. NULL if not found. | 342 // 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, | 444 static bool GetTransportDescription(const SessionDescription* description, |
438 const std::string& content_name, | 445 const std::string& content_name, |
439 TransportDescription* info); | 446 TransportDescription* info); |
440 | 447 |
441 rtc::Thread* const signaling_thread_; | 448 rtc::Thread* const signaling_thread_; |
442 rtc::Thread* const worker_thread_; | 449 rtc::Thread* const worker_thread_; |
443 PortAllocator* const port_allocator_; | 450 PortAllocator* const port_allocator_; |
444 const std::string sid_; | 451 const std::string sid_; |
445 const std::string content_type_; | 452 const std::string content_type_; |
446 bool initiator_; | 453 bool initiator_; |
447 rtc::SSLIdentity* identity_; | 454 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |
448 rtc::SSLProtocolVersion ssl_max_version_; | 455 rtc::SSLProtocolVersion ssl_max_version_; |
449 rtc::scoped_ptr<const SessionDescription> local_description_; | 456 rtc::scoped_ptr<const SessionDescription> local_description_; |
450 rtc::scoped_ptr<SessionDescription> remote_description_; | 457 rtc::scoped_ptr<SessionDescription> remote_description_; |
451 uint64 ice_tiebreaker_; | 458 uint64 ice_tiebreaker_; |
452 // This flag will be set to true after the first role switch. This flag | 459 // 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. | 460 // will enable us to stop any role switch during the call. |
454 bool role_switch_; | 461 bool role_switch_; |
455 TransportMap transports_; | 462 TransportMap transports_; |
456 | 463 |
457 // Timeout value in milliseconds for which no ICE connection receives | 464 // Timeout value in milliseconds for which no ICE connection receives |
458 // any packets. | 465 // any packets. |
459 int ice_receiving_timeout_; | 466 int ice_receiving_timeout_; |
460 }; | 467 }; |
461 | 468 |
462 } // namespace cricket | 469 } // namespace cricket |
463 | 470 |
464 #endif // WEBRTC_P2P_BASE_SESSION_H_ | 471 #endif // WEBRTC_P2P_BASE_SESSION_H_ |
OLD | NEW |