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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 int buffer_len, | 181 int buffer_len, |
182 IPEndPoint* server_address, | 182 IPEndPoint* server_address, |
183 IPAddressNumber* client_ip); | 183 IPAddressNumber* client_ip); |
184 | 184 |
185 EpollServer* epoll_server() { return epoll_server_; } | 185 EpollServer* epoll_server() { return epoll_server_; } |
186 QuicConfig* config() { return &config_; } | 186 QuicConfig* config() { return &config_; } |
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 |
| 192 class DummyPacketWriterFactory : public QuicConnection::PacketWriterFactory { |
| 193 public: |
| 194 DummyPacketWriterFactory(QuicPacketWriter* writer); |
| 195 virtual ~DummyPacketWriterFactory(); |
| 196 |
| 197 virtual QuicPacketWriter* Create(QuicConnection* connection) const OVERRIDE; |
| 198 |
| 199 private: |
| 200 QuicPacketWriter* writer_; |
| 201 }; |
| 202 |
191 // Used during initialization: creates the UDP socket FD, sets socket options, | 203 // Used during initialization: creates the UDP socket FD, sets socket options, |
192 // and binds the socket to our address. | 204 // and binds the socket to our address. |
193 bool CreateUDPSocket(); | 205 bool CreateUDPSocket(); |
194 | 206 |
195 // Read a UDP packet and hand it to the framer. | 207 // Read a UDP packet and hand it to the framer. |
196 bool ReadAndProcessPacket(); | 208 bool ReadAndProcessPacket(); |
197 | 209 |
198 // Address of the server. | 210 // Address of the server. |
199 const IPEndPoint server_address_; | 211 const IPEndPoint server_address_; |
200 | 212 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // when the stream is closed (in OnClose). | 266 // when the stream is closed (in OnClose). |
255 bool print_response_; | 267 bool print_response_; |
256 | 268 |
257 DISALLOW_COPY_AND_ASSIGN(QuicClient); | 269 DISALLOW_COPY_AND_ASSIGN(QuicClient); |
258 }; | 270 }; |
259 | 271 |
260 } // namespace tools | 272 } // namespace tools |
261 } // namespace net | 273 } // namespace net |
262 | 274 |
263 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 275 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
OLD | NEW |