| 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class QuicClient : public EpollCallbackInterface, | 38 class QuicClient : public EpollCallbackInterface, |
| 39 public QuicDataStream::Visitor { | 39 public QuicDataStream::Visitor { |
| 40 public: | 40 public: |
| 41 class ResponseListener { | 41 class ResponseListener { |
| 42 public: | 42 public: |
| 43 ResponseListener() {} | 43 ResponseListener() {} |
| 44 virtual ~ResponseListener() {} | 44 virtual ~ResponseListener() {} |
| 45 virtual void OnCompleteResponse(QuicStreamId id, | 45 virtual void OnCompleteResponse(QuicStreamId id, |
| 46 const BalsaHeaders& response_headers, | 46 const BalsaHeaders& response_headers, |
| 47 const string& response_body) = 0; | 47 const std::string& response_body) = 0; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // Create a quic client, which will have events managed by an externally owned | 50 // Create a quic client, which will have events managed by an externally owned |
| 51 // EpollServer. | 51 // EpollServer. |
| 52 QuicClient(IPEndPoint server_address, | 52 QuicClient(IPEndPoint server_address, |
| 53 const QuicServerId& server_id, | 53 const QuicServerId& server_id, |
| 54 const QuicVersionVector& supported_versions, | 54 const QuicVersionVector& supported_versions, |
| 55 bool print_response, | 55 bool print_response, |
| 56 EpollServer* epoll_server); | 56 EpollServer* epoll_server); |
| 57 QuicClient(IPEndPoint server_address, | 57 QuicClient(IPEndPoint server_address, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 int fd() { return fd_; } | 137 int fd() { return fd_; } |
| 138 | 138 |
| 139 const QuicServerId& server_id() const { return server_id_; } | 139 const QuicServerId& server_id() const { return server_id_; } |
| 140 | 140 |
| 141 // This should only be set before the initial Connect() | 141 // This should only be set before the initial Connect() |
| 142 void set_server_id(const QuicServerId& server_id) { | 142 void set_server_id(const QuicServerId& server_id) { |
| 143 server_id_ = server_id; | 143 server_id_ = server_id; |
| 144 } | 144 } |
| 145 | 145 |
| 146 void SetUserAgentID(const string& user_agent_id) { | 146 void SetUserAgentID(const std::string& user_agent_id) { |
| 147 crypto_config_.set_user_agent_id(user_agent_id); | 147 crypto_config_.set_user_agent_id(user_agent_id); |
| 148 } | 148 } |
| 149 | 149 |
| 150 // SetProofVerifier sets the ProofVerifier that will be used to verify the | 150 // SetProofVerifier sets the ProofVerifier that will be used to verify the |
| 151 // server's certificate and takes ownership of |verifier|. | 151 // server's certificate and takes ownership of |verifier|. |
| 152 void SetProofVerifier(ProofVerifier* verifier) { | 152 void SetProofVerifier(ProofVerifier* verifier) { |
| 153 // TODO(rtenneti): We should set ProofVerifier in QuicClientSession. | 153 // TODO(rtenneti): We should set ProofVerifier in QuicClientSession. |
| 154 crypto_config_.SetProofVerifier(verifier); | 154 crypto_config_.SetProofVerifier(verifier); |
| 155 } | 155 } |
| 156 | 156 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // when the stream is closed (in OnClose). | 265 // when the stream is closed (in OnClose). |
| 266 bool print_response_; | 266 bool print_response_; |
| 267 | 267 |
| 268 DISALLOW_COPY_AND_ASSIGN(QuicClient); | 268 DISALLOW_COPY_AND_ASSIGN(QuicClient); |
| 269 }; | 269 }; |
| 270 | 270 |
| 271 } // namespace tools | 271 } // namespace tools |
| 272 } // namespace net | 272 } // namespace net |
| 273 | 273 |
| 274 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 274 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
| OLD | NEW |