| 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "net/quic/core/crypto/crypto_handshake.h" | 15 #include "net/quic/core/crypto/crypto_handshake.h" |
| 16 #include "net/quic/core/crypto/quic_crypto_client_config.h" | 16 #include "net/quic/core/crypto/quic_crypto_client_config.h" |
| 17 #include "net/quic/core/quic_alarm_factory.h" | 17 #include "net/quic/core/quic_alarm_factory.h" |
| 18 #include "net/quic/core/quic_bandwidth.h" | 18 #include "net/quic/core/quic_bandwidth.h" |
| 19 #include "net/quic/core/quic_client_push_promise_index.h" | 19 #include "net/quic/core/quic_client_push_promise_index.h" |
| 20 #include "net/quic/core/quic_config.h" | 20 #include "net/quic/core/quic_config.h" |
| 21 #include "net/quic/core/quic_connection.h" | 21 #include "net/quic/core/quic_connection.h" |
| 22 #include "net/quic/core/quic_packet_writer.h" | 22 #include "net/quic/core/quic_packet_writer.h" |
| 23 #include "net/quic/core/quic_protocol.h" | 23 #include "net/quic/core/quic_packets.h" |
| 24 #include "net/quic/platform/api/quic_socket_address.h" | 24 #include "net/quic/platform/api/quic_socket_address.h" |
| 25 #include "net/tools/quic/quic_client_session.h" | 25 #include "net/tools/quic/quic_client_session.h" |
| 26 #include "net/tools/quic/quic_spdy_client_stream.h" | 26 #include "net/tools/quic/quic_spdy_client_stream.h" |
| 27 | 27 |
| 28 namespace net { | 28 namespace net { |
| 29 | 29 |
| 30 class ProofVerifier; | 30 class ProofVerifier; |
| 31 class QuicServerId; | 31 class QuicServerId; |
| 32 | 32 |
| 33 class QuicClientBase : public QuicClientPushPromiseIndex::Delegate, | 33 class QuicClientBase : public QuicClientPushPromiseIndex::Delegate, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void SendRequestsAndWaitForResponse(const std::vector<std::string>& url_list); | 126 void SendRequestsAndWaitForResponse(const std::vector<std::string>& url_list); |
| 127 | 127 |
| 128 // Returns a newly created QuicSpdyClientStream, owned by the | 128 // Returns a newly created QuicSpdyClientStream, owned by the |
| 129 // QuicSimpleClient. | 129 // QuicSimpleClient. |
| 130 virtual QuicSpdyClientStream* CreateClientStream(); | 130 virtual QuicSpdyClientStream* CreateClientStream(); |
| 131 | 131 |
| 132 // Wait for events until the stream with the given ID is closed. | 132 // Wait for events until the stream with the given ID is closed. |
| 133 void WaitForStreamToClose(QuicStreamId id); | 133 void WaitForStreamToClose(QuicStreamId id); |
| 134 | 134 |
| 135 // Wait for events until the handshake is confirmed. | 135 // Wait for events until the handshake is confirmed. |
| 136 void WaitForCryptoHandshakeConfirmed(); | 136 // Returns true if the crypto handshake succeeds, false otherwise. |
| 137 bool WaitForCryptoHandshakeConfirmed() WARN_UNUSED_RESULT; |
| 137 | 138 |
| 138 // Wait up to 50ms, and handle any events which occur. | 139 // Wait up to 50ms, and handle any events which occur. |
| 139 // Returns true if there are any outstanding requests. | 140 // Returns true if there are any outstanding requests. |
| 140 bool WaitForEvents(); | 141 bool WaitForEvents(); |
| 141 | 142 |
| 142 // Migrate to a new socket during an active connection. | 143 // Migrate to a new socket during an active connection. |
| 143 bool MigrateSocket(const QuicIpAddress& new_host); | 144 bool MigrateSocket(const QuicIpAddress& new_host); |
| 144 | 145 |
| 145 QuicClientSession* session() { return session_.get(); } | 146 QuicClientSession* session() { return session_.get(); } |
| 146 | 147 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 std::vector<std::unique_ptr<QuicDataToResend>> data_to_resend_on_connect_; | 477 std::vector<std::unique_ptr<QuicDataToResend>> data_to_resend_on_connect_; |
| 477 | 478 |
| 478 std::unique_ptr<ClientQuicDataToResend> push_promise_data_to_resend_; | 479 std::unique_ptr<ClientQuicDataToResend> push_promise_data_to_resend_; |
| 479 | 480 |
| 480 DISALLOW_COPY_AND_ASSIGN(QuicClientBase); | 481 DISALLOW_COPY_AND_ASSIGN(QuicClientBase); |
| 481 }; | 482 }; |
| 482 | 483 |
| 483 } // namespace net | 484 } // namespace net |
| 484 | 485 |
| 485 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ | 486 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ |
| OLD | NEW |