41 #ifndef _networkftpcommand_cpp
42 #define _networkftpcommand_cpp
44 #include "Network/ftpcommand.h"
46 #include "stringtool.h"
77 CommandStream <<
"\r\n";
78 return CommandStream.str();
84 return this->
Decompose(CurrIt,Message.end());
92 if( CurrIt != EndIt ) {
94 while( CurrIt != EndIt && !this->
IsEndOfLine(CurrIt) )
96 if( (*CurrIt) ==
' ' ) {
100 Component.push_back( *CurrIt );
107 while( CurrIt != EndIt )
113 Component.push_back( *CurrIt );
204 Whole ComSize = Command.size();
205 if( ComSize == 3 || ComSize == 4 ) {
206 String UpperCommand = Command;
208 switch( UpperCommand[0] )
212 switch( UpperCommand[1] )
224 switch( UpperCommand[1] )
235 switch( UpperCommand[1] )
240 switch( UpperCommand[2] )
251 switch( UpperCommand[1] )
259 switch( UpperCommand[1] )
265 switch( UpperCommand[2] )
275 switch( UpperCommand[1] )
282 if( UpperCommand.size() > 3 ) {
283 switch( UpperCommand[3] )
295 switch( UpperCommand[1] )
304 switch( UpperCommand[1] )
308 if( UpperCommand.size() > 3 ) {
309 switch( UpperCommand[3] )
325 switch( UpperCommand[1] )
329 switch( UpperCommand[2] )
339 switch( UpperCommand[2] )
349 switch( UpperCommand[1] )
353 switch( UpperCommand[2] )
362 switch( UpperCommand[2] )
367 if( UpperCommand.size() > 3 ) {
368 switch( UpperCommand[3] )
385 switch( UpperCommand[1] )
389 switch( UpperCommand[2] )
399 switch( UpperCommand[2] )
408 if( UpperCommand.size() > 3 ) {
409 switch( UpperCommand[3] )
Transfer Mode. Sets how the data will be transferred from the source to destination. See FTPTransferMode enum.
Status. Requests the current status of the FTP server or the current executing FTP operation on the s...
FTPCommandList CommandType
The command being issued.
User Name. The user name to be used for authentication to the FTP server. In most cases the user name...
Passive. Requests the server go into passive mode for the connection. Going into passive mode tells t...
Data Type. Sets the type of data requested the file be in for downloads or the type of data that the ...
Logout. Logs out of the FTP server and closes all connections. Pending transfers are allowed to finis...
bool Boole
Generally acts a single bit, true or false.
Data Port. Specifies the IP/Port on which to establish the data connection. Expressed in 6 comma sepa...
Rename To. The new pathname of the file being renamed. This command must be preceded by a RNFR comman...
Print Working Directory. Requests the pathname of the current directory for FTP operations.
static String ConvertCommand(const Network::FTPCommandList Command)
Converts a FTPCommandList enum value to it's text representation.
Make Directory. Creates a new directory on the server with the name provided in the argument...
Abort. Aborts the currently active file transfer.
No Operation. This command does nothing and asks the server to do nothing but send a basic response...
Reinitialize. Sets the connection back to a starting state. User is logged out but the command connec...
const String & GetArguments() const
Gets the arguments for the command to be issued.
Confidentiality Protected Command. Generic command for allowing the configuration of confidentiality ...
Rename From. The pathname of the file to be renamed. This simple selects the file the operation is to...
Host. Similar to HTTP Host header, allows an FTP client to provide an FTP URI Authority to specify a ...
Delete. Deletes the file specified in the argument.
Integrity Protected Command. Generic command for allowing the configuration of integrity settings on ...
Remove Directory. Deletes the directory (and all files under it) specified in the argument from the s...
Print Working Directory. Obsolete command, but can be used an an alias for PWD to provide backwards c...
Store Unique. This is the same as STOR (Store), but forces the name of the file at the destination to...
Structure Mount. Allows the user to mount a file system data structure without requiring the connecti...
std::stringstream StringStream
A Datatype used for streaming operations with strings.
File Structure. Specifies the structure being transferred. Will almost never need to be used as the d...
Change Working Directory. Obsolete command, but can be used an an alias for CWD to provide backwards ...
Long Passive. Obsolete command. Similar to the PASV command, but permits larger addresses. Format is identical to the LPRT command.
FTPCommand()
Invalid constructor.
Data Channel Protection Level. Sets the security to be used on the data channel. See FTPSecurityLevel...
List. Gets information on the current directory. Either files or directories other than the current o...
File Size. Gets the size of a specified file. Argument is a file and the response will contain the si...
Not an actual command. Used for error conditions.
Name List. Same as the LIST command, but only specifying names so as to make it easier to parse for m...
Extended Passive. This is similar to LPSV, but with friendlier syntax. The format is identical to the...
Options. Enables command specific options for the next command issued. Argument must be the command n...
Clear Command Channel. Clears the command stream of protected status, reverting to plain-text transmi...
Site. Executes a command that is not in the standard specific to the connected server. The argument is the command to be executed.
Change to Parent Directory. Changes the directory for file/folder operations to the parent of the cur...
void SetArguments(const String &Args)
Sets the arguments for the command to be issued.
FTPCommandList
This enum is a listing of the commands that can be issued to an FTP server.
Protection BufferSize. Sets the maximum size (in bytes, max of 32-bit UInt) of the encoded blocks to ...
Remove Directory. Obsolete command, but can be used an an alias for RMD to provide backwards compatib...
Restart. The point where the file transfer is to begin. For files, the argument should an integer rep...
Unknown Meaning. Obsolete command, do not use. Listed here for error detection server side...
Retrieve. Downloads a file from the server, expecting a filename at the source as the argument...
Change to Parent Directory. Obsolete command, but can be used an an alias for CDUP to provide backwar...
System. Requests an identifier for the type of system the server is operating on as well as the defau...
Change Working Directory. Changes the current directory for file/folder operations.
Boole Decompose(const String &Message)
Populates the members of this class with data from a text FTP message.
Features. Requests a listing of the available features/extensions on the server. No argument needed...
Network::FTPCommandList GetCommand() const
Gets the comment to be sent.
Authentication/Security Data. A String of Base64 encoded data necessary to complete the authenticatio...
String::const_iterator StringIterator
Convenience typedef for String iterators.
String Compose() const
Creates a completed message that can be sent across an FTP connection.
Account. Identifies the users account. While similar sounding to the USER command, some servers differentiate the two when determining access.
Send to Terminal. Obsolete command, do not use. Listed here for error detection server side...
String CommandArgs
The arguments of the command. Not all commands require this.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Allocate. Requests the server allocate space for a file in advance. Many servers don't require this...
Append. Appends the contents of the transfer to an existing file at the destination. If the file does not exist it will be created.
~FTPCommand()
Class destructor.
Password. The users password for authentication.
Machine List Directory. Gets a machine friendly listing of all the files in the specified directory...
Authentication/Security Mechanism. Declares the desired means of protection on the FTP connection(s)...
Modification Time. Gets the time a file was last modified. Argument should be a file name...
Long Port. Obsolete command. Similar to the PORT command, but permits larger addresses. The format is comma separated bytes. Starts with an address family, then address size followed by address bytes, then port size followed by port bytes.
Make Directory. Obsolete command, but can be used an an alias for MKD to provide backwards compatibil...
Help. Another command may be specified as an argument to get details on it's implementation status on...
Boole IsEndOfLine(const StringIterator CurrIt) const
Checks to see if a parsing iterator is at a Telnet End-Of-Line.
Store. Uploads a file to the server, expecting a filename to be given to the file at the destination ...
Privacy Protected Command. Generic command for allowing the configuration of privacy settings on the ...
Language. Requests the server change it's response message language to a different language...
Unknown Meaning. Obsolete command, do not use. Listed here for error detection server side...
std::string String
A datatype used to a series of characters.
Send to Mail. Obsolete command, do not use. Listed here for error detection server side...
void SetCommand(const Network::FTPCommandList Command)
Sets the command to be sent.
Machine List. Gets a machine friendly listing of information on the specified file. The format is defined in RFC 3659, section 7.2.
Extended Port. This is similar to LPRT, but with friendlier syntax. Takes a "|" delimited String star...