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