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