| // Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #ifndef NET_QUIC_QUIC_SOCKET_ADDRESS_CODER_H_ |
| #define NET_QUIC_QUIC_SOCKET_ADDRESS_CODER_H_ |
| #include "base/basictypes.h" |
| #include "net/base/ip_endpoint.h" |
| #include "net/base/net_export.h" |
| // Serializes and parses a socket address (IP address and port), to be used in |
| // the kCADR tag in the ServerHello handshake message and the Public Reset |
| class NET_EXPORT_PRIVATE QuicSocketAddressCoder { |
| QuicSocketAddressCoder(); |
| explicit QuicSocketAddressCoder(const IPEndPoint& address); |
| ~QuicSocketAddressCoder(); |
| std::string Encode() const; |
| bool Decode(const char* data, size_t length); |
| IPAddressNumber ip() const { |
| return address_.address(); |
| DISALLOW_COPY_AND_ASSIGN(QuicSocketAddressCoder); |
| #endif // NET_QUIC_QUIC_SOCKET_ADDRESS_CODER_H_ |