Use a variable on the stack to not have a temporary in the call
[ACE_TAO.git] / ACE / protocols / ace / INet / FTP_Session.h
blob8a218490fde69d897996a0a0abb42d4e636fd0ba
1 /**
2 * @file FTP_Session.h
4 * @author Martin Corino <mcorino@remedy.nl>
5 */
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
24 namespace ACE
26 namespace FTP
28 /**
29 * @class ACE_FTP_Session
31 * @brief Encapsulates FTP session.
34 template <ACE_SYNCH_DECL>
35 class Session_T
37 public:
38 typedef ACE::IOS::StreamHandler<ACE_SOCK_STREAM, ACE_SYNCH_USE> connection_type;
40 enum
42 FTP_PORT = 21
45 Session_T ();
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 ();
75 void close ();
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;
87 private:
88 enum
90 DEFAULT_TIMEOUT = 30, // sec
92 INTERRUPT = 244 // Telnet IP signal
95 ACE_CString host_;
96 u_short port_;
98 typedef ACE::IOS::Sock_IOStreamBase<ACE_SYNCH_USE> sock_stream_type;
100 bool reactive_;
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
106 bool new_connect_;
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 */