| 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 // A toy client, which connects to a specified port and sends QUIC | 5 // A toy client, which connects to a specified port and sends QUIC |
| 6 // request to that endpoint. | 6 // request to that endpoint. |
| 7 | 7 |
| 8 #ifndef NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ |
| 9 #define NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ | 9 #define NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ |
| 10 | 10 |
| 11 #include <stddef.h> | 11 #include <stddef.h> |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
| 19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
| 20 #include "net/http/http_response_headers.h" | 20 #include "net/http/http_response_headers.h" |
| 21 #include "net/log/net_log.h" | 21 #include "net/log/net_log.h" |
| 22 #include "net/quic/quic_config.h" | 22 #include "net/quic/quic_config.h" |
| 23 #include "net/quic/quic_packet_reader.h" | 23 #include "net/quic/quic_packet_reader.h" |
| 24 #include "net/quic/quic_spdy_stream.h" | 24 #include "net/quic/quic_spdy_stream.h" |
| 25 #include "net/tools/quic/quic_client_base.h" | 25 #include "net/tools/quic/quic_client_base.h" |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 | 28 |
| 29 struct HttpRequestInfo; | 29 struct HttpRequestInfo; |
| 30 class QuicConnectionHelper; | 30 class QuicChromiumConnectionHelper; |
| 31 class UDPClientSocket; | 31 class UDPClientSocket; |
| 32 | 32 |
| 33 namespace tools { | 33 namespace tools { |
| 34 | 34 |
| 35 namespace test { | 35 namespace test { |
| 36 class QuicClientPeer; | 36 class QuicClientPeer; |
| 37 } // namespace test | 37 } // namespace test |
| 38 | 38 |
| 39 class QuicSimpleClient : public QuicClientBase, | 39 class QuicSimpleClient : public QuicClientBase, |
| 40 public QuicSpdyStream::Visitor, | 40 public QuicSpdyStream::Visitor, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 response_listener_.reset(listener); | 159 response_listener_.reset(listener); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void set_store_response(bool val) { store_response_ = val; } | 162 void set_store_response(bool val) { store_response_ = val; } |
| 163 | 163 |
| 164 size_t latest_response_code() const; | 164 size_t latest_response_code() const; |
| 165 const std::string& latest_response_headers() const; | 165 const std::string& latest_response_headers() const; |
| 166 const std::string& latest_response_body() const; | 166 const std::string& latest_response_body() const; |
| 167 | 167 |
| 168 protected: | 168 protected: |
| 169 virtual QuicConnectionHelper* CreateQuicConnectionHelper(); | 169 virtual QuicChromiumConnectionHelper* CreateQuicConnectionHelper(); |
| 170 virtual QuicPacketWriter* CreateQuicPacketWriter(); | 170 virtual QuicPacketWriter* CreateQuicPacketWriter(); |
| 171 | 171 |
| 172 private: | 172 private: |
| 173 friend class net::tools::test::QuicClientPeer; | 173 friend class net::tools::test::QuicClientPeer; |
| 174 | 174 |
| 175 // Specific QuicClient class for storing data to resend. | 175 // Specific QuicClient class for storing data to resend. |
| 176 class ClientQuicDataToResend : public QuicDataToResend { | 176 class ClientQuicDataToResend : public QuicDataToResend { |
| 177 public: | 177 public: |
| 178 // Takes ownership of |headers|. | 178 // Takes ownership of |headers|. |
| 179 ClientQuicDataToResend(HttpRequestInfo* headers, | 179 ClientQuicDataToResend(HttpRequestInfo* headers, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 base::WeakPtrFactory<QuicSimpleClient> weak_factory_; | 261 base::WeakPtrFactory<QuicSimpleClient> weak_factory_; |
| 262 | 262 |
| 263 DISALLOW_COPY_AND_ASSIGN(QuicSimpleClient); | 263 DISALLOW_COPY_AND_ASSIGN(QuicSimpleClient); |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 } // namespace tools | 266 } // namespace tools |
| 267 } // namespace net | 267 } // namespace net |
| 268 | 268 |
| 269 #endif // NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ | 269 #endif // NET_TOOLS_QUIC_QUIC_SIMPLE_CLIENT_H_ |
| OLD | NEW |