| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 const std::string& old_pwd, | 135 const std::string& old_pwd, |
| 136 const std::string& new_ufrag, | 136 const std::string& new_ufrag, |
| 137 const std::string& new_pwd); | 137 const std::string& new_pwd); |
| 138 | 138 |
| 139 class Transport : public rtc::MessageHandler, | 139 class Transport : public rtc::MessageHandler, |
| 140 public sigslot::has_slots<> { | 140 public sigslot::has_slots<> { |
| 141 public: | 141 public: |
| 142 Transport(rtc::Thread* signaling_thread, | 142 Transport(rtc::Thread* signaling_thread, |
| 143 rtc::Thread* worker_thread, | 143 rtc::Thread* worker_thread, |
| 144 const std::string& content_name, | 144 const std::string& content_name, |
| 145 const std::string& type, | |
| 146 PortAllocator* allocator); | 145 PortAllocator* allocator); |
| 147 virtual ~Transport(); | 146 virtual ~Transport(); |
| 148 | 147 |
| 149 // Returns the signaling thread. The app talks to Transport on this thread. | 148 // Returns the signaling thread. The app talks to Transport on this thread. |
| 150 rtc::Thread* signaling_thread() const { return signaling_thread_; } | 149 rtc::Thread* signaling_thread() const { return signaling_thread_; } |
| 151 // Returns the worker thread. The actual networking is done on this thread. | 150 // Returns the worker thread. The actual networking is done on this thread. |
| 152 rtc::Thread* worker_thread() const { return worker_thread_; } | 151 rtc::Thread* worker_thread() const { return worker_thread_; } |
| 153 | 152 |
| 154 // Returns the content_name of this transport. | 153 // Returns the content_name of this transport. |
| 155 const std::string& content_name() const { return content_name_; } | 154 const std::string& content_name() const { return content_name_; } |
| 156 // Returns the type of this transport. | |
| 157 const std::string& type() const { return type_; } | |
| 158 | 155 |
| 159 // Returns the port allocator object for this transport. | 156 // Returns the port allocator object for this transport. |
| 160 PortAllocator* port_allocator() { return allocator_; } | 157 PortAllocator* port_allocator() { return allocator_; } |
| 161 | 158 |
| 162 // Returns the readable and states of this manager. These bits are the ORs | 159 // Returns the readable and states of this manager. These bits are the ORs |
| 163 // of the corresponding bits on the managed channels. Each time one of these | 160 // of the corresponding bits on the managed channels. Each time one of these |
| 164 // states changes, a signal is raised. | 161 // states changes, a signal is raised. |
| 165 // TODO: Replace uses of readable() and writable() with | 162 // TODO: Replace uses of readable() and writable() with |
| 166 // any_channels_readable() and any_channels_writable(). | 163 // any_channels_readable() and any_channels_writable(). |
| 167 bool readable() const { return any_channels_readable(); } | 164 bool readable() const { return any_channels_readable(); } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // Must be called before applying local session description. | 203 // Must be called before applying local session description. |
| 207 void SetCertificate( | 204 void SetCertificate( |
| 208 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); | 205 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); |
| 209 | 206 |
| 210 // Get a copy of the local identity provided by SetIdentity. | 207 // Get a copy of the local identity provided by SetIdentity. |
| 211 bool GetCertificate(rtc::scoped_refptr<rtc::RTCCertificate>* certificate); | 208 bool GetCertificate(rtc::scoped_refptr<rtc::RTCCertificate>* certificate); |
| 212 | 209 |
| 213 // Get a copy of the remote certificate in use by the specified channel. | 210 // Get a copy of the remote certificate in use by the specified channel. |
| 214 bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert); | 211 bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert); |
| 215 | 212 |
| 216 TransportProtocol protocol() const { return protocol_; } | |
| 217 | |
| 218 // Create, destroy, and lookup the channels of this type by their components. | 213 // Create, destroy, and lookup the channels of this type by their components. |
| 219 TransportChannelImpl* CreateChannel(int component); | 214 TransportChannelImpl* CreateChannel(int component); |
| 220 // Note: GetChannel may lead to race conditions, since the mutex is not held | 215 // Note: GetChannel may lead to race conditions, since the mutex is not held |
| 221 // after the pointer is returned. | 216 // after the pointer is returned. |
| 222 TransportChannelImpl* GetChannel(int component); | 217 TransportChannelImpl* GetChannel(int component); |
| 223 // Note: HasChannel does not lead to race conditions, unlike GetChannel. | 218 // Note: HasChannel does not lead to race conditions, unlike GetChannel. |
| 224 bool HasChannel(int component) { | 219 bool HasChannel(int component) { |
| 225 return (NULL != GetChannel(component)); | 220 return (NULL != GetChannel(component)); |
| 226 } | 221 } |
| 227 bool HasChannels(); | 222 bool HasChannels(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // Derived classes can override, but must call the base as well. | 314 // Derived classes can override, but must call the base as well. |
| 320 virtual bool ApplyLocalTransportDescription_w(TransportChannelImpl* channel, | 315 virtual bool ApplyLocalTransportDescription_w(TransportChannelImpl* channel, |
| 321 std::string* error_desc); | 316 std::string* error_desc); |
| 322 | 317 |
| 323 // Pushes down remote ice credentials from the remote description to the | 318 // Pushes down remote ice credentials from the remote description to the |
| 324 // transport channel. | 319 // transport channel. |
| 325 virtual bool ApplyRemoteTransportDescription_w(TransportChannelImpl* ch, | 320 virtual bool ApplyRemoteTransportDescription_w(TransportChannelImpl* ch, |
| 326 std::string* error_desc); | 321 std::string* error_desc); |
| 327 | 322 |
| 328 // Negotiates the transport parameters based on the current local and remote | 323 // Negotiates the transport parameters based on the current local and remote |
| 329 // transport description, such at the version of ICE to use, and whether DTLS | 324 // transport description, such as the ICE role to use, and whether DTLS |
| 330 // should be activated. | 325 // should be activated. |
| 331 // Derived classes can negotiate their specific parameters here, but must call | 326 // Derived classes can negotiate their specific parameters here, but must call |
| 332 // the base as well. | 327 // the base as well. |
| 333 virtual bool NegotiateTransportDescription_w(ContentAction local_role, | 328 virtual bool NegotiateTransportDescription_w(ContentAction local_role, |
| 334 std::string* error_desc); | 329 std::string* error_desc); |
| 335 | 330 |
| 336 // Pushes down the transport parameters obtained via negotiation. | 331 // Pushes down the transport parameters obtained via negotiation. |
| 337 // Derived classes can set their specific parameters here, but must call the | 332 // Derived classes can set their specific parameters here, but must call the |
| 338 // base as well. | 333 // base as well. |
| 339 virtual bool ApplyNegotiatedTransportDescription_w( | 334 virtual bool ApplyNegotiatedTransportDescription_w( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 bool GetRemoteSSLCertificate_w(rtc::SSLCertificate** cert); | 440 bool GetRemoteSSLCertificate_w(rtc::SSLCertificate** cert); |
| 446 | 441 |
| 447 void SetChannelReceivingTimeout_w(int timeout_ms); | 442 void SetChannelReceivingTimeout_w(int timeout_ms); |
| 448 | 443 |
| 449 // Sends SignalCompleted if we are now in that state. | 444 // Sends SignalCompleted if we are now in that state. |
| 450 void MaybeCompleted_w(); | 445 void MaybeCompleted_w(); |
| 451 | 446 |
| 452 rtc::Thread* const signaling_thread_; | 447 rtc::Thread* const signaling_thread_; |
| 453 rtc::Thread* const worker_thread_; | 448 rtc::Thread* const worker_thread_; |
| 454 const std::string content_name_; | 449 const std::string content_name_; |
| 455 const std::string type_; | |
| 456 PortAllocator* const allocator_; | 450 PortAllocator* const allocator_; |
| 457 bool destroyed_; | 451 bool destroyed_; |
| 458 TransportState readable_; | 452 TransportState readable_; |
| 459 TransportState writable_; | 453 TransportState writable_; |
| 460 TransportState receiving_; | 454 TransportState receiving_; |
| 461 bool was_writable_; | 455 bool was_writable_; |
| 462 bool connect_requested_; | 456 bool connect_requested_; |
| 463 IceRole ice_role_; | 457 IceRole ice_role_; |
| 464 uint64 tiebreaker_; | 458 uint64 tiebreaker_; |
| 465 TransportProtocol protocol_; | |
| 466 IceMode remote_ice_mode_; | 459 IceMode remote_ice_mode_; |
| 467 int channel_receiving_timeout_; | 460 int channel_receiving_timeout_; |
| 468 rtc::scoped_ptr<TransportDescription> local_description_; | 461 rtc::scoped_ptr<TransportDescription> local_description_; |
| 469 rtc::scoped_ptr<TransportDescription> remote_description_; | 462 rtc::scoped_ptr<TransportDescription> remote_description_; |
| 470 | 463 |
| 471 // TODO(tommi): Make sure we only use this on the worker thread. | 464 // TODO(tommi): Make sure we only use this on the worker thread. |
| 472 ChannelMap channels_; | 465 ChannelMap channels_; |
| 473 // Buffers the ready_candidates so that SignalCanidatesReady can | 466 // Buffers the ready_candidates so that SignalCanidatesReady can |
| 474 // provide them in multiples. | 467 // provide them in multiples. |
| 475 std::vector<Candidate> ready_candidates_; | 468 std::vector<Candidate> ready_candidates_; |
| 476 // Protects changes to channels and messages | 469 // Protects changes to channels and messages |
| 477 rtc::CriticalSection crit_; | 470 rtc::CriticalSection crit_; |
| 478 | 471 |
| 479 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); | 472 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); |
| 480 }; | 473 }; |
| 481 | 474 |
| 482 // Extract a TransportProtocol from a TransportDescription. | |
| 483 TransportProtocol TransportProtocolFromDescription( | |
| 484 const TransportDescription* desc); | |
| 485 | 475 |
| 486 } // namespace cricket | 476 } // namespace cricket |
| 487 | 477 |
| 488 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ | 478 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ |
| OLD | NEW |