goldengate.ftp.core.command
Enum FtpCommandCode

java.lang.Object
  extended by java.lang.Enum<FtpCommandCode>
      extended by goldengate.ftp.core.command.FtpCommandCode
All Implemented Interfaces:
Serializable, Comparable<FtpCommandCode>

public enum FtpCommandCode
extends Enum<FtpCommandCode>

This class must reassemble all the commands that could be implemented. The comment says the object of the command and the kind of returned codes that could follow this command.

Command structure:
Main class
Previous Valid Command (null means all are valid)
Next Valid Commands (none means all are valid)

Author:
Frederic Bregier

Enum Constant Summary
ABOR
          This command tells the server to abort the previous FTP service command and any associated transfer of data.
ACCT
          The argument field is a Telnet string identifying the user's account.
ALLO
          This command may be required by some servers to reserve sufficient storage to accommodate the new file to be transferred.
APPE
          This command causes the server-DTP to accept the data transferred via the data connection and to store the data in a file at the server site.
CDUP
          This command is a special case of CWD, and is included to simplify the implementation of programs for transferring directory trees between operating systems having different syntaxes for naming the parent directory.
Connection
          Command to simulate the beginning of a connection in order to force the authentication step.
CWD
          This command allows the user to work with a different directory or dataset for file storage or retrieval without altering his login or accounting information.
DELE
          This command causes the file specified in the pathname to be deleted at the server site.
EPRT
          The EPRT command allows for the specification of an extended address for the data connection.
EPSV
          The EPSV command requests that a server listen on a data port and wait for a connection.
FEAT
          The FEAT command consists solely of the word "FEAT".
HELP
          This command shall cause the server to send helpful information regarding its implementation status over the control connection to the user.
IncorrectSequence
          Bad sequence of commands
Always return 503
INTERNALSHUTDOWN
          Shutdown command (internal password protected command).
LIMITBANDWIDTH
          Change the Limit of the global bandwidth.
LIST
          This command causes a list to be sent from the server to the passive DTP.
MDTM
          The FTP command, MODIFICATION TIME (MDTM), can be used to determine when a file in the server NVFS was last modified.
MKD
          This command causes the directory specified in the pathname to be created as a directory (if the pathname is absolute) or as a subdirectory of the current working directory (if the pathname is relative).
MLSD
          The MLSD command is intended to standardize the file and directory information returned by the server-FTP process.
MLST
          The MLST command is intended to standardize the file and directory information returned by the server-FTP process.
MODE
          The argument is a single Telnet character code specifying the data transfer modes described in the Section on Transmission Modes.
NLST
          This command causes a directory listing to be sent from server to user site.
NOOP
          This command does not affect any parameters or previously entered commands.
OPTS
          The OPTS (options) command allows a user-PI to specify the desired behavior of a server-FTP process when another FTP command (the target command) is later issued.
PASS
          The argument field is a Telnet string specifying the user's password.
PASV
          This command requests the server-DTP to "listen" on a data port (which is not its default data port) and to wait for a connection rather than initiate one upon receipt of a transfer command.
PORT
          The argument is a HOST-PORT specification for the data port to be used in data connection.
PWD
          This command causes the name of the current working directory to be returned in the reply.
QUIT
          This command terminates a USER and if file transfer is not in progress, the server closes the control connection.
REIN
          This command terminates a USER, flushing all I/O and account information, except to allow any transfer in progress to be completed.
REST
          The argument field represents the server marker at which file transfer is to be restarted.
RETR
          This command causes the server-DTP to transfer a copy of the file, specified in the pathname, to the server- or user-DTP at the other end of the data connection.
RMD
          This command causes the directory specified in the pathname to be removed as a directory (if the pathname is absolute) or as a subdirectory of the current working directory (if the pathname is relative).
RNFR
          This command specifies the old pathname of the file which is to be renamed.
RNTO
          This command specifies the new pathname of the file specified in the immediately preceding "rename from" RNFR command.
SITE
          This command is used by the server to provide services specific to his system that are essential to file transfer but not sufficiently universal to be included as commands in the protocol.
SIZE
          The FTP command, SIZE OF FILE (SIZE), is used to obtain the transfer size of a file from the server-FTP process.
SMNT
          This command allows the user to mount a different file system data structure without altering his login or accounting information.
STAT
          This command shall cause a status response to be sent over the control connection in the form of a reply.
STOR
          This command causes the server-DTP to accept the data transferred via the data connection and to store the data as a file at the server site.
STOU
          This command behaves like STOR except that the resultant file is to be created in the current directory under a name unique to that directory.
STRU
          The argument is a single Telnet character code specifying file structure described in the Section on Data Representation and Storage.
SYST
          This command is used to find out the type of operating system at the server.
TYPE
          The argument specifies the representation type as described in the Section on Data Representation and Storage.
Unimplemented
          Unimplemented command
Always return 502
Unknown
          Unknown Command from control network
Always return 500
USER
          The argument field is a Telnet string identifying the user.
XCRC
          Compute CRC on pathname given as argument.
XCUP
          Change to the parent of the current working directory.
XCWD
          Change to a new working directory.
XMD5
          Compute MD5 on pathname given as argument.
XMKD
          Make a directory.
XPWD
          Print the current working directory.
XRMD
          Remove the directory.
XSHA1
          Compute SHA-1 on pathname given as argument.
 
Field Summary
 Class<? extends AbstractCommand> command
          The Class that implements this command
 Class<?>[] nextValids
          Next valids class that could follow this command (null means any)
 Class<? extends AbstractCommand> previousValid
          Previous positive class that must precede this command (null means any)
 
Method Summary
static AbstractCommand getFromLine(FtpSession session, String line)
          Get the corresponding AbstractCommand object from the line received from the client associated with the handler
static boolean isExtensionCommand(FtpCommandCode command)
          True if the command is an extension operation (XMD5, XCRC, XSHA1, ...)
static boolean isListLikeCommand(FtpCommandCode command)
          True if the command is a List like operation (LIST, NLST, MLSD, MLST, ...)
static boolean isRetrLikeCommand(FtpCommandCode command)
          True if the command is a Retrieve like operation (RETR, ...)
static boolean isSpecialCommand(FtpCommandCode command)
          True if the command is a special operation (QUIT, ABOR, NOOP, STAT, ...)
static boolean isStoreLikeCommand(FtpCommandCode command)
          True if the command is a Store like operation (APPE, STOR, STOU, ...)
static boolean isStorOrRetrLikeCommand(FtpCommandCode command)
          True if the command is a Retrieve or Store like operation
 String toString()
           
static FtpCommandCode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static FtpCommandCode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

Connection

public static final FtpCommandCode Connection
Command to simulate the beginning of a connection in order to force the authentication step.
120->220
220
421


USER

public static final FtpCommandCode USER
The argument field is a Telnet string identifying the user. The user identification is that which is required by the server for access to its file system. This command will normally be the first command transmitted by the user after the control connections are made (some servers may require this). Additional identification information in the form of a password and/or an account command may also be required by some servers. Servers may allow a new USER command to be entered at any point in order to change the access control and/or accounting information. This has the effect of flushing any user, password, and account information already supplied and beginning the login sequence again. All transfer parameters are unchanged and any file transfer in progress is completed under the old access control parameters.
230
530
500, 501, 421
331, 332


PASS

public static final FtpCommandCode PASS
The argument field is a Telnet string specifying the user's password. This command must be immediately preceded by the user name command, and, for some sites, completes the user's identification for access control. Since password information is quite sensitive, it is desirable in general to "mask" it or suppress typeout. It appears that the server has no foolproof way to achieve this. It is therefore the responsibility of the user-FTP process to hide the sensitive password information.
230
202
530
500, 501, 503, 421
332


ACCT

public static final FtpCommandCode ACCT
The argument field is a Telnet string identifying the user's account. The command is not necessarily related to the USER command, as some sites may require an account for login and others only for specific access, such as storing files. In the latter case the command may arrive at any time.

There are reply codes to differentiate these cases for the automation: when account information is required for login, the response to a successful PASSword command is reply code 332. On the other hand, if account information is NOT required for login, the reply to a successful PASSword command is 230; and if the account information is needed for a command issued later in the dialogue, the server should return a 332 or 532 reply depending on whether it stores (pending receipt of the ACCounT command) or discards the command, respectively.
230
202
530
500, 501, 503, 421


CWD

public static final FtpCommandCode CWD
This command allows the user to work with a different directory or dataset for file storage or retrieval without altering his login or accounting information. Transfer parameters are similarly unchanged. The argument is a pathname specifying a directory or other system dependent file group designator.
250
500, 501, 502, 421, 530, 550


CDUP

public static final FtpCommandCode CDUP
This command is a special case of CWD, and is included to simplify the implementation of programs for transferring directory trees between operating systems having different syntaxes for naming the parent directory. The reply codes shall be identical to the reply codes of CWD. See Appendix II for further details.
200
500, 501, 502, 421, 530, 550


SMNT

public static final FtpCommandCode SMNT
This command allows the user to mount a different file system data structure without altering his login or accounting information. Transfer parameters are similarly unchanged. The argument is a pathname specifying a directory or other system dependent file group designator.

As for now, this command will not be implemented, so returns 502.
202, 250
500, 501, 502, 421, 530, 550


REIN

public static final FtpCommandCode REIN
This command terminates a USER, flushing all I/O and account information, except to allow any transfer in progress to be completed. All parameters are reset to the default settings and the control connection is left open. This is identical to the state in which a user finds himself immediately after the control connection is opened. A USER command may be expected to follow.

As for now, this command will not be implemented, so returns 502.

Should called QUIT.
120
220
220
421
500, 502


QUIT

public static final FtpCommandCode QUIT
This command terminates a USER and if file transfer is not in progress, the server closes the control connection. If file transfer is in progress, the connection will remain open for result response and the server will then close it. If the user-process is transferring files for several USERs but does not wish to close and then reopen connections for each, then the REIN command should be used instead of QUIT.

An unexpected close on the control connection will cause the server to take the effective action of an abort (ABOR) and a logout (QUIT).
221
500


PORT

public static final FtpCommandCode PORT
The argument is a HOST-PORT specification for the data port to be used in data connection. There are defaults for both the user and server data ports, and under normal circumstances this command and its reply are not needed. If this command is used, the argument is the concatenation of a 32-bit internet host address and a 16-bit TCP port address. This address information is broken into 8-bit fields and the value of each field is transmitted as a decimal number (in character string representation). The fields are separated by commas. A port command would be:

 PORT h1,h2,h3,h4,p1,p2
 
where h1 is the high order 8 bits of the internet host address.
200
500, 501, 421, 530


PASV

public static final FtpCommandCode PASV
This command requests the server-DTP to "listen" on a data port (which is not its default data port) and to wait for a connection rather than initiate one upon receipt of a transfer command. The response to this command includes the host and port address this server is listening on.
227
500, 501, 502, 421, 530


TYPE

public static final FtpCommandCode TYPE
The argument specifies the representation type as described in the Section on Data Representation and Storage. Several types take a second parameter. The first parameter is denoted by a single Telnet character, as is the second Format parameter for ASCII and EBCDIC; the second parameter for local byte is a decimal integer to indicate Bytesize. The parameters are separated by a <SP> (Space, ASCII code 32).

The following codes are assigned for type:
 \    /
                A - ASCII |    | N - Non-print
                          |-><-| T - Telnet format effectors
                E - EBCDIC|    | C - Carriage Control (ASA)
                          /    \
                I - Image
                L <byte size> - Local byte Byte size
 
The default representation type is ASCII Non-print. If the Format parameter is changed, and later just the first argument is changed, Format then returns to the Non-print default.
200
500, 501, 504, 421, 530


STRU

public static final FtpCommandCode STRU
The argument is a single Telnet character code specifying file structure described in the Section on Data Representation and Storage.

The following codes are assigned for structure:
 F - FtpFile (no record structure)
                R - Record structure
                P - Page structure
 
The default structure is FtpFile.
200
500, 501, 504, 421, 530


MODE

public static final FtpCommandCode MODE
The argument is a single Telnet character code specifying the data transfer modes described in the Section on Transmission Modes.

The following codes are assigned for transfer modes:
 S - Stream
                B - Block
                C - Compressed
 
The default transfer mode is Stream.
200
500, 501, 504, 421, 530


RETR

public static final FtpCommandCode RETR
This command causes the server-DTP to transfer a copy of the file, specified in the pathname, to the server- or user-DTP at the other end of the data connection. The status and contents of the file at the server site shall be unaffected.
125, 150
(110)
226, 250
425, 426, 451
450, 550
500, 501, 421, 530


STOR

public static final FtpCommandCode STOR
This command causes the server-DTP to accept the data transferred via the data connection and to store the data as a file at the server site. If the file specified in the pathname exists at the server site, then its contents shall be replaced by the data being transferred. A new file is created at the server site if the file specified in the pathname does not already exist.
125, 150
(110)
226, 250
425, 426, 451, 551, 552
532, 450, 452, 553
500, 501, 421, 530


STOU

public static final FtpCommandCode STOU
This command behaves like STOR except that the resultant file is to be created in the current directory under a name unique to that directory. The 250 Transfer Started response must include the name generated.
125, 150
(110)
226, 250
425, 426, 451, 551, 552
532, 450, 452, 553
500, 501, 421, 530


APPE

public static final FtpCommandCode APPE
This command causes the server-DTP to accept the data transferred via the data connection and to store the data in a file at the server site. If the file specified in the pathname exists at the server site, then the data shall be appended to that file; otherwise the file specified in the pathname shall be created at the server site.
125, 150
(110)
226, 250
425, 426, 451, 551, 552
532, 450, 452, 553
500, 501, 421, 530


ALLO

public static final FtpCommandCode ALLO
This command may be required by some servers to reserve sufficient storage to accommodate the new file to be transferred. The argument shall be a decimal integer representing the number of bytes (using the logical byte size) of storage to be reserved for the file. For files sent with record or page structure a maximum record or page size (in logical bytes) might also be necessary; this is indicated by a decimal integer in a second argument field of the command. This second argument is optional, but when present should be separated from the first by the three Telnet characters <SP> R <SP>. This command shall be followed by a STORe or APPEnd command. The ALLO command should be treated as a NOOP (no operation) by those servers which do not require that the maximum size of the file be declared beforehand, and those servers interested in only the maximum record or page size should accept a dummy value in the first argument and ignore it.
125, 150
226, 250
425, 426, 451
450
500, 501, 502, 421, 530


REST

public static final FtpCommandCode REST
The argument field represents the server marker at which file transfer is to be restarted. This command does not cause file transfer but skips over the file to the specified data checkpoint. This command shall be immediately followed by the appropriate FTP service command which shall cause file transfer to resume.

The current implementation allows restart only on Stream since others would imply to store those informations somewhere (how?).

However, it could be changed if necessary by modifying the FtpFile restartMarker method.

This command will accept commands of transfer parameter following since some clients do this.
500, 501, 502, 421, 530
350


RNFR

public static final FtpCommandCode RNFR
This command specifies the old pathname of the file which is to be renamed. This command must be immediately followed by a "rename to" RNTO command specifying the new file pathname.
450, 550
500, 501, 502, 421, 530
350


RNTO

public static final FtpCommandCode RNTO
This command specifies the new pathname of the file specified in the immediately preceding "rename from" RNFR command. Together the two commands cause a file to be renamed.
250
532, 553
500, 501, 502, 503, 421, 530


ABOR

public static final FtpCommandCode ABOR
This command tells the server to abort the previous FTP service command and any associated transfer of data. The abort command may require "special action", as discussed in the Section on FTP Commands, to force recognition by the server. No action is to be taken if the previous command has been completed (including data transfer). The control connection is not to be closed by the server, but the data connection must be closed.

There are two cases for the server upon receipt of this command: (1) the FTP service command was already completed, or (2) the FTP service command is still in progress.

In the first case, the server closes the data connection (if it is open) and responds with a 226 reply, indicating that the abort command was successfully processed.

In the second case, the server aborts the FTP service in progress and closes the data connection, returning a 426 reply to indicate that the service request terminated abnormally. The server then sends a 226 reply, indicating that the abort command was successfully processed.
225, 226
500, 501, 502, 421


DELE

public static final FtpCommandCode DELE
This command causes the file specified in the pathname to be deleted at the server site. If an extra level of protection is desired (such as the query, "Do you really wish to delete?"), it should be provided by the user-FTP process.
250
450, 550
500, 501, 502, 421, 530


RMD

public static final FtpCommandCode RMD
This command causes the directory specified in the pathname to be removed as a directory (if the pathname is absolute) or as a subdirectory of the current working directory (if the pathname is relative).
250
500, 501, 502, 421, 530, 550


MKD

public static final FtpCommandCode MKD
This command causes the directory specified in the pathname to be created as a directory (if the pathname is absolute) or as a subdirectory of the current working directory (if the pathname is relative).
257
500, 501, 502, 421, 530, 550


PWD

public static final FtpCommandCode PWD
This command causes the name of the current working directory to be returned in the reply.
257
500, 501, 502, 421, 550


LIST

public static final FtpCommandCode LIST
This command causes a list to be sent from the server to the passive DTP. If the pathname specifies a directory or other group of files, the server should transfer a list of files in the specified directory. If the pathname specifies a file then the server should send current information on the file. A null argument implies the user's current working or default directory. The data transfer is over the data connection in type ASCII or type EBCDIC. (The user must ensure that the TYPE is appropriately ASCII or EBCDIC). Since the information on a file may vary widely from system to system, this information may be hard to use automatically in a program, but may be quite useful to a human user.

The option '-a' is accepted but ignored.
125, 150
226, 250
425, 426, 451
450
500, 501, 502, 421, 530


NLST

public static final FtpCommandCode NLST
This command causes a directory listing to be sent from server to user site. The pathname should specify a directory or other system-specific file group descriptor; a null argument implies the current directory. The server will return a stream of names of files and no other information. The data will be transferred in ASCII or EBCDIC type over the data connection as valid pathname strings separated by <CRLF> or <NL>. (Again the user must ensure that the TYPE is correct.) This command is intended to return information that can be used by a program to further process the files automatically. For example, in the implementation of a "multiple get" function.

The option '-l' is accepted and turns to LIST command.
125, 150
226, 250
425, 426, 451
450
500, 501, 502, 421, 530


SITE

public static final FtpCommandCode SITE
This command is used by the server to provide services specific to his system that are essential to file transfer but not sufficiently universal to be included as commands in the protocol. The nature of these services and the specification of their syntax can be stated in a reply to the HELP SITE command.

As for now, this command will not be implemented, so returns 502.

200
202
500, 501, 530


SYST

public static final FtpCommandCode SYST
This command is used to find out the type of operating system at the server. The reply shall have as its first word one of the system names listed in the current version of the Assigned Numbers document.

Returns "UNIX Type: L8".
215
500, 501, 502, 421


STAT

public static final FtpCommandCode STAT
This command shall cause a status response to be sent over the control connection in the form of a reply. The command may be sent during a file transfer (along with the Telnet IP and Synch signals--see the Section on FTP Commands) in which case the server will respond with the status of the operation in progress, or it may be sent between file transfers. In the latter case, the command may have an argument field. If the argument is a pathname, the command is analogous to the "list" command except that data shall be transferred over the control connection. If a partial pathname is given, the server may respond with a list of file names or attributes associated with that specification. If no argument is given, the server should return general status information about the server FTP process. This should include current values of all transfer parameters and the status of connections.
211, 212, 213
450
500, 501, 502, 421, 530


HELP

public static final FtpCommandCode HELP
This command shall cause the server to send helpful information regarding its implementation status over the control connection to the user. The command may take an argument (e.g., any command name) and return more specific information as a response. The reply is type 211 or 214. It is suggested that HELP be allowed before entering a USER command. The server may use this reply to specify site-dependent parameters, e.g., in response to HELP SITE.
211, 214
500, 501, 502, 421


NOOP

public static final FtpCommandCode NOOP
This command does not affect any parameters or previously entered commands. It specifies no action other than that the server send an OK reply.
200
500 421


XCWD

public static final FtpCommandCode XCWD
Change to a new working directory. Same as CWD
250
500, 501, 502, 421, 530, 550


XCUP

public static final FtpCommandCode XCUP
Change to the parent of the current working directory. Same as CDUP.
200
500, 501, 502, 421, 530, 550


XRMD

public static final FtpCommandCode XRMD
Remove the directory. Same as RMD.
250
500, 501, 502, 421, 530, 550


XMKD

public static final FtpCommandCode XMKD
Make a directory. Same as MKD.
257
500, 501, 502, 421, 530, 550


XPWD

public static final FtpCommandCode XPWD
Print the current working directory. Same as PWD.
257
500, 501, 502, 421, 550


MDTM

public static final FtpCommandCode MDTM
The FTP command, MODIFICATION TIME (MDTM), can be used to determine when a file in the server NVFS was last modified.

The "pathname" specifies an object in the NVFS that may be the object of a RETR command. Attempts to query the modification time of files that exist but are unable to be retrieved may generate an error- response, or can result in a positive response carrying a time-val with an unspecified value, the choice being made by the server-PI.

The server-PI will respond to the MDTM command with a 213 reply giving the last modification time of the file whose pathname was supplied, or a 550 reply if the file does not exist, the modification time is unavailable, or some other error has occurred.
213
500, 501, 550


SIZE

public static final FtpCommandCode SIZE
The FTP command, SIZE OF FILE (SIZE), is used to obtain the transfer size of a file from the server-FTP process. This is the exact number of octets (8 bit bytes) that would be transmitted over the data connection should that file be transmitted. This value will change depending on the current STRUcture, MODE, and TYPE of the data connection or of a data connection that would be created were one created now. Thus, the result of the SIZE command is dependent on the currently established STRU, MODE, and TYPE parameters.

The SIZE command returns how many octets would be transferred if the file were to be transferred using the current transfer structure, mode, and type. This command is normally used in conjunction with the RESTART (REST) command when STORing a file to a remote server in STREAM mode, to determine the restart point. The server-PI might need to read the partially transferred file, do any appropriate conversion, and count the number of octets that would be generated when sending the file in order to correctly respond to this command. Estimates of the file transfer size MUST NOT be returned; only precise information is acceptable.
213
500, 501, 550


MLSD

public static final FtpCommandCode MLSD
The MLSD command is intended to standardize the file and directory information returned by the server-FTP process. This command differs from the LIST command in that the format of the replies is strictly defined although extensible.

MLSD lists the contents of a directory if a directory is named, otherwise a 501 reply is returned. If no object is named, the current directory is assumed. That will cause MLSD to list the contents of the current directory.
125, 150
226, 250
425, 426, 451
450
500, 501, 502, 421, 530


MLST

public static final FtpCommandCode MLST
The MLST command is intended to standardize the file and directory information returned by the server-FTP process. This command differs from the LIST command in that the format of the replies is strictly defined although extensible.

MLST provides data about exactly the object named on its command line, and no others. If no object is named, the current directory is assumed. That will cause MLST to send a one-line response, describing the current directory itself.
125, 150
226, 250
425, 426, 451
450
500, 501, 502, 421, 530


FEAT

public static final FtpCommandCode FEAT
The FEAT command consists solely of the word "FEAT". It has no parameters or arguments.

Where a server-FTP process does not support the FEAT command, it will respond to the FEAT command with a 500 or 502 reply. This is simply the normal "unrecognized command" reply that any unknown command would elicit. Errors in the command syntax, such as giving parameters, will result in a 501 reply.

Server-FTP processes that recognize the FEAT command, but implement no extended features, and therefore have nothing to report, SHOULD respond with the "no-features" 211 reply. However, as this case is practically indistinguishable from a server-FTP that does not recognize the FEAT command, a 500 or 502 reply MAY also be used. The "no-features" reply MUST NOT use the multi-line response format, exactly one response line is required and permitted.

Replies to the FEAT command MUST comply with the following syntax. Text on the first line of the reply is free form, and not interpreted, and has no practical use, as this text is not expected to be revealed to end users. The syntax of other reply lines is precisely defined, and if present, MUST be exactly as specified.

 feat-response   = error-response / no-features / feature-listing
         no-features     = "211" SP *TCHAR CRLF
         feature-listing = "211-" *TCHAR CRLF
                           1*( SP feature CRLF )
                           "211 End" CRLF
         feature         = feature-label [ SP feature-parms ]
         feature-label   = 1*VCHAR
         feature-parms   = 1*TCHAR
 
Note that each feature line in the feature-listing begins with a single space. That space is not optional, nor does it indicate general white space. This space guarantees that the feature line can never be misinterpreted as the end of the feature-listing, but is required even where there is no possibility of ambiguity.

Each extension supported must be listed on a separate line to facilitate the possible inclusion of parameters supported by each extension command. The feature-label to be used in the response to the FEAT command will be specified as each new feature is added to the FTP command set. Often it will be the name of a new command added, however this is not required. In fact it is not required that a new feature actually add a new command. Any parameters included are to be specified with the definition of the command concerned. That specification shall also specify how any parameters present are to be interpreted.

The feature-label and feature-parms are nominally case sensitive, however the definitions of specific labels and parameters specify the precise interpretation, and it is to be expected that those definitions will usually specify the label and parameters in a case independent manner. Where this is done, implementations are recommended to use upper case letters when transmitting the feature response.

The FEAT command itself is not included in the list of features supported, support for the FEAT command is indicated by return of a reply other than a 500 or 502 reply.
211
500, 501, 550


OPTS

public static final FtpCommandCode OPTS
The OPTS (options) command allows a user-PI to specify the desired behavior of a server-FTP process when another FTP command (the target command) is later issued. The exact behavior, and syntax, will vary with the target command indicated, and will be specified with the definition of that command. Where no OPTS behavior is defined for a particular command there are no options available for that command.
200
451, 500, 501, 550


EPRT

public static final FtpCommandCode EPRT
The EPRT command allows for the specification of an extended address for the data connection. The extended address MUST consist of the network protocol as well as the network and transport addresses. The format of EPRT is:

 EPRT<space><d><net-prt><d><net-addr><d><tcp-port><d>
 

The EPRT command keyword MUST be followed by a single space (ASCII 32). Following the space, a delimiter character (<d>) MUST be specified. The delimiter character MUST be one of the ASCII characters in range 33-126 inclusive. The character "|" (ASCII 124) is recommended unless it coincides with a character needed to encode the network address.
The <net-prt> argument MUST be an address family number defined by IANA in the latest Assigned Numbers RFC (RFC 1700 [RP94] as of the writing of this document). This number indicates the protocol to be used (and, implicitly, the address length). This document will use two of address family numbers from [RP94] as examples, according to the following table:

 AF Number   Protocol
         ---------   --------
         1           Internet Protocol, Version 4 [Pos81a]
         2           Internet Protocol, Version 6 [DH96]
 

The <net-addr> is a protocol specific string representation of the network address. For the two address families specified above (AF Number 1 and 2), addresses MUST be in the following format:

 AF Number   Address Format      Example
         ---------   --------------      -------
         1           dotted decimal      132.235.1.2
         2           IPv6 string         1080::8:800:200C:417A
                     representations
                     defined in [HD96]
 

The <tcp-port> argument must be the string representation of the number of the TCP port on which the host is listening for the data connection.
200
500, 501, 522, 421, 530


EPSV

public static final FtpCommandCode EPSV
The EPSV command requests that a server listen on a data port and wait for a connection. The EPSV command takes an optional argument. The response to this command includes only the TCP port number of the listening connection. The format of the response, however, is similar to the argument of the EPRT command. This allows the same parsing routines to be used for both commands. In addition, the format leaves a place holder for the network protocol and/or network address, which may be needed in the EPSV response in the future. The response code for entering passive mode using an extended address MUST be 229. The interpretation of this code, according to [PR85] is:

 2yz Positive Completion
         x2z Connections
         xy9 Extended Passive Mode Entered
 

The text returned in response to the EPSV command MUST be:

 <text indicating server is entering extended passive mode> (<d><d><d><tcp-port><d>)
 

The portion of the string enclosed in parentheses MUST be the exact string needed by the EPRT command to open the data connection, as specified above.

The first two fields contained in the parenthesis MUST be blank. The third field MUST be the string representation of the TCP port number on which the server is listening for a data connection. The network protocol used by the data connection will be the same network protocol used by the control connection. In addition, the network address used to establish the data connection will be the same network address used for the control connection. An example response string follows:

 Entering Extended Passive Mode (|||6446|)
 

The standard negative error codes 500 and 501 are sufficient to handle all errors involving the EPSV command (e.g., syntax errors).

When the EPSV command is issued with no argument, the server will choose the network protocol for the data connection based on the protocol used for the control connection. However, in the case of proxy FTP, this protocol might not be appropriate for communication between the two servers. Therefore, the client needs to be able to request a specific protocol. If the server returns a protocol that is not supported by the host that will be connecting to the port, the client MUST issue an ABOR (abort) command to allow the server to close down the listening connection. The client can then send an EPSV command requesting the use of a specific network protocol, as follows:

 EPSV<space><net-prt>
 

If the requested protocol is supported by the server, it SHOULD use the protocol. If not, the server MUST return the 522 error messages as outlined in section 2.

The following part is not implemented.
Finally, the EPSV command can be used with the argument "ALL" to inform Network Address Translators that the EPRT command (as well as other data commands) will no longer be used. An example of this command follows:

 EPSV < space > ALL
 

Upon receipt of an EPSV ALL command, the server MUST reject all data connection setup commands other than EPSV (i.e., EPRT, PORT, PASV, et al.). This use of the EPSV command is further explained in section 4.
229
500, 501, 502, 522, 421, 530


XCRC

public static final FtpCommandCode XCRC
Compute CRC on pathname given as argument. Return on control network as 250 "CRC" is CRC of file "pathname"
250
500, 501, 502, 504, 421, 530


XMD5

public static final FtpCommandCode XMD5
Compute MD5 on pathname given as argument. Return on control network as 250 "MD5" is MD5 of file "pathname"
250
500, 501, 502, 504, 421, 530


XSHA1

public static final FtpCommandCode XSHA1
Compute SHA-1 on pathname given as argument. Return on control network as 250 "SHA1" is SHA-1 of file "pathname"
250
500, 501, 502, 504, 421, 530


Unknown

public static final FtpCommandCode Unknown
Unknown Command from control network
Always return 500


Unimplemented

public static final FtpCommandCode Unimplemented
Unimplemented command
Always return 502


IncorrectSequence

public static final FtpCommandCode IncorrectSequence
Bad sequence of commands
Always return 503


INTERNALSHUTDOWN

public static final FtpCommandCode INTERNALSHUTDOWN
Shutdown command (internal password protected command).
Shutdown the FTP service


LIMITBANDWIDTH

public static final FtpCommandCode LIMITBANDWIDTH
Change the Limit of the global bandwidth.
No argument reset to default, 1 argument change both write and read to same value, 2 arguments stand for write then read limit.
Limit is written in byte/s. Example: "LIMITBANDWIDTH 104857600 104857600" stands for 100MB/s limitation globaly.
-1 means no limit

Field Detail

command

public Class<? extends AbstractCommand> command
The Class that implements this command


previousValid

public Class<? extends AbstractCommand> previousValid
Previous positive class that must precede this command (null means any)


nextValids

public Class<?>[] nextValids
Next valids class that could follow this command (null means any)

Method Detail

values

public static FtpCommandCode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (FtpCommandCode c : FtpCommandCode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static FtpCommandCode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getFromLine

public static AbstractCommand getFromLine(FtpSession session,
                                          String line)
Get the corresponding AbstractCommand object from the line received from the client associated with the handler

Parameters:
session -
line -
Returns:
the AbstractCommand from the line received from the client

isStoreLikeCommand

public static boolean isStoreLikeCommand(FtpCommandCode command)
True if the command is a Store like operation (APPE, STOR, STOU, ...)

Parameters:
command -
Returns:
True if the command is a Store like operation (APPE, STOR, STOU, ...)

isRetrLikeCommand

public static boolean isRetrLikeCommand(FtpCommandCode command)
True if the command is a Retrieve like operation (RETR, ...)

Parameters:
command -
Returns:
True if the command is a Retrieve like operation (RETR, ...)

isStorOrRetrLikeCommand

public static boolean isStorOrRetrLikeCommand(FtpCommandCode command)
True if the command is a Retrieve or Store like operation

Parameters:
command -
Returns:
True if the command is a Retrieve or Store like operation

isListLikeCommand

public static boolean isListLikeCommand(FtpCommandCode command)
True if the command is a List like operation (LIST, NLST, MLSD, MLST, ...)

Parameters:
command -
Returns:
True if the command is a List like operation (LIST, NLST, MLSD, MLST, ...)

isSpecialCommand

public static boolean isSpecialCommand(FtpCommandCode command)
True if the command is a special operation (QUIT, ABOR, NOOP, STAT, ...)

Parameters:
command -
Returns:
True if the command is a special operation (QUIT, ABOR, NOOP, STAT, ...)

isExtensionCommand

public static boolean isExtensionCommand(FtpCommandCode command)
True if the command is an extension operation (XMD5, XCRC, XSHA1, ...)

Parameters:
command -
Returns:
True if the command is an extension operation (XMD5, XCRC, XSHA1, ...)

toString

public String toString()
Overrides:
toString in class Enum<FtpCommandCode>


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.