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

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

Issue 215058: Correctly talk to VMS servers (translate UNIX paths to VMS and vice versa). (Closed)
Patch Set: fixes Created 11 years, 3 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) 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
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 // Major categories of remote system types, as returned by SYST command.
89 enum SystemType {
90 SYSTEM_TYPE_UNKNOWN,
91 SYSTEM_TYPE_UNIX,
92 SYSTEM_TYPE_WINDOWS,
93 SYSTEM_TYPE_OS2,
94 SYSTEM_TYPE_VMS,
95 };
96
88 // Resets the members of the transaction so it can be restarted. 97 // Resets the members of the transaction so it can be restarted.
89 void ResetStateForRestart(); 98 void ResetStateForRestart();
90 99
91 void DoCallback(int result); 100 void DoCallback(int result);
92 void OnIOComplete(int result); 101 void OnIOComplete(int result);
93 102
94 // Executes correct ProcessResponse + command_name function based on last 103 // Executes correct ProcessResponse + command_name function based on last
95 // issued command. Returns error code. 104 // issued command. Returns error code.
96 int ProcessCtrlResponse(); 105 int ProcessCtrlResponse();
97 106
98 int SendFtpCommand(const std::string& command, Command cmd); 107 int SendFtpCommand(const std::string& command, Command cmd);
99 108
100 // Return the error class for given response code. You should validate the 109 // Return the error class for given response code. You should validate the
101 // code to be in range 100-599. 110 // code to be in range 100-599.
102 static ErrorClass GetErrorClass(int response_code); 111 static ErrorClass GetErrorClass(int response_code);
103 112
104 // Returns request path suitable to be included in an FTP command. 113 // Returns request path suitable to be included in an FTP command. If the path
105 std::string GetRequestPathForFtpCommand() const; 114 // will be used as a directory, |is_directory| should be true.
115 std::string GetRequestPathForFtpCommand(bool is_directory) const;
106 116
107 // Runs the state transition loop. 117 // Runs the state transition loop.
108 int DoLoop(int result); 118 int DoLoop(int result);
109 119
110 // Each of these methods corresponds to a State value. Those with an input 120 // Each of these methods corresponds to a State value. Those with an input
111 // argument receive the result from the previous state. If a method returns 121 // argument receive the result from the previous state. If a method returns
112 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the 122 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the
113 // next state method as the result arg. 123 // next state method as the result arg.
114 int DoCtrlInit(); 124 int DoCtrlInit();
115 int DoCtrlInitComplete(int result); 125 int DoCtrlInitComplete(int result);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Buffer passed to the Write method of control socket. It actually writes 193 // Buffer passed to the Write method of control socket. It actually writes
184 // to the write_command_buf_ at correct offset. 194 // to the write_command_buf_ at correct offset.
185 scoped_refptr<ReusedIOBuffer> write_buf_; 195 scoped_refptr<ReusedIOBuffer> write_buf_;
186 196
187 // Number of bytes from write_command_buf_ that we've already sent to the 197 // Number of bytes from write_command_buf_ that we've already sent to the
188 // server. 198 // server.
189 int write_command_buf_written_; 199 int write_command_buf_written_;
190 200
191 int last_error_; 201 int last_error_;
192 202
203 SystemType system_type_;
204
193 // We get username and password as wstrings in RestartWithAuth, so they are 205 // We get username and password as wstrings in RestartWithAuth, so they are
194 // also kept as wstrings here. 206 // also kept as wstrings here.
195 std::wstring username_; 207 std::wstring username_;
196 std::wstring password_; 208 std::wstring password_;
197 209
210 // Current directory on the remote server, as returned by last PWD command,
211 // with any trailing slash removed.
212 std::string current_remote_directory_;
213
198 bool retr_failed_; 214 bool retr_failed_;
199 215
200 int data_connection_port_; 216 int data_connection_port_;
201 217
202 ClientSocketFactory* socket_factory_; 218 ClientSocketFactory* socket_factory_;
203 219
204 scoped_ptr<ClientSocket> ctrl_socket_; 220 scoped_ptr<ClientSocket> ctrl_socket_;
205 scoped_ptr<ClientSocket> data_socket_; 221 scoped_ptr<ClientSocket> data_socket_;
206 222
207 enum State { 223 enum State {
(...skipping 27 matching lines...) Expand all
235 STATE_DATA_READ, 251 STATE_DATA_READ,
236 STATE_DATA_READ_COMPLETE, 252 STATE_DATA_READ_COMPLETE,
237 STATE_NONE 253 STATE_NONE
238 }; 254 };
239 State next_state_; 255 State next_state_;
240 }; 256 };
241 257
242 } // namespace net 258 } // namespace net
243 259
244 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_ 260 #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