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

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

Issue 22861033: Move server socket functionality from TCPServerSocket into TCPSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/net.gyp » ('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 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 switch (address.size()) { 1962 switch (address.size()) {
1963 case kIPv4AddressSize: 1963 case kIPv4AddressSize:
1964 return ADDRESS_FAMILY_IPV4; 1964 return ADDRESS_FAMILY_IPV4;
1965 case kIPv6AddressSize: 1965 case kIPv6AddressSize:
1966 return ADDRESS_FAMILY_IPV6; 1966 return ADDRESS_FAMILY_IPV6;
1967 default: 1967 default:
1968 return ADDRESS_FAMILY_UNSPECIFIED; 1968 return ADDRESS_FAMILY_UNSPECIFIED;
1969 } 1969 }
1970 } 1970 }
1971 1971
1972 int ConvertAddressFamily(AddressFamily address_family) {
1973 switch (address_family) {
1974 case ADDRESS_FAMILY_UNSPECIFIED:
1975 return AF_UNSPEC;
1976 case ADDRESS_FAMILY_IPV4:
1977 return AF_INET;
1978 case ADDRESS_FAMILY_IPV6:
1979 return AF_INET6;
1980 }
1981 NOTREACHED();
1982 return AF_UNSPEC;
1983 }
1984
1972 bool ParseIPLiteralToNumber(const std::string& ip_literal, 1985 bool ParseIPLiteralToNumber(const std::string& ip_literal,
1973 IPAddressNumber* ip_number) { 1986 IPAddressNumber* ip_number) {
1974 // |ip_literal| could be either a IPv4 or an IPv6 literal. If it contains 1987 // |ip_literal| could be either a IPv4 or an IPv6 literal. If it contains
1975 // a colon however, it must be an IPv6 address. 1988 // a colon however, it must be an IPv6 address.
1976 if (ip_literal.find(':') != std::string::npos) { 1989 if (ip_literal.find(':') != std::string::npos) {
1977 // GURL expects IPv6 hostnames to be surrounded with brackets. 1990 // GURL expects IPv6 hostnames to be surrounded with brackets.
1978 std::string host_brackets = "[" + ip_literal + "]"; 1991 std::string host_brackets = "[" + ip_literal + "]";
1979 url_parse::Component host_comp(0, host_brackets.size()); 1992 url_parse::Component host_comp(0, host_brackets.size());
1980 1993
1981 // Try parsing the hostname as an IPv6 literal. 1994 // Try parsing the hostname as an IPv6 literal.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 2161
2149 NetworkInterface::NetworkInterface(const std::string& name, 2162 NetworkInterface::NetworkInterface(const std::string& name,
2150 const IPAddressNumber& address) 2163 const IPAddressNumber& address)
2151 : name(name), address(address) { 2164 : name(name), address(address) {
2152 } 2165 }
2153 2166
2154 NetworkInterface::~NetworkInterface() { 2167 NetworkInterface::~NetworkInterface() {
2155 } 2168 }
2156 2169
2157 } // namespace net 2170 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_util.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698