| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 85 // | 85 // | 
| 86 // IPv6 literals must be specified in a bracketed form, for instance: | 86 // IPv6 literals must be specified in a bracketed form, for instance: | 
| 87 //   [::1]:90 and [::1] | 87 //   [::1]:90 and [::1] | 
| 88 // | 88 // | 
| 89 // The resultant |*host| in both cases will be "::1" (not bracketed). | 89 // The resultant |*host| in both cases will be "::1" (not bracketed). | 
| 90 NET_EXPORT bool ParseHostAndPort( | 90 NET_EXPORT bool ParseHostAndPort( | 
| 91     std::string::const_iterator host_and_port_begin, | 91     std::string::const_iterator host_and_port_begin, | 
| 92     std::string::const_iterator host_and_port_end, | 92     std::string::const_iterator host_and_port_end, | 
| 93     std::string* host, | 93     std::string* host, | 
| 94     int* port); | 94     int* port); | 
| 95 NET_EXPORT bool ParseHostAndPort( | 95 NET_EXPORT bool ParseHostAndPort(const std::string& host_and_port, | 
| 96     const std::string& host_and_port, | 96                                  std::string* host, | 
| 97     std::string* host, | 97                                  int* port); | 
| 98     int* port); |  | 
| 99 | 98 | 
| 100 // Returns a host:port string for the given URL. | 99 // Returns a host:port string for the given URL. | 
| 101 NET_EXPORT std::string GetHostAndPort(const GURL& url); | 100 NET_EXPORT std::string GetHostAndPort(const GURL& url); | 
| 102 | 101 | 
| 103 // Returns a host[:port] string for the given URL, where the port is omitted | 102 // Returns a host[:port] string for the given URL, where the port is omitted | 
| 104 // if it is the default for the URL's scheme. | 103 // if it is the default for the URL's scheme. | 
| 105 NET_EXPORT_PRIVATE std::string GetHostAndOptionalPort(const GURL& url); | 104 NET_EXPORT_PRIVATE std::string GetHostAndOptionalPort(const GURL& url); | 
| 106 | 105 | 
| 107 // Returns true if |hostname| contains a non-registerable or non-assignable | 106 // Returns true if |hostname| contains a non-registerable or non-assignable | 
| 108 // domain name (eg: a gTLD that has not been assigned by IANA) or an IP address | 107 // domain name (eg: a gTLD that has not been assigned by IANA) or an IP address | 
| 109 // that falls in an IANA-reserved range. | 108 // that falls in an IANA-reserved range. | 
| 110 NET_EXPORT bool IsHostnameNonUnique(const std::string& hostname); | 109 NET_EXPORT bool IsHostnameNonUnique(const std::string& hostname); | 
| 111 | 110 | 
| 112 // Returns true if an IP address hostname is in a range reserved by the IANA. | 111 // Returns true if an IP address hostname is in a range reserved by the IANA. | 
| 113 // Works with both IPv4 and IPv6 addresses, and only compares against a given | 112 // Works with both IPv4 and IPv6 addresses, and only compares against a given | 
| 114 // protocols's reserved ranges. | 113 // protocols's reserved ranges. | 
| 115 NET_EXPORT bool IsIPAddressReserved(const IPAddressNumber& address); | 114 NET_EXPORT bool IsIPAddressReserved(const IPAddressNumber& address); | 
| 116 | 115 | 
| 117 // Convenience struct for when you need a |struct sockaddr|. | 116 // Convenience struct for when you need a |struct sockaddr|. | 
| 118 struct SockaddrStorage { | 117 struct SockaddrStorage { | 
| 119   SockaddrStorage() : addr_len(sizeof(addr_storage)), | 118   SockaddrStorage() | 
| 120                       addr(reinterpret_cast<struct sockaddr*>(&addr_storage)) {} | 119       : addr_len(sizeof(addr_storage)), | 
|  | 120         addr(reinterpret_cast<struct sockaddr*>(&addr_storage)) {} | 
| 121   SockaddrStorage(const SockaddrStorage& other); | 121   SockaddrStorage(const SockaddrStorage& other); | 
| 122   void operator=(const SockaddrStorage& other); | 122   void operator=(const SockaddrStorage& other); | 
| 123 | 123 | 
| 124   struct sockaddr_storage addr_storage; | 124   struct sockaddr_storage addr_storage; | 
| 125   socklen_t addr_len; | 125   socklen_t addr_len; | 
| 126   struct sockaddr* const addr; | 126   struct sockaddr* const addr; | 
| 127 }; | 127 }; | 
| 128 | 128 | 
| 129 // Extracts the IP address and port portions of a sockaddr. |port| is optional, | 129 // Extracts the IP address and port portions of a sockaddr. |port| is optional, | 
| 130 // and will not be filled in if NULL. | 130 // and will not be filled in if NULL. | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 152 | 152 | 
| 153 // Same as IPAddressToStringWithPort() but for a sockaddr. This output will not | 153 // Same as IPAddressToStringWithPort() but for a sockaddr. This output will not | 
| 154 // include the IPv6 scope ID. | 154 // include the IPv6 scope ID. | 
| 155 NET_EXPORT std::string NetAddressToStringWithPort(const struct sockaddr* sa, | 155 NET_EXPORT std::string NetAddressToStringWithPort(const struct sockaddr* sa, | 
| 156                                                   socklen_t sock_addr_len); | 156                                                   socklen_t sock_addr_len); | 
| 157 | 157 | 
| 158 // Same as IPAddressToString() but for an IPAddressNumber. | 158 // Same as IPAddressToString() but for an IPAddressNumber. | 
| 159 NET_EXPORT std::string IPAddressToString(const IPAddressNumber& addr); | 159 NET_EXPORT std::string IPAddressToString(const IPAddressNumber& addr); | 
| 160 | 160 | 
| 161 // Same as IPAddressToStringWithPort() but for an IPAddressNumber. | 161 // Same as IPAddressToStringWithPort() but for an IPAddressNumber. | 
| 162 NET_EXPORT std::string IPAddressToStringWithPort( | 162 NET_EXPORT std::string IPAddressToStringWithPort(const IPAddressNumber& addr, | 
| 163     const IPAddressNumber& addr, uint16 port); | 163                                                  uint16 port); | 
| 164 | 164 | 
| 165 // Returns the address as a sequence of bytes in network-byte-order. | 165 // Returns the address as a sequence of bytes in network-byte-order. | 
| 166 NET_EXPORT std::string IPAddressToPackedString(const IPAddressNumber& addr); | 166 NET_EXPORT std::string IPAddressToPackedString(const IPAddressNumber& addr); | 
| 167 | 167 | 
| 168 // Returns the hostname of the current system. Returns empty string on failure. | 168 // Returns the hostname of the current system. Returns empty string on failure. | 
| 169 NET_EXPORT std::string GetHostName(); | 169 NET_EXPORT std::string GetHostName(); | 
| 170 | 170 | 
| 171 // Extracts the unescaped username/password from |url|, saving the results | 171 // Extracts the unescaped username/password from |url|, saving the results | 
| 172 // into |*username| and |*password|. | 172 // into |*username| and |*password|. | 
| 173 NET_EXPORT_PRIVATE void GetIdentityFromURL(const GURL& url, | 173 NET_EXPORT_PRIVATE void GetIdentityFromURL(const GURL& url, | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 231 // |addRow|. | 231 // |addRow|. | 
| 232 // | 232 // | 
| 233 // |name| is the file name to be displayed. |raw_bytes| will be used | 233 // |name| is the file name to be displayed. |raw_bytes| will be used | 
| 234 // as the actual target of the link (so for example, ftp links should use | 234 // as the actual target of the link (so for example, ftp links should use | 
| 235 // server's encoding). If |raw_bytes| is an empty string, UTF-8 encoded |name| | 235 // server's encoding). If |raw_bytes| is an empty string, UTF-8 encoded |name| | 
| 236 // will be used. | 236 // will be used. | 
| 237 // | 237 // | 
| 238 // Both |name| and |raw_bytes| are escaped internally. | 238 // Both |name| and |raw_bytes| are escaped internally. | 
| 239 NET_EXPORT std::string GetDirectoryListingEntry(const base::string16& name, | 239 NET_EXPORT std::string GetDirectoryListingEntry(const base::string16& name, | 
| 240                                                 const std::string& raw_bytes, | 240                                                 const std::string& raw_bytes, | 
| 241                                                 bool is_dir, int64 size, | 241                                                 bool is_dir, | 
|  | 242                                                 int64 size, | 
| 242                                                 base::Time modified); | 243                                                 base::Time modified); | 
| 243 | 244 | 
| 244 // If text starts with "www." it is removed, otherwise text is returned | 245 // If text starts with "www." it is removed, otherwise text is returned | 
| 245 // unmodified. | 246 // unmodified. | 
| 246 NET_EXPORT base::string16 StripWWW(const base::string16& text); | 247 NET_EXPORT base::string16 StripWWW(const base::string16& text); | 
| 247 | 248 | 
| 248 // Runs |url|'s host through StripWWW().  |url| must be valid. | 249 // Runs |url|'s host through StripWWW().  |url| must be valid. | 
| 249 NET_EXPORT base::string16 StripWWWFromHost(const GURL& url); | 250 NET_EXPORT base::string16 StripWWWFromHost(const GURL& url); | 
| 250 | 251 | 
| 251 // Checks |port| against a list of ports which are restricted by default. | 252 // Checks |port| against a list of ports which are restricted by default. | 
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 326     UnescapeRule::Type unescape_rules, | 327     UnescapeRule::Type unescape_rules, | 
| 327     url::Parsed* new_parsed, | 328     url::Parsed* new_parsed, | 
| 328     size_t* prefix_end, | 329     size_t* prefix_end, | 
| 329     base::OffsetAdjuster::Adjustments* adjustments); | 330     base::OffsetAdjuster::Adjustments* adjustments); | 
| 330 | 331 | 
| 331 // This is a convenience function for FormatUrl() with | 332 // This is a convenience function for FormatUrl() with | 
| 332 // format_types = kFormatUrlOmitAll and unescape = SPACES.  This is the typical | 333 // format_types = kFormatUrlOmitAll and unescape = SPACES.  This is the typical | 
| 333 // set of flags for "URLs to display to the user".  You should be cautious about | 334 // set of flags for "URLs to display to the user".  You should be cautious about | 
| 334 // using this for URLs which will be parsed or sent to other applications. | 335 // using this for URLs which will be parsed or sent to other applications. | 
| 335 inline base::string16 FormatUrl(const GURL& url, const std::string& languages) { | 336 inline base::string16 FormatUrl(const GURL& url, const std::string& languages) { | 
| 336   return FormatUrl(url, languages, kFormatUrlOmitAll, UnescapeRule::SPACES, | 337   return FormatUrl(url, | 
| 337                    NULL, NULL, NULL); | 338                    languages, | 
|  | 339                    kFormatUrlOmitAll, | 
|  | 340                    UnescapeRule::SPACES, | 
|  | 341                    NULL, | 
|  | 342                    NULL, | 
|  | 343                    NULL); | 
| 338 } | 344 } | 
| 339 | 345 | 
| 340 // Returns whether FormatUrl() would strip a trailing slash from |url|, given a | 346 // Returns whether FormatUrl() would strip a trailing slash from |url|, given a | 
| 341 // format flag including kFormatUrlOmitTrailingSlashOnBareHostname. | 347 // format flag including kFormatUrlOmitTrailingSlashOnBareHostname. | 
| 342 NET_EXPORT bool CanStripTrailingSlash(const GURL& url); | 348 NET_EXPORT bool CanStripTrailingSlash(const GURL& url); | 
| 343 | 349 | 
| 344 // Strip the portions of |url| that aren't core to the network request. | 350 // Strip the portions of |url| that aren't core to the network request. | 
| 345 //   - user name / password | 351 //   - user name / password | 
| 346 //   - reference section | 352 //   - reference section | 
| 347 NET_EXPORT_PRIVATE GURL SimplifyUrlForRequest(const GURL& url); | 353 NET_EXPORT_PRIVATE GURL SimplifyUrlForRequest(const GURL& url); | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 358 | 364 | 
| 359   DISALLOW_COPY_AND_ASSIGN(ScopedPortException); | 365   DISALLOW_COPY_AND_ASSIGN(ScopedPortException); | 
| 360 }; | 366 }; | 
| 361 | 367 | 
| 362 // Returns true if it can determine that only loopback addresses are configured. | 368 // Returns true if it can determine that only loopback addresses are configured. | 
| 363 // i.e. if only 127.0.0.1 and ::1 are routable. | 369 // i.e. if only 127.0.0.1 and ::1 are routable. | 
| 364 // Also returns false if it cannot determine this. | 370 // Also returns false if it cannot determine this. | 
| 365 bool HaveOnlyLoopbackAddresses(); | 371 bool HaveOnlyLoopbackAddresses(); | 
| 366 | 372 | 
| 367 // Returns AddressFamily of the address. | 373 // Returns AddressFamily of the address. | 
| 368 NET_EXPORT_PRIVATE AddressFamily GetAddressFamily( | 374 NET_EXPORT_PRIVATE AddressFamily | 
| 369     const IPAddressNumber& address); | 375     GetAddressFamily(const IPAddressNumber& address); | 
| 370 | 376 | 
| 371 // Maps the given AddressFamily to either AF_INET, AF_INET6 or AF_UNSPEC. | 377 // Maps the given AddressFamily to either AF_INET, AF_INET6 or AF_UNSPEC. | 
| 372 NET_EXPORT_PRIVATE int ConvertAddressFamily(AddressFamily address_family); | 378 NET_EXPORT_PRIVATE int ConvertAddressFamily(AddressFamily address_family); | 
| 373 | 379 | 
| 374 // Parses a URL-safe IP literal (see RFC 3986, Sec 3.2.2) to its numeric value. | 380 // Parses a URL-safe IP literal (see RFC 3986, Sec 3.2.2) to its numeric value. | 
| 375 // Returns true on success, and fills |ip_number| with the numeric value | 381 // Returns true on success, and fills |ip_number| with the numeric value | 
| 376 NET_EXPORT bool ParseURLHostnameToNumber(const std::string& hostname, | 382 NET_EXPORT bool ParseURLHostnameToNumber(const std::string& hostname, | 
| 377                                          IPAddressNumber* ip_number); | 383                                          IPAddressNumber* ip_number); | 
| 378 | 384 | 
| 379 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. | 385 // Parses an IP address literal (either IPv4 or IPv6) to its numeric value. | 
| 380 // Returns true on success and fills |ip_number| with the numeric value. | 386 // Returns true on success and fills |ip_number| with the numeric value. | 
| 381 NET_EXPORT bool ParseIPLiteralToNumber(const std::string& ip_literal, | 387 NET_EXPORT bool ParseIPLiteralToNumber(const std::string& ip_literal, | 
| 382                                        IPAddressNumber* ip_number); | 388                                        IPAddressNumber* ip_number); | 
| 383 | 389 | 
| 384 // Converts an IPv4 address to an IPv4-mapped IPv6 address. | 390 // Converts an IPv4 address to an IPv4-mapped IPv6 address. | 
| 385 // For example 192.168.0.1 would be converted to ::ffff:192.168.0.1. | 391 // For example 192.168.0.1 would be converted to ::ffff:192.168.0.1. | 
| 386 NET_EXPORT_PRIVATE IPAddressNumber ConvertIPv4NumberToIPv6Number( | 392 NET_EXPORT_PRIVATE IPAddressNumber | 
| 387     const IPAddressNumber& ipv4_number); | 393     ConvertIPv4NumberToIPv6Number(const IPAddressNumber& ipv4_number); | 
| 388 | 394 | 
| 389 // Returns true iff |address| is an IPv4-mapped IPv6 address. | 395 // Returns true iff |address| is an IPv4-mapped IPv6 address. | 
| 390 NET_EXPORT_PRIVATE bool IsIPv4Mapped(const IPAddressNumber& address); | 396 NET_EXPORT_PRIVATE bool IsIPv4Mapped(const IPAddressNumber& address); | 
| 391 | 397 | 
| 392 // Converts an IPv4-mapped IPv6 address to IPv4 address. Should only be called | 398 // Converts an IPv4-mapped IPv6 address to IPv4 address. Should only be called | 
| 393 // on IPv4-mapped IPv6 addresses. | 399 // on IPv4-mapped IPv6 addresses. | 
| 394 NET_EXPORT_PRIVATE IPAddressNumber ConvertIPv4MappedToIPv4( | 400 NET_EXPORT_PRIVATE IPAddressNumber | 
| 395     const IPAddressNumber& address); | 401     ConvertIPv4MappedToIPv4(const IPAddressNumber& address); | 
| 396 | 402 | 
| 397 // Parses an IP block specifier from CIDR notation to an | 403 // Parses an IP block specifier from CIDR notation to an | 
| 398 // (IP address, prefix length) pair. Returns true on success and fills | 404 // (IP address, prefix length) pair. Returns true on success and fills | 
| 399 // |*ip_number| with the numeric value of the IP address and sets | 405 // |*ip_number| with the numeric value of the IP address and sets | 
| 400 // |*prefix_length_in_bits| with the length of the prefix. | 406 // |*prefix_length_in_bits| with the length of the prefix. | 
| 401 // | 407 // | 
| 402 // CIDR notation literals can use either IPv4 or IPv6 literals. Some examples: | 408 // CIDR notation literals can use either IPv4 or IPv6 literals. Some examples: | 
| 403 // | 409 // | 
| 404 //    10.10.3.1/20 | 410 //    10.10.3.1/20 | 
| 405 //    a:b:c::/46 | 411 //    a:b:c::/46 | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 463                    const std::string& friendly_name, | 469                    const std::string& friendly_name, | 
| 464                    uint32 interface_index, | 470                    uint32 interface_index, | 
| 465                    NetworkChangeNotifier::ConnectionType type, | 471                    NetworkChangeNotifier::ConnectionType type, | 
| 466                    const IPAddressNumber& address, | 472                    const IPAddressNumber& address, | 
| 467                    uint32 network_prefix, | 473                    uint32 network_prefix, | 
| 468                    int ip_address_attributes); | 474                    int ip_address_attributes); | 
| 469   ~NetworkInterface(); | 475   ~NetworkInterface(); | 
| 470 | 476 | 
| 471   std::string name; | 477   std::string name; | 
| 472   std::string friendly_name;  // Same as |name| on non-Windows. | 478   std::string friendly_name;  // Same as |name| on non-Windows. | 
| 473   uint32 interface_index;  // Always 0 on Android. | 479   uint32 interface_index;     // Always 0 on Android. | 
| 474   NetworkChangeNotifier::ConnectionType type; | 480   NetworkChangeNotifier::ConnectionType type; | 
| 475   IPAddressNumber address; | 481   IPAddressNumber address; | 
| 476   uint32 network_prefix; | 482   uint32 network_prefix; | 
| 477   int ip_address_attributes;  // Combination of |IPAddressAttributes|. | 483   int ip_address_attributes;  // Combination of |IPAddressAttributes|. | 
| 478 }; | 484 }; | 
| 479 | 485 | 
| 480 typedef std::vector<NetworkInterface> NetworkInterfaceList; | 486 typedef std::vector<NetworkInterface> NetworkInterfaceList; | 
| 481 | 487 | 
| 482 // Policy settings to include/exclude network interfaces. | 488 // Policy settings to include/exclude network interfaces. | 
| 483 enum HostAddressSelectionPolicy { | 489 enum HostAddressSelectionPolicy { | 
| 484   INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES           = 0x0, | 490   INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x0, | 
| 485   EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES           = 0x1, | 491   EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES = 0x1, | 
| 486   // Include temp address only when interface has both permanent and | 492   // Include temp address only when interface has both permanent and | 
| 487   // temp addresses. | 493   // temp addresses. | 
| 488   INCLUDE_ONLY_TEMP_IPV6_ADDRESS_IF_POSSIBLE      = 0x2, | 494   INCLUDE_ONLY_TEMP_IPV6_ADDRESS_IF_POSSIBLE = 0x2, | 
| 489 }; | 495 }; | 
| 490 | 496 | 
| 491 // Returns list of network interfaces except loopback interface. If an | 497 // Returns list of network interfaces except loopback interface. If an | 
| 492 // interface has more than one address, a separate entry is added to | 498 // interface has more than one address, a separate entry is added to | 
| 493 // the list for each address. | 499 // the list for each address. | 
| 494 // Can be called only on a thread that allows IO. | 500 // Can be called only on a thread that allows IO. | 
| 495 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks, | 501 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks, int policy); | 
| 496                                int policy); |  | 
| 497 | 502 | 
| 498 // General category of the IEEE 802.11 (wifi) physical layer operating mode. | 503 // General category of the IEEE 802.11 (wifi) physical layer operating mode. | 
| 499 enum WifiPHYLayerProtocol { | 504 enum WifiPHYLayerProtocol { | 
| 500   // No wifi support or no associated AP. | 505   // No wifi support or no associated AP. | 
| 501   WIFI_PHY_LAYER_PROTOCOL_NONE, | 506   WIFI_PHY_LAYER_PROTOCOL_NONE, | 
| 502   // An obsolete modes introduced by the original 802.11, e.g. IR, FHSS. | 507   // An obsolete modes introduced by the original 802.11, e.g. IR, FHSS. | 
| 503   WIFI_PHY_LAYER_PROTOCOL_ANCIENT, | 508   WIFI_PHY_LAYER_PROTOCOL_ANCIENT, | 
| 504   // 802.11a, OFDM-based rates. | 509   // 802.11a, OFDM-based rates. | 
| 505   WIFI_PHY_LAYER_PROTOCOL_A, | 510   WIFI_PHY_LAYER_PROTOCOL_A, | 
| 506   // 802.11b, DSSS or HR DSSS. | 511   // 802.11b, DSSS or HR DSSS. | 
| 507   WIFI_PHY_LAYER_PROTOCOL_B, | 512   WIFI_PHY_LAYER_PROTOCOL_B, | 
| 508   // 802.11g, same rates as 802.11a but compatible with 802.11b. | 513   // 802.11g, same rates as 802.11a but compatible with 802.11b. | 
| 509   WIFI_PHY_LAYER_PROTOCOL_G, | 514   WIFI_PHY_LAYER_PROTOCOL_G, | 
| 510   // 802.11n, HT rates. | 515   // 802.11n, HT rates. | 
| 511   WIFI_PHY_LAYER_PROTOCOL_N, | 516   WIFI_PHY_LAYER_PROTOCOL_N, | 
| 512   // Unclassified mode or failure to identify. | 517   // Unclassified mode or failure to identify. | 
| 513   WIFI_PHY_LAYER_PROTOCOL_UNKNOWN | 518   WIFI_PHY_LAYER_PROTOCOL_UNKNOWN | 
| 514 }; | 519 }; | 
| 515 | 520 | 
| 516 // Characterize the PHY mode of the currently associated access point. | 521 // Characterize the PHY mode of the currently associated access point. | 
| 517 // Currently only available on OS_WIN. | 522 // Currently only available on OS_WIN. | 
| 518 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); | 523 NET_EXPORT WifiPHYLayerProtocol GetWifiPHYLayerProtocol(); | 
| 519 | 524 | 
| 520 enum WifiOptions { | 525 enum WifiOptions { | 
| 521   // Disables background SSID scans. | 526   // Disables background SSID scans. | 
| 522   WIFI_OPTIONS_DISABLE_SCAN =  1 << 0, | 527   WIFI_OPTIONS_DISABLE_SCAN = 1 << 0, | 
| 523   // Enables media streaming mode. | 528   // Enables media streaming mode. | 
| 524   WIFI_OPTIONS_MEDIA_STREAMING_MODE = 1 << 1 | 529   WIFI_OPTIONS_MEDIA_STREAMING_MODE = 1 << 1 | 
| 525 }; | 530 }; | 
| 526 | 531 | 
| 527 class NET_EXPORT ScopedWifiOptions { | 532 class NET_EXPORT ScopedWifiOptions { | 
| 528  public: | 533  public: | 
| 529   ScopedWifiOptions() {} | 534   ScopedWifiOptions() {} | 
| 530   virtual ~ScopedWifiOptions(); | 535   virtual ~ScopedWifiOptions(); | 
| 531 | 536 | 
| 532  private: | 537  private: | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 545 | 550 | 
| 546 // Computes the number of leading 1-bits in |mask|. | 551 // Computes the number of leading 1-bits in |mask|. | 
| 547 unsigned MaskPrefixLength(const IPAddressNumber& mask); | 552 unsigned MaskPrefixLength(const IPAddressNumber& mask); | 
| 548 | 553 | 
| 549 // Differentiated Services Code Point. | 554 // Differentiated Services Code Point. | 
| 550 // See http://tools.ietf.org/html/rfc2474 for details. | 555 // See http://tools.ietf.org/html/rfc2474 for details. | 
| 551 enum DiffServCodePoint { | 556 enum DiffServCodePoint { | 
| 552   DSCP_NO_CHANGE = -1, | 557   DSCP_NO_CHANGE = -1, | 
| 553   DSCP_FIRST = DSCP_NO_CHANGE, | 558   DSCP_FIRST = DSCP_NO_CHANGE, | 
| 554   DSCP_DEFAULT = 0,  // Same as DSCP_CS0 | 559   DSCP_DEFAULT = 0,  // Same as DSCP_CS0 | 
| 555   DSCP_CS0  = 0,   // The default | 560   DSCP_CS0 = 0,      // The default | 
| 556   DSCP_CS1  = 8,   // Bulk/background traffic | 561   DSCP_CS1 = 8,      // Bulk/background traffic | 
| 557   DSCP_AF11 = 10, | 562   DSCP_AF11 = 10, | 
| 558   DSCP_AF12 = 12, | 563   DSCP_AF12 = 12, | 
| 559   DSCP_AF13 = 14, | 564   DSCP_AF13 = 14, | 
| 560   DSCP_CS2  = 16, | 565   DSCP_CS2 = 16, | 
| 561   DSCP_AF21 = 18, | 566   DSCP_AF21 = 18, | 
| 562   DSCP_AF22 = 20, | 567   DSCP_AF22 = 20, | 
| 563   DSCP_AF23 = 22, | 568   DSCP_AF23 = 22, | 
| 564   DSCP_CS3  = 24, | 569   DSCP_CS3 = 24, | 
| 565   DSCP_AF31 = 26, | 570   DSCP_AF31 = 26, | 
| 566   DSCP_AF32 = 28, | 571   DSCP_AF32 = 28, | 
| 567   DSCP_AF33 = 30, | 572   DSCP_AF33 = 30, | 
| 568   DSCP_CS4  = 32, | 573   DSCP_CS4 = 32, | 
| 569   DSCP_AF41 = 34,  // Video | 574   DSCP_AF41 = 34,  // Video | 
| 570   DSCP_AF42 = 36,  // Video | 575   DSCP_AF42 = 36,  // Video | 
| 571   DSCP_AF43 = 38,  // Video | 576   DSCP_AF43 = 38,  // Video | 
| 572   DSCP_CS5  = 40,  // Video | 577   DSCP_CS5 = 40,   // Video | 
| 573   DSCP_EF   = 46,  // Voice | 578   DSCP_EF = 46,    // Voice | 
| 574   DSCP_CS6  = 48,  // Voice | 579   DSCP_CS6 = 48,   // Voice | 
| 575   DSCP_CS7  = 56,  // Control messages | 580   DSCP_CS7 = 56,   // Control messages | 
| 576   DSCP_LAST = DSCP_CS7 | 581   DSCP_LAST = DSCP_CS7 | 
| 577 }; | 582 }; | 
| 578 | 583 | 
| 579 }  // namespace net | 584 }  // namespace net | 
| 580 | 585 | 
| 581 #endif  // NET_BASE_NET_UTIL_H_ | 586 #endif  // NET_BASE_NET_UTIL_H_ | 
| OLD | NEW | 
|---|