| 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 27 matching lines...) Expand all Loading... |
| 38 public: | 38 public: |
| 39 QuicClient(IPEndPoint server_address, | 39 QuicClient(IPEndPoint server_address, |
| 40 const string& server_hostname, | 40 const string& server_hostname, |
| 41 const QuicVersionVector& supported_versions, | 41 const QuicVersionVector& supported_versions, |
| 42 bool print_response); | 42 bool print_response); |
| 43 QuicClient(IPEndPoint server_address, | 43 QuicClient(IPEndPoint server_address, |
| 44 const std::string& server_hostname, | 44 const std::string& server_hostname, |
| 45 const QuicConfig& config, | 45 const QuicConfig& config, |
| 46 const QuicVersionVector& supported_versions); | 46 const QuicVersionVector& supported_versions); |
| 47 | 47 |
| 48 virtual ~QuicClient(); | 48 virtual ~QuicClient() OVERRIDE; |
| 49 | 49 |
| 50 // Initializes the client to create a connection. Should be called exactly | 50 // Initializes the client to create a connection. Should be called exactly |
| 51 // once before calling StartConnect or Connect. Returns true if the | 51 // once before calling StartConnect or Connect. Returns true if the |
| 52 // initialization succeeds, false otherwise. | 52 // initialization succeeds, false otherwise. |
| 53 bool Initialize(); | 53 bool Initialize(); |
| 54 | 54 |
| 55 // "Connect" to the QUIC server, including performing synchronous crypto | 55 // "Connect" to the QUIC server, including performing synchronous crypto |
| 56 // handshake. | 56 // handshake. |
| 57 bool Connect(); | 57 bool Connect(); |
| 58 | 58 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 81 void WaitForStreamToClose(QuicStreamId id); | 81 void WaitForStreamToClose(QuicStreamId id); |
| 82 | 82 |
| 83 // Wait for events until the handshake is confirmed. | 83 // Wait for events until the handshake is confirmed. |
| 84 void WaitForCryptoHandshakeConfirmed(); | 84 void WaitForCryptoHandshakeConfirmed(); |
| 85 | 85 |
| 86 // Wait up to 50ms, and handle any events which occur. | 86 // Wait up to 50ms, and handle any events which occur. |
| 87 // Returns true if there are any outstanding requests. | 87 // Returns true if there are any outstanding requests. |
| 88 bool WaitForEvents(); | 88 bool WaitForEvents(); |
| 89 | 89 |
| 90 // From EpollCallbackInterface | 90 // From EpollCallbackInterface |
| 91 virtual void OnRegistration( | 91 virtual void OnRegistration(EpollServer* eps, |
| 92 EpollServer* eps, int fd, int event_mask) OVERRIDE {} | 92 int fd, |
| 93 int event_mask) OVERRIDE {} |
| 93 virtual void OnModification(int fd, int event_mask) OVERRIDE {} | 94 virtual void OnModification(int fd, int event_mask) OVERRIDE {} |
| 94 virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; | 95 virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; |
| 95 // |fd_| can be unregistered without the client being disconnected. This | 96 // |fd_| can be unregistered without the client being disconnected. This |
| 96 // happens in b3m QuicProber where we unregister |fd_| to feed in events to | 97 // happens in b3m QuicProber where we unregister |fd_| to feed in events to |
| 97 // the client from the SelectServer. | 98 // the client from the SelectServer. |
| 98 virtual void OnUnregistration(int fd, bool replaced) OVERRIDE {} | 99 virtual void OnUnregistration(int fd, bool replaced) OVERRIDE {} |
| 99 virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} | 100 virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} |
| 100 | 101 |
| 101 // QuicDataStream::Visitor | 102 // QuicDataStream::Visitor |
| 102 virtual void OnClose(QuicDataStream* stream) OVERRIDE; | 103 virtual void OnClose(QuicDataStream* stream) OVERRIDE; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // when the stream is closed (in OnClose). | 218 // when the stream is closed (in OnClose). |
| 218 bool print_response_; | 219 bool print_response_; |
| 219 | 220 |
| 220 DISALLOW_COPY_AND_ASSIGN(QuicClient); | 221 DISALLOW_COPY_AND_ASSIGN(QuicClient); |
| 221 }; | 222 }; |
| 222 | 223 |
| 223 } // namespace tools | 224 } // namespace tools |
| 224 } // namespace net | 225 } // namespace net |
| 225 | 226 |
| 226 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 227 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
| OLD | NEW |