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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 IPAddressNumber bind_to_address() const { return bind_to_address_; } | 130 IPAddressNumber bind_to_address() const { return bind_to_address_; } |
131 | 131 |
132 void set_local_port(int local_port) { local_port_ = local_port; } | 132 void set_local_port(int local_port) { local_port_ = local_port; } |
133 | 133 |
134 const IPEndPoint& server_address() const { return server_address_; } | 134 const IPEndPoint& server_address() const { return server_address_; } |
135 | 135 |
136 const IPEndPoint& client_address() const { return client_address_; } | 136 const IPEndPoint& client_address() const { return client_address_; } |
137 | 137 |
138 EpollServer* epoll_server() { return epoll_server_; } | |
139 | |
140 int fd() { return fd_; } | 138 int fd() { return fd_; } |
141 | 139 |
142 const QuicServerId& server_id() const { return server_id_; } | 140 const QuicServerId& server_id() const { return server_id_; } |
143 | 141 |
144 // This should only be set before the initial Connect() | 142 // This should only be set before the initial Connect() |
145 void set_server_id(const QuicServerId& server_id) { | 143 void set_server_id(const QuicServerId& server_id) { |
146 server_id_ = server_id; | 144 server_id_ = server_id; |
147 } | 145 } |
148 | 146 |
149 void SetUserAgentID(const string& user_agent_id) { | 147 void SetUserAgentID(const string& user_agent_id) { |
(...skipping 27 matching lines...) Expand all Loading... |
177 protected: | 175 protected: |
178 virtual QuicConnectionId GenerateConnectionId(); | 176 virtual QuicConnectionId GenerateConnectionId(); |
179 virtual QuicEpollConnectionHelper* CreateQuicConnectionHelper(); | 177 virtual QuicEpollConnectionHelper* CreateQuicConnectionHelper(); |
180 virtual QuicPacketWriter* CreateQuicPacketWriter(); | 178 virtual QuicPacketWriter* CreateQuicPacketWriter(); |
181 | 179 |
182 virtual int ReadPacket(char* buffer, | 180 virtual int ReadPacket(char* buffer, |
183 int buffer_len, | 181 int buffer_len, |
184 IPEndPoint* server_address, | 182 IPEndPoint* server_address, |
185 IPAddressNumber* client_ip); | 183 IPAddressNumber* client_ip); |
186 | 184 |
| 185 EpollServer* epoll_server() { return epoll_server_; } |
| 186 |
187 private: | 187 private: |
188 friend class net::tools::test::QuicClientPeer; | 188 friend class net::tools::test::QuicClientPeer; |
189 | 189 |
190 // Used during initialization: creates the UDP socket FD, sets socket options, | 190 // Used during initialization: creates the UDP socket FD, sets socket options, |
191 // and binds the socket to our address. | 191 // and binds the socket to our address. |
192 bool CreateUDPSocket(); | 192 bool CreateUDPSocket(); |
193 | 193 |
194 // Read a UDP packet and hand it to the framer. | 194 // Read a UDP packet and hand it to the framer. |
195 bool ReadAndProcessPacket(); | 195 bool ReadAndProcessPacket(); |
196 | 196 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // when the stream is closed (in OnClose). | 252 // when the stream is closed (in OnClose). |
253 bool print_response_; | 253 bool print_response_; |
254 | 254 |
255 DISALLOW_COPY_AND_ASSIGN(QuicClient); | 255 DISALLOW_COPY_AND_ASSIGN(QuicClient); |
256 }; | 256 }; |
257 | 257 |
258 } // namespace tools | 258 } // namespace tools |
259 } // namespace net | 259 } // namespace net |
260 | 260 |
261 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ | 261 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_H_ |
OLD | NEW |