| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 const std::string& content_name, | 46 const std::string& content_name, |
| 47 int component) | 47 int component) |
| 48 : TransportChannelImpl(content_name, component), | 48 : TransportChannelImpl(content_name, component), |
| 49 transport_(transport), | 49 transport_(transport), |
| 50 dest_(nullptr), | 50 dest_(nullptr), |
| 51 state_(STATE_INIT), | 51 state_(STATE_INIT), |
| 52 async_(false), | 52 async_(false), |
| 53 do_dtls_(false), | 53 do_dtls_(false), |
| 54 role_(ICEROLE_UNKNOWN), | 54 role_(ICEROLE_UNKNOWN), |
| 55 tiebreaker_(0), | 55 tiebreaker_(0), |
| 56 ice_proto_(ICEPROTO_HYBRID), |
| 56 remote_ice_mode_(ICEMODE_FULL), | 57 remote_ice_mode_(ICEMODE_FULL), |
| 57 dtls_fingerprint_("", nullptr, 0), | 58 dtls_fingerprint_("", nullptr, 0), |
| 58 ssl_role_(rtc::SSL_CLIENT), | 59 ssl_role_(rtc::SSL_CLIENT), |
| 59 connection_count_(0) { | 60 connection_count_(0) { |
| 60 } | 61 } |
| 61 ~FakeTransportChannel() { | 62 ~FakeTransportChannel() { |
| 62 Reset(); | 63 Reset(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 uint64 IceTiebreaker() const { return tiebreaker_; } | 66 uint64 IceTiebreaker() const { return tiebreaker_; } |
| 67 TransportProtocol protocol() const { return ice_proto_; } |
| 66 IceMode remote_ice_mode() const { return remote_ice_mode_; } | 68 IceMode remote_ice_mode() const { return remote_ice_mode_; } |
| 67 const std::string& ice_ufrag() const { return ice_ufrag_; } | 69 const std::string& ice_ufrag() const { return ice_ufrag_; } |
| 68 const std::string& ice_pwd() const { return ice_pwd_; } | 70 const std::string& ice_pwd() const { return ice_pwd_; } |
| 69 const std::string& remote_ice_ufrag() const { return remote_ice_ufrag_; } | 71 const std::string& remote_ice_ufrag() const { return remote_ice_ufrag_; } |
| 70 const std::string& remote_ice_pwd() const { return remote_ice_pwd_; } | 72 const std::string& remote_ice_pwd() const { return remote_ice_pwd_; } |
| 71 const rtc::SSLFingerprint& dtls_fingerprint() const { | 73 const rtc::SSLFingerprint& dtls_fingerprint() const { |
| 72 return dtls_fingerprint_; | 74 return dtls_fingerprint_; |
| 73 } | 75 } |
| 74 | 76 |
| 75 void SetAsync(bool async) { | 77 void SetAsync(bool async) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 95 void SetIceRole(IceRole role) override { role_ = role; } | 97 void SetIceRole(IceRole role) override { role_ = role; } |
| 96 IceRole GetIceRole() const override { return role_; } | 98 IceRole GetIceRole() const override { return role_; } |
| 97 void SetIceTiebreaker(uint64 tiebreaker) override { | 99 void SetIceTiebreaker(uint64 tiebreaker) override { |
| 98 tiebreaker_ = tiebreaker; | 100 tiebreaker_ = tiebreaker; |
| 99 } | 101 } |
| 100 void SetIceCredentials(const std::string& ice_ufrag, | 102 void SetIceCredentials(const std::string& ice_ufrag, |
| 101 const std::string& ice_pwd) override { | 103 const std::string& ice_pwd) override { |
| 102 ice_ufrag_ = ice_ufrag; | 104 ice_ufrag_ = ice_ufrag; |
| 103 ice_pwd_ = ice_pwd; | 105 ice_pwd_ = ice_pwd; |
| 104 } | 106 } |
| 107 bool GetIceProtocolType(IceProtocolType* type) const override { |
| 108 *type = ice_proto_; |
| 109 return true; |
| 110 } |
| 111 void SetIceProtocolType(IceProtocolType type) override { ice_proto_ = type; } |
| 105 void SetRemoteIceCredentials(const std::string& ice_ufrag, | 112 void SetRemoteIceCredentials(const std::string& ice_ufrag, |
| 106 const std::string& ice_pwd) override { | 113 const std::string& ice_pwd) override { |
| 107 remote_ice_ufrag_ = ice_ufrag; | 114 remote_ice_ufrag_ = ice_ufrag; |
| 108 remote_ice_pwd_ = ice_pwd; | 115 remote_ice_pwd_ = ice_pwd; |
| 109 } | 116 } |
| 110 | 117 |
| 111 void SetRemoteIceMode(IceMode mode) override { remote_ice_mode_ = mode; } | 118 void SetRemoteIceMode(IceMode mode) override { remote_ice_mode_ = mode; } |
| 112 bool SetRemoteFingerprint(const std::string& alg, const uint8* digest, | 119 bool SetRemoteFingerprint(const std::string& alg, const uint8* digest, |
| 113 size_t digest_len) override { | 120 size_t digest_len) override { |
| 114 dtls_fingerprint_ = rtc::SSLFingerprint(alg, digest, digest_len); | 121 dtls_fingerprint_ = rtc::SSLFingerprint(alg, digest, digest_len); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 FakeTransportChannel* dest_; | 312 FakeTransportChannel* dest_; |
| 306 State state_; | 313 State state_; |
| 307 bool async_; | 314 bool async_; |
| 308 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; | 315 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |
| 309 rtc::FakeSSLCertificate* remote_cert_; | 316 rtc::FakeSSLCertificate* remote_cert_; |
| 310 bool do_dtls_; | 317 bool do_dtls_; |
| 311 std::vector<std::string> srtp_ciphers_; | 318 std::vector<std::string> srtp_ciphers_; |
| 312 std::string chosen_srtp_cipher_; | 319 std::string chosen_srtp_cipher_; |
| 313 IceRole role_; | 320 IceRole role_; |
| 314 uint64 tiebreaker_; | 321 uint64 tiebreaker_; |
| 322 IceProtocolType ice_proto_; |
| 315 std::string ice_ufrag_; | 323 std::string ice_ufrag_; |
| 316 std::string ice_pwd_; | 324 std::string ice_pwd_; |
| 317 std::string remote_ice_ufrag_; | 325 std::string remote_ice_ufrag_; |
| 318 std::string remote_ice_pwd_; | 326 std::string remote_ice_pwd_; |
| 319 IceMode remote_ice_mode_; | 327 IceMode remote_ice_mode_; |
| 320 rtc::SSLFingerprint dtls_fingerprint_; | 328 rtc::SSLFingerprint dtls_fingerprint_; |
| 321 rtc::SSLRole ssl_role_; | 329 rtc::SSLRole ssl_role_; |
| 322 size_t connection_count_; | 330 size_t connection_count_; |
| 323 }; | 331 }; |
| 324 | 332 |
| 325 // Fake transport class, which can be passed to anything that needs a Transport. | 333 // Fake transport class, which can be passed to anything that needs a Transport. |
| 326 // Can be informed of another FakeTransport via SetDestination (low-tech way | 334 // Can be informed of another FakeTransport via SetDestination (low-tech way |
| 327 // of doing candidates) | 335 // of doing candidates) |
| 328 class FakeTransport : public Transport { | 336 class FakeTransport : public Transport { |
| 329 public: | 337 public: |
| 330 typedef std::map<int, FakeTransportChannel*> ChannelMap; | 338 typedef std::map<int, FakeTransportChannel*> ChannelMap; |
| 331 FakeTransport(rtc::Thread* signaling_thread, | 339 FakeTransport(rtc::Thread* signaling_thread, |
| 332 rtc::Thread* worker_thread, | 340 rtc::Thread* worker_thread, |
| 333 const std::string& content_name, | 341 const std::string& content_name, |
| 334 PortAllocator* alllocator = nullptr) | 342 PortAllocator* alllocator = nullptr) |
| 335 : Transport(signaling_thread, worker_thread, | 343 : Transport(signaling_thread, worker_thread, |
| 336 content_name, nullptr), | 344 content_name, "test_type", nullptr), |
| 337 dest_(nullptr), | 345 dest_(nullptr), |
| 338 async_(false) { | 346 async_(false) { |
| 339 } | 347 } |
| 340 ~FakeTransport() { | 348 ~FakeTransport() { |
| 341 DestroyAllChannels(); | 349 DestroyAllChannels(); |
| 342 } | 350 } |
| 343 | 351 |
| 344 const ChannelMap& channels() const { return channels_; } | 352 const ChannelMap& channels() const { return channels_; } |
| 345 | 353 |
| 346 void SetAsync(bool async) { async_ = async; } | 354 void SetAsync(bool async) { async_ = async; } |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 505 } |
| 498 } | 506 } |
| 499 | 507 |
| 500 private: | 508 private: |
| 501 bool fail_create_channel_; | 509 bool fail_create_channel_; |
| 502 }; | 510 }; |
| 503 | 511 |
| 504 } // namespace cricket | 512 } // namespace cricket |
| 505 | 513 |
| 506 #endif // WEBRTC_P2P_BASE_FAKESESSION_H_ | 514 #endif // WEBRTC_P2P_BASE_FAKESESSION_H_ |
| OLD | NEW |