OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 tiebreaker_(0), | 55 tiebreaker_(0), |
56 remote_ice_mode_(ICEMODE_FULL), | 56 remote_ice_mode_(ICEMODE_FULL), |
57 dtls_fingerprint_("", nullptr, 0), | 57 dtls_fingerprint_("", nullptr, 0), |
58 ssl_role_(rtc::SSL_CLIENT), | 58 ssl_role_(rtc::SSL_CLIENT), |
59 connection_count_(0) { | 59 connection_count_(0) { |
60 } | 60 } |
61 ~FakeTransportChannel() { | 61 ~FakeTransportChannel() { |
62 Reset(); | 62 Reset(); |
63 } | 63 } |
64 | 64 |
65 uint64 IceTiebreaker() const { return tiebreaker_; } | 65 uint64_t IceTiebreaker() const { return tiebreaker_; } |
66 IceMode remote_ice_mode() const { return remote_ice_mode_; } | 66 IceMode remote_ice_mode() const { return remote_ice_mode_; } |
67 const std::string& ice_ufrag() const { return ice_ufrag_; } | 67 const std::string& ice_ufrag() const { return ice_ufrag_; } |
68 const std::string& ice_pwd() const { return ice_pwd_; } | 68 const std::string& ice_pwd() const { return ice_pwd_; } |
69 const std::string& remote_ice_ufrag() const { return remote_ice_ufrag_; } | 69 const std::string& remote_ice_ufrag() const { return remote_ice_ufrag_; } |
70 const std::string& remote_ice_pwd() const { return remote_ice_pwd_; } | 70 const std::string& remote_ice_pwd() const { return remote_ice_pwd_; } |
71 const rtc::SSLFingerprint& dtls_fingerprint() const { | 71 const rtc::SSLFingerprint& dtls_fingerprint() const { |
72 return dtls_fingerprint_; | 72 return dtls_fingerprint_; |
73 } | 73 } |
74 | 74 |
75 void SetAsync(bool async) { | 75 void SetAsync(bool async) { |
(...skipping 11 matching lines...) Expand all Loading... |
87 | 87 |
88 if (connection_count_ == 1) { | 88 if (connection_count_ == 1) { |
89 return TransportChannelState::STATE_COMPLETED; | 89 return TransportChannelState::STATE_COMPLETED; |
90 } | 90 } |
91 | 91 |
92 return TransportChannelState::STATE_FAILED; | 92 return TransportChannelState::STATE_FAILED; |
93 } | 93 } |
94 | 94 |
95 void SetIceRole(IceRole role) override { role_ = role; } | 95 void SetIceRole(IceRole role) override { role_ = role; } |
96 IceRole GetIceRole() const override { return role_; } | 96 IceRole GetIceRole() const override { return role_; } |
97 void SetIceTiebreaker(uint64 tiebreaker) override { | 97 void SetIceTiebreaker(uint64_t tiebreaker) override { |
98 tiebreaker_ = tiebreaker; | 98 tiebreaker_ = tiebreaker; |
99 } | 99 } |
100 void SetIceCredentials(const std::string& ice_ufrag, | 100 void SetIceCredentials(const std::string& ice_ufrag, |
101 const std::string& ice_pwd) override { | 101 const std::string& ice_pwd) override { |
102 ice_ufrag_ = ice_ufrag; | 102 ice_ufrag_ = ice_ufrag; |
103 ice_pwd_ = ice_pwd; | 103 ice_pwd_ = ice_pwd; |
104 } | 104 } |
105 void SetRemoteIceCredentials(const std::string& ice_ufrag, | 105 void SetRemoteIceCredentials(const std::string& ice_ufrag, |
106 const std::string& ice_pwd) override { | 106 const std::string& ice_pwd) override { |
107 remote_ice_ufrag_ = ice_ufrag; | 107 remote_ice_ufrag_ = ice_ufrag; |
108 remote_ice_pwd_ = ice_pwd; | 108 remote_ice_pwd_ = ice_pwd; |
109 } | 109 } |
110 | 110 |
111 void SetRemoteIceMode(IceMode mode) override { remote_ice_mode_ = mode; } | 111 void SetRemoteIceMode(IceMode mode) override { remote_ice_mode_ = mode; } |
112 bool SetRemoteFingerprint(const std::string& alg, const uint8* digest, | 112 bool SetRemoteFingerprint(const std::string& alg, |
| 113 const uint8_t* digest, |
113 size_t digest_len) override { | 114 size_t digest_len) override { |
114 dtls_fingerprint_ = rtc::SSLFingerprint(alg, digest, digest_len); | 115 dtls_fingerprint_ = rtc::SSLFingerprint(alg, digest, digest_len); |
115 return true; | 116 return true; |
116 } | 117 } |
117 bool SetSslRole(rtc::SSLRole role) override { | 118 bool SetSslRole(rtc::SSLRole role) override { |
118 ssl_role_ = role; | 119 ssl_role_ = role; |
119 return true; | 120 return true; |
120 } | 121 } |
121 bool GetSslRole(rtc::SSLRole* role) const override { | 122 bool GetSslRole(rtc::SSLRole* role) const override { |
122 *role = ssl_role_; | 123 *role = ssl_role_; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 258 |
258 bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override { | 259 bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override { |
259 if (!remote_cert_) | 260 if (!remote_cert_) |
260 return false; | 261 return false; |
261 | 262 |
262 *cert = remote_cert_->GetReference(); | 263 *cert = remote_cert_->GetReference(); |
263 return true; | 264 return true; |
264 } | 265 } |
265 | 266 |
266 bool ExportKeyingMaterial(const std::string& label, | 267 bool ExportKeyingMaterial(const std::string& label, |
267 const uint8* context, | 268 const uint8_t* context, |
268 size_t context_len, | 269 size_t context_len, |
269 bool use_context, | 270 bool use_context, |
270 uint8* result, | 271 uint8_t* result, |
271 size_t result_len) override { | 272 size_t result_len) override { |
272 if (!chosen_srtp_cipher_.empty()) { | 273 if (!chosen_srtp_cipher_.empty()) { |
273 memset(result, 0xff, result_len); | 274 memset(result, 0xff, result_len); |
274 return true; | 275 return true; |
275 } | 276 } |
276 | 277 |
277 return false; | 278 return false; |
278 } | 279 } |
279 | 280 |
280 virtual void NegotiateSrtpCiphers() { | 281 virtual void NegotiateSrtpCiphers() { |
(...skipping 23 matching lines...) Expand all Loading... |
304 Transport* transport_; | 305 Transport* transport_; |
305 FakeTransportChannel* dest_; | 306 FakeTransportChannel* dest_; |
306 State state_; | 307 State state_; |
307 bool async_; | 308 bool async_; |
308 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; | 309 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |
309 rtc::FakeSSLCertificate* remote_cert_; | 310 rtc::FakeSSLCertificate* remote_cert_; |
310 bool do_dtls_; | 311 bool do_dtls_; |
311 std::vector<std::string> srtp_ciphers_; | 312 std::vector<std::string> srtp_ciphers_; |
312 std::string chosen_srtp_cipher_; | 313 std::string chosen_srtp_cipher_; |
313 IceRole role_; | 314 IceRole role_; |
314 uint64 tiebreaker_; | 315 uint64_t tiebreaker_; |
315 std::string ice_ufrag_; | 316 std::string ice_ufrag_; |
316 std::string ice_pwd_; | 317 std::string ice_pwd_; |
317 std::string remote_ice_ufrag_; | 318 std::string remote_ice_ufrag_; |
318 std::string remote_ice_pwd_; | 319 std::string remote_ice_pwd_; |
319 IceMode remote_ice_mode_; | 320 IceMode remote_ice_mode_; |
320 rtc::SSLFingerprint dtls_fingerprint_; | 321 rtc::SSLFingerprint dtls_fingerprint_; |
321 rtc::SSLRole ssl_role_; | 322 rtc::SSLRole ssl_role_; |
322 size_t connection_count_; | 323 size_t connection_count_; |
323 }; | 324 }; |
324 | 325 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 } | 498 } |
498 } | 499 } |
499 | 500 |
500 private: | 501 private: |
501 bool fail_create_channel_; | 502 bool fail_create_channel_; |
502 }; | 503 }; |
503 | 504 |
504 } // namespace cricket | 505 } // namespace cricket |
505 | 506 |
506 #endif // WEBRTC_P2P_BASE_FAKESESSION_H_ | 507 #endif // WEBRTC_P2P_BASE_FAKESESSION_H_ |
OLD | NEW |