#ifndef __TLSSession_h__
#define __TLSSession_h__

#include "includes"
#include "TCPSession.h"
#include "TLSServer.h"
#include <openssl/ssl.h>

namespace core {
   
   class TLSServer;
   
   ///
   /// TLSSession
   ///
   /// Provides a network TLS socket.
   ///
   /// For accessing TLS network functions use this object. The connection oriented nature of TLS
   /// provides a single client persistent connection with data error correction and a durable 
   /// synchronous data connection. 
   ///
   
   class TLSSession : public TCPSession {

    public:
      
      TLSSession(EPoll &ePoll, TCPServer &server);
      ~TLSSession();
      
      ///
      /// The output method is called by a socket session (Session) and
      /// will output the detail information for the client socket. When extending 
      /// TLSSocket or Session you can override the method to add attributes 
      /// to the list. 
      ///
      
      virtual void output(std::stringstream &out);
      virtual void protocol(coreutils::ZString &data) override;
      
    protected:
      void receiveData(coreutils::ZString &buffer) override;
      void onRegister();
      void onRegistered();
      
    private:
      bool initialized = false;
      SSL *ssl;
      
   };
   
}

#endif
