4 * @author Martin Corino <mcorino@remedy.nl>
7 #ifndef ACE_FTP_SESSION_H
8 #define ACE_FTP_SESSION_H
10 #include /**/ "ace/pre.h"
12 #include "ace/SString.h"
13 #include "ace/Countdown_Time.h"
14 #include "ace/SOCK_Connector.h"
15 #include "ace/INET_Addr.h"
16 #include "ace/INet/INet_Export.h"
17 #include "ace/INet/FTP_Request.h"
18 #include "ace/INet/FTP_Response.h"
19 #include "ace/INet/StreamHandler.h"
20 #include "ace/INet/Sock_IOStream.h"
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 * @class ACE_FTP_Session
31 * @brief Encapsulates FTP session.
34 template <ACE_SYNCH_DECL
>
38 typedef ACE::IOS::StreamHandler
<ACE_SOCK_STREAM
, ACE_SYNCH_USE
> connection_type
;
47 Session_T (const ACE_Time_Value
& timeout
);
49 virtual ~Session_T ();
51 bool is_connected () const;
53 bool is_new_connection () const;
55 void set_host (const ACE_CString
& host
, u_short port
);
57 void set_host (const ACE_CString
& host
);
59 void set_port (u_short port
);
61 const ACE_CString
& get_host () const;
63 u_short
get_port () const;
65 bool connect (bool use_reactor
= false);
67 bool connect (connection_type
* connection
);
69 bool send_request (Request
& request
);
71 bool receive_response (Response
& response
);
73 bool send_interrupt ();
77 bool supports_ftp_extensions () const;
79 void set_ftp_extension_support (bool f
);
81 bool is_reactive () const;
83 const ACE_Time_Value
& timeout () const;
85 void get_local_addr (ACE_INET_Addr
& loc_addr
) const;
90 DEFAULT_TIMEOUT
= 30, // sec
92 INTERRUPT
= 244 // Telnet IP signal
98 typedef ACE::IOS::Sock_IOStreamBase
<ACE_SYNCH_USE
> sock_stream_type
;
101 connection_type
* connection_
;
102 sock_stream_type
* sock_stream_
;
103 ACE_Time_Value ftp_timeout_
;
104 bool cannot_reconnect_
;
105 bool has_ftp_ext_
; // RFC 2428 - IPv6 and NAT
109 typedef Session_T
<ACE_NULL_SYNCH
> Session
;
113 ACE_END_VERSIONED_NAMESPACE_DECL
115 #include "ace/INet/FTP_Session.cpp"
117 #include /**/ "ace/post.h"
118 #endif /* ACE_FTP_SESSION_H */