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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 virtual int SendPacket(const char *data, size_t len, | 78 virtual int SendPacket(const char *data, size_t len, |
79 const rtc::PacketOptions& options, int flags); | 79 const rtc::PacketOptions& options, int flags); |
80 virtual int SetOption(rtc::Socket::Option opt, int value); | 80 virtual int SetOption(rtc::Socket::Option opt, int value); |
81 virtual bool GetOption(rtc::Socket::Option opt, int* value); | 81 virtual bool GetOption(rtc::Socket::Option opt, int* value); |
82 virtual int GetError() { return error_; } | 82 virtual int GetError() { return error_; } |
83 virtual bool GetStats(std::vector<ConnectionInfo>* stats); | 83 virtual bool GetStats(std::vector<ConnectionInfo>* stats); |
84 | 84 |
85 const Connection* best_connection() const { return best_connection_; } | 85 const Connection* best_connection() const { return best_connection_; } |
86 void set_incoming_only(bool value) { incoming_only_ = value; } | 86 void set_incoming_only(bool value) { incoming_only_ = value; } |
87 | 87 |
| 88 // Sets the receiving timeout in milliseconds. |
| 89 // This also sets the check_receiving_delay proportionally. |
| 90 void set_receiving_timeout(int receiving_timeout_ms); |
| 91 |
88 // Note: This is only for testing purpose. | 92 // Note: This is only for testing purpose. |
89 // |ports_| should not be changed from outside. | 93 // |ports_| should not be changed from outside. |
90 const std::vector<PortInterface*>& ports() { return ports_; } | 94 const std::vector<PortInterface*>& ports() { return ports_; } |
91 | 95 |
92 IceMode remote_ice_mode() const { return remote_ice_mode_; } | 96 IceMode remote_ice_mode() const { return remote_ice_mode_; } |
93 | 97 |
94 // DTLS methods. | 98 // DTLS methods. |
95 virtual bool IsDtlsActive() const { return false; } | 99 virtual bool IsDtlsActive() const { return false; } |
96 | 100 |
97 // Default implementation. | 101 // Default implementation. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 147 } |
144 | 148 |
145 // Set DTLS Remote fingerprint. Must be after local identity set. | 149 // Set DTLS Remote fingerprint. Must be after local identity set. |
146 virtual bool SetRemoteFingerprint( | 150 virtual bool SetRemoteFingerprint( |
147 const std::string& digest_alg, | 151 const std::string& digest_alg, |
148 const uint8* digest, | 152 const uint8* digest, |
149 size_t digest_len) { | 153 size_t digest_len) { |
150 return false; | 154 return false; |
151 } | 155 } |
152 | 156 |
| 157 int receiving_timeout() const { return receiving_timeout_; } |
| 158 int check_receiving_delay() const { return check_receiving_delay_; } |
| 159 |
153 // Helper method used only in unittest. | 160 // Helper method used only in unittest. |
154 rtc::DiffServCodePoint DefaultDscpValue() const; | 161 rtc::DiffServCodePoint DefaultDscpValue() const; |
155 | 162 |
156 // Public for unit tests. | 163 // Public for unit tests. |
157 Connection* FindNextPingableConnection(); | 164 Connection* FindNextPingableConnection(); |
158 | 165 |
159 private: | 166 private: |
160 rtc::Thread* thread() { return worker_thread_; } | 167 rtc::Thread* thread() { return worker_thread_; } |
161 PortAllocatorSession* allocator_session() { | 168 PortAllocatorSession* allocator_session() { |
162 return allocator_sessions_.back(); | 169 return allocator_sessions_.back(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 const rtc::PacketTime& packet_time); | 213 const rtc::PacketTime& packet_time); |
207 void OnReadyToSend(Connection* connection); | 214 void OnReadyToSend(Connection* connection); |
208 void OnConnectionDestroyed(Connection *connection); | 215 void OnConnectionDestroyed(Connection *connection); |
209 | 216 |
210 void OnUseCandidate(Connection* conn); | 217 void OnUseCandidate(Connection* conn); |
211 | 218 |
212 virtual void OnMessage(rtc::Message *pmsg); | 219 virtual void OnMessage(rtc::Message *pmsg); |
213 void OnSort(); | 220 void OnSort(); |
214 void OnPing(); | 221 void OnPing(); |
215 | 222 |
| 223 void OnCheckReceiving(); |
| 224 |
216 P2PTransport* transport_; | 225 P2PTransport* transport_; |
217 PortAllocator *allocator_; | 226 PortAllocator *allocator_; |
218 rtc::Thread *worker_thread_; | 227 rtc::Thread *worker_thread_; |
219 bool incoming_only_; | 228 bool incoming_only_; |
220 bool waiting_for_signaling_; | 229 bool waiting_for_signaling_; |
221 int error_; | 230 int error_; |
222 std::vector<PortAllocatorSession*> allocator_sessions_; | 231 std::vector<PortAllocatorSession*> allocator_sessions_; |
223 std::vector<PortInterface *> ports_; | 232 std::vector<PortInterface *> ports_; |
224 std::vector<Connection *> connections_; | 233 std::vector<Connection *> connections_; |
225 Connection* best_connection_; | 234 Connection* best_connection_; |
226 // Connection selected by the controlling agent. This should be used only | 235 // Connection selected by the controlling agent. This should be used only |
227 // at controlled side when protocol type is RFC5245. | 236 // at controlled side when protocol type is RFC5245. |
228 Connection* pending_best_connection_; | 237 Connection* pending_best_connection_; |
229 std::vector<RemoteCandidate> remote_candidates_; | 238 std::vector<RemoteCandidate> remote_candidates_; |
230 bool sort_dirty_; // indicates whether another sort is needed right now | 239 bool sort_dirty_; // indicates whether another sort is needed right now |
231 bool was_writable_; | 240 bool was_writable_; |
232 typedef std::map<rtc::Socket::Option, int> OptionMap; | 241 typedef std::map<rtc::Socket::Option, int> OptionMap; |
233 OptionMap options_; | 242 OptionMap options_; |
234 std::string ice_ufrag_; | 243 std::string ice_ufrag_; |
235 std::string ice_pwd_; | 244 std::string ice_pwd_; |
236 std::string remote_ice_ufrag_; | 245 std::string remote_ice_ufrag_; |
237 std::string remote_ice_pwd_; | 246 std::string remote_ice_pwd_; |
238 IceProtocolType protocol_type_; | 247 IceProtocolType protocol_type_; |
239 IceMode remote_ice_mode_; | 248 IceMode remote_ice_mode_; |
240 IceRole ice_role_; | 249 IceRole ice_role_; |
241 uint64 tiebreaker_; | 250 uint64 tiebreaker_; |
242 uint32 remote_candidate_generation_; | 251 uint32 remote_candidate_generation_; |
243 | 252 |
| 253 int check_receiving_delay_; |
| 254 int receiving_timeout_; |
| 255 |
244 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 256 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
245 }; | 257 }; |
246 | 258 |
247 } // namespace cricket | 259 } // namespace cricket |
248 | 260 |
249 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 261 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |