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

Side by Side Diff: net/ftp/ftp_network_transaction.h

Issue 2985004: Clean up FTP code a bit: (Closed)
Patch Set: Created 10 years, 5 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
« no previous file with comments | « no previous file | net/ftp/ftp_network_transaction.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) 2008 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // source code is governed by a BSD-style license that can be found in the 2 // Use of this source code is governed by a BSD-style license that can be
3 // LICENSE file. 3 // found in the 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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/ref_counted.h" 13 #include "base/ref_counted.h"
(...skipping 29 matching lines...) Expand all
43 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); 43 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback);
44 virtual const FtpResponseInfo* GetResponseInfo() const; 44 virtual const FtpResponseInfo* GetResponseInfo() const;
45 virtual LoadState GetLoadState() const; 45 virtual LoadState GetLoadState() const;
46 virtual uint64 GetUploadProgress() const; 46 virtual uint64 GetUploadProgress() const;
47 47
48 private: 48 private:
49 enum Command { 49 enum Command {
50 COMMAND_NONE, 50 COMMAND_NONE,
51 COMMAND_USER, 51 COMMAND_USER,
52 COMMAND_PASS, 52 COMMAND_PASS,
53 COMMAND_ACCT,
54 COMMAND_SYST, 53 COMMAND_SYST,
55 COMMAND_TYPE, 54 COMMAND_TYPE,
56 COMMAND_EPSV, 55 COMMAND_EPSV,
57 COMMAND_PASV, 56 COMMAND_PASV,
58 COMMAND_PWD, 57 COMMAND_PWD,
59 COMMAND_SIZE, 58 COMMAND_SIZE,
60 COMMAND_RETR, 59 COMMAND_RETR,
61 COMMAND_CWD, 60 COMMAND_CWD,
62 COMMAND_MLSD, 61 COMMAND_MLSD,
63 COMMAND_LIST, 62 COMMAND_LIST,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // See if the request URL contains a typecode and make us respect it. 134 // See if the request URL contains a typecode and make us respect it.
136 void DetectTypecode(); 135 void DetectTypecode();
137 136
138 // Runs the state transition loop. 137 // Runs the state transition loop.
139 int DoLoop(int result); 138 int DoLoop(int result);
140 139
141 // Each of these methods corresponds to a State value. Those with an input 140 // Each of these methods corresponds to a State value. Those with an input
142 // argument receive the result from the previous state. If a method returns 141 // argument receive the result from the previous state. If a method returns
143 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the 142 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the
144 // next state method as the result arg. 143 // next state method as the result arg.
145 int DoCtrlInit();
146 int DoCtrlInitComplete(int result);
147 int DoCtrlResolveHost(); 144 int DoCtrlResolveHost();
148 int DoCtrlResolveHostComplete(int result); 145 int DoCtrlResolveHostComplete(int result);
149 int DoCtrlConnect(); 146 int DoCtrlConnect();
150 int DoCtrlConnectComplete(int result); 147 int DoCtrlConnectComplete(int result);
151 int DoCtrlRead(); 148 int DoCtrlRead();
152 int DoCtrlReadComplete(int result); 149 int DoCtrlReadComplete(int result);
153 int DoCtrlWrite(); 150 int DoCtrlWrite();
154 int DoCtrlWriteComplete(int result); 151 int DoCtrlWriteComplete(int result);
155 int DoCtrlWriteUSER(); 152 int DoCtrlWriteUSER();
156 int ProcessResponseUSER(const FtpCtrlResponse& response); 153 int ProcessResponseUSER(const FtpCtrlResponse& response);
157 int DoCtrlWritePASS(); 154 int DoCtrlWritePASS();
158 int ProcessResponsePASS(const FtpCtrlResponse& response); 155 int ProcessResponsePASS(const FtpCtrlResponse& response);
159 int DoCtrlWriteACCT();
160 int ProcessResponseACCT(const FtpCtrlResponse& response);
161 int DoCtrlWriteSYST(); 156 int DoCtrlWriteSYST();
162 int ProcessResponseSYST(const FtpCtrlResponse& response); 157 int ProcessResponseSYST(const FtpCtrlResponse& response);
163 int DoCtrlWritePWD(); 158 int DoCtrlWritePWD();
164 int ProcessResponsePWD(const FtpCtrlResponse& response); 159 int ProcessResponsePWD(const FtpCtrlResponse& response);
165 int DoCtrlWriteTYPE(); 160 int DoCtrlWriteTYPE();
166 int ProcessResponseTYPE(const FtpCtrlResponse& response); 161 int ProcessResponseTYPE(const FtpCtrlResponse& response);
167 int DoCtrlWriteEPSV(); 162 int DoCtrlWriteEPSV();
168 int ProcessResponseEPSV(const FtpCtrlResponse& response); 163 int ProcessResponseEPSV(const FtpCtrlResponse& response);
169 int DoCtrlWritePASV(); 164 int DoCtrlWritePASV();
170 int ProcessResponsePASV(const FtpCtrlResponse& response); 165 int ProcessResponsePASV(const FtpCtrlResponse& response);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 238
244 int data_connection_port_; 239 int data_connection_port_;
245 240
246 ClientSocketFactory* socket_factory_; 241 ClientSocketFactory* socket_factory_;
247 242
248 scoped_ptr<ClientSocket> ctrl_socket_; 243 scoped_ptr<ClientSocket> ctrl_socket_;
249 scoped_ptr<ClientSocket> data_socket_; 244 scoped_ptr<ClientSocket> data_socket_;
250 245
251 enum State { 246 enum State {
252 // Control connection states: 247 // Control connection states:
253 STATE_CTRL_INIT,
254 STATE_CTRL_INIT_COMPLETE,
255 STATE_CTRL_RESOLVE_HOST, 248 STATE_CTRL_RESOLVE_HOST,
256 STATE_CTRL_RESOLVE_HOST_COMPLETE, 249 STATE_CTRL_RESOLVE_HOST_COMPLETE,
257 STATE_CTRL_CONNECT, 250 STATE_CTRL_CONNECT,
258 STATE_CTRL_CONNECT_COMPLETE, 251 STATE_CTRL_CONNECT_COMPLETE,
259 STATE_CTRL_READ, 252 STATE_CTRL_READ,
260 STATE_CTRL_READ_COMPLETE, 253 STATE_CTRL_READ_COMPLETE,
261 STATE_CTRL_WRITE, 254 STATE_CTRL_WRITE,
262 STATE_CTRL_WRITE_COMPLETE, 255 STATE_CTRL_WRITE_COMPLETE,
263 STATE_CTRL_WRITE_USER, 256 STATE_CTRL_WRITE_USER,
264 STATE_CTRL_WRITE_PASS, 257 STATE_CTRL_WRITE_PASS,
265 STATE_CTRL_WRITE_ACCT,
266 STATE_CTRL_WRITE_SYST, 258 STATE_CTRL_WRITE_SYST,
267 STATE_CTRL_WRITE_TYPE, 259 STATE_CTRL_WRITE_TYPE,
268 STATE_CTRL_WRITE_EPSV, 260 STATE_CTRL_WRITE_EPSV,
269 STATE_CTRL_WRITE_PASV, 261 STATE_CTRL_WRITE_PASV,
270 STATE_CTRL_WRITE_PWD, 262 STATE_CTRL_WRITE_PWD,
271 STATE_CTRL_WRITE_RETR, 263 STATE_CTRL_WRITE_RETR,
272 STATE_CTRL_WRITE_SIZE, 264 STATE_CTRL_WRITE_SIZE,
273 STATE_CTRL_WRITE_CWD, 265 STATE_CTRL_WRITE_CWD,
274 STATE_CTRL_WRITE_MLSD, 266 STATE_CTRL_WRITE_MLSD,
275 STATE_CTRL_WRITE_LIST, 267 STATE_CTRL_WRITE_LIST,
276 STATE_CTRL_WRITE_QUIT, 268 STATE_CTRL_WRITE_QUIT,
277 // Data connection states: 269 // Data connection states:
278 STATE_DATA_CONNECT, 270 STATE_DATA_CONNECT,
279 STATE_DATA_CONNECT_COMPLETE, 271 STATE_DATA_CONNECT_COMPLETE,
280 STATE_DATA_READ, 272 STATE_DATA_READ,
281 STATE_DATA_READ_COMPLETE, 273 STATE_DATA_READ_COMPLETE,
282 STATE_NONE 274 STATE_NONE
283 }; 275 };
284 State next_state_; 276 State next_state_;
285 }; 277 };
286 278
287 } // namespace net 279 } // namespace net
288 280
289 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_ 281 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_
OLDNEW
« no previous file with comments | « no previous file | net/ftp/ftp_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698