| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Wait for events until the handshake is confirmed. | 100 // Wait for events until the handshake is confirmed. |
| 101 void WaitForCryptoHandshakeConfirmed(); | 101 void WaitForCryptoHandshakeConfirmed(); |
| 102 | 102 |
| 103 // Wait up to 50ms, and handle any events which occur. | 103 // Wait up to 50ms, and handle any events which occur. |
| 104 // Returns true if there are any outstanding requests. | 104 // Returns true if there are any outstanding requests. |
| 105 bool WaitForEvents(); | 105 bool WaitForEvents(); |
| 106 | 106 |
| 107 // From EpollCallbackInterface | 107 // From EpollCallbackInterface |
| 108 virtual void OnRegistration(EpollServer* eps, | 108 virtual void OnRegistration(EpollServer* eps, |
| 109 int fd, | 109 int fd, |
| 110 int event_mask) OVERRIDE {} | 110 int event_mask) override {} |
| 111 virtual void OnModification(int fd, int event_mask) OVERRIDE {} | 111 virtual void OnModification(int fd, int event_mask) override {} |
| 112 virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; | 112 virtual void OnEvent(int fd, EpollEvent* event) override; |
| 113 // |fd_| can be unregistered without the client being disconnected. This | 113 // |fd_| can be unregistered without the client being disconnected. This |
| 114 // happens in b3m QuicProber where we unregister |fd_| to feed in events to | 114 // happens in b3m QuicProber where we unregister |fd_| to feed in events to |
| 115 // the client from the SelectServer. | 115 // the client from the SelectServer. |
| 116 virtual void OnUnregistration(int fd, bool replaced) OVERRIDE {} | 116 virtual void OnUnregistration(int fd, bool replaced) override {} |
| 117 virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} | 117 virtual void OnShutdown(EpollServer* eps, int fd) override {} |
| 118 | 118 |
| 119 // QuicDataStream::Visitor | 119 // QuicDataStream::Visitor |
| 120 virtual void OnClose(QuicDataStream* stream) OVERRIDE; | 120 virtual void OnClose(QuicDataStream* stream) override; |
| 121 | 121 |
| 122 QuicClientSession* session() { return session_.get(); } | 122 QuicClientSession* session() { return session_.get(); } |
| 123 | 123 |
| 124 bool connected() const; | 124 bool connected() const; |
| 125 | 125 |
| 126 void set_bind_to_address(IPAddressNumber address) { | 126 void set_bind_to_address(IPAddressNumber address) { |
| 127 bind_to_address_ = address; | 127 bind_to_address_ = address; |
| 128 } | 128 } |
| 129 | 129 |
| 130 IPAddressNumber bind_to_address() const { return bind_to_address_; } | 130 IPAddressNumber bind_to_address() const { return bind_to_address_; } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 private: | 188 private: |
| 189 friend class net::tools::test::QuicClientPeer; | 189 friend class net::tools::test::QuicClientPeer; |
| 190 | 190 |
| 191 // A packet writer factory that always returns the same writer | 191 // A packet writer factory that always returns the same writer |
| 192 class DummyPacketWriterFactory : public QuicConnection::PacketWriterFactory { | 192 class DummyPacketWriterFactory : public QuicConnection::PacketWriterFactory { |
| 193 public: | 193 public: |
| 194 DummyPacketWriterFactory(QuicPacketWriter* writer); | 194 DummyPacketWriterFactory(QuicPacketWriter* writer); |
| 195 virtual ~DummyPacketWriterFactory(); | 195 virtual ~DummyPacketWriterFactory(); |
| 196 | 196 |
| 197 virtual QuicPacketWriter* Create(QuicConnection* connection) const OVERRIDE; | 197 virtual QuicPacketWriter* Create(QuicConnection* connection) const override; |
| 198 | 198 |
| 199 private: | 199 private: |
| 200 QuicPacketWriter* writer_; | 200 QuicPacketWriter* writer_; |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 // Used during initialization: creates the UDP socket FD, sets socket options, | 203 // Used during initialization: creates the UDP socket FD, sets socket options, |
| 204 // and binds the socket to our address. | 204 // and binds the socket to our address. |
| 205 bool CreateUDPSocket(); | 205 bool CreateUDPSocket(); |
| 206 | 206 |
| 207 // Read a UDP packet and hand it to the framer. | 207 // Read a UDP packet and hand it to the framer. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // when the stream is closed (in OnClose). | 266 // when the stream is closed (in OnClose). |
| 267 bool print_response_; | 267 bool print_response_; |
| 268 | 268 |
| 269 DISALLOW_COPY_AND_ASSIGN(QuicClient); | 269 DISALLOW_COPY_AND_ASSIGN(QuicClient); |
| 270 }; | 270 }; |
| 271 | 271 |
| 272 } // namespace tools | 272 } // namespace tools |
| 273 } // namespace net | 273 } // namespace net |
| 274 | 274 |
| 275 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 275 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
| OLD | NEW |