OLD | NEW |
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 #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 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 socklen_t address_len); | 409 socklen_t address_len); |
410 | 410 |
411 // Returns true if |host| is one of the names (e.g. "localhost") or IP | 411 // Returns true if |host| is one of the names (e.g. "localhost") or IP |
412 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback. | 412 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback. |
413 // | 413 // |
414 // Note that this function does not check for IP addresses other than | 414 // Note that this function does not check for IP addresses other than |
415 // the above, although other IP addresses may point to the local | 415 // the above, although other IP addresses may point to the local |
416 // machine. | 416 // machine. |
417 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); | 417 NET_EXPORT_PRIVATE bool IsLocalhost(const std::string& host); |
418 | 418 |
| 419 // Category of network interface types. |
| 420 enum NetworkInterfaceType { |
| 421 NETWORK_INTERFACE_UNKNOWN, |
| 422 NETWORK_INTERFACE_ETHERNET, |
| 423 NETWORK_INTERFACE_WIFI, |
| 424 NETWORK_INTERFACE_CELLULAR, |
| 425 NETWORK_INTERFACE_VPN |
| 426 }; |
| 427 |
419 // struct that is used by GetNetworkList() to represent a network | 428 // struct that is used by GetNetworkList() to represent a network |
420 // interface. | 429 // interface. |
421 struct NET_EXPORT NetworkInterface { | 430 struct NET_EXPORT NetworkInterface { |
422 NetworkInterface(); | 431 NetworkInterface(); |
423 NetworkInterface(const std::string& name, | 432 NetworkInterface(const std::string& name, |
424 const std::string& friendly_name, | 433 const std::string& friendly_name, |
425 uint32 interface_index, | 434 uint32 interface_index, |
| 435 NetworkInterfaceType type, |
426 const IPAddressNumber& address, | 436 const IPAddressNumber& address, |
427 size_t network_prefix); | 437 size_t network_prefix); |
428 ~NetworkInterface(); | 438 ~NetworkInterface(); |
429 | 439 |
430 std::string name; | 440 std::string name; |
431 std::string friendly_name; // Same as |name| on non-Windows. | 441 std::string friendly_name; // Same as |name| on non-Windows. |
432 uint32 interface_index; // Always 0 on Android. | 442 uint32 interface_index; // Always 0 on Android. |
| 443 NetworkInterfaceType type; |
433 IPAddressNumber address; | 444 IPAddressNumber address; |
434 size_t network_prefix; | 445 size_t network_prefix; |
435 }; | 446 }; |
436 | 447 |
437 typedef std::vector<NetworkInterface> NetworkInterfaceList; | 448 typedef std::vector<NetworkInterface> NetworkInterfaceList; |
438 | 449 |
439 // Policy settings to include/exclude network interfaces. | 450 // Policy settings to include/exclude network interfaces. |
440 enum HostAddressSelectionPolicy { | 451 enum HostAddressSelectionPolicy { |
441 INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x0, | 452 INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x0, |
442 EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x1, | 453 EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x1, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 DSCP_CS5 = 40, // Video | 518 DSCP_CS5 = 40, // Video |
508 DSCP_EF = 46, // Voice | 519 DSCP_EF = 46, // Voice |
509 DSCP_CS6 = 48, // Voice | 520 DSCP_CS6 = 48, // Voice |
510 DSCP_CS7 = 56, // Control messages | 521 DSCP_CS7 = 56, // Control messages |
511 DSCP_LAST = DSCP_CS7 | 522 DSCP_LAST = DSCP_CS7 |
512 }; | 523 }; |
513 | 524 |
514 } // namespace net | 525 } // namespace net |
515 | 526 |
516 #endif // NET_BASE_NET_UTIL_H_ | 527 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |