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