1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-10-05 19:18:01 +08:00
ULib/include/ulib/ssl/net/ssl_session.h
stefanocasazza 456a345e48 bug fixing
2015-07-22 20:10:46 +02:00

75 lines
1.7 KiB
C++

// ============================================================================
//
// = LIBRARY
// ULib - c++ library
//
// = FILENAME
// ssl_session.h - ssl session utility
//
// = AUTHOR
// Stefano Casazza
//
// ============================================================================
#ifndef ULIB_SSL_SESSION_H
#define ULIB_SSL_SESSION_H 1
#include <ulib/ssl/net/sslsocket.h>
#include <ulib/utility/data_session.h>
/**
* SSL Session Information
*
* This class contains data about an SSL session
*/
class UHTTP;
class UHttpPlugIn;
class U_EXPORT USSLSession : public UDataStorage {
public:
// COSTRUTTORE
USSLSession()
{
U_TRACE_REGISTER_OBJECT(0, USSLSession, "", 0)
}
virtual ~USSLSession() U_DECL_FINAL
{
U_TRACE_UNREGISTER_OBJECT(0, USSLSession)
}
// define method VIRTUAL of class UDataStorage
virtual char* toBuffer() U_DECL_FINAL;
virtual void fromData(const char* ptr, uint32_t len) U_DECL_FINAL;
// SERVICES
#if defined(DEBUG) && defined(U_STDCPP_ENABLE)
const char* dump(bool reset) const { return UDataStorage::dump(reset); }
#endif
private:
static SSL_SESSION* sess;
static int newSession(SSL* ssl, SSL_SESSION* sess);
static void removeSession(SSL_CTX* ctx, SSL_SESSION* sess);
static SSL_SESSION* getSession(SSL* ssl, unsigned char* id, int len, int* copy);
#ifdef U_COMPILER_DELETE_MEMBERS
USSLSession(const USSLSession&) = delete;
USSLSession& operator=(const USSLSession&) = delete;
#else
USSLSession(const USSLSession&) : UDataStorage() {}
USSLSession& operator=(const USSLSession&) { return *this; }
#endif
friend class UHTTP;
friend class UHttpPlugIn;
};
#endif