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 virtual TransportChannel* CreateTransportChannel_n( | 116 virtual DtlsTransportInternal* CreateTransportChannel_n( |
117 const std::string& transport_name, | 117 const std::string& transport_name, |
118 int component); | 118 int component); |
119 | 119 |
120 // Decrements a channel's reference count, and destroys the channel if | 120 // Decrements a channel's reference count, and destroys the channel if |
121 // nothing is referencing it. | 121 // nothing is referencing it. |
122 virtual void DestroyTransportChannel_n(const std::string& transport_name, | 122 virtual void DestroyTransportChannel_n(const std::string& transport_name, |
123 int component); | 123 int component); |
124 | 124 |
125 void use_quic() { quic_ = true; } | 125 void use_quic() { quic_ = true; } |
126 bool quic() const { return quic_; } | 126 bool quic() const { return quic_; } |
127 | 127 |
128 // TODO(deadbeef): Remove all for_testing methods! | 128 // TODO(deadbeef): Remove all for_testing methods! |
129 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing() | 129 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing() |
130 const { | 130 const { |
131 return certificate_; | 131 return certificate_; |
132 } | 132 } |
133 std::vector<std::string> transport_names_for_testing(); | 133 std::vector<std::string> transport_names_for_testing(); |
134 std::vector<TransportChannelImpl*> channels_for_testing(); | 134 std::vector<DtlsTransportInternal*> channels_for_testing(); |
135 TransportChannelImpl* get_channel_for_testing( | 135 DtlsTransportInternal* get_channel_for_testing( |
136 const std::string& transport_name, | 136 const std::string& transport_name, |
137 int component); | 137 int component); |
138 | 138 |
139 // All of these signals are fired on the signalling thread. | 139 // All of these signals are fired on the signalling thread. |
140 | 140 |
141 // If any transport failed => failed, | 141 // If any transport failed => failed, |
142 // Else if all completed => completed, | 142 // Else if all completed => completed, |
143 // Else if all connected => connected, | 143 // Else if all connected => connected, |
144 // Else => connecting | 144 // Else => connecting |
145 sigslot::signal1<IceConnectionState> SignalConnectionState; | 145 sigslot::signal1<IceConnectionState> SignalConnectionState; |
(...skipping 11 matching lines...) Expand all Loading... |
157 SignalCandidatesGathered; | 157 SignalCandidatesGathered; |
158 | 158 |
159 sigslot::signal1<const Candidates&> SignalCandidatesRemoved; | 159 sigslot::signal1<const Candidates&> SignalCandidatesRemoved; |
160 | 160 |
161 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError; | 161 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError; |
162 | 162 |
163 protected: | 163 protected: |
164 // TODO(deadbeef): Get rid of these virtual methods. Used by | 164 // TODO(deadbeef): Get rid of these virtual methods. Used by |
165 // FakeTransportController currently, but FakeTransportController shouldn't | 165 // FakeTransportController currently, but FakeTransportController shouldn't |
166 // even be functioning by subclassing TransportController. | 166 // even be functioning by subclassing TransportController. |
167 virtual TransportChannelImpl* CreateIceTransportChannel_n( | 167 virtual IceTransportInternal* CreateIceTransportChannel_n( |
168 const std::string& transport_name, | 168 const std::string& transport_name, |
169 int component); | 169 int component); |
170 virtual TransportChannelImpl* CreateDtlsTransportChannel_n( | 170 virtual DtlsTransportInternal* CreateDtlsTransportChannel_n( |
171 const std::string& transport_name, | 171 const std::string& transport_name, |
172 int component, | 172 int component, |
173 TransportChannelImpl* ice); | 173 IceTransportInternal* ice); |
174 | 174 |
175 private: | 175 private: |
176 void OnMessage(rtc::Message* pmsg) override; | 176 void OnMessage(rtc::Message* pmsg) override; |
177 | 177 |
178 class ChannelPair; | 178 class ChannelPair; |
179 typedef rtc::RefCountedObject<ChannelPair> RefCountedChannel; | 179 typedef rtc::RefCountedObject<ChannelPair> RefCountedChannel; |
180 | 180 |
181 // Helper functions to get a channel or transport, or iterator to it (in case | 181 // Helper functions to get a channel or transport, or iterator to it (in case |
182 // it needs to be erased). | 182 // it needs to be erased). |
183 std::vector<RefCountedChannel*>::iterator GetChannelIterator_n( | 183 std::vector<RefCountedChannel*>::iterator GetChannelIterator_n( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 const Candidates& candidates, | 222 const Candidates& candidates, |
223 std::string* err); | 223 std::string* err); |
224 bool RemoveRemoteCandidates_n(const Candidates& candidates, std::string* err); | 224 bool RemoveRemoteCandidates_n(const Candidates& candidates, std::string* err); |
225 bool ReadyForRemoteCandidates_n(const std::string& transport_name) const; | 225 bool ReadyForRemoteCandidates_n(const std::string& transport_name) const; |
226 bool GetStats_n(const std::string& transport_name, TransportStats* stats); | 226 bool GetStats_n(const std::string& transport_name, TransportStats* stats); |
227 void SetMetricsObserver_n(webrtc::MetricsObserverInterface* metrics_observer); | 227 void SetMetricsObserver_n(webrtc::MetricsObserverInterface* metrics_observer); |
228 | 228 |
229 // Handlers for signals from Transport. | 229 // Handlers for signals from Transport. |
230 void OnChannelWritableState_n(rtc::PacketTransportInterface* transport); | 230 void OnChannelWritableState_n(rtc::PacketTransportInterface* transport); |
231 void OnChannelReceivingState_n(rtc::PacketTransportInterface* transport); | 231 void OnChannelReceivingState_n(rtc::PacketTransportInterface* transport); |
232 void OnChannelGatheringState_n(TransportChannelImpl* channel); | 232 void OnChannelGatheringState_n(IceTransportInternal* channel); |
233 void OnChannelCandidateGathered_n(TransportChannelImpl* channel, | 233 void OnChannelCandidateGathered_n(IceTransportInternal* channel, |
234 const Candidate& candidate); | 234 const Candidate& candidate); |
235 void OnChannelCandidatesRemoved(const Candidates& candidates); | 235 void OnChannelCandidatesRemoved(const Candidates& candidates); |
236 void OnChannelCandidatesRemoved_n(TransportChannelImpl* channel, | 236 void OnChannelCandidatesRemoved_n(IceTransportInternal* channel, |
237 const Candidates& candidates); | 237 const Candidates& candidates); |
238 void OnChannelRoleConflict_n(TransportChannelImpl* channel); | 238 void OnChannelRoleConflict_n(IceTransportInternal* channel); |
239 void OnChannelStateChanged_n(TransportChannelImpl* channel); | 239 void OnChannelStateChanged_n(IceTransportInternal* channel); |
240 | 240 |
241 void UpdateAggregateStates_n(); | 241 void UpdateAggregateStates_n(); |
242 | 242 |
243 void OnDtlsHandshakeError(rtc::SSLHandshakeError error); | 243 void OnDtlsHandshakeError(rtc::SSLHandshakeError error); |
244 | 244 |
245 rtc::Thread* const signaling_thread_ = nullptr; | 245 rtc::Thread* const signaling_thread_ = nullptr; |
246 rtc::Thread* const network_thread_ = nullptr; | 246 rtc::Thread* const network_thread_ = nullptr; |
247 PortAllocator* const port_allocator_ = nullptr; | 247 PortAllocator* const port_allocator_ = nullptr; |
248 | 248 |
249 std::map<std::string, std::unique_ptr<JsepTransport>> transports_; | 249 std::map<std::string, std::unique_ptr<JsepTransport>> transports_; |
(...skipping 15 matching lines...) Expand all Loading... |
265 bool quic_ = false; | 265 bool quic_ = false; |
266 | 266 |
267 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; | 267 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; |
268 | 268 |
269 RTC_DISALLOW_COPY_AND_ASSIGN(TransportController); | 269 RTC_DISALLOW_COPY_AND_ASSIGN(TransportController); |
270 }; | 270 }; |
271 | 271 |
272 } // namespace cricket | 272 } // namespace cricket |
273 | 273 |
274 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ | 274 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ |
OLD | NEW |