OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_H_ | 5 #ifndef NET_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_H_ |
6 #define NET_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_H_ | 6 #define NET_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "net/quic/platform/api/quic_export.h" |
10 #include "net/quic/platform/impl/quic_ip_address_impl.h" | 11 #include "net/quic/platform/impl/quic_ip_address_impl.h" |
11 | 12 |
12 namespace net { | 13 namespace net { |
13 | 14 |
14 class NET_EXPORT_PRIVATE QuicIpAddress { | 15 class QUIC_EXPORT_PRIVATE QuicIpAddress { |
15 // A class representing an IPv4 or IPv6 address in QUIC. The actual | 16 // A class representing an IPv4 or IPv6 address in QUIC. The actual |
16 // implementation (platform dependent) of an IP address is in | 17 // implementation (platform dependent) of an IP address is in |
17 // QuicIpAddressImpl. | 18 // QuicIpAddressImpl. |
18 public: | 19 public: |
19 static QuicIpAddress Loopback4(); | 20 static QuicIpAddress Loopback4(); |
20 static QuicIpAddress Loopback6(); | 21 static QuicIpAddress Loopback6(); |
21 static QuicIpAddress Any4(); | 22 static QuicIpAddress Any4(); |
22 static QuicIpAddress Any6(); | 23 static QuicIpAddress Any6(); |
23 | 24 |
24 QuicIpAddress() = default; | 25 QuicIpAddress() = default; |
25 QuicIpAddress(const QuicIpAddress& other) = default; | 26 QuicIpAddress(const QuicIpAddress& other) = default; |
26 explicit QuicIpAddress(const QuicIpAddressImpl& impl); | 27 explicit QuicIpAddress(const QuicIpAddressImpl& impl); |
27 QuicIpAddress& operator=(const QuicIpAddress& other) = default; | 28 QuicIpAddress& operator=(const QuicIpAddress& other) = default; |
28 QuicIpAddress& operator=(QuicIpAddress&& other) = default; | 29 QuicIpAddress& operator=(QuicIpAddress&& other) = default; |
29 NET_EXPORT_PRIVATE friend bool operator==(QuicIpAddress lhs, | 30 QUIC_EXPORT_PRIVATE friend bool operator==(QuicIpAddress lhs, |
30 QuicIpAddress rhs); | 31 QuicIpAddress rhs); |
31 NET_EXPORT_PRIVATE friend bool operator!=(QuicIpAddress lhs, | 32 QUIC_EXPORT_PRIVATE friend bool operator!=(QuicIpAddress lhs, |
32 QuicIpAddress rhs); | 33 QuicIpAddress rhs); |
33 | 34 |
34 bool IsInitialized() const; | 35 bool IsInitialized() const; |
35 IpAddressFamily address_family() const; | 36 IpAddressFamily address_family() const; |
36 int AddressFamilyToInt() const; | 37 int AddressFamilyToInt() const; |
37 // Returns the address as a sequence of bytes in network-byte-order. IPv4 will | 38 // Returns the address as a sequence of bytes in network-byte-order. IPv4 will |
38 // be 6 bytes. IPv6 will be 18 bytes. | 39 // be 6 bytes. IPv6 will be 18 bytes. |
39 std::string ToPackedString() const; | 40 std::string ToPackedString() const; |
40 // Returns std::string representation of the address. | 41 // Returns std::string representation of the address. |
41 std::string ToString() const; | 42 std::string ToString() const; |
42 // Normalizes the address representation with respect to IPv4 addresses, i.e, | 43 // Normalizes the address representation with respect to IPv4 addresses, i.e, |
(...skipping 14 matching lines...) Expand all Loading... |
57 | 58 |
58 const QuicIpAddressImpl& impl() const { return impl_; } | 59 const QuicIpAddressImpl& impl() const { return impl_; } |
59 | 60 |
60 private: | 61 private: |
61 QuicIpAddressImpl impl_; | 62 QuicIpAddressImpl impl_; |
62 }; | 63 }; |
63 | 64 |
64 } // namespace net | 65 } // namespace net |
65 | 66 |
66 #endif // NET_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_H_ | 67 #endif // NET_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_H_ |
OLD | NEW |