31 lines
627 B
C++
31 lines
627 B
C++
#pragma once
|
|
|
|
#include <openssl/bio.h>
|
|
#include <openssl/err.h>
|
|
#include <openssl/ssl.h>
|
|
|
|
#include "socket/iocp.h"
|
|
#include "utils/thread_pool.h"
|
|
|
|
namespace Network {
|
|
|
|
enum class SessionType { LISTEN, CONNECT };
|
|
|
|
class Session {
|
|
public:
|
|
Session(gsl::not_null<Network::IOCP*> iocp, utils::ThreadPool* tp,
|
|
SessionType type, SessionProtocol proto, Network::Address addr);
|
|
~Session();
|
|
|
|
private:
|
|
gsl::not_null<Network::IOCP*> iocp_;
|
|
utils::ThreadPool* tp_ = nullptr;
|
|
|
|
SessionProtocol proto_;
|
|
Network::Socket* sock_ = nullptr;
|
|
|
|
SSL_CTX* ssl_ctx_ = nullptr;
|
|
SSL* ssl_ = nullptr;
|
|
};
|
|
} // namespace Network
|