xrpld
Loading...
Searching...
No Matches
xrpl::ServerHandler Class Reference

#include <ServerHandler.h>

Collaboration diagram for xrpl::ServerHandler:

Classes

struct  Setup
struct  ServerHandlerCreator

Public Types

using Output = json::Output

Public Member Functions

 ServerHandler (ServerHandlerCreator const &, Application &app, boost::asio::io_context &ioContext, JobQueue &jobQueue, NetworkOPs &networkOPs, Resource::Manager &resourceManager, CollectorManager &cm)
 ~ServerHandler ()
void setup (Setup const &setup, beast::Journal journal)
Setup const & setup () const
Endpoints const & endpoints () const
void stop ()
bool onAccept (Session &session, boost::asio::ip::tcp::endpoint endpoint)
Handoff onHandoff (Session &session, std::unique_ptr< stream_type > &&bundle, http_request_type &&request, boost::asio::ip::tcp::endpoint const &remoteAddress)
Handoff onHandoff (Session &session, http_request_type &&request, boost::asio::ip::tcp::endpoint const &remoteAddress)
void onRequest (Session &session)
void onWSMessage (std::shared_ptr< WSSession > session, std::vector< boost::asio::const_buffer > const &buffers)
void onClose (Session &session, boost::system::error_code const &)
void onStopped (Server &)

Private Types

using socket_type = boost::beast::tcp_stream
using stream_type = boost::beast::ssl_stream<socket_type>

Private Member Functions

json::Value processSession (std::shared_ptr< WSSession > const &session, std::shared_ptr< JobQueue::Coro > const &coro, json::Value const &jv)
void processSession (std::shared_ptr< Session > const &, std::shared_ptr< JobQueue::Coro > coro)
void processRequest (Port const &port, std::string const &request, beast::IP::Endpoint const &remoteIPAddress, Output const &, std::shared_ptr< JobQueue::Coro > coro, std::string_view forwardedFor, std::string_view user)
Handoff statusResponse (http_request_type const &request) const

Private Attributes

Applicationapp_
Resource::ManagerresourceManager_
beast::Journal journal_
NetworkOPsnetworkOPs_
std::unique_ptr< Serverserver_
Setup setup_
Endpoints endpoints_
JobQueuejobQueue_
beast::insight::Counter rpcRequests_
beast::insight::Event rpcSize_
beast::insight::Event rpcTime_
std::mutex mutex_
std::condition_variable condition_
bool stopped_ {false}
std::map< std::reference_wrapper< Port const >, int > count_

Friends

std::unique_ptr< ServerHandlermakeServerHandler (Application &app, boost::asio::io_context &ioContext, JobQueue &jobQueue, NetworkOPs &networkOPs, Resource::Manager &resourceManager, CollectorManager &cm)

Detailed Description

Definition at line 30 of file ServerHandler.h.

Member Typedef Documentation

◆ socket_type

using xrpl::ServerHandler::socket_type = boost::beast::tcp_stream
private

Definition at line 64 of file ServerHandler.h.

◆ stream_type

using xrpl::ServerHandler::stream_type = boost::beast::ssl_stream<socket_type>
private

Definition at line 65 of file ServerHandler.h.

◆ Output

Definition at line 113 of file ServerHandler.h.

Constructor & Destructor Documentation

◆ ServerHandler()

xrpl::ServerHandler::ServerHandler ( ServerHandlerCreator const & ,
Application & app,
boost::asio::io_context & ioContext,
JobQueue & jobQueue,
NetworkOPs & networkOPs,
Resource::Manager & resourceManager,
CollectorManager & cm )

Definition at line 126 of file ServerHandler.cpp.

◆ ~ServerHandler()

xrpl::ServerHandler::~ServerHandler ( )

Definition at line 147 of file ServerHandler.cpp.

Member Function Documentation

◆ setup() [1/2]

void xrpl::ServerHandler::setup ( Setup const & setup,
beast::Journal journal )

Definition at line 153 of file ServerHandler.cpp.

◆ setup() [2/2]

Setup const & xrpl::ServerHandler::setup ( ) const
nodiscard

Definition at line 119 of file ServerHandler.h.

◆ endpoints()

Endpoints const & xrpl::ServerHandler::endpoints ( ) const
nodiscard

Definition at line 125 of file ServerHandler.h.

◆ stop()

void xrpl::ServerHandler::stop ( )

Definition at line 180 of file ServerHandler.cpp.

◆ onAccept()

bool xrpl::ServerHandler::onAccept ( Session & session,
boost::asio::ip::tcp::endpoint endpoint )

Definition at line 192 of file ServerHandler.cpp.

◆ onHandoff() [1/2]

Handoff xrpl::ServerHandler::onHandoff ( Session & session,
std::unique_ptr< stream_type > && bundle,
http_request_type && request,
boost::asio::ip::tcp::endpoint const & remoteAddress )

Definition at line 211 of file ServerHandler.cpp.

◆ onHandoff() [2/2]

Handoff xrpl::ServerHandler::onHandoff ( Session & session,
http_request_type && request,
boost::asio::ip::tcp::endpoint const & remoteAddress )

Definition at line 148 of file ServerHandler.h.

◆ onRequest()

void xrpl::ServerHandler::onRequest ( Session & session)

Definition at line 301 of file ServerHandler.cpp.

◆ onWSMessage()

void xrpl::ServerHandler::onWSMessage ( std::shared_ptr< WSSession > session,
std::vector< boost::asio::const_buffer > const & buffers )

Definition at line 334 of file ServerHandler.cpp.

◆ onClose()

void xrpl::ServerHandler::onClose ( Session & session,
boost::system::error_code const &  )

Definition at line 378 of file ServerHandler.cpp.

◆ onStopped()

void xrpl::ServerHandler::onStopped ( Server & )

Definition at line 385 of file ServerHandler.cpp.

◆ processSession() [1/2]

json::Value xrpl::ServerHandler::processSession ( std::shared_ptr< WSSession > const & session,
std::shared_ptr< JobQueue::Coro > const & coro,
json::Value const & jv )
private

Definition at line 413 of file ServerHandler.cpp.

◆ processSession() [2/2]

void xrpl::ServerHandler::processSession ( std::shared_ptr< Session > const & session,
std::shared_ptr< JobQueue::Coro > coro )
private

Definition at line 556 of file ServerHandler.cpp.

◆ processRequest()

void xrpl::ServerHandler::processRequest ( Port const & port,
std::string const & request,
beast::IP::Endpoint const & remoteIPAddress,
Output const & output,
std::shared_ptr< JobQueue::Coro > coro,
std::string_view forwardedFor,
std::string_view user )
private

Clear header-assigned values if not positively identified from a secureGateway.

Definition at line 601 of file ServerHandler.cpp.

◆ statusResponse()

Handoff xrpl::ServerHandler::statusResponse ( http_request_type const & request) const
nodiscardprivate

Definition at line 1027 of file ServerHandler.cpp.

◆ makeServerHandler

std::unique_ptr< ServerHandler > makeServerHandler ( Application & app,
boost::asio::io_context & ioContext,
JobQueue & jobQueue,
NetworkOPs & networkOPs,
Resource::Manager & resourceManager,
CollectorManager & cm )
friend

Definition at line 1254 of file ServerHandler.cpp.

Member Data Documentation

◆ app_

Application& xrpl::ServerHandler::app_
private

Definition at line 67 of file ServerHandler.h.

◆ resourceManager_

Resource::Manager& xrpl::ServerHandler::resourceManager_
private

Definition at line 68 of file ServerHandler.h.

◆ journal_

beast::Journal xrpl::ServerHandler::journal_
private

Definition at line 69 of file ServerHandler.h.

◆ networkOPs_

NetworkOPs& xrpl::ServerHandler::networkOPs_
private

Definition at line 70 of file ServerHandler.h.

◆ server_

std::unique_ptr<Server> xrpl::ServerHandler::server_
private

Definition at line 71 of file ServerHandler.h.

◆ setup_

Setup xrpl::ServerHandler::setup_
private

Definition at line 72 of file ServerHandler.h.

◆ endpoints_

Endpoints xrpl::ServerHandler::endpoints_
private

Definition at line 73 of file ServerHandler.h.

◆ jobQueue_

JobQueue& xrpl::ServerHandler::jobQueue_
private

Definition at line 74 of file ServerHandler.h.

◆ rpcRequests_

beast::insight::Counter xrpl::ServerHandler::rpcRequests_
private

Definition at line 75 of file ServerHandler.h.

◆ rpcSize_

beast::insight::Event xrpl::ServerHandler::rpcSize_
private

Definition at line 76 of file ServerHandler.h.

◆ rpcTime_

beast::insight::Event xrpl::ServerHandler::rpcTime_
private

Definition at line 77 of file ServerHandler.h.

◆ mutex_

std::mutex xrpl::ServerHandler::mutex_
private

Definition at line 78 of file ServerHandler.h.

◆ condition_

std::condition_variable xrpl::ServerHandler::condition_
private

Definition at line 79 of file ServerHandler.h.

◆ stopped_

bool xrpl::ServerHandler::stopped_ {false}
private

Definition at line 80 of file ServerHandler.h.

◆ count_

std::map<std::reference_wrapper<Port const>, int> xrpl::ServerHandler::count_
private

Definition at line 81 of file ServerHandler.h.