| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CORE_QUIC_SOCKET_ADDRESS_CODER_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_SOCKET_ADDRESS_CODER_H_ |
| 6 #define NET_QUIC_CORE_QUIC_SOCKET_ADDRESS_CODER_H_ | 6 #define NET_QUIC_CORE_QUIC_SOCKET_ADDRESS_CODER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "net/base/net_export.h" | 14 #include "net/quic/platform/api/quic_export.h" |
| 15 #include "net/quic/platform/api/quic_socket_address.h" | 15 #include "net/quic/platform/api/quic_socket_address.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 // Serializes and parses a socket address (IP address and port), to be used in | 19 // Serializes and parses a socket address (IP address and port), to be used in |
| 20 // the kCADR tag in the ServerHello handshake message and the Public Reset | 20 // the kCADR tag in the ServerHello handshake message and the Public Reset |
| 21 // packet. | 21 // packet. |
| 22 class NET_EXPORT_PRIVATE QuicSocketAddressCoder { | 22 class QUIC_EXPORT_PRIVATE QuicSocketAddressCoder { |
| 23 public: | 23 public: |
| 24 QuicSocketAddressCoder(); | 24 QuicSocketAddressCoder(); |
| 25 explicit QuicSocketAddressCoder(const QuicSocketAddress& address); | 25 explicit QuicSocketAddressCoder(const QuicSocketAddress& address); |
| 26 ~QuicSocketAddressCoder(); | 26 ~QuicSocketAddressCoder(); |
| 27 | 27 |
| 28 std::string Encode() const; | 28 std::string Encode() const; |
| 29 | 29 |
| 30 bool Decode(const char* data, size_t length); | 30 bool Decode(const char* data, size_t length); |
| 31 | 31 |
| 32 QuicIpAddress ip() const { return address_.host(); } | 32 QuicIpAddress ip() const { return address_.host(); } |
| 33 | 33 |
| 34 uint16_t port() const { return address_.port(); } | 34 uint16_t port() const { return address_.port(); } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 QuicSocketAddress address_; | 37 QuicSocketAddress address_; |
| 38 | 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(QuicSocketAddressCoder); | 39 DISALLOW_COPY_AND_ASSIGN(QuicSocketAddressCoder); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 } // namespace net | 42 } // namespace net |
| 43 | 43 |
| 44 #endif // NET_QUIC_CORE_QUIC_SOCKET_ADDRESS_CODER_H_ | 44 #endif // NET_QUIC_CORE_QUIC_SOCKET_ADDRESS_CODER_H_ |
| OLD | NEW |