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

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

Issue 3036011: [Linux] Enable connecting to localhost when offline. (Closed)
Patch Set: Address comments Created 10 years, 5 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef NET_BASE_NET_UTIL_H_ 5 #ifndef NET_BASE_NET_UTIL_H_
6 #define NET_BASE_NET_UTIL_H_ 6 #define NET_BASE_NET_UTIL_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #ifdef OS_WIN 10 #ifdef OS_WIN
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // - reference section 320 // - reference section
321 GURL SimplifyUrlForRequest(const GURL& url); 321 GURL SimplifyUrlForRequest(const GURL& url);
322 322
323 void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports); 323 void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports);
324 324
325 // Perform a simplistic test to see if IPv6 is supported by trying to create an 325 // Perform a simplistic test to see if IPv6 is supported by trying to create an
326 // IPv6 socket. 326 // IPv6 socket.
327 // TODO(jar): Make test more in-depth as needed. 327 // TODO(jar): Make test more in-depth as needed.
328 bool IPv6Supported(); 328 bool IPv6Supported();
329 329
330 // Returns true if it can determine that only loopback addresses are configured.
331 // i.e. if only 127.0.0.1 and ::1 are routable.
332 bool HaveOnlyLoopbackAddresses();
333
330 // IPAddressNumber is used to represent an IP address's numeric value as an 334 // IPAddressNumber is used to represent an IP address's numeric value as an
331 // array of bytes, from most significant to least significant. This is the 335 // array of bytes, from most significant to least significant. This is the
332 // network byte ordering. 336 // network byte ordering.
333 // 337 //
334 // IPv4 addresses will have length 4, whereas IPv6 address will have length 16. 338 // IPv4 addresses will have length 4, whereas IPv6 address will have length 16.
335 typedef std::vector<unsigned char> IPAddressNumber; 339 typedef std::vector<unsigned char> IPAddressNumber;
336 340
337 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. 341 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value.
338 // Returns true on success and fills |ip_number| with the numeric value. 342 // Returns true on success and fills |ip_number| with the numeric value.
339 bool ParseIPLiteralToNumber(const std::string& ip_literal, 343 bool ParseIPLiteralToNumber(const std::string& ip_literal,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 378
375 // Returns the port field of the sockaddr in |info|. 379 // Returns the port field of the sockaddr in |info|.
376 uint16* GetPortFieldFromAddrinfo(const struct addrinfo* info); 380 uint16* GetPortFieldFromAddrinfo(const struct addrinfo* info);
377 381
378 // Returns the value of |info's| port (in host byte ordering). 382 // Returns the value of |info's| port (in host byte ordering).
379 int GetPortFromAddrinfo(const struct addrinfo* info); 383 int GetPortFromAddrinfo(const struct addrinfo* info);
380 384
381 } // namespace net 385 } // namespace net
382 386
383 #endif // NET_BASE_NET_UTIL_H_ 387 #endif // NET_BASE_NET_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698