#include <FTP_Request.h>


Public Member Functions | |
| Request () | |
| virtual | ~Request () |
| void | reset () |
| resets the request object | |
| Request & | operator() (const ACE_CString &cmd) |
| void | command (const ACE_CString &cmd) |
| sets the current command | |
| const ACE_CString & | command () const |
| returns the current command | |
| Request & | operator<< (const ACE_CString &arg) |
| const ACE_CString & | arguments () const |
| returns the arguments string | |
| void | arguments (ACE_Array< ACE_CString > &args) const |
| retrieves the arguments | |
| void | write (std::ostream &str) const |
| Writes the FTP request to the given stream. | |
| bool | read (std::istream &str) |
Static Public Attributes | |
| static const ACE_CString | FTP_USER = "USER" |
| static const ACE_CString | FTP_PASS = "PASS" |
| static const ACE_CString | FTP_QUIT = "QUIT" |
| static const ACE_CString | FTP_TYPE = "TYPE" |
| static const ACE_CString | FTP_SYST = "SYST" |
| static const ACE_CString | FTP_PWD = "PWD" |
| static const ACE_CString | FTP_CWD = "CWD" |
| static const ACE_CString | FTP_CDUP = "CDUP" |
| static const ACE_CString | FTP_RNFR = "RNFR" |
| static const ACE_CString | FTP_RNTO = "RNTO" |
| static const ACE_CString | FTP_DELE = "DELE" |
| static const ACE_CString | FTP_MKD = "MKD" |
| static const ACE_CString | FTP_RMD = "RMD" |
| static const ACE_CString | FTP_RETR = "RETR" |
| static const ACE_CString | FTP_STOR = "STOR" |
| static const ACE_CString | FTP_LIST = "LIST" |
| static const ACE_CString | FTP_NLST = "NLST" |
| static const ACE_CString | FTP_ABOR = "ABOR" |
| static const ACE_CString | FTP_EPRT = "EPRT" |
| static const ACE_CString | FTP_PORT = "PORT" |
| static const ACE_CString | FTP_EPSV = "EPSV" |
| static const ACE_CString | FTP_PASV = "PASV" |
| static const ACE_CString | FTP_STAT = "STAT" |
Private Types | |
| enum | Limits { MAX_CMD_LENGTH = 4, MAX_ARG_LENGTH = 4096 } |
Private Attributes | |
| ACE_CString | command_ |
| ACE_CString | args_ |
Static Private Attributes | |
| static const int | eof_ = std::char_traits<char>::eof () |
Definition at line 23 of file FTP_Request.h.
enum ACE::FTP::Request::Limits [private] |
Definition at line 88 of file FTP_Request.h.
:
static const int eof_;
| ACE::FTP::Request::Request | ( | ) |
| ACE::FTP::Request::~Request | ( | ) | [virtual] |
| const ACE_CString & ACE::FTP::Request::arguments | ( | ) | const [inline] |
| void ACE::FTP::Request::arguments | ( | ACE_Array< ACE_CString > & | args | ) | const |
retrieves the arguments
Definition at line 57 of file FTP_Request.cpp.
{
ACE::IOS::CString_IStream sis (this->args_);
int ch = sis.get ();
while (ch != eof_)
{
// skip whitespace
while (ACE_OS::ace_isspace (ch)) ch = sis.get ();
if (ch != eof_)
{
// get arg
ACE_Array<ACE_CString>::size_type n =
args.size ();
args.size (n + 1);
ACE_CString& arg = args[n];
while (ch != eof_ && !ACE_OS::ace_isspace (ch))
{
arg += ch;
ch = sis.get ();
}
}
}
}
| const ACE_CString & ACE::FTP::Request::command | ( | ) | const [inline] |
returns the current command
Definition at line 34 of file FTP_Request.inl.
{
return this->command_;
}
| void ACE::FTP::Request::command | ( | const ACE_CString & | cmd | ) | [inline] |
| Request & ACE::FTP::Request::operator() | ( | const ACE_CString & | cmd | ) | [inline] |
resets the request object and sets new command
Definition at line 20 of file FTP_Request.inl.
| Request & ACE::FTP::Request::operator<< | ( | const ACE_CString & | arg | ) | [inline] |
| bool ACE::FTP::Request::read | ( | std::istream & | str | ) |
Reads the FTP request from the given stream.
Definition at line 96 of file FTP_Request.cpp.
{
ACE_CString cmd (4, '\0');
ACE_CString args (128, '\0');
int ch = str.peek ();
if (ch == eof_)
{
str.get (); // skip to eof
return false;
}
// skip whitespace
while (ACE_OS::ace_isspace (str.peek ()))
{
str.get ();
}
// get method
ch = str.get ();
while (!ACE_OS::ace_isspace (ch) && ch != eof_ && cmd.length () < MAX_CMD_LENGTH)
{
cmd += ch;
ch = str.get ();
}
if (!ACE_OS::ace_isspace (ch))
return false; // invalid FTP command string
if (ch != '\r' && ch != '\n')
{
// skip whitespace
while (ACE_OS::ace_isspace (str.peek ()))
{
str.get ();
}
// get arguments
ch = str.get ();
while (ch != eof_ && ch != '\r' && ch != '\n' && args.length () < MAX_ARG_LENGTH)
{
args += ch;
ch = str.get ();
}
if (ch != eof_ && ch != '\r' && ch != '\n')
{
return false; // args too long
}
}
if (ch == '\r')
{
str.get ();
}
this->command (cmd);
this->args_ = args;
return true;
}
| void ACE::FTP::Request::reset | ( | void | ) | [inline] |
| void ACE::FTP::Request::write | ( | std::ostream & | str | ) | const |
Writes the FTP request to the given stream.
Definition at line 82 of file FTP_Request.cpp.
ACE_CString ACE::FTP::Request::args_ [private] |
Definition at line 95 of file FTP_Request.h.
ACE_CString ACE::FTP::Request::command_ [private] |
Definition at line 94 of file FTP_Request.h.
const int ACE::FTP::Request::eof_ = std::char_traits<char>::eof () [static, private] |
Definition at line 86 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_ABOR = "ABOR" [static] |
Definition at line 78 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_CDUP = "CDUP" [static] |
Definition at line 68 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_CWD = "CWD" [static] |
Definition at line 67 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_DELE = "DELE" [static] |
Definition at line 71 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_EPRT = "EPRT" [static] |
Definition at line 79 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_EPSV = "EPSV" [static] |
Definition at line 81 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_LIST = "LIST" [static] |
Definition at line 76 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_MKD = "MKD" [static] |
Definition at line 72 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_NLST = "NLST" [static] |
Definition at line 77 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_PASS = "PASS" [static] |
Definition at line 62 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_PASV = "PASV" [static] |
Definition at line 82 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_PORT = "PORT" [static] |
Definition at line 80 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_PWD = "PWD" [static] |
Definition at line 66 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_QUIT = "QUIT" [static] |
Definition at line 63 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_RETR = "RETR" [static] |
Definition at line 74 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_RMD = "RMD" [static] |
Definition at line 73 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_RNFR = "RNFR" [static] |
Definition at line 69 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_RNTO = "RNTO" [static] |
Definition at line 70 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_STAT = "STAT" [static] |
Definition at line 83 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_STOR = "STOR" [static] |
Definition at line 75 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_SYST = "SYST" [static] |
Definition at line 65 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_TYPE = "TYPE" [static] |
Definition at line 64 of file FTP_Request.h.
const ACE_CString ACE::FTP::Request::FTP_USER = "USER" [static] |
Definition at line 61 of file FTP_Request.h.
1.7.0