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

Unified Diff: net/base/ip_endpoint.cc

Issue 11528012: [net] Make IPEndPoint::GetFamily() return AddressFamily and add GetSockAddrFamily() to be used when… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update uses of GetFamily in net/dns/ Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/ip_endpoint.h ('k') | net/dns/address_sorter_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/ip_endpoint.cc
diff --git a/net/base/ip_endpoint.cc b/net/base/ip_endpoint.cc
index 8dc8e9ace3571161b35cbda39403e2fdf1103793..923596e810cb352923d49f2d64cb22cefaef0416 100644
--- a/net/base/ip_endpoint.cc
+++ b/net/base/ip_endpoint.cc
@@ -34,7 +34,19 @@ IPEndPoint::IPEndPoint(const IPEndPoint& endpoint) {
port_ = endpoint.port_;
}
-int IPEndPoint::GetFamily() const {
+AddressFamily IPEndPoint::GetFamily() const {
+ switch (address_.size()) {
+ case kIPv4AddressSize:
+ return ADDRESS_FAMILY_IPV4;
+ case kIPv6AddressSize:
+ return ADDRESS_FAMILY_IPV6;
+ default:
+ NOTREACHED() << "Bad IP address";
+ return ADDRESS_FAMILY_UNSPECIFIED;
+ }
+}
+
+int IPEndPoint::GetSockAddrFamily() const {
switch (address_.size()) {
case kIPv4AddressSize:
return AF_INET;
« no previous file with comments | « net/base/ip_endpoint.h ('k') | net/dns/address_sorter_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698