#include <FTP_Session.h>

Definition at line 25 of file FTP_Session.h.
| typedef ACE::IOS::StreamHandler<ACE_SOCK_STREAM, ACE_SYNCH_USE> ACE::FTP::Session_T< ACE_SYNCH_DECL >::connection_type |
Definition at line 28 of file FTP_Session.h.
typedef ACE::IOS::Sock_IOStreamBase<ACE_SYNCH_USE> ACE::FTP::Session_T< ACE_SYNCH_DECL >::sock_stream_type [private] |
Definition at line 88 of file FTP_Session.h.
| anonymous enum |
anonymous enum [private] |
| ACE::FTP::Session_T< ACE_SYNCH_DECL >::Session_T | ( | ) |
Definition at line 26 of file FTP_Session.cpp.
: port_ (FTP_PORT), reactive_ (false), connection_ (0), sock_stream_ (0), ftp_timeout_ (DEFAULT_TIMEOUT), cannot_reconnect_ (false), has_ftp_ext_ (true), new_connect_ (true) { INET_TRACE ("ACE_FTP_Session - ctor"); }
| ACE::FTP::Session_T< ACE_SYNCH_DECL >::Session_T | ( | const ACE_Time_Value & | timeout | ) |
Definition at line 40 of file FTP_Session.cpp.
: port_ (FTP_PORT), reactive_ (false), connection_ (0), sock_stream_ (0), ftp_timeout_ (timeout), cannot_reconnect_ (false), has_ftp_ext_ (true), new_connect_ (true) { INET_TRACE ("ACE_FTP_Session - ctor"); }
| ACE::FTP::Session_T< ACE_SYNCH_DECL >::~Session_T | ( | ) | [virtual] |
Definition at line 54 of file FTP_Session.cpp.
{
INET_TRACE ("ACE_FTP_Session - dtor");
this->close ();
}
| void ACE::FTP::Session_T< ACE_SYNCH_DECL >::close | ( | void | ) |
Definition at line 268 of file FTP_Session.cpp.
{
INET_TRACE ("ACE_FTP_Session::close");
if (this->connection_)
{
if (this->sock_stream_)
{
delete this->sock_stream_;
this->sock_stream_ = 0;
}
// this should be the last referece and removing it
// causes the connection to be destroyed
this->connection_->remove_reference ();
this->connection_ = 0;
}
}
| bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::connect | ( | connection_type * | connection | ) |
Definition at line 167 of file FTP_Session.cpp.
{
INET_TRACE ("ACE_FTP_Session::connect(connection)");
this->close ();
if (connection->is_connected ())
{
ACE_INET_Addr remote;
connection->peer ().get_remote_addr (remote);
this->host_ = remote.get_host_name ();
this->port_ = remote.get_port_number ();
}
else
{
typedef ACE_Connector<connection_type, ACE_SOCK_CONNECTOR> connector_type;
connector_type connector;
if (connector.connect (connection,
ACE_INET_Addr (this->host_.c_str (),
this->port_)) == -1)
{
INET_ERROR (1, (LM_ERROR, DLINFO
ACE_TEXT ("(%d) ACE_FTP_Session::connect(connection) - ")
ACE_TEXT ("failed to connect; host=%C, port=%d"),
ACE_OS::last_error (), this->host_.c_str (), this->port_));
return false;
}
}
this->connection_ = connection;
this->connection_->add_reference ();
ACE_NEW_NORETURN (this->sock_stream_,
sock_stream_type (this->connection_));
if (this->sock_stream_)
{
this->new_connect_ = true;
this->cannot_reconnect_ = true;
return true;
}
else
{
this->close ();
return false;
}
}
| bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::connect | ( | bool | use_reactor = false |
) |
Definition at line 113 of file FTP_Session.cpp.
{
INET_TRACE ("ACE_FTP_Session::connect");
typedef ACE_Connector<connection_type, ACE_SOCK_CONNECTOR> connector_type;
this->close ();
unsigned long f_reactor = use_reactor ? ACE_Synch_Options::USE_REACTOR : 0;
ACE_Synch_Options sync_opt (ACE_Synch_Options::USE_TIMEOUT | f_reactor,
this->ftp_timeout_);
connector_type connector;
connection_type* new_connection = 0;
ACE_NEW_RETURN (new_connection,
connection_type(sync_opt),
false);
if (connector.connect (new_connection,
ACE_INET_Addr (this->port_,
this->host_.c_str ()),
ACE_Synch_Options (0,this->ftp_timeout_)) == -1)
{
INET_ERROR (1, (LM_ERROR, DLINFO
ACE_TEXT ("(%d) ACE_FTP_Session::connect - ")
ACE_TEXT ("failed to connect; host=%C, port=%d"),
ACE_OS::last_error (), this->host_.c_str (), this->port_));
// as the connection was dynamically allocated
// the connector causes it to be destroyed after
// the connection failure
return false;
}
this->connection_ = new_connection;
this->connection_->reference_counting_policy ().value (
ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
ACE_NEW_NORETURN (this->sock_stream_,
sock_stream_type (this->connection_));
if (this->sock_stream_)
{
this->new_connect_ = true;
this->cannot_reconnect_ = false;
this->reactive_ = use_reactor;
return true;
}
else
{
this->close ();
return false;
}
}
| const ACE_CString & ACE::FTP::Session_T< ACE_SYNCH_DECL >::get_host | ( | ) | const |
Definition at line 101 of file FTP_Session.cpp.
{
return this->host_;
}
| void ACE::FTP::Session_T< ACE_SYNCH_DECL >::get_local_addr | ( | ACE_INET_Addr & | loc_addr | ) | const |
Definition at line 311 of file FTP_Session.cpp.
{
if (this->is_connected ())
this->connection_->peer ().get_local_addr (loc_addr);
}
| u_short ACE::FTP::Session_T< ACE_SYNCH_DECL >::get_port | ( | ) | const |
Definition at line 107 of file FTP_Session.cpp.
{
return this->port_;
}
| bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::is_connected | ( | ) | const |
Definition at line 61 of file FTP_Session.cpp.
{
return this->connection_ && this->connection_->is_connected ();
}
| bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::is_new_connection | ( | ) | const |
Definition at line 67 of file FTP_Session.cpp.
{
return this->new_connect_;
}
| bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::is_reactive | ( | ) | const |
Definition at line 299 of file FTP_Session.cpp.
{
return this->reactive_;
}
| bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::receive_response | ( | Response & | response | ) |
Definition at line 242 of file FTP_Session.cpp.
{
INET_TRACE ("ACE_FTP_Session::receive_response");
this->sock_stream_->flush ();
response.reset ();
return response.read (*this->sock_stream_);
}
| bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::send_interrupt | ( | ) |
Definition at line 253 of file FTP_Session.cpp.
{
INET_TRACE ("ACE_FTP_Session::send_interrupt");
if (this->is_connected ())
{
this->sock_stream_->put (ACE_Utils::truncate_cast<char> (int (INTERRUPT)));
this->sock_stream_->sync ();
return this->sock_stream_->good ();
}
return false;
}
| bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::send_request | ( | Request & | request | ) |
Definition at line 217 of file FTP_Session.cpp.
{
INET_TRACE ("ACE_FTP_Session::send_request");
if (!this->is_connected ())
{
if (this->cannot_reconnect_ || !this->connect(this->reactive_))
{
if (!this->cannot_reconnect_)
INET_ERROR (1, (LM_ERROR, DLINFO
ACE_TEXT ("(%d) FTP_Session::send_request - ")
ACE_TEXT ("reconnect failed\n"),
ACE_OS::last_error ()));
return ACE::IOS::Null::out_stream_;
}
}
this->new_connect_ = false;
request.write (*this->sock_stream_);
return this->is_connected () && this->sock_stream_->good ();
}
| void ACE::FTP::Session_T< ACE_SYNCH_DECL >::set_ftp_extension_support | ( | bool | f | ) |
Definition at line 293 of file FTP_Session.cpp.
{
this->has_ftp_ext_ = f;
}
| void ACE::FTP::Session_T< ACE_SYNCH_DECL >::set_host | ( | const ACE_CString & | host, | |
| u_short | port | |||
| ) |
Definition at line 73 of file FTP_Session.cpp.
{
if (!this->is_connected ())
{
this->host_ = host;
this->port_ = port;
}
}
| void ACE::FTP::Session_T< ACE_SYNCH_DECL >::set_host | ( | const ACE_CString & | host | ) |
Definition at line 83 of file FTP_Session.cpp.
{
if (!this->is_connected ())
{
this->host_ = host;
}
}
| void ACE::FTP::Session_T< ACE_SYNCH_DECL >::set_port | ( | u_short | port | ) |
Definition at line 92 of file FTP_Session.cpp.
{
if (!this->is_connected ())
{
this->port_ = port;
}
}
| bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::supports_ftp_extensions | ( | ) | const |
Definition at line 287 of file FTP_Session.cpp.
{
return this->has_ftp_ext_;
}
| const ACE_Time_Value & ACE::FTP::Session_T< ACE_SYNCH_DECL >::timeout | ( | void | ) | const |
Definition at line 305 of file FTP_Session.cpp.
{
return this->ftp_timeout_;
}
bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::cannot_reconnect_ [private] |
Definition at line 94 of file FTP_Session.h.
connection_type* ACE::FTP::Session_T< ACE_SYNCH_DECL >::connection_ [private] |
Definition at line 91 of file FTP_Session.h.
ACE_Time_Value ACE::FTP::Session_T< ACE_SYNCH_DECL >::ftp_timeout_ [private] |
Definition at line 93 of file FTP_Session.h.
bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::has_ftp_ext_ [private] |
Definition at line 95 of file FTP_Session.h.
ACE_CString ACE::FTP::Session_T< ACE_SYNCH_DECL >::host_ [private] |
Definition at line 85 of file FTP_Session.h.
bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::new_connect_ [private] |
Definition at line 96 of file FTP_Session.h.
u_short ACE::FTP::Session_T< ACE_SYNCH_DECL >::port_ [private] |
Definition at line 86 of file FTP_Session.h.
bool ACE::FTP::Session_T< ACE_SYNCH_DECL >::reactive_ [private] |
Definition at line 90 of file FTP_Session.h.
sock_stream_type* ACE::FTP::Session_T< ACE_SYNCH_DECL >::sock_stream_ [private] |
Definition at line 92 of file FTP_Session.h.
1.7.0