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