Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

ACE::FTP::Response Class Reference

#include <FTP_Response.h>

Inheritance diagram for ACE::FTP::Response:
Inheritance graph
[legend]
Collaboration diagram for ACE::FTP::Response:
Collaboration graph
[legend]

List of all members.

Public Types

enum  StatusType {
  NOSTATE = -1, NORESPONSE = 0, PRELIM_OK = 1, COMPLETED_OK = 2,
  INTERMEDIATE_OK = 3, TRANSIENT_FAIL = 4, PERMANENT_FAIL = 5
}
 

response types

More...
enum  StatusSubtype {
  NOSUBTYPE = -1, SYNTAX = 0, INFORMATION = 1, CONNECTION = 2,
  AUTHENTICATION = 3, NONE = 4, FILESYSTEM = 5
}
 

response subtypes

More...

Public Member Functions

 Response ()
virtual ~Response ()
void reset ()
 resets the FTP response
Responseoperator() (int status)
int status () const
 returns the current response status
void status (int status)
 sets the current response status
const ACE_Array< ACE_CString > & response () const
 retrieves the current response line(s)
Responseoperator<< (const ACE_CString &line)
 adds a response line
void write (std::ostream &str) const
 Writes the FTP response to the given stream.
bool read (std::istream &str)
StatusType status_type () const
 returns the current response type
bool is_preliminary_ok () const
 returns true if the current response type is PRELIM_OK
bool is_completed_ok () const
 returns true if the current response type is COMPLETED_OK
bool is_intermediate_ok () const
 returns true if the current response type is INTERMEDIATE_OK
bool is_transient_fail () const
 returns true if the current response type is TRANSIENT_FAIL
bool is_permanent_fail () const
 returns true if the current response type is PERMANENT_FAIL
StatusSubtype status_sub_type () const
 returns the current response sub type

Static Public Member Functions

static StatusType status_type (int status)

Private Member Functions

int read_line (std::istream &is, std::ostream &os)

Private Attributes

int status_
ACE_Array< ACE_CStringresponse_

Static Private Attributes

static const int eof_ = std::char_traits<char>::eof ()

Detailed Description

Definition at line 33 of file FTP_Response.h.


Member Enumeration Documentation

response subtypes

Enumerator:
NOSUBTYPE 
SYNTAX 
INFORMATION 
CONNECTION 
AUTHENTICATION 
NONE 
FILESYSTEM 

Definition at line 80 of file FTP_Response.h.

              {
                NOSUBTYPE = -1,
                SYNTAX = 0,
                INFORMATION = 1,
                CONNECTION = 2,
                AUTHENTICATION = 3,
                NONE = 4,
                FILESYSTEM = 5
              };

response types

Enumerator:
NOSTATE 
NORESPONSE 
PRELIM_OK 
COMPLETED_OK 
INTERMEDIATE_OK 
TRANSIENT_FAIL 
PERMANENT_FAIL 

Definition at line 68 of file FTP_Response.h.


Constructor & Destructor Documentation

ACE::FTP::Response::Response (  ) 

Reimplemented from ACE::INet::Response.

Definition at line 25 of file FTP_Response.cpp.

ACE::FTP::Response::~Response (  )  [virtual]

Reimplemented from ACE::INet::Response.

Definition at line 30 of file FTP_Response.cpp.

      {
      }


Member Function Documentation

bool ACE::FTP::Response::is_completed_ok (  )  const [inline]

returns true if the current response type is COMPLETED_OK

Definition at line 93 of file FTP_Response.inl.

      {
        return this->status_type () == COMPLETED_OK;
      }

bool ACE::FTP::Response::is_intermediate_ok (  )  const [inline]

returns true if the current response type is INTERMEDIATE_OK

Definition at line 99 of file FTP_Response.inl.

      {
        return this->status_type () == INTERMEDIATE_OK;
      }

bool ACE::FTP::Response::is_permanent_fail (  )  const [inline]

returns true if the current response type is PERMANENT_FAIL

Definition at line 111 of file FTP_Response.inl.

      {
        return this->status_type () == PERMANENT_FAIL;
      }

bool ACE::FTP::Response::is_preliminary_ok (  )  const [inline]

returns true if the current response type is PRELIM_OK

Definition at line 87 of file FTP_Response.inl.

      {
        return this->status_type () == PRELIM_OK;
      }

bool ACE::FTP::Response::is_transient_fail (  )  const [inline]

returns true if the current response type is TRANSIENT_FAIL

Definition at line 105 of file FTP_Response.inl.

      {
        return this->status_type () == TRANSIENT_FAIL;
      }

Response & ACE::FTP::Response::operator() ( int  status  )  [inline]

resets the FTP response and sets the response status

Definition at line 32 of file FTP_Response.inl.

      {
        this->reset ();
        this->status (status);
        return *this;
      }

Response & ACE::FTP::Response::operator<< ( const ACE_CString line  )  [inline]

adds a response line

Definition at line 46 of file FTP_Response.inl.

      {
        ACE_Array<ACE_CString>::size_type n =
            this->response_.size ();
        this->response_.size (n+1);
        this->response_[n] = line;
        return *this;
      }

bool ACE::FTP::Response::read ( std::istream &  str  ) 

Reads the FTP response from the given stream.

int ACE::FTP::Response::read_line ( std::istream &  is,
std::ostream &  os 
) [inline, private]

Definition at line 117 of file FTP_Response.inl.

      {
        int ch;
        for (ch = is.get ();
             ch != eof_ && ch != '\r' && ch != '\n';
             ch = is.get ())
          {
            os.put (ch);
          }
        return ch;
      }

void ACE::FTP::Response::reset ( void   )  [inline]

resets the FTP response

Definition at line 13 of file FTP_Response.inl.

      {
        this->status_ = NORESPONSE;
        this->response_.size (0);
      }

const ACE_Array< ACE_CString > & ACE::FTP::Response::response (  )  const [inline]

retrieves the current response line(s)

Definition at line 40 of file FTP_Response.inl.

      {
        return this->response_;
      }

void ACE::FTP::Response::status ( int  status  )  [inline]

sets the current response status

Definition at line 20 of file FTP_Response.inl.

      {
        this->status_ = status;
      }

int ACE::FTP::Response::status ( void   )  const [inline]

returns the current response status

Definition at line 26 of file FTP_Response.inl.

      {
        return this->status_;
      }

Response::StatusSubtype ACE::FTP::Response::status_sub_type (  )  const [inline]

returns the current response sub type

Definition at line 74 of file FTP_Response.inl.

      {
        StatusType st = this->status_type ();
        if (st != NOSTATE && st != NORESPONSE)
          {
            int sst = (this->status_ - (st * 100)) / 10;
            if (sst >= SYNTAX && sst <= FILESYSTEM)
              return static_cast<StatusSubtype> (sst);
          }
        return NOSUBTYPE;
      }

Response::StatusType ACE::FTP::Response::status_type ( int  status  )  [inline, static]

Definition at line 56 of file FTP_Response.inl.

      {
        if (status == NORESPONSE)
          return NORESPONSE;
        int st = status / 100;
        if (st >= PRELIM_OK && st <= PERMANENT_FAIL)
          return static_cast<StatusType> (st);
        else
          return NOSTATE;
      }

Response::StatusType ACE::FTP::Response::status_type (  )  const [inline]

returns the current response type

Definition at line 68 of file FTP_Response.inl.

      {
        return status_type (this->status_);
      }

void ACE::FTP::Response::write ( std::ostream &  str  )  const

Writes the FTP response to the given stream.


Member Data Documentation

const int ACE::FTP::Response::eof_ = std::char_traits<char>::eof () [static, private]

Definition at line 115 of file FTP_Response.h.

Definition at line 120 of file FTP_Response.h.

Definition at line 119 of file FTP_Response.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines