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 int component) | 46 int component) |
47 : TransportChannelImpl(content_name, component), | 47 : TransportChannelImpl(content_name, component), |
48 transport_(transport), | 48 transport_(transport), |
49 dest_(NULL), | 49 dest_(NULL), |
50 state_(STATE_INIT), | 50 state_(STATE_INIT), |
51 async_(false), | 51 async_(false), |
52 identity_(NULL), | 52 identity_(NULL), |
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_("", NULL, 0), | 58 dtls_fingerprint_("", NULL, 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 12 matching lines...) Expand all Loading... |
88 if (connection_count_ == 1) { | 90 if (connection_count_ == 1) { |
89 return TransportChannelState::STATE_COMPLETED; | 91 return TransportChannelState::STATE_COMPLETED; |
90 } | 92 } |
91 | 93 |
92 return TransportChannelState::STATE_FAILED; | 94 return TransportChannelState::STATE_FAILED; |
93 } | 95 } |
94 | 96 |
95 virtual void SetIceRole(IceRole role) { role_ = role; } | 97 virtual void SetIceRole(IceRole role) { role_ = role; } |
96 virtual IceRole GetIceRole() const { return role_; } | 98 virtual IceRole GetIceRole() const { return role_; } |
97 virtual void SetIceTiebreaker(uint64 tiebreaker) { tiebreaker_ = tiebreaker; } | 99 virtual void SetIceTiebreaker(uint64 tiebreaker) { tiebreaker_ = tiebreaker; } |
| 100 virtual bool GetIceProtocolType(IceProtocolType* type) const { |
| 101 *type = ice_proto_; |
| 102 return true; |
| 103 } |
| 104 virtual void SetIceProtocolType(IceProtocolType type) { ice_proto_ = type; } |
98 virtual void SetIceCredentials(const std::string& ice_ufrag, | 105 virtual void SetIceCredentials(const std::string& ice_ufrag, |
99 const std::string& ice_pwd) { | 106 const std::string& ice_pwd) { |
100 ice_ufrag_ = ice_ufrag; | 107 ice_ufrag_ = ice_ufrag; |
101 ice_pwd_ = ice_pwd; | 108 ice_pwd_ = ice_pwd; |
102 } | 109 } |
103 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, | 110 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, |
104 const std::string& ice_pwd) { | 111 const std::string& ice_pwd) { |
105 remote_ice_ufrag_ = ice_ufrag; | 112 remote_ice_ufrag_ = ice_ufrag; |
106 remote_ice_pwd_ = ice_pwd; | 113 remote_ice_pwd_ = ice_pwd; |
107 } | 114 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 FakeTransportChannel* dest_; | 313 FakeTransportChannel* dest_; |
307 State state_; | 314 State state_; |
308 bool async_; | 315 bool async_; |
309 rtc::SSLIdentity* identity_; | 316 rtc::SSLIdentity* identity_; |
310 rtc::FakeSSLCertificate* remote_cert_; | 317 rtc::FakeSSLCertificate* remote_cert_; |
311 bool do_dtls_; | 318 bool do_dtls_; |
312 std::vector<std::string> srtp_ciphers_; | 319 std::vector<std::string> srtp_ciphers_; |
313 std::string chosen_srtp_cipher_; | 320 std::string chosen_srtp_cipher_; |
314 IceRole role_; | 321 IceRole role_; |
315 uint64 tiebreaker_; | 322 uint64 tiebreaker_; |
| 323 IceProtocolType ice_proto_; |
316 std::string ice_ufrag_; | 324 std::string ice_ufrag_; |
317 std::string ice_pwd_; | 325 std::string ice_pwd_; |
318 std::string remote_ice_ufrag_; | 326 std::string remote_ice_ufrag_; |
319 std::string remote_ice_pwd_; | 327 std::string remote_ice_pwd_; |
320 IceMode remote_ice_mode_; | 328 IceMode remote_ice_mode_; |
321 rtc::SSLFingerprint dtls_fingerprint_; | 329 rtc::SSLFingerprint dtls_fingerprint_; |
322 rtc::SSLRole ssl_role_; | 330 rtc::SSLRole ssl_role_; |
323 size_t connection_count_; | 331 size_t connection_count_; |
324 }; | 332 }; |
325 | 333 |
326 // Fake transport class, which can be passed to anything that needs a Transport. | 334 // Fake transport class, which can be passed to anything that needs a Transport. |
327 // Can be informed of another FakeTransport via SetDestination (low-tech way | 335 // Can be informed of another FakeTransport via SetDestination (low-tech way |
328 // of doing candidates) | 336 // of doing candidates) |
329 class FakeTransport : public Transport { | 337 class FakeTransport : public Transport { |
330 public: | 338 public: |
331 typedef std::map<int, FakeTransportChannel*> ChannelMap; | 339 typedef std::map<int, FakeTransportChannel*> ChannelMap; |
332 FakeTransport(rtc::Thread* signaling_thread, | 340 FakeTransport(rtc::Thread* signaling_thread, |
333 rtc::Thread* worker_thread, | 341 rtc::Thread* worker_thread, |
334 const std::string& content_name, | 342 const std::string& content_name, |
335 PortAllocator* alllocator = NULL) | 343 PortAllocator* alllocator = NULL) |
336 : Transport(signaling_thread, worker_thread, | 344 : Transport(signaling_thread, worker_thread, |
337 content_name, NULL), | 345 content_name, "test_type", NULL), |
338 dest_(NULL), | 346 dest_(NULL), |
339 async_(false), | 347 async_(false), |
340 identity_(NULL) { | 348 identity_(NULL) { |
341 } | 349 } |
342 ~FakeTransport() { | 350 ~FakeTransport() { |
343 DestroyAllChannels(); | 351 DestroyAllChannels(); |
344 } | 352 } |
345 | 353 |
346 const ChannelMap& channels() const { return channels_; } | 354 const ChannelMap& channels() const { return channels_; } |
347 | 355 |
(...skipping 149 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 |