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_CLIENT_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
9 #define NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 9 #define NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 namespace test { | 33 namespace test { |
34 class QuicClientPeer; | 34 class QuicClientPeer; |
35 } // namespace test | 35 } // namespace test |
36 | 36 |
37 class QuicClient : public EpollCallbackInterface, | 37 class QuicClient : public EpollCallbackInterface, |
38 public ReliableQuicStream::Visitor { | 38 public ReliableQuicStream::Visitor { |
39 public: | 39 public: |
40 QuicClient(IPEndPoint server_address, | 40 QuicClient(IPEndPoint server_address, |
41 const string& server_hostname, | 41 const string& server_hostname, |
42 const QuicVersion version, | 42 const QuicVersionVector& supported_versions, |
43 bool print_response); | 43 bool print_response); |
44 QuicClient(IPEndPoint server_address, | 44 QuicClient(IPEndPoint server_address, |
45 const std::string& server_hostname, | 45 const std::string& server_hostname, |
46 const QuicConfig& config, | 46 const QuicConfig& config, |
47 const QuicVersion version); | 47 const QuicVersionVector& supported_versions); |
48 | 48 |
49 virtual ~QuicClient(); | 49 virtual ~QuicClient(); |
50 | 50 |
51 // Initializes the client to create a connection. Should be called exactly | 51 // Initializes the client to create a connection. Should be called exactly |
52 // once before calling StartConnect or Connect. Returns true if the | 52 // once before calling StartConnect or Connect. Returns true if the |
53 // initialization succeeds, false otherwise. | 53 // initialization succeeds, false otherwise. |
54 bool Initialize(); | 54 bool Initialize(); |
55 | 55 |
56 // "Connect" to the QUIC server, including performing synchronous crypto | 56 // "Connect" to the QUIC server, including performing synchronous crypto |
57 // handshake. | 57 // handshake. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 // If overflow_supported_ is true, this will be the number of packets dropped | 195 // If overflow_supported_ is true, this will be the number of packets dropped |
196 // during the lifetime of the server. This may overflow if enough packets | 196 // during the lifetime of the server. This may overflow if enough packets |
197 // are dropped. | 197 // are dropped. |
198 int packets_dropped_; | 198 int packets_dropped_; |
199 | 199 |
200 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped | 200 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped |
201 // because the socket would otherwise overflow. | 201 // because the socket would otherwise overflow. |
202 bool overflow_supported_; | 202 bool overflow_supported_; |
203 | 203 |
204 // Which QUIC version does this client talk? | 204 // This vector contains QUIC versions which we currently support. |
205 QuicVersion version_; | 205 // This should be ordered such that the highest supported version is the first |
| 206 // element, with subsequent elements in descending order (versions can be |
| 207 // skipped as necessary). We will always pick supported_versions_[0] as the |
| 208 // initial version to use. |
| 209 QuicVersionVector supported_versions_; |
206 | 210 |
207 // If true, then the contents of each response will be printed to stdout | 211 // If true, then the contents of each response will be printed to stdout |
208 // when the stream is closed (in OnClose). | 212 // when the stream is closed (in OnClose). |
209 bool print_response_; | 213 bool print_response_; |
210 | 214 |
211 DISALLOW_COPY_AND_ASSIGN(QuicClient); | 215 DISALLOW_COPY_AND_ASSIGN(QuicClient); |
212 }; | 216 }; |
213 | 217 |
214 } // namespace tools | 218 } // namespace tools |
215 } // namespace net | 219 } // namespace net |
216 | 220 |
217 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 221 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
OLD | NEW |