Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
web::Detector< PlainSessionType, SslSessionType, HandlerType > Class Template Reference

The Detector class to detect if the connection is a ssl or not. More...

#include <Server.hpp>

Inheritance diagram for web::Detector< PlainSessionType, SslSessionType, HandlerType >:
Collaboration diagram for web::Detector< PlainSessionType, SslSessionType, HandlerType >:

Public Member Functions

 Detector (tcp::socket &&socket, std::optional< std::reference_wrapper< boost::asio::ssl::context > > ctx, std::reference_wrapper< util::TagDecoratorFactory const > tagFactory, std::reference_wrapper< dosguard::DOSGuardInterface > dosGuard, std::shared_ptr< HandlerType > handler, std::shared_ptr< AdminVerificationStrategy > adminVerification, std::uint32_t maxWsSendingQueueSize)
 Create a new detector.
 
void fail (boost::system::error_code ec, char const *message)
 A helper function that is called when any error ocurs.
 
void run ()
 Initiate the detection.
 
void onDetect (boost::beast::error_code ec, bool result)
 Handles detection result.
 

Detailed Description

template<template< typename > class PlainSessionType, template< typename > class SslSessionType, SomeServerHandler HandlerType>
class web::Detector< PlainSessionType, SslSessionType, HandlerType >

The Detector class to detect if the connection is a ssl or not.

If it is an SSL connection, the Detector will pass the ownership of the socket to SslSessionType, otherwise to PlainSessionType.

Template Parameters
PlainSessionTypeThe plain session type
SslSessionTypeThe SSL session type
HandlerTypeThe executor to handle the requests

Constructor & Destructor Documentation

◆ Detector()

template<template< typename > class PlainSessionType, template< typename > class SslSessionType, SomeServerHandler HandlerType>
web::Detector< PlainSessionType, SslSessionType, HandlerType >::Detector ( tcp::socket && socket,
std::optional< std::reference_wrapper< boost::asio::ssl::context > > ctx,
std::reference_wrapper< util::TagDecoratorFactory const > tagFactory,
std::reference_wrapper< dosguard::DOSGuardInterface > dosGuard,
std::shared_ptr< HandlerType > handler,
std::shared_ptr< AdminVerificationStrategy > adminVerification,
std::uint32_t maxWsSendingQueueSize )
inline

Create a new detector.

Parameters
socketThe socket. Ownership is transferred
ctxThe SSL context if any
tagFactoryA factory that is used to generate tags to track requests and sessions
dosGuardThe denial of service guard to use
handlerThe server handler to use
adminVerificationThe admin verification strategy to use
maxWsSendingQueueSizeThe maximum size of the sending queue for websocket

Member Function Documentation

◆ fail()

template<template< typename > class PlainSessionType, template< typename > class SslSessionType, SomeServerHandler HandlerType>
void web::Detector< PlainSessionType, SslSessionType, HandlerType >::fail ( boost::system::error_code ec,
char const * message )
inline

A helper function that is called when any error ocurs.

Parameters
ecThe error code
messageThe message to include in the log

◆ onDetect()

template<template< typename > class PlainSessionType, template< typename > class SslSessionType, SomeServerHandler HandlerType>
void web::Detector< PlainSessionType, SslSessionType, HandlerType >::onDetect ( boost::beast::error_code ec,
bool result )
inline

Handles detection result.

Parameters
ecThe error code
resulttrue if SSL is detected; false otherwise

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