| 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_SOCKET_ADDRESS_H_ | 5 #ifndef NET_QUIC_PLATFORM_API_QUIC_SOCKET_ADDRESS_H_ |
| 6 #define NET_QUIC_PLATFORM_API_QUIC_SOCKET_ADDRESS_H_ | 6 #define NET_QUIC_PLATFORM_API_QUIC_SOCKET_ADDRESS_H_ |
| 7 | 7 |
| 8 #include "net/quic/platform/api/quic_export.h" |
| 8 #include "net/quic/platform/api/quic_ip_address.h" | 9 #include "net/quic/platform/api/quic_ip_address.h" |
| 9 #include "net/quic/platform/impl/quic_socket_address_impl.h" | 10 #include "net/quic/platform/impl/quic_socket_address_impl.h" |
| 10 | 11 |
| 11 namespace net { | 12 namespace net { |
| 12 | 13 |
| 13 class NET_EXPORT_PRIVATE QuicSocketAddress { | 14 class QUIC_EXPORT_PRIVATE QuicSocketAddress { |
| 14 // A class representing a socket endpoint address (i.e., IP address plus a | 15 // A class representing a socket endpoint address (i.e., IP address plus a |
| 15 // port) in QUIC. The actual implementation (platform dependent) of a socket | 16 // port) in QUIC. The actual implementation (platform dependent) of a socket |
| 16 // address is in QuicSocketAddressImpl. | 17 // address is in QuicSocketAddressImpl. |
| 17 public: | 18 public: |
| 18 QuicSocketAddress() = default; | 19 QuicSocketAddress() = default; |
| 19 QuicSocketAddress(QuicIpAddress address, uint16_t port); | 20 QuicSocketAddress(QuicIpAddress address, uint16_t port); |
| 20 explicit QuicSocketAddress(const struct sockaddr_storage& saddr); | 21 explicit QuicSocketAddress(const struct sockaddr_storage& saddr); |
| 21 explicit QuicSocketAddress(const struct sockaddr& saddr); | 22 explicit QuicSocketAddress(const struct sockaddr& saddr); |
| 22 explicit QuicSocketAddress(const QuicSocketAddressImpl& impl); | 23 explicit QuicSocketAddress(const QuicSocketAddressImpl& impl); |
| 23 QuicSocketAddress(const QuicSocketAddress& other) = default; | 24 QuicSocketAddress(const QuicSocketAddress& other) = default; |
| 24 QuicSocketAddress& operator=(const QuicSocketAddress& other) = default; | 25 QuicSocketAddress& operator=(const QuicSocketAddress& other) = default; |
| 25 QuicSocketAddress& operator=(QuicSocketAddress&& other) = default; | 26 QuicSocketAddress& operator=(QuicSocketAddress&& other) = default; |
| 26 NET_EXPORT_PRIVATE friend bool operator==(QuicSocketAddress lhs, | 27 QUIC_EXPORT_PRIVATE friend bool operator==(QuicSocketAddress lhs, |
| 27 QuicSocketAddress rhs); | 28 QuicSocketAddress rhs); |
| 28 NET_EXPORT_PRIVATE friend bool operator!=(QuicSocketAddress lhs, | 29 QUIC_EXPORT_PRIVATE friend bool operator!=(QuicSocketAddress lhs, |
| 29 QuicSocketAddress rhs); | 30 QuicSocketAddress rhs); |
| 30 | 31 |
| 31 bool IsInitialized() const; | 32 bool IsInitialized() const; |
| 32 std::string ToString() const; | 33 std::string ToString() const; |
| 33 bool FromString(std::string str); | 34 bool FromString(std::string str); |
| 34 int FromSocket(int fd); | 35 int FromSocket(int fd); |
| 35 QuicSocketAddress Normalized() const; | 36 QuicSocketAddress Normalized() const; |
| 36 | 37 |
| 37 QuicIpAddress host() const; | 38 QuicIpAddress host() const; |
| 38 uint16_t port() const; | 39 uint16_t port() const; |
| 39 sockaddr_storage generic_address() const; | 40 sockaddr_storage generic_address() const; |
| 40 const QuicSocketAddressImpl& impl() const { return impl_; } | 41 const QuicSocketAddressImpl& impl() const { return impl_; } |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 QuicSocketAddressImpl impl_; | 44 QuicSocketAddressImpl impl_; |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 } // namespace net | 47 } // namespace net |
| 47 | 48 |
| 48 #endif // NET_QUIC_PLATFORM_API_QUIC_SOCKET_ADDRESS_H_ | 49 #endif // NET_QUIC_PLATFORM_API_QUIC_SOCKET_ADDRESS_H_ |
| OLD | NEW |