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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 // Returns true if an IP address hostname is in a range reserved by the IANA. | 108 // Returns true if an IP address hostname is in a range reserved by the IANA. |
109 // Works with both IPv4 and IPv6 addresses, and only compares against a given | 109 // Works with both IPv4 and IPv6 addresses, and only compares against a given |
110 // protocols's reserved ranges. | 110 // protocols's reserved ranges. |
111 NET_EXPORT bool IsIPAddressReserved(const IPAddressNumber& address); | 111 NET_EXPORT bool IsIPAddressReserved(const IPAddressNumber& address); |
112 | 112 |
113 // Convenience struct for when you need a |struct sockaddr|. | 113 // Convenience struct for when you need a |struct sockaddr|. |
114 struct SockaddrStorage { | 114 struct SockaddrStorage { |
115 SockaddrStorage() : addr_len(sizeof(addr_storage)), | 115 SockaddrStorage() : addr_len(sizeof(addr_storage)), |
116 addr(reinterpret_cast<struct sockaddr*>(&addr_storage)) {} | 116 addr(reinterpret_cast<struct sockaddr*>(&addr_storage)) {} |
| 117 SockaddrStorage(const SockaddrStorage& other); |
| 118 void operator=(const SockaddrStorage& other); |
| 119 |
117 struct sockaddr_storage addr_storage; | 120 struct sockaddr_storage addr_storage; |
118 socklen_t addr_len; | 121 socklen_t addr_len; |
119 struct sockaddr* const addr; | 122 struct sockaddr* const addr; |
120 }; | 123 }; |
121 | 124 |
122 // Extracts the IP address and port portions of a sockaddr. |port| is optional, | 125 // Extracts the IP address and port portions of a sockaddr. |port| is optional, |
123 // and will not be filled in if NULL. | 126 // and will not be filled in if NULL. |
124 bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr, | 127 bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr, |
125 socklen_t sock_addr_len, | 128 socklen_t sock_addr_len, |
126 const unsigned char** address, | 129 const unsigned char** address, |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 DSCP_CS5 = 40, // Video | 526 DSCP_CS5 = 40, // Video |
524 DSCP_EF = 46, // Voice | 527 DSCP_EF = 46, // Voice |
525 DSCP_CS6 = 48, // Voice | 528 DSCP_CS6 = 48, // Voice |
526 DSCP_CS7 = 56, // Control messages | 529 DSCP_CS7 = 56, // Control messages |
527 DSCP_LAST = DSCP_CS7 | 530 DSCP_LAST = DSCP_CS7 |
528 }; | 531 }; |
529 | 532 |
530 } // namespace net | 533 } // namespace net |
531 | 534 |
532 #endif // NET_BASE_NET_UTIL_H_ | 535 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |