2 * @file HTTPS_Session.h
4 * @author Martin Corino <mcorino@remedy.nl>
7 #ifndef ACE_HTTPS_SESSION_H
8 #define ACE_HTTPS_SESSION_H
10 #include /**/ "ace/pre.h"
12 #include "ace/SSL/SSL_SOCK_Connector.h"
13 #include "ace/INet/HTTP_SessionBase.h"
14 #include "ace/INet/StreamHandler.h"
15 #include "ace/INet/SSLSock_IOStream.h"
16 #include "ace/INet/HTTPS_Context.h"
18 // we need OpenSSL > v0.9.8e to get support for SSL_set_SSL_CTX
19 #define OPENSSL_VERSION_098E 0x0090805fL
20 #if OPENSSL_VERSION_NUMBER > OPENSSL_VERSION_098E
21 # define SSL_HAS_SSL_set_SSL_CTX 1
23 # define SSL_HAS_SSL_set_SSL_CTX 0
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
33 * @class ACE_HTTPS_Session
35 * @brief Encapsulates HTTPS session.
38 template <ACE_SYNCH_DECL
>
39 class Session_T
: public ACE::HTTP::SessionBase
42 typedef ACE::IOS::StreamHandler
<ACE_SSL_SOCK_Stream
, ACE_SYNCH_USE
> connection_type
;
44 Session_T (bool keep_alive
= true
45 #if defined (SSL_HAS_SSL_set_SSL_CTX) && (SSL_HAS_SSL_set_SSL_CTX == 1)
50 Session_T (const ACE_Time_Value
& timeout
,
51 bool keep_alive
= true,
52 const ACE_Time_Value
* alive_timeout
= 0
53 #if defined (SSL_HAS_SSL_set_SSL_CTX) && (SSL_HAS_SSL_set_SSL_CTX == 1)
58 virtual ~Session_T ();
60 virtual bool is_connected () const;
62 bool attach_connection (connection_type
* connection
);
65 void close_connection ();
67 virtual bool connect_i (const ACE_Synch_Options
& sync_opt
);
69 virtual void close_i ();
71 virtual std::iostream
& sock_stream ();
74 typedef ACE::IOS::SSLSock_IOStreamBase
<ACE_SYNCH_USE
> sock_stream_type
;
76 connection_type
* connection_
;
77 sock_stream_type
* sock_stream_
;
78 #if defined (SSL_HAS_SSL_set_SSL_CTX) && (SSL_HAS_SSL_set_SSL_CTX == 1)
83 typedef Session_T
<ACE_NULL_SYNCH
> Session
;
87 ACE_END_VERSIONED_NAMESPACE_DECL
89 #include "ace/INet/HTTPS_Session.cpp"
91 #include /**/ "ace/post.h"
92 #endif /* ACE_HTTPS_SESSION_H */