Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1389)

Side by Side Diff: net/tools/quic/quic_client.h

Issue 14816006: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing NET_PRIVATE_EXPORT to QuicWallTime Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include <string> 11 #include <string>
12 12
13 #include "base/hash_tables.h" 13 #include "base/hash_tables.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "net/base/ip_endpoint.h" 15 #include "net/base/ip_endpoint.h"
16 #include "net/quic/crypto/crypto_handshake.h" 16 #include "net/quic/crypto/crypto_handshake.h"
17 #include "net/quic/quic_config.h" 17 #include "net/quic/quic_config.h"
18 #include "net/quic/quic_framer.h" 18 #include "net/quic/quic_framer.h"
19 #include "net/quic/quic_packet_creator.h" 19 #include "net/quic/quic_packet_creator.h"
20 #include "net/tools/flip_server/epoll_server.h" 20 #include "net/tools/flip_server/epoll_server.h"
21 #include "net/tools/quic/quic_client_session.h" 21 #include "net/tools/quic/quic_client_session.h"
22 #include "net/tools/quic/quic_reliable_client_stream.h" 22 #include "net/tools/quic/quic_reliable_client_stream.h"
23 23
24 namespace net { 24 namespace net {
25 namespace tools { 25 namespace tools {
26 26
27 class QuicClient : public EpollCallbackInterface { 27 class QuicClient : public EpollCallbackInterface {
28 public: 28 public:
29 QuicClient(IPEndPoint server_address, const std::string& server_hostname); 29 QuicClient(IPEndPoint server_address, const std::string& server_hostname);
30 QuicClient(IPEndPoint server_address,
31 const std::string& server_hostname,
32 const QuicConfig& config);
33
30 virtual ~QuicClient(); 34 virtual ~QuicClient();
31 35
32 // Initializes the client to create a connection. Should be called exactly 36 // Initializes the client to create a connection. Should be called exactly
33 // once before calling StartConnect or Connect. Returns true if the 37 // once before calling StartConnect or Connect. Returns true if the
34 // initialization succeeds, false otherwise. 38 // initialization succeeds, false otherwise.
35 bool Initialize(); 39 bool Initialize();
36 40
37 // "Connect" to the QUIC server, including performing synchronous crypto 41 // "Connect" to the QUIC server, including performing synchronous crypto
38 // handshake. 42 // handshake.
39 bool Connect(); 43 bool Connect();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 113
110 // Set of streams created (and owned) by this client 114 // Set of streams created (and owned) by this client
111 base::hash_set<QuicReliableClientStream*> streams_; 115 base::hash_set<QuicReliableClientStream*> streams_;
112 116
113 // Address of the server. 117 // Address of the server.
114 const IPEndPoint server_address_; 118 const IPEndPoint server_address_;
115 119
116 // Hostname of the server. This may be a DNS name or an IP address literal. 120 // Hostname of the server. This may be a DNS name or an IP address literal.
117 const std::string server_hostname_; 121 const std::string server_hostname_;
118 122
123 // config_ and crypto_config_ contain configuration and cached state about
124 // servers.
125 QuicConfig config_;
126 QuicCryptoClientConfig crypto_config_;
127
119 // Address of the client if the client is connected to the server. 128 // Address of the client if the client is connected to the server.
120 IPEndPoint client_address_; 129 IPEndPoint client_address_;
121 130
122 // If initialized, the address to bind to. 131 // If initialized, the address to bind to.
123 IPAddressNumber bind_to_address_; 132 IPAddressNumber bind_to_address_;
124 // Local port to bind to. Initialize to 0. 133 // Local port to bind to. Initialize to 0.
125 int local_port_; 134 int local_port_;
126 135
127 // Session which manages streams. 136 // Session which manages streams.
128 scoped_ptr<QuicClientSession> session_; 137 scoped_ptr<QuicClientSession> session_;
129 // Listens for events on the client socket. 138 // Listens for events on the client socket.
130 EpollServer epoll_server_; 139 EpollServer epoll_server_;
131 // UDP socket. 140 // UDP socket.
132 int fd_; 141 int fd_;
133 142
134 // Tracks if the client is initialized to connect. 143 // Tracks if the client is initialized to connect.
135 bool initialized_; 144 bool initialized_;
136 145
137 // If overflow_supported_ is true, this will be the number of packets dropped 146 // If overflow_supported_ is true, this will be the number of packets dropped
138 // during the lifetime of the server. This may overflow if enough packets 147 // during the lifetime of the server. This may overflow if enough packets
139 // are dropped. 148 // are dropped.
140 int packets_dropped_; 149 int packets_dropped_;
141 150
142 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped 151 // True if the kernel supports SO_RXQ_OVFL, the number of packets dropped
143 // because the socket would otherwise overflow. 152 // because the socket would otherwise overflow.
144 bool overflow_supported_; 153 bool overflow_supported_;
145 154
146 // config_ and crypto_config_ contain configuration and cached state about
147 // servers.
148 QuicConfig config_;
149 QuicCryptoClientConfig crypto_config_;
150
151 DISALLOW_COPY_AND_ASSIGN(QuicClient); 155 DISALLOW_COPY_AND_ASSIGN(QuicClient);
152 }; 156 };
153 157
154 } // namespace tools 158 } // namespace tools
155 } // namespace net 159 } // namespace net
156 160
157 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ 161 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_
OLDNEW
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698