| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 bool RemoveRemoteCandidates(const Candidates& candidates, std::string* err); | 106 bool RemoveRemoteCandidates(const Candidates& candidates, std::string* err); |
| 107 bool ReadyForRemoteCandidates(const std::string& transport_name) const; | 107 bool ReadyForRemoteCandidates(const std::string& transport_name) const; |
| 108 // TODO(deadbeef): GetStats isn't const because all the way down to | 108 // TODO(deadbeef): GetStats isn't const because all the way down to |
| 109 // OpenSSLStreamAdapter, | 109 // OpenSSLStreamAdapter, |
| 110 // GetSslCipherSuite and GetDtlsSrtpCryptoSuite are not const. Fix this. | 110 // GetSslCipherSuite and GetDtlsSrtpCryptoSuite are not const. Fix this. |
| 111 bool GetStats(const std::string& transport_name, TransportStats* stats); | 111 bool GetStats(const std::string& transport_name, TransportStats* stats); |
| 112 void SetMetricsObserver(webrtc::MetricsObserverInterface* metrics_observer); | 112 void SetMetricsObserver(webrtc::MetricsObserverInterface* metrics_observer); |
| 113 | 113 |
| 114 // Creates a channel if it doesn't exist. Otherwise, increments a reference | 114 // Creates a channel if it doesn't exist. Otherwise, increments a reference |
| 115 // count and returns an existing channel. | 115 // count and returns an existing channel. |
| 116 DtlsTransportInternal* CreateDtlsTransport(const std::string& transport_name, | 116 TransportChannel* CreateTransportChannel(const std::string& transport_name, |
| 117 int component); | 117 int component); |
| 118 virtual DtlsTransportInternal* CreateDtlsTransport_n( | 118 virtual TransportChannel* CreateTransportChannel_n( |
| 119 const std::string& transport_name, | 119 const std::string& transport_name, |
| 120 int component); | 120 int component); |
| 121 | 121 |
| 122 // Decrements a channel's reference count, and destroys the channel if | 122 // Decrements a channel's reference count, and destroys the channel if |
| 123 // nothing is referencing it. | 123 // nothing is referencing it. |
| 124 virtual void DestroyDtlsTransport(const std::string& transport_name, | 124 virtual void DestroyTransportChannel(const std::string& transport_name, |
| 125 int component); | 125 int component); |
| 126 virtual void DestroyDtlsTransport_n(const std::string& transport_name, | 126 virtual void DestroyTransportChannel_n(const std::string& transport_name, |
| 127 int component); | 127 int component); |
| 128 | 128 |
| 129 void use_quic() { quic_ = true; } | 129 void use_quic() { quic_ = true; } |
| 130 bool quic() const { return quic_; } | 130 bool quic() const { return quic_; } |
| 131 | 131 |
| 132 // TODO(deadbeef): Remove all for_testing methods! | 132 // TODO(deadbeef): Remove all for_testing methods! |
| 133 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing() | 133 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing() |
| 134 const { | 134 const { |
| 135 return certificate_; | 135 return certificate_; |
| 136 } | 136 } |
| 137 std::vector<std::string> transport_names_for_testing(); | 137 std::vector<std::string> transport_names_for_testing(); |
| 138 std::vector<DtlsTransportInternal*> channels_for_testing(); | 138 std::vector<TransportChannelImpl*> channels_for_testing(); |
| 139 DtlsTransportInternal* get_channel_for_testing( | 139 TransportChannelImpl* get_channel_for_testing( |
| 140 const std::string& transport_name, | 140 const std::string& transport_name, |
| 141 int component); | 141 int component); |
| 142 | 142 |
| 143 // All of these signals are fired on the signalling thread. | 143 // All of these signals are fired on the signalling thread. |
| 144 | 144 |
| 145 // If any transport failed => failed, | 145 // If any transport failed => failed, |
| 146 // Else if all completed => completed, | 146 // Else if all completed => completed, |
| 147 // Else if all connected => connected, | 147 // Else if all connected => connected, |
| 148 // Else => connecting | 148 // Else => connecting |
| 149 sigslot::signal1<IceConnectionState> SignalConnectionState; | 149 sigslot::signal1<IceConnectionState> SignalConnectionState; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 164 | 164 |
| 165 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError; | 165 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError; |
| 166 | 166 |
| 167 protected: | 167 protected: |
| 168 // TODO(deadbeef): Get rid of these virtual methods. Used by | 168 // TODO(deadbeef): Get rid of these virtual methods. Used by |
| 169 // FakeTransportController currently, but FakeTransportController shouldn't | 169 // FakeTransportController currently, but FakeTransportController shouldn't |
| 170 // even be functioning by subclassing TransportController. | 170 // even be functioning by subclassing TransportController. |
| 171 virtual IceTransportInternal* CreateIceTransportChannel_n( | 171 virtual IceTransportInternal* CreateIceTransportChannel_n( |
| 172 const std::string& transport_name, | 172 const std::string& transport_name, |
| 173 int component); | 173 int component); |
| 174 virtual DtlsTransportInternal* CreateDtlsTransportChannel_n( | 174 virtual TransportChannelImpl* CreateDtlsTransportChannel_n( |
| 175 const std::string& transport_name, | 175 const std::string& transport_name, |
| 176 int component, | 176 int component, |
| 177 IceTransportInternal* ice); | 177 IceTransportInternal* ice); |
| 178 | 178 |
| 179 private: | 179 private: |
| 180 void OnMessage(rtc::Message* pmsg) override; | 180 void OnMessage(rtc::Message* pmsg) override; |
| 181 | 181 |
| 182 class ChannelPair; | 182 class ChannelPair; |
| 183 typedef rtc::RefCountedObject<ChannelPair> RefCountedChannel; | 183 typedef rtc::RefCountedObject<ChannelPair> RefCountedChannel; |
| 184 | 184 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 const Candidates& candidates, | 226 const Candidates& candidates, |
| 227 std::string* err); | 227 std::string* err); |
| 228 bool RemoveRemoteCandidates_n(const Candidates& candidates, std::string* err); | 228 bool RemoveRemoteCandidates_n(const Candidates& candidates, std::string* err); |
| 229 bool ReadyForRemoteCandidates_n(const std::string& transport_name) const; | 229 bool ReadyForRemoteCandidates_n(const std::string& transport_name) const; |
| 230 bool GetStats_n(const std::string& transport_name, TransportStats* stats); | 230 bool GetStats_n(const std::string& transport_name, TransportStats* stats); |
| 231 void SetMetricsObserver_n(webrtc::MetricsObserverInterface* metrics_observer); | 231 void SetMetricsObserver_n(webrtc::MetricsObserverInterface* metrics_observer); |
| 232 | 232 |
| 233 // Handlers for signals from Transport. | 233 // Handlers for signals from Transport. |
| 234 void OnChannelWritableState_n(rtc::PacketTransportInterface* transport); | 234 void OnChannelWritableState_n(rtc::PacketTransportInterface* transport); |
| 235 void OnChannelReceivingState_n(rtc::PacketTransportInterface* transport); | 235 void OnChannelReceivingState_n(rtc::PacketTransportInterface* transport); |
| 236 void OnChannelGatheringState_n(IceTransportInternal* channel); | 236 void OnChannelGatheringState_n(TransportChannelImpl* channel); |
| 237 void OnChannelCandidateGathered_n(IceTransportInternal* channel, | 237 void OnChannelCandidateGathered_n(TransportChannelImpl* channel, |
| 238 const Candidate& candidate); | 238 const Candidate& candidate); |
| 239 void OnChannelCandidatesRemoved(const Candidates& candidates); | 239 void OnChannelCandidatesRemoved(const Candidates& candidates); |
| 240 void OnChannelCandidatesRemoved_n(IceTransportInternal* channel, | 240 void OnChannelCandidatesRemoved_n(TransportChannelImpl* channel, |
| 241 const Candidates& candidates); | 241 const Candidates& candidates); |
| 242 void OnChannelRoleConflict_n(IceTransportInternal* channel); | 242 void OnChannelRoleConflict_n(TransportChannelImpl* channel); |
| 243 void OnChannelStateChanged_n(IceTransportInternal* channel); | 243 void OnChannelStateChanged_n(TransportChannelImpl* channel); |
| 244 | 244 |
| 245 void UpdateAggregateStates_n(); | 245 void UpdateAggregateStates_n(); |
| 246 | 246 |
| 247 void OnDtlsHandshakeError(rtc::SSLHandshakeError error); | 247 void OnDtlsHandshakeError(rtc::SSLHandshakeError error); |
| 248 | 248 |
| 249 rtc::Thread* const signaling_thread_ = nullptr; | 249 rtc::Thread* const signaling_thread_ = nullptr; |
| 250 rtc::Thread* const network_thread_ = nullptr; | 250 rtc::Thread* const network_thread_ = nullptr; |
| 251 PortAllocator* const port_allocator_ = nullptr; | 251 PortAllocator* const port_allocator_ = nullptr; |
| 252 | 252 |
| 253 std::map<std::string, std::unique_ptr<JsepTransport>> transports_; | 253 std::map<std::string, std::unique_ptr<JsepTransport>> transports_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 269 bool quic_ = false; | 269 bool quic_ = false; |
| 270 | 270 |
| 271 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; | 271 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; |
| 272 | 272 |
| 273 RTC_DISALLOW_COPY_AND_ASSIGN(TransportController); | 273 RTC_DISALLOW_COPY_AND_ASSIGN(TransportController); |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 } // namespace cricket | 276 } // namespace cricket |
| 277 | 277 |
| 278 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ | 278 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ |
| OLD | NEW |