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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 int UDPPort::GetOption(rtc::Socket::Option opt, int* value) { | 273 int UDPPort::GetOption(rtc::Socket::Option opt, int* value) { |
274 return socket_->GetOption(opt, value); | 274 return socket_->GetOption(opt, value); |
275 } | 275 } |
276 | 276 |
277 int UDPPort::GetError() { | 277 int UDPPort::GetError() { |
278 return error_; | 278 return error_; |
279 } | 279 } |
280 | 280 |
281 void UDPPort::OnLocalAddressReady(rtc::AsyncPacketSocket* socket, | 281 void UDPPort::OnLocalAddressReady(rtc::AsyncPacketSocket* socket, |
282 const rtc::SocketAddress& address) { | 282 const rtc::SocketAddress& address) { |
283 AddAddress(address, address, rtc::SocketAddress(), | 283 AddAddress(address, address, rtc::SocketAddress(), UDP_PROTOCOL_NAME, "", "", |
284 UDP_PROTOCOL_NAME, "", LOCAL_PORT_TYPE, | 284 LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST, 0, false); |
285 ICE_TYPE_PREFERENCE_HOST, 0, false); | |
286 MaybePrepareStunCandidate(); | 285 MaybePrepareStunCandidate(); |
287 } | 286 } |
288 | 287 |
289 void UDPPort::OnReadPacket( | 288 void UDPPort::OnReadPacket( |
290 rtc::AsyncPacketSocket* socket, const char* data, size_t size, | 289 rtc::AsyncPacketSocket* socket, const char* data, size_t size, |
291 const rtc::SocketAddress& remote_addr, | 290 const rtc::SocketAddress& remote_addr, |
292 const rtc::PacketTime& packet_time) { | 291 const rtc::PacketTime& packet_time) { |
293 ASSERT(socket == socket_); | 292 ASSERT(socket == socket_); |
294 ASSERT(!remote_addr.IsUnresolved()); | 293 ASSERT(!remote_addr.IsUnresolved()); |
295 | 294 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 !HasCandidateWithAddress(stun_reflected_addr)) { | 388 !HasCandidateWithAddress(stun_reflected_addr)) { |
390 | 389 |
391 rtc::SocketAddress related_address = socket_->GetLocalAddress(); | 390 rtc::SocketAddress related_address = socket_->GetLocalAddress(); |
392 if (!(candidate_filter() & CF_HOST)) { | 391 if (!(candidate_filter() & CF_HOST)) { |
393 // If candidate filter doesn't have CF_HOST specified, empty raddr to | 392 // If candidate filter doesn't have CF_HOST specified, empty raddr to |
394 // avoid local address leakage. | 393 // avoid local address leakage. |
395 related_address = rtc::EmptySocketAddressWithFamily( | 394 related_address = rtc::EmptySocketAddressWithFamily( |
396 related_address.family()); | 395 related_address.family()); |
397 } | 396 } |
398 | 397 |
399 AddAddress(stun_reflected_addr, socket_->GetLocalAddress(), | 398 AddAddress(stun_reflected_addr, socket_->GetLocalAddress(), related_address, |
400 related_address, UDP_PROTOCOL_NAME, "", | 399 UDP_PROTOCOL_NAME, "", "", STUN_PORT_TYPE, |
401 STUN_PORT_TYPE, ICE_TYPE_PREFERENCE_SRFLX, 0, false); | 400 ICE_TYPE_PREFERENCE_SRFLX, 0, false); |
402 } | 401 } |
403 MaybeSetPortCompleteOrError(); | 402 MaybeSetPortCompleteOrError(); |
404 } | 403 } |
405 | 404 |
406 void UDPPort::OnStunBindingOrResolveRequestFailed( | 405 void UDPPort::OnStunBindingOrResolveRequestFailed( |
407 const rtc::SocketAddress& stun_server_addr) { | 406 const rtc::SocketAddress& stun_server_addr) { |
408 if (bind_request_failed_servers_.find(stun_server_addr) != | 407 if (bind_request_failed_servers_.find(stun_server_addr) != |
409 bind_request_failed_servers_.end()) { | 408 bind_request_failed_servers_.end()) { |
410 return; | 409 return; |
411 } | 410 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 const std::vector<Candidate>& existing_candidates = Candidates(); | 449 const std::vector<Candidate>& existing_candidates = Candidates(); |
451 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); | 450 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); |
452 for (; it != existing_candidates.end(); ++it) { | 451 for (; it != existing_candidates.end(); ++it) { |
453 if (it->address() == addr) | 452 if (it->address() == addr) |
454 return true; | 453 return true; |
455 } | 454 } |
456 return false; | 455 return false; |
457 } | 456 } |
458 | 457 |
459 } // namespace cricket | 458 } // namespace cricket |
OLD | NEW |