17db0aea6SShuo Chen#pragma once 27db0aea6SShuo Chen#include "Common.h" 37db0aea6SShuo Chen#include "Socket.h" 47db0aea6SShuo Chen 57db0aea6SShuo Chen#include "TlsContext.h" 67db0aea6SShuo Chen 77db0aea6SShuo Chen#include <memory> 87db0aea6SShuo Chen 97db0aea6SShuo Chenclass InetAddress; 107db0aea6SShuo Chen 117db0aea6SShuo Chenclass TlsStream; 127db0aea6SShuo Chentypedef std::unique_ptr<TlsStream> TlsStreamPtr; 137db0aea6SShuo Chen 147db0aea6SShuo Chenclass TlsAcceptor : noncopyable 157db0aea6SShuo Chen{ 167db0aea6SShuo Chen public: 177db0aea6SShuo Chen TlsAcceptor(TlsConfig* config, const InetAddress& listenAddr); 187db0aea6SShuo Chen 197db0aea6SShuo Chen ~TlsAcceptor() = default; 207db0aea6SShuo Chen TlsAcceptor(TlsAcceptor&&) = default; 217db0aea6SShuo Chen TlsAcceptor& operator=(TlsAcceptor&&) = default; 227db0aea6SShuo Chen 237db0aea6SShuo Chen // thread safe 247db0aea6SShuo Chen TlsStreamPtr accept(); 257db0aea6SShuo Chen 267db0aea6SShuo Chen private: 277db0aea6SShuo Chen TlsContext context_; 287db0aea6SShuo Chen Socket listenSock_; 297db0aea6SShuo Chen}; 307db0aea6SShuo Chen 317db0aea6SShuo Chen 32