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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 void set_bind_to_address(const IPAddress& address) { | 164 void set_bind_to_address(const IPAddress& address) { |
165 bind_to_address_ = address; | 165 bind_to_address_ = address; |
166 } | 166 } |
167 | 167 |
168 const IPAddress& bind_to_address() const { return bind_to_address_; } | 168 const IPAddress& bind_to_address() const { return bind_to_address_; } |
169 | 169 |
170 void set_local_port(int local_port) { local_port_ = local_port; } | 170 void set_local_port(int local_port) { local_port_ = local_port; } |
171 | 171 |
172 const IPEndPoint& server_address() const { return server_address_; } | 172 const IPEndPoint& server_address() const { return server_address_; } |
173 | 173 |
174 // Takes ownership of the listener. | 174 void set_server_address(const IPEndPoint& server_address) { |
| 175 server_address_ = server_address; |
| 176 } |
| 177 |
| 178 // Takes ownership of the std::listener. |
175 void set_response_listener(ResponseListener* listener) { | 179 void set_response_listener(ResponseListener* listener) { |
176 response_listener_.reset(listener); | 180 response_listener_.reset(listener); |
177 } | 181 } |
178 | 182 |
179 void set_store_response(bool val) { store_response_ = val; } | 183 void set_store_response(bool val) { store_response_ = val; } |
180 | 184 |
181 size_t latest_response_code() const; | 185 size_t latest_response_code() const; |
182 const std::string& latest_response_headers() const; | 186 const std::string& latest_response_headers() const; |
183 const std::string& latest_response_body() const; | 187 const std::string& latest_response_body() const; |
184 const std::string& latest_response_trailers() const; | 188 const std::string& latest_response_trailers() const; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 void CleanUpUDPSocketImpl(int fd); | 243 void CleanUpUDPSocketImpl(int fd); |
240 | 244 |
241 // If the request URL matches a push promise, bypass sending the | 245 // If the request URL matches a push promise, bypass sending the |
242 // request. | 246 // request. |
243 bool MaybeHandlePromised(const BalsaHeaders& headers, | 247 bool MaybeHandlePromised(const BalsaHeaders& headers, |
244 const SpdyHeaderBlock& spdy_headers, | 248 const SpdyHeaderBlock& spdy_headers, |
245 base::StringPiece body, | 249 base::StringPiece body, |
246 bool fin); | 250 bool fin); |
247 | 251 |
248 // Address of the server. | 252 // Address of the server. |
249 const IPEndPoint server_address_; | 253 IPEndPoint server_address_; |
250 | 254 |
251 // If initialized, the address to bind to. | 255 // If initialized, the address to bind to. |
252 IPAddress bind_to_address_; | 256 IPAddress bind_to_address_; |
253 | 257 |
254 // Local port to bind to. Initialize to 0. | 258 // Local port to bind to. Initialize to 0. |
255 int local_port_; | 259 int local_port_; |
256 | 260 |
257 // Listens for events on the client socket. | 261 // Listens for events on the client socket. |
258 EpollServer* epoll_server_; | 262 EpollServer* epoll_server_; |
259 | 263 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 std::unique_ptr<QuicPacketReader> packet_reader_; | 305 std::unique_ptr<QuicPacketReader> packet_reader_; |
302 | 306 |
303 std::unique_ptr<ClientQuicDataToResend> push_promise_data_to_resend_; | 307 std::unique_ptr<ClientQuicDataToResend> push_promise_data_to_resend_; |
304 | 308 |
305 DISALLOW_COPY_AND_ASSIGN(QuicClient); | 309 DISALLOW_COPY_AND_ASSIGN(QuicClient); |
306 }; | 310 }; |
307 | 311 |
308 } // namespace net | 312 } // namespace net |
309 | 313 |
310 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 314 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
OLD | NEW |