#ifndef __TLSSession_h__
#define __TLSSession_h__

#include "includes"
#include "Session.h"
#include "TLSServerSocket.h"
#include <openssl/ssl.h>

namespace core {
   
   class TLSServerSocket;
   
   ///
   /// 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 Session {

    public:
      
      TLSSession(EPoll &ePoll, Service &service);
      ~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(std::string data) override;
      
    protected:
      void init() override;
      void receiveData(char *buffer, int bufferLength) override;
      
    private:
      bool initialized = false;
//      TLSServerSocket &server;
      SSL *ssl;
      
   };
   
}

#endif
