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_PORT_UTIL_ | 5 #ifndef NET_BASE_NET_PORT_UTIL_ |
6 #define NET_BASE_NET_PORT_UTIL_ | 6 #define NET_BASE_NET_PORT_UTIL_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | 12 #include "base/macros.h" |
11 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
12 | 14 |
13 namespace net { | 15 namespace net { |
14 | 16 |
15 // Checks if |port| is in the valid range (0 to 65535, though 0 is technically | 17 // Checks if |port| is in the valid range (0 to 65535, though 0 is technically |
16 // reserved). Should be used before casting a port to a uint16_t. | 18 // reserved). Should be used before casting a port to a uint16_t. |
17 NET_EXPORT bool IsPortValid(int port); | 19 NET_EXPORT bool IsPortValid(int port); |
18 | 20 |
19 // Returns true if the port is in the range [0, 1023]. These ports are | 21 // Returns true if the port is in the range [0, 1023]. These ports are |
20 // registered by IANA and typically need root access to listen on. | 22 // registered by IANA and typically need root access to listen on. |
(...skipping 16 matching lines...) Expand all Loading... |
37 | 39 |
38 private: | 40 private: |
39 int port_; | 41 int port_; |
40 | 42 |
41 DISALLOW_COPY_AND_ASSIGN(ScopedPortException); | 43 DISALLOW_COPY_AND_ASSIGN(ScopedPortException); |
42 }; | 44 }; |
43 | 45 |
44 } // namespace net | 46 } // namespace net |
45 | 47 |
46 #endif // NET_BASE_NET_PORT_UTIL_ | 48 #endif // NET_BASE_NET_PORT_UTIL_ |
OLD | NEW |