Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::internal::service::http::HttpServiceImpl Class Referencefinal

HTTP service implementation. More...

#include <HttpServiceImpl.h>

Inheritance diagram for sese::internal::service::http::HttpServiceImpl:
sese::service::http::HttpService sese::service::Service

Public Member Functions

 HttpServiceImpl (const sese::net::IPAddress::Ptr &address, SSLContextPtr ssl_context, uint32_t keepalive, std::string &serv_name, MountPointMap &mount_points, ServletMap &servlets, FilterCallback &tail_filter, FilterMap &filters, ConnectionCallback &connection_callback)
 
bool startup () override
 
bool shutdown () override
 
int getLastError () override
 
std::string getLastErrorMessage () override
 
uint32_t getKeepalive () const
 
void handleFilter (const Handleable::Ptr &conn) const
 
void handleRequest (const Handleable::Ptr &conn) const
 
- Public Member Functions inherited from sese::service::Service
 Service ()=default
 
virtual ~Service ()=default
 
ErrorCode getErrorCode ()
 

Private Member Functions

void handleAccept ()
 
void handleSSLAccept ()
 

Static Private Member Functions

static int alpnCallback (SSL *ssl, const uint8_t **out, uint8_t *out_length, const uint8_t *in, uint32_t in_length, void *data)
 

Private Attributes

asio::io_context io_context
 
std::optional< asio::ssl::context > ssl_context
 
asio::ip::tcp::acceptor acceptor
 
asio::error_code error
 
std::set< HttpConnection::Ptrconnections
 
std::set< HttpConnectionEx::Ptrconnections2
 

Static Private Attributes

static constexpr unsigned char ALPN_PROTOS [] = "\x2h2\x8http/1.1"
 

Friends

struct HttpConnection
 
struct HttpConnectionEx
 

Additional Inherited Members

- Public Types inherited from sese::service::http::HttpService
using Ptr = std::shared_ptr<HttpService>
 
using SSLContextPtr = std::unique_ptr<security::SSLContext>
 
using FilterCallback = std::function<bool(net::http::Request &, net::http::Response &)>
 
using ConnectionCallback = std::function<bool(net::IPAddress::Ptr &)>
 
using FilterMap = std::unordered_map<std::string, FilterCallback>
 
using MountPointMap = std::unordered_map<std::string, std::string>
 
using ServletMap = std::unordered_map<std::string, net::http::Servlet>
 
- Public Types inherited from sese::service::Service
using Ptr = std::unique_ptr<Service>
 
- Static Public Member Functions inherited from sese::service::http::HttpService
static HttpService::Ptr create (const net::IPAddress::Ptr &address, SSLContextPtr ssl_context, uint32_t keepalive, std::string &serv_name, MountPointMap &mount_points, ServletMap &servlets, FilterCallback &tail_filter, FilterMap &filters, ConnectionCallback &connection_callback)
 
- Protected Member Functions inherited from sese::service::http::HttpService
 HttpService (net::IPAddress::Ptr address, SSLContextPtr ssl_context, uint32_t keepalive, std::string &serv_name, MountPointMap &mount_points, ServletMap &servlets, FilterCallback &tail_filter, FilterMap &filters, ConnectionCallback &connection_callback)
 
- Protected Attributes inherited from sese::service::http::HttpService
net::IPAddress::Ptr address
 
SSLContextPtr ssl_context
 
Thread::Ptr thread
 
uint32_t keepalive = 30
 
std::string & serv_name
 
MountPointMapmount_points
 
ServletMapservlets
 
FilterCallbacktail_filter
 
FilterMapfilters
 
ConnectionCallbackconnection_callback
 

Detailed Description

HTTP service implementation.

Constructor & Destructor Documentation

◆ HttpServiceImpl()

sese::internal::service::http::HttpServiceImpl::HttpServiceImpl ( const sese::net::IPAddress::Ptr & address,
SSLContextPtr ssl_context,
uint32_t keepalive,
std::string & serv_name,
MountPointMap & mount_points,
ServletMap & servlets,
FilterCallback & tail_filter,
FilterMap & filters,
ConnectionCallback & connection_callback )

Member Function Documentation

◆ alpnCallback()

int sese::internal::service::http::HttpServiceImpl::alpnCallback ( SSL * ssl,
const uint8_t ** out,
uint8_t * out_length,
const uint8_t * in,
uint32_t in_length,
void * data )
staticprivate

References in().

◆ getKeepalive()

uint32_t sese::internal::service::http::HttpServiceImpl::getKeepalive ( ) const
inline

◆ getLastError()

int sese::internal::service::http::HttpServiceImpl::getLastError ( )
overridevirtual

◆ getLastErrorMessage()

std::string sese::internal::service::http::HttpServiceImpl::getLastErrorMessage ( )
overridevirtual

◆ handleAccept()

void sese::internal::service::http::HttpServiceImpl::handleAccept ( )
private

References e.

◆ handleFilter()

void sese::internal::service::http::HttpServiceImpl::handleFilter ( const Handleable::Ptr & conn) const

◆ handleRequest()

◆ handleSSLAccept()

void sese::internal::service::http::HttpServiceImpl::handleSSLAccept ( )
private

References e.

◆ shutdown()

bool sese::internal::service::http::HttpServiceImpl::shutdown ( )
overridevirtual

Implements sese::service::Service.

References sese::sleep().

◆ startup()

bool sese::internal::service::http::HttpServiceImpl::startup ( )
overridevirtual

Friends And Related Symbol Documentation

◆ HttpConnection

friend struct HttpConnection
friend

◆ HttpConnectionEx

friend struct HttpConnectionEx
friend

Member Data Documentation

◆ acceptor

asio::ip::tcp::acceptor sese::internal::service::http::HttpServiceImpl::acceptor
private

◆ ALPN_PROTOS

unsigned char sese::internal::service::http::HttpServiceImpl::ALPN_PROTOS[] = "\x2h2\x8http/1.1"
staticconstexprprivate

◆ connections

std::set<HttpConnection::Ptr> sese::internal::service::http::HttpServiceImpl::connections
private

◆ connections2

std::set<HttpConnectionEx::Ptr> sese::internal::service::http::HttpServiceImpl::connections2
private

◆ error

asio::error_code sese::internal::service::http::HttpServiceImpl::error
private

◆ io_context

asio::io_context sese::internal::service::http::HttpServiceImpl::io_context
private

◆ ssl_context

std::optional<asio::ssl::context> sese::internal::service::http::HttpServiceImpl::ssl_context
private

The documentation for this class was generated from the following files: