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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 const std::map<std::string, Transport*>& transports() { return transports_; } | 118 const std::map<std::string, Transport*>& transports() { return transports_; } |
119 Transport* GetTransport_w(const std::string& transport_name); | 119 Transport* GetTransport_w(const std::string& transport_name); |
120 | 120 |
121 private: | 121 private: |
122 void OnMessage(rtc::Message* pmsg) override; | 122 void OnMessage(rtc::Message* pmsg) override; |
123 | 123 |
124 Transport* GetOrCreateTransport_w(const std::string& transport_name); | 124 Transport* GetOrCreateTransport_w(const std::string& transport_name); |
125 void DestroyTransport_w(const std::string& transport_name); | 125 void DestroyTransport_w(const std::string& transport_name); |
126 void DestroyAllTransports_w(); | 126 void DestroyAllTransports_w(); |
127 | 127 |
128 // Add channel to internal list and connect signals. | |
129 void AddChannel_w(TransportChannelImpl* channel); | |
130 // Remove channel from internal list. | |
131 void RemoveChannel_w(TransportChannelImpl* channel); | |
132 | |
128 bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version); | 133 bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version); |
129 void SetIceConfig_w(const IceConfig& config); | 134 void SetIceConfig_w(const IceConfig& config); |
130 void SetIceRole_w(IceRole ice_role); | 135 void SetIceRole_w(IceRole ice_role); |
131 bool GetSslRole_w(rtc::SSLRole* role); | 136 bool GetSslRole_w(rtc::SSLRole* role); |
132 bool SetLocalCertificate_w( | 137 bool SetLocalCertificate_w( |
133 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); | 138 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); |
134 bool GetLocalCertificate_w( | 139 bool GetLocalCertificate_w( |
135 const std::string& transport_name, | 140 const std::string& transport_name, |
136 rtc::scoped_refptr<rtc::RTCCertificate>* certificate); | 141 rtc::scoped_refptr<rtc::RTCCertificate>* certificate); |
137 bool GetRemoteSSLCertificate_w(const std::string& transport_name, | 142 bool GetRemoteSSLCertificate_w(const std::string& transport_name, |
138 rtc::SSLCertificate** cert); | 143 rtc::SSLCertificate** cert); |
139 bool SetLocalTransportDescription_w(const std::string& transport_name, | 144 bool SetLocalTransportDescription_w(const std::string& transport_name, |
140 const TransportDescription& tdesc, | 145 const TransportDescription& tdesc, |
141 ContentAction action, | 146 ContentAction action, |
142 std::string* err); | 147 std::string* err); |
143 bool SetRemoteTransportDescription_w(const std::string& transport_name, | 148 bool SetRemoteTransportDescription_w(const std::string& transport_name, |
144 const TransportDescription& tdesc, | 149 const TransportDescription& tdesc, |
145 ContentAction action, | 150 ContentAction action, |
146 std::string* err); | 151 std::string* err); |
147 void MaybeStartGathering_w(); | 152 void MaybeStartGathering_w(); |
148 bool AddRemoteCandidates_w(const std::string& transport_name, | 153 bool AddRemoteCandidates_w(const std::string& transport_name, |
149 const Candidates& candidates, | 154 const Candidates& candidates, |
150 std::string* err); | 155 std::string* err); |
151 bool ReadyForRemoteCandidates_w(const std::string& transport_name); | 156 bool ReadyForRemoteCandidates_w(const std::string& transport_name); |
152 bool GetStats_w(const std::string& transport_name, TransportStats* stats); | 157 bool GetStats_w(const std::string& transport_name, TransportStats* stats); |
153 | 158 |
154 // Handlers for signals from Transport. | 159 // Handlers for signals from Transport. |
pthatcher1
2015/09/29 18:12:43
from TransportChannel.
| |
155 void OnTransportConnecting_w(Transport* transport); | 160 void OnChannelWritableState_w(TransportChannel* channel); |
156 void OnTransportWritableState_w(Transport* transport); | 161 void OnChannelReceivingState_w(TransportChannel* channel); |
157 void OnTransportReceivingState_w(Transport* transport); | 162 void OnChannelGatheringState_w(TransportChannelImpl* channel); |
158 void OnTransportCompleted_w(Transport* transport); | 163 void OnChannelCandidateGathered_w(TransportChannelImpl* channel, |
159 void OnTransportFailed_w(Transport* transport); | 164 const Candidate& candidate); |
160 void OnTransportGatheringState_w(Transport* transport); | 165 void OnChannelRoleConflict_w(TransportChannelImpl* channel); |
161 void OnTransportCandidatesGathered_w( | 166 void OnChannelConnectionRemoved_w(TransportChannelImpl* channel); |
162 Transport* transport, | |
163 const std::vector<Candidate>& candidates); | |
164 void OnTransportRoleConflict_w(); | |
165 | 167 |
166 void UpdateAggregateStates_w(); | 168 void UpdateAggregateStates_w(); |
167 bool HasChannels_w(); | |
168 | 169 |
169 rtc::Thread* const signaling_thread_ = nullptr; | 170 rtc::Thread* const signaling_thread_ = nullptr; |
170 rtc::Thread* const worker_thread_ = nullptr; | 171 rtc::Thread* const worker_thread_ = nullptr; |
171 typedef std::map<std::string, Transport*> TransportMap; | 172 typedef std::map<std::string, Transport*> TransportMap; |
172 TransportMap transports_; | 173 TransportMap transports_; |
173 | 174 |
175 std::vector<TransportChannelImpl*> channels_; | |
176 | |
174 PortAllocator* const port_allocator_ = nullptr; | 177 PortAllocator* const port_allocator_ = nullptr; |
175 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_10; | 178 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_10; |
176 | 179 |
177 // Aggregate state for Transports | 180 // Aggregate state for TransportChannelImpls. |
178 IceConnectionState connection_state_ = kIceConnectionConnecting; | 181 IceConnectionState connection_state_ = kIceConnectionConnecting; |
179 bool receiving_ = false; | 182 bool receiving_ = false; |
180 IceGatheringState gathering_state_ = kIceGatheringNew; | 183 IceGatheringState gathering_state_ = kIceGatheringNew; |
181 | 184 |
182 // TODO(deadbeef): Move the fields below down to the transports themselves | 185 // TODO(deadbeef): Move the fields below down to the transports themselves |
183 IceConfig ice_config_; | 186 IceConfig ice_config_; |
184 IceRole ice_role_ = ICEROLE_CONTROLLING; | 187 IceRole ice_role_ = ICEROLE_CONTROLLING; |
185 // Flag which will be set to true after the first role switch | 188 // Flag which will be set to true after the first role switch |
186 bool ice_role_switch_ = false; | 189 bool ice_role_switch_ = false; |
187 uint64 ice_tiebreaker_ = rtc::CreateRandomId64(); | 190 uint64 ice_tiebreaker_ = rtc::CreateRandomId64(); |
188 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; | 191 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |
189 }; | 192 }; |
190 | 193 |
191 } // namespace cricket | 194 } // namespace cricket |
192 | 195 |
193 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ | 196 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ |
OLD | NEW |