Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: webrtc/base/ipaddress.h

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/httpcommon-inl.h ('k') | webrtc/base/ipaddress.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 explicit IPAddress(const in_addr& ip4) : family_(AF_INET) { 56 explicit IPAddress(const in_addr& ip4) : family_(AF_INET) {
57 memset(&u_, 0, sizeof(u_)); 57 memset(&u_, 0, sizeof(u_));
58 u_.ip4 = ip4; 58 u_.ip4 = ip4;
59 } 59 }
60 60
61 explicit IPAddress(const in6_addr& ip6) : family_(AF_INET6) { 61 explicit IPAddress(const in6_addr& ip6) : family_(AF_INET6) {
62 u_.ip6 = ip6; 62 u_.ip6 = ip6;
63 } 63 }
64 64
65 explicit IPAddress(uint32 ip_in_host_byte_order) : family_(AF_INET) { 65 explicit IPAddress(uint32_t ip_in_host_byte_order) : family_(AF_INET) {
66 memset(&u_, 0, sizeof(u_)); 66 memset(&u_, 0, sizeof(u_));
67 u_.ip4.s_addr = HostToNetwork32(ip_in_host_byte_order); 67 u_.ip4.s_addr = HostToNetwork32(ip_in_host_byte_order);
68 } 68 }
69 69
70 IPAddress(const IPAddress& other) : family_(other.family_) { 70 IPAddress(const IPAddress& other) : family_(other.family_) {
71 ::memcpy(&u_, &other.u_, sizeof(u_)); 71 ::memcpy(&u_, &other.u_, sizeof(u_));
72 } 72 }
73 73
74 virtual ~IPAddress() {} 74 virtual ~IPAddress() {}
75 75
(...skipping 24 matching lines...) Expand all
100 100
101 // Returns an unmapped address from a possibly-mapped address. 101 // Returns an unmapped address from a possibly-mapped address.
102 // Returns the same address if this isn't a mapped address. 102 // Returns the same address if this isn't a mapped address.
103 IPAddress Normalized() const; 103 IPAddress Normalized() const;
104 104
105 // Returns this address as an IPv6 address. 105 // Returns this address as an IPv6 address.
106 // Maps v4 addresses (as ::ffff:a.b.c.d), returns v6 addresses unchanged. 106 // Maps v4 addresses (as ::ffff:a.b.c.d), returns v6 addresses unchanged.
107 IPAddress AsIPv6Address() const; 107 IPAddress AsIPv6Address() const;
108 108
109 // For socketaddress' benefit. Returns the IP in host byte order. 109 // For socketaddress' benefit. Returns the IP in host byte order.
110 uint32 v4AddressAsHostOrderInteger() const; 110 uint32_t v4AddressAsHostOrderInteger() const;
111 111
112 // Whether this is an unspecified IP address. 112 // Whether this is an unspecified IP address.
113 bool IsNil() const; 113 bool IsNil() const;
114 114
115 static void set_strip_sensitive(bool enable); 115 static void set_strip_sensitive(bool enable);
116 116
117 private: 117 private:
118 int family_; 118 int family_;
119 union { 119 union {
120 in_addr ip4; 120 in_addr ip4;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 IPAddress GetLoopbackIP(int family); 182 IPAddress GetLoopbackIP(int family);
183 183
184 // Returns the number of contiguously set bits, counting from the MSB in network 184 // Returns the number of contiguously set bits, counting from the MSB in network
185 // byte order, in this IPAddress. Bits after the first 0 encountered are not 185 // byte order, in this IPAddress. Bits after the first 0 encountered are not
186 // counted. 186 // counted.
187 int CountIPMaskBits(IPAddress mask); 187 int CountIPMaskBits(IPAddress mask);
188 188
189 } // namespace rtc 189 } // namespace rtc
190 190
191 #endif // WEBRTC_BASE_IPADDRESS_H_ 191 #endif // WEBRTC_BASE_IPADDRESS_H_
OLDNEW
« no previous file with comments | « webrtc/base/httpcommon-inl.h ('k') | webrtc/base/ipaddress.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698