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

Side by Side Diff: net/base/net_util.cc

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_unittest.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 10
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 #elif defined(OS_WIN) 2009 #elif defined(OS_WIN)
2010 // TODO(wtc): implement with the GetAdaptersAddresses function. 2010 // TODO(wtc): implement with the GetAdaptersAddresses function.
2011 NOTIMPLEMENTED(); 2011 NOTIMPLEMENTED();
2012 return false; 2012 return false;
2013 #else 2013 #else
2014 NOTIMPLEMENTED(); 2014 NOTIMPLEMENTED();
2015 return false; 2015 return false;
2016 #endif // defined(various platforms) 2016 #endif // defined(various platforms)
2017 } 2017 }
2018 2018
2019 AddressFamily GetAddressFamily(const IPAddressNumber& address) {
2020 switch (address.size()) {
2021 case kIPv4AddressSize:
2022 return ADDRESS_FAMILY_IPV4;
2023 case kIPv6AddressSize:
2024 return ADDRESS_FAMILY_IPV6;
2025 default:
2026 return ADDRESS_FAMILY_UNSPECIFIED;
2027 }
2028 }
2029
2019 bool ParseIPLiteralToNumber(const std::string& ip_literal, 2030 bool ParseIPLiteralToNumber(const std::string& ip_literal,
2020 IPAddressNumber* ip_number) { 2031 IPAddressNumber* ip_number) {
2021 // |ip_literal| could be either a IPv4 or an IPv6 literal. If it contains 2032 // |ip_literal| could be either a IPv4 or an IPv6 literal. If it contains
2022 // a colon however, it must be an IPv6 address. 2033 // a colon however, it must be an IPv6 address.
2023 if (ip_literal.find(':') != std::string::npos) { 2034 if (ip_literal.find(':') != std::string::npos) {
2024 // GURL expects IPv6 hostnames to be surrounded with brackets. 2035 // GURL expects IPv6 hostnames to be surrounded with brackets.
2025 std::string host_brackets = "[" + ip_literal + "]"; 2036 std::string host_brackets = "[" + ip_literal + "]";
2026 url_parse::Component host_comp(0, host_brackets.size()); 2037 url_parse::Component host_comp(0, host_brackets.size());
2027 2038
2028 // Try parsing the hostname as an IPv6 literal. 2039 // Try parsing the hostname as an IPv6 literal.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 2224
2214 NetworkInterface::NetworkInterface(const std::string& name, 2225 NetworkInterface::NetworkInterface(const std::string& name,
2215 const IPAddressNumber& address) 2226 const IPAddressNumber& address)
2216 : name(name), address(address) { 2227 : name(name), address(address) {
2217 } 2228 }
2218 2229
2219 NetworkInterface::~NetworkInterface() { 2230 NetworkInterface::~NetworkInterface() {
2220 } 2231 }
2221 2232
2222 } // namespace net 2233 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698