net.sf.hermesftp.cmd.impl
Class FtpCmdEprt

java.lang.Object
  extended by net.sf.hermesftp.cmd.AbstractFtpCmd
      extended by net.sf.hermesftp.cmd.AbstractFtpCmdPort
          extended by net.sf.hermesftp.cmd.impl.FtpCmdEprt
All Implemented Interfaces:
java.lang.Cloneable, FtpCmd, FtpConstants

public class FtpCmdEprt
extends AbstractFtpCmdPort

The EPRT Command (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. The following are sample EPRT commands:

       EPRT |1|132.235.1.2|6275|
      
       EPRT |2|1080::8:800:200C:417A|5282|
 

The first command specifies that the server should use IPv4 to open a data connection to the host "132.235.1.2" on TCP port 6275. The second command specifies that the server should use the IPv6 network protocol and the network address "1080::8:800:200C:417A" to open a TCP data connection on port 5282.

Upon receipt of a valid EPRT command, the server MUST return a code of 200 (Command OK). The standard negative error code 500 and 501 [PR85] are sufficient to handle most errors (e.g., syntax errors) involving the EPRT command. However, an additional error code is needed. The response code 522 indicates that the server does not support the requested network protocol. The interpretation of this new error code is:

       5yz Negative Completion
       x2z Connections
       xy2 Extended Port Failure - unknown network protocol
 

The text portion of the response MUST indicate which network protocols the server does support. If the network protocol is unsupported, the format of the response string MUST be:

       <text stating that the network protocol is unsupported> \
       (prot1,prot2,...,protn)
 

Both the numeric code specified above and the protocol information between the characters '(' and ')' are intended for the software automata receiving the response; the textual message between the numeric code and the '(' is intended for the human user and can be any arbitrary text, but MUST NOT include the characters '(' and ')'. In the above case, the text SHOULD indicate that the network protocol in the EPRT command is not supported by the server. The list of protocols inside the parenthesis MUST be a comma separated list of address family numbers. Two example response strings follow: Network protocol not supported, use (1) Network protocol not supported, use (1,2)

[Excerpt from RFC-2428, Allman]

Author:
Lars Behnke

Field Summary
 
Fields inherited from interface net.sf.hermesftp.common.FtpConstants
ATTR_CLIENT_NAME, ATTR_DATA_PROT, ATTR_FILE_OFFSET, ATTR_FORCE_UTF8, ATTR_GROUP_DATA, ATTR_LOGIN_TIME, ATTR_RENAME_FILE, ATTR_RESTART_MARKERS, ATTR_SSL, ATTR_USER_DATA, BYTE_LENGTH, BYTE_MASK, DEFAULT_BEAN_RES, DEFAULT_KEYSTORE, DEFAULT_KEYSTORE_PASS, DT_ASCII, DT_BINARY, DT_EBCDIC, HERMES_HOME, MILLI, MODE_BLOCK, MODE_COMPRESS, MODE_STREAM, MODE_ZIP, MSG_GOODBYE, MSG150, MSG200, MSG200_NOTED, MSG200_PBSZ, MSG200_SIZE, MSG200_TYPE, MSG202, MSG211_FEAT_ENTRY, MSG211_FEAT_FOOTER, MSG211_FEAT_HEADER, MSG211_STAT, MSG213_SIZE, MSG213_TIME, MSG214, MSG220, MSG220_WEL, MSG226, MSG227, MSG229, MSG230, MSG234, MSG250, MSG257, MSG331, MSG350, MSG350_REST, MSG421, MSG425, MSG426, MSG431, MSG450, MSG451, MSG500, MSG500_CMD, MSG501, MSG501_PATH, MSG501_SIZE, MSG503, MSG503_USR, MSG504, MSG522, MSG530, MSG530_AUTH, MSG534, MSG536, MSG550, MSG550_COMM, MSG550_EXISTS, MSG550_MSG, MSG550_NOTEMPTY, MSG550_PERM, MSG553, OPT_ALLOWED_PASSIVE_PORTS, OPT_BUFFER_SIZE, OPT_CHARSET_ASCII, OPT_CHARSET_EBCDIC, OPT_EMULATE_UNIX, OPT_FTP_PORT, OPT_IPV4_BLACK_LIST, OPT_IPV6_BLACK_LIST, OPT_MAX_CONNECTIONS, OPT_MAX_DOWNLOAD_RATE, OPT_MAX_IDLE_SECONDS, OPT_MAX_UPLOAD_RATE, OPT_MSG_GOODBYE, OPT_MSG_WELCOME, OPT_REMOTE_DIR, OPT_SSL_ALLOW_EXPLICIT, OPT_SSL_ALLOW_IMPLICIT, OPT_SSL_CIPHER_SUITES, OPT_SSL_FORCE, OPT_SSL_KEYSTORE_FILE, OPT_SSL_KEYSTORE_PASS, OPT_SSL_PORT_IMPLICIT, PRIV_NONE, PRIV_READ, PRIV_READ_WRITE, PRIV_WRITE, PWD, SEPARATOR, SERVER_STATUS_HALTED, SERVER_STATUS_INIT, SERVER_STATUS_READY, SERVER_STATUS_UNDEF, SPACE, STAT_BYTES_DOWNLOADED, STAT_BYTES_UPLOADED, STAT_DOWNLOAD_RATE, STAT_FILES_DOWNLOADED, STAT_FILES_UPLOADED, STAT_UPLOAD_RATE, STRUCT_FILE, STRUCT_RECORD, TYPE_NAMES, WILDCARD
 
Constructor Summary
FtpCmdEprt()
           
 
Method Summary
protected  java.lang.String doReadIPAddr(java.lang.String args)
          Reads the IPv4 or IPv6 compliant address from the passed arguments.
protected  int doReadPort(java.lang.String args)
          Reads port from passed arguments.
protected  int doReadProtocolIdx(java.lang.String args)
          Reads the protocol index (1=IPv4, 2=IPv6) from the passed arguments.
 java.lang.String getHelp()
          Returns a short help text for the command.
 
Methods inherited from class net.sf.hermesftp.cmd.AbstractFtpCmdPort
execute, isAuthenticationRequired, setupDataChannel
 
Methods inherited from class net.sf.hermesftp.cmd.AbstractFtpCmd
getAbsPath, getAndResetFileOffset, getArguments, getCtx, getPathArg, getPermission, getToken, handleAsyncCmd, isResponded, msg, msg, msg, msgOut, msgOut, msgOut, out, setArguments, setCtx, setToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FtpCmdEprt

public FtpCmdEprt()
Method Detail

getHelp

public java.lang.String getHelp()
Returns a short help text for the command.

Returns:
The help text.

doReadIPAddr

protected java.lang.String doReadIPAddr(java.lang.String args)
Reads the IPv4 or IPv6 compliant address from the passed arguments.

Specified by:
doReadIPAddr in class AbstractFtpCmdPort
Parameters:
args - The arguments.
Returns:
The IP address.

doReadPort

protected int doReadPort(java.lang.String args)
Reads port from passed arguments.

Specified by:
doReadPort in class AbstractFtpCmdPort
Parameters:
args - The arguments.
Returns:
The port.

doReadProtocolIdx

protected int doReadProtocolIdx(java.lang.String args)
Reads the protocol index (1=IPv4, 2=IPv6) from the passed arguments.

Specified by:
doReadProtocolIdx in class AbstractFtpCmdPort
Parameters:
args - The arguments.
Returns:
The protocol index.


Copyright © 2005-2007 Lars Behnke. All Rights Reserved.