OLD | NEW |
---|---|
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #ifndef NET_FTP_FTP_NETWORK_TRANSACTION_H_ | 5 #ifndef NET_FTP_FTP_NETWORK_TRANSACTION_H_ |
6 #define NET_FTP_FTP_NETWORK_TRANSACTION_H_ | 6 #define NET_FTP_FTP_NETWORK_TRANSACTION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <queue> | 9 #include <queue> |
10 #include <utility> | 10 #include <utility> |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 // This condition is temporary, and the client is encouraged to restart the | 78 // This condition is temporary, and the client is encouraged to restart the |
79 // command sequence. | 79 // command sequence. |
80 ERROR_CLASS_TRANSIENT_ERROR, | 80 ERROR_CLASS_TRANSIENT_ERROR, |
81 | 81 |
82 // The command was not accepted and the requested action did not take place. | 82 // The command was not accepted and the requested action did not take place. |
83 // This condition is rather permanent, and the client is discouraged from | 83 // This condition is rather permanent, and the client is discouraged from |
84 // repeating the exact request. | 84 // repeating the exact request. |
85 ERROR_CLASS_PERMANENT_ERROR, | 85 ERROR_CLASS_PERMANENT_ERROR, |
86 }; | 86 }; |
87 | 87 |
88 // Resets the members of the transaction so it can be restarted. | |
89 void ResetStateForRestart(); | |
90 | |
88 void DoCallback(int result); | 91 void DoCallback(int result); |
89 void OnIOComplete(int result); | 92 void OnIOComplete(int result); |
90 | 93 |
91 // Executes correct ProcessResponse + command_name function based on last | 94 // Executes correct ProcessResponse + command_name function based on last |
92 // issued command. Returns error code. | 95 // issued command. Returns error code. |
93 int ProcessCtrlResponse(); | 96 int ProcessCtrlResponse(); |
94 | 97 |
95 int SendFtpCommand(const std::string& command, Command cmd); | 98 int SendFtpCommand(const std::string& command, Command cmd); |
96 | 99 |
97 // Return the error class for given response code. You should validate the | 100 // Return the error class for given response code. You should validate the |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 const FtpRequestInfo* request_; | 163 const FtpRequestInfo* request_; |
161 FtpResponseInfo response_; | 164 FtpResponseInfo response_; |
162 | 165 |
163 // Cancels the outstanding request on destruction. | 166 // Cancels the outstanding request on destruction. |
164 SingleRequestHostResolver resolver_; | 167 SingleRequestHostResolver resolver_; |
165 AddressList addresses_; | 168 AddressList addresses_; |
166 | 169 |
167 // User buffer passed to the Read method for control socket. | 170 // User buffer passed to the Read method for control socket. |
168 scoped_refptr<IOBuffer> read_ctrl_buf_; | 171 scoped_refptr<IOBuffer> read_ctrl_buf_; |
169 | 172 |
170 FtpCtrlResponseBuffer ctrl_response_buffer_; | 173 scoped_ptr<FtpCtrlResponseBuffer> ctrl_response_buffer_; |
171 | 174 |
172 scoped_refptr<IOBuffer> read_data_buf_; | 175 scoped_refptr<IOBuffer> read_data_buf_; |
173 int read_data_buf_len_; | 176 int read_data_buf_len_; |
174 int file_data_len_; | 177 int file_data_len_; |
175 | 178 |
176 // Buffer holding the command line to be written to the control socket. | 179 // Buffer holding the command line to be written to the control socket. |
177 scoped_refptr<IOBufferWithSize> write_command_buf_; | 180 scoped_refptr<IOBufferWithSize> write_command_buf_; |
178 | 181 |
179 // Buffer passed to the Write method of control socket. It actually writes | 182 // Buffer passed to the Write method of control socket. It actually writes |
180 // to the write_command_buf_ at correct offset. | 183 // to the write_command_buf_ at correct offset. |
181 scoped_refptr<ReusedIOBuffer> write_buf_; | 184 scoped_refptr<ReusedIOBuffer> write_buf_; |
182 | 185 |
183 // Number of bytes from write_command_buf_ that we've already sent to the | 186 // Number of bytes from write_command_buf_ that we've already sent to the |
184 // server. | 187 // server. |
185 int write_command_buf_written_; | 188 int write_command_buf_written_; |
186 | 189 |
187 int last_error_; | 190 int last_error_; |
188 | 191 |
189 bool is_anonymous_; | 192 std::wstring username_; |
193 std::wstring password_; | |
wtc
2009/08/25 20:52:50
Nit: add a blank line to separate these from retr_
| |
190 bool retr_failed_; | 194 bool retr_failed_; |
191 | 195 |
192 std::string data_connection_ip_; | 196 std::string data_connection_ip_; |
193 int data_connection_port_; | 197 int data_connection_port_; |
194 | 198 |
195 ClientSocketFactory* socket_factory_; | 199 ClientSocketFactory* socket_factory_; |
196 | 200 |
197 scoped_ptr<ClientSocket> ctrl_socket_; | 201 scoped_ptr<ClientSocket> ctrl_socket_; |
198 scoped_ptr<ClientSocket> data_socket_; | 202 scoped_ptr<ClientSocket> data_socket_; |
199 | 203 |
(...skipping 30 matching lines...) Expand all Loading... | |
230 STATE_DATA_READ, | 234 STATE_DATA_READ, |
231 STATE_DATA_READ_COMPLETE, | 235 STATE_DATA_READ_COMPLETE, |
232 STATE_NONE | 236 STATE_NONE |
233 }; | 237 }; |
234 State next_state_; | 238 State next_state_; |
235 }; | 239 }; |
236 | 240 |
237 } // namespace net | 241 } // namespace net |
238 | 242 |
239 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_ | 243 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_ |
OLD | NEW |