OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2017 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2017 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 bool SetSrtpCiphers(const std::vector<std::string>& ciphers) override { | 175 bool SetSrtpCiphers(const std::vector<std::string>& ciphers) override { |
176 std::vector<int> crypto_suites; | 176 std::vector<int> crypto_suites; |
177 for (const auto cipher : ciphers) { | 177 for (const auto cipher : ciphers) { |
178 crypto_suites.push_back(rtc::SrtpCryptoSuiteFromName(cipher)); | 178 crypto_suites.push_back(rtc::SrtpCryptoSuiteFromName(cipher)); |
179 } | 179 } |
180 return SetSrtpCryptoSuites(crypto_suites); | 180 return SetSrtpCryptoSuites(crypto_suites); |
181 } | 181 } |
182 | 182 |
183 IceTransportInternal* ice_transport() override { return ice_transport_; } | 183 IceTransportInternal* ice_transport() override { return ice_transport_; } |
184 | 184 |
185 // PacketTransportInterface implementation, which passes through to fake ICE | 185 // PacketTransportInternal implementation, which passes through to fake ICE |
186 // transport for sending actual packets. | 186 // transport for sending actual packets. |
187 bool writable() const override { return writable_; } | 187 bool writable() const override { return writable_; } |
188 bool receiving() const override { return receiving_; } | 188 bool receiving() const override { return receiving_; } |
189 int SendPacket(const char* data, | 189 int SendPacket(const char* data, |
190 size_t len, | 190 size_t len, |
191 const rtc::PacketOptions& options, | 191 const rtc::PacketOptions& options, |
192 int flags) override { | 192 int flags) override { |
193 // We expect only SRTP packets to be sent through this interface. | 193 // We expect only SRTP packets to be sent through this interface. |
194 if (flags != PF_SRTP_BYPASS && flags != 0) { | 194 if (flags != PF_SRTP_BYPASS && flags != 0) { |
195 return -1; | 195 return -1; |
196 } | 196 } |
197 return ice_transport_->SendPacket(data, len, options, flags); | 197 return ice_transport_->SendPacket(data, len, options, flags); |
198 } | 198 } |
199 int SetOption(rtc::Socket::Option opt, int value) override { | 199 int SetOption(rtc::Socket::Option opt, int value) override { |
200 return ice_transport_->SetOption(opt, value); | 200 return ice_transport_->SetOption(opt, value); |
201 } | 201 } |
202 bool GetOption(rtc::Socket::Option opt, int* value) override { | 202 bool GetOption(rtc::Socket::Option opt, int* value) override { |
203 return ice_transport_->GetOption(opt, value); | 203 return ice_transport_->GetOption(opt, value); |
204 } | 204 } |
205 int GetError() override { return ice_transport_->GetError(); } | 205 int GetError() override { return ice_transport_->GetError(); } |
206 | 206 |
207 private: | 207 private: |
208 void OnIceTransportReadPacket(PacketTransportInterface* ice_, | 208 void OnIceTransportReadPacket(PacketTransportInternal* ice_, |
209 const char* data, | 209 const char* data, |
210 size_t len, | 210 size_t len, |
211 const rtc::PacketTime& time, | 211 const rtc::PacketTime& time, |
212 int flags) { | 212 int flags) { |
213 SignalReadPacket(this, data, len, time, flags); | 213 SignalReadPacket(this, data, len, time, flags); |
214 } | 214 } |
215 | 215 |
216 void NegotiateSrtpCiphers() { | 216 void NegotiateSrtpCiphers() { |
217 for (std::vector<int>::const_iterator it1 = srtp_ciphers_.begin(); | 217 for (std::vector<int>::const_iterator it1 = srtp_ciphers_.begin(); |
218 it1 != srtp_ciphers_.end(); ++it1) { | 218 it1 != srtp_ciphers_.end(); ++it1) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 261 |
262 DtlsTransportState dtls_state_ = DTLS_TRANSPORT_NEW; | 262 DtlsTransportState dtls_state_ = DTLS_TRANSPORT_NEW; |
263 | 263 |
264 bool receiving_ = false; | 264 bool receiving_ = false; |
265 bool writable_ = false; | 265 bool writable_ = false; |
266 }; | 266 }; |
267 | 267 |
268 } // namespace cricket | 268 } // namespace cricket |
269 | 269 |
270 #endif // WEBRTC_P2P_BASE_FAKEDTLSTRANSPORT_H_ | 270 #endif // WEBRTC_P2P_BASE_FAKEDTLSTRANSPORT_H_ |
OLD | NEW |