OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 }; | 47 }; |
48 | 48 |
49 // P2PTransportChannel manages the candidates and connection process to keep | 49 // P2PTransportChannel manages the candidates and connection process to keep |
50 // two P2P clients connected to each other. | 50 // two P2P clients connected to each other. |
51 class P2PTransportChannel : public TransportChannelImpl, | 51 class P2PTransportChannel : public TransportChannelImpl, |
52 public rtc::MessageHandler { | 52 public rtc::MessageHandler { |
53 public: | 53 public: |
54 P2PTransportChannel(const std::string& content_name, | 54 P2PTransportChannel(const std::string& content_name, |
55 int component, | 55 int component, |
56 P2PTransport* transport, | 56 P2PTransport* transport, |
57 PortAllocator *allocator); | 57 PortAllocator* allocator); |
58 virtual ~P2PTransportChannel(); | 58 virtual ~P2PTransportChannel(); |
59 | 59 |
60 // From TransportChannelImpl: | 60 // From TransportChannelImpl: |
61 virtual Transport* GetTransport() { return transport_; } | 61 virtual Transport* GetTransport() { return transport_; } |
62 virtual TransportChannelState GetState() const; | 62 virtual TransportChannelState GetState() const; |
63 virtual void SetIceRole(IceRole role); | 63 virtual void SetIceRole(IceRole role); |
64 virtual IceRole GetIceRole() const { return ice_role_; } | 64 virtual IceRole GetIceRole() const { return ice_role_; } |
65 virtual void SetIceTiebreaker(uint64 tiebreaker); | 65 virtual void SetIceTiebreaker(uint64 tiebreaker); |
66 virtual bool GetIceProtocolType(IceProtocolType* type) const; | 66 virtual bool GetIceProtocolType(IceProtocolType* type) const; |
67 virtual void SetIceProtocolType(IceProtocolType type); | 67 virtual void SetIceProtocolType(IceProtocolType type); |
68 virtual void SetIceCredentials(const std::string& ice_ufrag, | 68 virtual void SetIceCredentials(const std::string& ice_ufrag, |
69 const std::string& ice_pwd); | 69 const std::string& ice_pwd); |
70 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, | 70 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, |
71 const std::string& ice_pwd); | 71 const std::string& ice_pwd); |
72 virtual void SetRemoteIceMode(IceMode mode); | 72 virtual void SetRemoteIceMode(IceMode mode); |
73 virtual void Connect(); | 73 virtual void Connect(); |
74 virtual void OnSignalingReady(); | 74 virtual Transport::CandidateGatheringState candidate_gathering_state() const { |
| 75 return candidate_gathering_state_; |
| 76 } |
75 virtual void OnCandidate(const Candidate& candidate); | 77 virtual void OnCandidate(const Candidate& candidate); |
76 // Sets the receiving timeout in milliseconds. | 78 // Sets the receiving timeout in milliseconds. |
77 // This also sets the check_receiving_delay proportionally. | 79 // This also sets the check_receiving_delay proportionally. |
78 virtual void SetReceivingTimeout(int receiving_timeout_ms); | 80 virtual void SetReceivingTimeout(int receiving_timeout_ms); |
79 | 81 |
80 // From TransportChannel: | 82 // From TransportChannel: |
81 virtual int SendPacket(const char *data, size_t len, | 83 virtual int SendPacket(const char *data, size_t len, |
82 const rtc::PacketOptions& options, int flags); | 84 const rtc::PacketOptions& options, int flags); |
83 virtual int SetOption(rtc::Socket::Option opt, int value); | 85 virtual int SetOption(rtc::Socket::Option opt, int value); |
84 virtual bool GetOption(rtc::Socket::Option opt, int* value); | 86 virtual bool GetOption(rtc::Socket::Option opt, int* value); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 217 |
216 void OnUseCandidate(Connection* conn); | 218 void OnUseCandidate(Connection* conn); |
217 | 219 |
218 virtual void OnMessage(rtc::Message *pmsg); | 220 virtual void OnMessage(rtc::Message *pmsg); |
219 void OnSort(); | 221 void OnSort(); |
220 void OnPing(); | 222 void OnPing(); |
221 | 223 |
222 void OnCheckReceiving(); | 224 void OnCheckReceiving(); |
223 | 225 |
224 P2PTransport* transport_; | 226 P2PTransport* transport_; |
225 PortAllocator *allocator_; | 227 PortAllocator* allocator_; |
226 rtc::Thread *worker_thread_; | 228 rtc::Thread* worker_thread_; |
227 bool incoming_only_; | 229 bool incoming_only_; |
228 bool waiting_for_signaling_; | |
229 int error_; | 230 int error_; |
230 std::vector<PortAllocatorSession*> allocator_sessions_; | 231 std::vector<PortAllocatorSession*> allocator_sessions_; |
231 std::vector<PortInterface *> ports_; | 232 std::vector<PortInterface *> ports_; |
232 std::vector<Connection *> connections_; | 233 std::vector<Connection *> connections_; |
233 Connection* best_connection_; | 234 Connection* best_connection_; |
234 // Connection selected by the controlling agent. This should be used only | 235 // Connection selected by the controlling agent. This should be used only |
235 // at controlled side when protocol type is RFC5245. | 236 // at controlled side when protocol type is RFC5245. |
236 Connection* pending_best_connection_; | 237 Connection* pending_best_connection_; |
237 std::vector<RemoteCandidate> remote_candidates_; | 238 std::vector<RemoteCandidate> remote_candidates_; |
238 bool sort_dirty_; // indicates whether another sort is needed right now | 239 bool sort_dirty_; // indicates whether another sort is needed right now |
239 bool was_writable_; | 240 bool was_writable_; |
240 typedef std::map<rtc::Socket::Option, int> OptionMap; | 241 typedef std::map<rtc::Socket::Option, int> OptionMap; |
241 OptionMap options_; | 242 OptionMap options_; |
242 std::string ice_ufrag_; | 243 std::string ice_ufrag_; |
243 std::string ice_pwd_; | 244 std::string ice_pwd_; |
244 std::string remote_ice_ufrag_; | 245 std::string remote_ice_ufrag_; |
245 std::string remote_ice_pwd_; | 246 std::string remote_ice_pwd_; |
246 IceProtocolType protocol_type_; | 247 IceProtocolType protocol_type_; |
247 IceMode remote_ice_mode_; | 248 IceMode remote_ice_mode_; |
248 IceRole ice_role_; | 249 IceRole ice_role_; |
249 uint64 tiebreaker_; | 250 uint64 tiebreaker_; |
250 uint32 remote_candidate_generation_; | 251 uint32 remote_candidate_generation_; |
| 252 Transport::CandidateGatheringState candidate_gathering_state_; |
251 | 253 |
252 int check_receiving_delay_; | 254 int check_receiving_delay_; |
253 int receiving_timeout_; | 255 int receiving_timeout_; |
254 | 256 |
255 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 257 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
256 }; | 258 }; |
257 | 259 |
258 } // namespace cricket | 260 } // namespace cricket |
259 | 261 |
260 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 262 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |