| 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 16 matching lines...) Expand all Loading... |
| 27 class ProofVerifier; | 27 class ProofVerifier; |
| 28 | 28 |
| 29 namespace tools { | 29 namespace tools { |
| 30 | 30 |
| 31 namespace test { | 31 namespace test { |
| 32 class QuicClientPeer; | 32 class QuicClientPeer; |
| 33 } // namespace test | 33 } // namespace test |
| 34 | 34 |
| 35 class QuicClient : public EpollCallbackInterface { | 35 class QuicClient : public EpollCallbackInterface { |
| 36 public: | 36 public: |
| 37 QuicClient(IPEndPoint server_address, const std::string& server_hostname); | 37 QuicClient(IPEndPoint server_address, const std::string& server_hostname, |
| 38 const QuicVersion version); |
| 38 QuicClient(IPEndPoint server_address, | 39 QuicClient(IPEndPoint server_address, |
| 39 const std::string& server_hostname, | 40 const std::string& server_hostname, |
| 40 const QuicConfig& config); | 41 const QuicConfig& config, |
| 42 const QuicVersion version); |
| 41 | 43 |
| 42 virtual ~QuicClient(); | 44 virtual ~QuicClient(); |
| 43 | 45 |
| 44 // Initializes the client to create a connection. Should be called exactly | 46 // Initializes the client to create a connection. Should be called exactly |
| 45 // once before calling StartConnect or Connect. Returns true if the | 47 // once before calling StartConnect or Connect. Returns true if the |
| 46 // initialization succeeds, false otherwise. | 48 // initialization succeeds, false otherwise. |
| 47 bool Initialize(); | 49 bool Initialize(); |
| 48 | 50 |
| 49 // "Connect" to the QUIC server, including performing synchronous crypto | 51 // "Connect" to the QUIC server, including performing synchronous crypto |
| 50 // handshake. | 52 // handshake. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 server_hostname_ = hostname; | 125 server_hostname_ = hostname; |
| 124 } | 126 } |
| 125 | 127 |
| 126 // SetProofVerifier sets the ProofVerifier that will be used to verify the | 128 // SetProofVerifier sets the ProofVerifier that will be used to verify the |
| 127 // server's certificate and takes ownership of |verifier|. | 129 // server's certificate and takes ownership of |verifier|. |
| 128 void SetProofVerifier(ProofVerifier* verifier) { | 130 void SetProofVerifier(ProofVerifier* verifier) { |
| 129 // TODO(rtenneti): We should set ProofVerifier in QuicClientSession. | 131 // TODO(rtenneti): We should set ProofVerifier in QuicClientSession. |
| 130 crypto_config_.SetProofVerifier(verifier); | 132 crypto_config_.SetProofVerifier(verifier); |
| 131 } | 133 } |
| 132 | 134 |
| 135 // SetChannelIDSigner sets a ChannelIDSigner that will be called when the |
| 136 // server supports channel IDs to sign a message proving possession of the |
| 137 // given ChannelID. This object takes ownership of |signer|. |
| 138 void SetChannelIDSigner(ChannelIDSigner* signer) { |
| 139 crypto_config_.SetChannelIDSigner(signer); |
| 140 } |
| 141 |
| 133 private: | 142 private: |
| 134 friend class net::tools::test::QuicClientPeer; | 143 friend class net::tools::test::QuicClientPeer; |
| 135 | 144 |
| 136 // Read a UDP packet and hand it to the framer. | 145 // Read a UDP packet and hand it to the framer. |
| 137 bool ReadAndProcessPacket(); | 146 bool ReadAndProcessPacket(); |
| 138 | 147 |
| 139 // Set of streams created (and owned) by this client | 148 // Set of streams created (and owned) by this client |
| 140 base::hash_set<QuicReliableClientStream*> streams_; | 149 base::hash_set<QuicReliableClientStream*> streams_; |
| 141 | 150 |
| 142 // Address of the server. | 151 // Address of the server. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 170 | 179 |
| 171 // If overflow_supported_ is true, this will be the number of packets dropped | 180 // If overflow_supported_ is true, this will be the number of packets dropped |
| 172 // during the lifetime of the server. This may overflow if enough packets | 181 // during the lifetime of the server. This may overflow if enough packets |
| 173 // are dropped. | 182 // are dropped. |
| 174 int packets_dropped_; | 183 int packets_dropped_; |
| 175 | 184 |
| 176 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped | 185 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped |
| 177 // because the socket would otherwise overflow. | 186 // because the socket would otherwise overflow. |
| 178 bool overflow_supported_; | 187 bool overflow_supported_; |
| 179 | 188 |
| 189 // Which QUIC version does this client talk? |
| 190 QuicVersion version_; |
| 191 |
| 180 DISALLOW_COPY_AND_ASSIGN(QuicClient); | 192 DISALLOW_COPY_AND_ASSIGN(QuicClient); |
| 181 }; | 193 }; |
| 182 | 194 |
| 183 } // namespace tools | 195 } // namespace tools |
| 184 } // namespace net | 196 } // namespace net |
| 185 | 197 |
| 186 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 198 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
| OLD | NEW |