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 static in_addr ExtractMappedAddress(const in6_addr& addr); | 47 static in_addr ExtractMappedAddress(const in6_addr& addr); |
48 | 48 |
49 uint32 IPAddress::v4AddressAsHostOrderInteger() const { | 49 uint32 IPAddress::v4AddressAsHostOrderInteger() const { |
50 if (family_ == AF_INET) { | 50 if (family_ == AF_INET) { |
51 return NetworkToHost32(u_.ip4.s_addr); | 51 return NetworkToHost32(u_.ip4.s_addr); |
52 } else { | 52 } else { |
53 return 0; | 53 return 0; |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
| 57 bool IPAddress::IsNil() const { |
| 58 return IPIsUnspec(*this); |
| 59 } |
| 60 |
57 size_t IPAddress::Size() const { | 61 size_t IPAddress::Size() const { |
58 switch (family_) { | 62 switch (family_) { |
59 case AF_INET: | 63 case AF_INET: |
60 return sizeof(in_addr); | 64 return sizeof(in_addr); |
61 case AF_INET6: | 65 case AF_INET6: |
62 return sizeof(in6_addr); | 66 return sizeof(in6_addr); |
63 } | 67 } |
64 return 0; | 68 return 0; |
65 } | 69 } |
66 | 70 |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 return 1; | 492 return 1; |
489 } else { | 493 } else { |
490 // A 'normal' IPv6 address. | 494 // A 'normal' IPv6 address. |
491 return 40; | 495 return 40; |
492 } | 496 } |
493 } | 497 } |
494 return 0; | 498 return 0; |
495 } | 499 } |
496 | 500 |
497 } // Namespace talk base | 501 } // Namespace talk base |
OLD | NEW |