summaryrefslogtreecommitdiffstats
path: root/net/ftp/ftp_network_transaction.h
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 20:29:16 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 20:29:16 +0000
commitdcfd29f49e33a782aebe4194af30d707c61c6264 (patch)
treed58d1537a04a9c20bd281393d32a556a982d3311 /net/ftp/ftp_network_transaction.h
parentf2af104d3cc61c9e98b384cab459fcdf9e718ed1 (diff)
downloadchromium_src-dcfd29f49e33a782aebe4194af30d707c61c6264.zip
chromium_src-dcfd29f49e33a782aebe4194af30d707c61c6264.tar.gz
chromium_src-dcfd29f49e33a782aebe4194af30d707c61c6264.tar.bz2
Cleanup in new ftp transaction:
- don't use C cast, which is forbidden by the C++ style guide - more intuitive error class names - more precise error class descriptions, based on the RFC 959 TEST=none http://crbug.com/4965 Review URL: http://codereview.chromium.org/164162 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp/ftp_network_transaction.h')
-rw-r--r--net/ftp/ftp_network_transaction.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/net/ftp/ftp_network_transaction.h b/net/ftp/ftp_network_transaction.h
index 3f70bed..f138f42 100644
--- a/net/ftp/ftp_network_transaction.h
+++ b/net/ftp/ftp_network_transaction.h
@@ -62,16 +62,26 @@ class FtpNetworkTransaction : public FtpTransaction {
};
enum ErrorClass {
- ERROR_CLASS_INITIATED = 1, // The requested action was initiated.
- ERROR_CLASS_OK, // The requested action successfully completed.
- ERROR_CLASS_PENDING, // The command accepted, but the
- // request on hold.
- ERROR_CLASS_ERROR_RETRY, // The command was not accepted and the
- // requested action did not take place,
- // but the error condition is temporary and the
- // action may be requested again.
- ERROR_CLASS_ERROR, // The command was not accepted and
- // the requested action did not take place.
+ // The requested action was initiated. The client should expect another
+ // reply before issuing the next command.
+ ERROR_CLASS_INITIATED,
+
+ // The requested action has been successfully completed.
+ ERROR_CLASS_OK,
+
+ // The command has been accepted, but to complete the operation, more
+ // information must be sent by the client.
+ ERROR_CLASS_INFO_NEEDED,
+
+ // The command was not accepted and the requested action did not take place.
+ // This condition is temporary, and the client is encouraged to restart the
+ // command sequence.
+ ERROR_CLASS_TRANSIENT_ERROR,
+
+ // The command was not accepted and the requested action did not take place.
+ // This condition is rather permanent, and the client is discouraged from
+ // repeating the exact request.
+ ERROR_CLASS_PERMANENT_ERROR,
};
void DoCallback(int result);
@@ -83,10 +93,9 @@ class FtpNetworkTransaction : public FtpTransaction {
int SendFtpCommand(const std::string& command, Command cmd);
- // TODO(ibrar): Use C++ static_cast.
- ErrorClass GetErrorClass(int response_code) {
- return (ErrorClass)(response_code / 100);
- }
+ // Return the error class for given response code. You should validate the
+ // code to be in range 100-599.
+ static ErrorClass GetErrorClass(int response_code);
// Runs the state transition loop.
int DoLoop(int result);