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

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

Issue 2985012: FTP: add more detailed error codes based on RFC 959. (Closed)
Patch Set: fixes 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 COMMAND_PASV, 56 COMMAND_PASV,
57 COMMAND_PWD, 57 COMMAND_PWD,
58 COMMAND_SIZE, 58 COMMAND_SIZE,
59 COMMAND_RETR, 59 COMMAND_RETR,
60 COMMAND_CWD, 60 COMMAND_CWD,
61 COMMAND_MLSD, 61 COMMAND_MLSD,
62 COMMAND_LIST, 62 COMMAND_LIST,
63 COMMAND_QUIT, 63 COMMAND_QUIT,
64 }; 64 };
65 65
66 enum ErrorClass {
67 // The requested action was initiated. The client should expect another
68 // reply before issuing the next command.
69 ERROR_CLASS_INITIATED,
70
71 // The requested action has been successfully completed.
72 ERROR_CLASS_OK,
73
74 // The command has been accepted, but to complete the operation, more
75 // information must be sent by the client.
76 ERROR_CLASS_INFO_NEEDED,
77
78 // The command was not accepted and the requested action did not take place.
79 // This condition is temporary, and the client is encouraged to restart the
80 // command sequence.
81 ERROR_CLASS_TRANSIENT_ERROR,
82
83 // The command was not accepted and the requested action did not take place.
84 // This condition is rather permanent, and the client is discouraged from
85 // repeating the exact request.
86 ERROR_CLASS_PERMANENT_ERROR,
87 };
88
89 // Major categories of remote system types, as returned by SYST command. 66 // Major categories of remote system types, as returned by SYST command.
90 enum SystemType { 67 enum SystemType {
91 SYSTEM_TYPE_UNKNOWN, 68 SYSTEM_TYPE_UNKNOWN,
92 SYSTEM_TYPE_UNIX, 69 SYSTEM_TYPE_UNIX,
93 SYSTEM_TYPE_WINDOWS, 70 SYSTEM_TYPE_WINDOWS,
94 SYSTEM_TYPE_OS2, 71 SYSTEM_TYPE_OS2,
95 SYSTEM_TYPE_VMS, 72 SYSTEM_TYPE_VMS,
96 }; 73 };
97 74
98 // Data representation type, see RFC 959 section 3.1.1. Data Types. 75 // Data representation type, see RFC 959 section 3.1.1. Data Types.
(...skipping 17 matching lines...) Expand all
116 93
117 void DoCallback(int result); 94 void DoCallback(int result);
118 void OnIOComplete(int result); 95 void OnIOComplete(int result);
119 96
120 // Executes correct ProcessResponse + command_name function based on last 97 // Executes correct ProcessResponse + command_name function based on last
121 // issued command. Returns error code. 98 // issued command. Returns error code.
122 int ProcessCtrlResponse(); 99 int ProcessCtrlResponse();
123 100
124 int SendFtpCommand(const std::string& command, Command cmd); 101 int SendFtpCommand(const std::string& command, Command cmd);
125 102
126 // Return the error class for given response code. You should validate the
127 // code to be in range 100-599.
128 static ErrorClass GetErrorClass(int response_code);
129
130 // Returns request path suitable to be included in an FTP command. If the path 103 // Returns request path suitable to be included in an FTP command. If the path
131 // will be used as a directory, |is_directory| should be true. 104 // will be used as a directory, |is_directory| should be true.
132 std::string GetRequestPathForFtpCommand(bool is_directory) const; 105 std::string GetRequestPathForFtpCommand(bool is_directory) const;
133 106
134 // See if the request URL contains a typecode and make us respect it. 107 // See if the request URL contains a typecode and make us respect it.
135 void DetectTypecode(); 108 void DetectTypecode();
136 109
137 // Runs the state transition loop. 110 // Runs the state transition loop.
138 int DoLoop(int result); 111 int DoLoop(int result);
139 112
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 STATE_DATA_READ, 245 STATE_DATA_READ,
273 STATE_DATA_READ_COMPLETE, 246 STATE_DATA_READ_COMPLETE,
274 STATE_NONE 247 STATE_NONE
275 }; 248 };
276 State next_state_; 249 State next_state_;
277 }; 250 };
278 251
279 } // namespace net 252 } // namespace net
280 253
281 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_ 254 #endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698