rippled
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
ripple::ServerHandler Class Reference

#include <ServerHandler.h>

Collaboration diagram for ripple::ServerHandler:
Collaboration graph
[legend]

Classes

struct  ServerHandlerCreator
 
struct  Setup
 

Public Types

using Output = Json::Output
 

Public Member Functions

 ServerHandler (ServerHandlerCreator const &, Application &app, boost::asio::io_context &io_context, 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 &remote_address)
 
Handoff onHandoff (Session &session, http_request_type &&request, boost::asio::ip::tcp::endpoint const &remote_address)
 
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 &&, 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::Managerm_resourceManager
 
beast::Journal m_journal
 
NetworkOPsm_networkOPs
 
std::unique_ptr< Serverm_server
 
Setup setup_
 
Endpoints endpoints_
 
JobQueuem_jobQueue
 
beast::insight::Counter rpc_requests_
 
beast::insight::Event rpc_size_
 
beast::insight::Event rpc_time_
 
std::mutex mutex_
 
std::condition_variable condition_
 
bool stopped_ {false}
 
std::map< std::reference_wrapper< Port const >, int > count_
 

Friends

std::unique_ptr< ServerHandlermake_ServerHandler (Application &app, boost::asio::io_context &, JobQueue &, NetworkOPs &, Resource::Manager &, CollectorManager &cm)
 

Detailed Description

Definition at line 50 of file ServerHandler.h.

Member Typedef Documentation

◆ socket_type

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

Definition at line 84 of file ServerHandler.h.

◆ stream_type

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

Definition at line 85 of file ServerHandler.h.

◆ Output

Definition at line 133 of file ServerHandler.h.

Constructor & Destructor Documentation

◆ ServerHandler()

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

Definition at line 105 of file ServerHandler.cpp.

◆ ~ServerHandler()

ripple::ServerHandler::~ServerHandler ( )

Definition at line 126 of file ServerHandler.cpp.

Member Function Documentation

◆ setup() [1/2]

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

Definition at line 132 of file ServerHandler.cpp.

◆ setup() [2/2]

Setup const & ripple::ServerHandler::setup ( ) const

Definition at line 139 of file ServerHandler.h.

◆ endpoints()

Endpoints const & ripple::ServerHandler::endpoints ( ) const

Definition at line 145 of file ServerHandler.h.

◆ stop()

void ripple::ServerHandler::stop ( )

Definition at line 160 of file ServerHandler.cpp.

◆ onAccept()

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

Definition at line 172 of file ServerHandler.cpp.

◆ onHandoff() [1/2]

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

Definition at line 194 of file ServerHandler.cpp.

◆ onHandoff() [2/2]

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

Definition at line 168 of file ServerHandler.h.

◆ onRequest()

void ripple::ServerHandler::onRequest ( Session session)

Definition at line 297 of file ServerHandler.cpp.

◆ onWSMessage()

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

Definition at line 337 of file ServerHandler.cpp.

◆ onClose()

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

Definition at line 387 of file ServerHandler.cpp.

◆ onStopped()

void ripple::ServerHandler::onStopped ( Server )

Definition at line 394 of file ServerHandler.cpp.

◆ processSession() [1/2]

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

Definition at line 423 of file ServerHandler.cpp.

◆ processSession() [2/2]

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

Definition at line 572 of file ServerHandler.cpp.

◆ processRequest()

void ripple::ServerHandler::processRequest ( Port const &  port,
std::string const &  request,
beast::IP::Endpoint const &  remoteIPAddress,
Output &&  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 secure_gateway.

Definition at line 613 of file ServerHandler.cpp.

◆ statusResponse()

Handoff ripple::ServerHandler::statusResponse ( http_request_type const &  request) const
private

Definition at line 1051 of file ServerHandler.cpp.

Friends And Related Symbol Documentation

◆ make_ServerHandler

std::unique_ptr< ServerHandler > make_ServerHandler ( Application app,
boost::asio::io_context &  ,
JobQueue ,
NetworkOPs ,
Resource::Manager ,
CollectorManager cm 
)
friend

Definition at line 1272 of file ServerHandler.cpp.

Member Data Documentation

◆ app_

Application& ripple::ServerHandler::app_
private

Definition at line 87 of file ServerHandler.h.

◆ m_resourceManager

Resource::Manager& ripple::ServerHandler::m_resourceManager
private

Definition at line 88 of file ServerHandler.h.

◆ m_journal

beast::Journal ripple::ServerHandler::m_journal
private

Definition at line 89 of file ServerHandler.h.

◆ m_networkOPs

NetworkOPs& ripple::ServerHandler::m_networkOPs
private

Definition at line 90 of file ServerHandler.h.

◆ m_server

std::unique_ptr<Server> ripple::ServerHandler::m_server
private

Definition at line 91 of file ServerHandler.h.

◆ setup_

Setup ripple::ServerHandler::setup_
private

Definition at line 92 of file ServerHandler.h.

◆ endpoints_

Endpoints ripple::ServerHandler::endpoints_
private

Definition at line 93 of file ServerHandler.h.

◆ m_jobQueue

JobQueue& ripple::ServerHandler::m_jobQueue
private

Definition at line 94 of file ServerHandler.h.

◆ rpc_requests_

beast::insight::Counter ripple::ServerHandler::rpc_requests_
private

Definition at line 95 of file ServerHandler.h.

◆ rpc_size_

beast::insight::Event ripple::ServerHandler::rpc_size_
private

Definition at line 96 of file ServerHandler.h.

◆ rpc_time_

beast::insight::Event ripple::ServerHandler::rpc_time_
private

Definition at line 97 of file ServerHandler.h.

◆ mutex_

std::mutex ripple::ServerHandler::mutex_
private

Definition at line 98 of file ServerHandler.h.

◆ condition_

std::condition_variable ripple::ServerHandler::condition_
private

Definition at line 99 of file ServerHandler.h.

◆ stopped_

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

Definition at line 100 of file ServerHandler.h.

◆ count_

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

Definition at line 101 of file ServerHandler.h.