| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 base class for the toy client, which connects to a specified port and sends | 5 // A base class for the toy client, which connects to a specified port and sends |
| 6 // QUIC request to that endpoint. | 6 // QUIC request to that endpoint. |
| 7 | 7 |
| 8 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ |
| 9 #define NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ | 9 #define NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "net/tools/quic/quic_client_session.h" | 26 #include "net/tools/quic/quic_client_session.h" |
| 27 #include "net/tools/quic/quic_spdy_client_stream.h" | 27 #include "net/tools/quic/quic_spdy_client_stream.h" |
| 28 | 28 |
| 29 namespace net { | 29 namespace net { |
| 30 | 30 |
| 31 class ProofVerifier; | 31 class ProofVerifier; |
| 32 class QuicServerId; | 32 class QuicServerId; |
| 33 | 33 |
| 34 class QuicClientBase { | 34 class QuicClientBase { |
| 35 public: | 35 public: |
| 36 // The client uses these objects to keep track of any data to resend upon |
| 37 // receipt of a stateless reject. Recall that the client API allows callers |
| 38 // to optimistically send data to the server prior to handshake-confirmation. |
| 39 // If the client subsequently receives a stateless reject, it must tear down |
| 40 // its existing session, create a new session, and resend all previously sent |
| 41 // data. It uses these objects to keep track of all the sent data, and to |
| 42 // resend the data upon a subsequent connection. |
| 43 class QuicDataToResend { |
| 44 public: |
| 45 // |headers| may be null, since it's possible to send data without headers. |
| 46 QuicDataToResend(std::unique_ptr<SpdyHeaderBlock> headers, |
| 47 base::StringPiece body, |
| 48 bool fin); |
| 49 |
| 50 virtual ~QuicDataToResend(); |
| 51 |
| 52 // Must be overridden by specific classes with the actual method for |
| 53 // re-sending data. |
| 54 virtual void Resend() = 0; |
| 55 |
| 56 protected: |
| 57 std::unique_ptr<SpdyHeaderBlock> headers_; |
| 58 base::StringPiece body_; |
| 59 bool fin_; |
| 60 |
| 61 private: |
| 62 DISALLOW_COPY_AND_ASSIGN(QuicDataToResend); |
| 63 }; |
| 64 |
| 36 QuicClientBase(const QuicServerId& server_id, | 65 QuicClientBase(const QuicServerId& server_id, |
| 37 const QuicVersionVector& supported_versions, | 66 const QuicVersionVector& supported_versions, |
| 38 const QuicConfig& config, | 67 const QuicConfig& config, |
| 39 QuicConnectionHelperInterface* helper, | 68 QuicConnectionHelperInterface* helper, |
| 40 QuicAlarmFactory* alarm_factory, | 69 QuicAlarmFactory* alarm_factory, |
| 41 std::unique_ptr<ProofVerifier> proof_verifier); | 70 std::unique_ptr<ProofVerifier> proof_verifier); |
| 42 | 71 |
| 43 ~QuicClientBase(); | 72 ~QuicClientBase(); |
| 44 | 73 |
| 45 // Initializes the client to create a connection. Should be called exactly | 74 // Initializes the client to create a connection. Should be called exactly |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 bool connected_or_attempting_connect_; | 289 bool connected_or_attempting_connect_; |
| 261 | 290 |
| 262 QuicClientPushPromiseIndex push_promise_index_; | 291 QuicClientPushPromiseIndex push_promise_index_; |
| 263 | 292 |
| 264 DISALLOW_COPY_AND_ASSIGN(QuicClientBase); | 293 DISALLOW_COPY_AND_ASSIGN(QuicClientBase); |
| 265 }; | 294 }; |
| 266 | 295 |
| 267 } // namespace net | 296 } // namespace net |
| 268 | 297 |
| 269 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ | 298 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ |
| OLD | NEW |