22#include "data/LedgerCacheInterface.hpp" 
   24#include "util/log/Logger.hpp" 
   25#include "web/AdminVerificationStrategy.hpp" 
   26#include "web/SubscriptionContextInterface.hpp" 
   27#include "web/dosguard/DOSGuardInterface.hpp" 
   28#include "web/ng/Connection.hpp" 
   29#include "web/ng/Request.hpp" 
   30#include "web/ng/Response.hpp" 
   32#include <boost/asio/spawn.hpp> 
   33#include <boost/beast/http/status.hpp> 
   34#include <boost/json/array.hpp> 
   35#include <boost/json/parse.hpp> 
   49    std::reference_wrapper<web::dosguard::DOSGuardInterface> dosguard_;
 
   65    std::expected<void, web::ng::Response>
 
 
   74    std::reference_wrapper<web::dosguard::DOSGuardInterface> dosguard_;
 
   91    operator()(std::string 
const& oldIp, std::string 
const& newIp);
 
 
   98    std::reference_wrapper<web::dosguard::DOSGuardInterface> dosguard_;
 
 
  121    std::shared_ptr<web::AdminVerificationStrategy> adminVerifier_;
 
  129    MetricsHandler(std::shared_ptr<web::AdminVerificationStrategy> adminVerifier);
 
  143        boost::asio::yield_context
 
 
  163        boost::asio::yield_context
 
 
  171    std::reference_wrapper<data::LedgerCacheInterface const> cache_;
 
  194        boost::asio::yield_context
 
 
  203template <
typename RpcHandlerType>
 
  206    std::shared_ptr<web::AdminVerificationStrategy> adminVerifier_;
 
  207    std::reference_wrapper<RpcHandlerType> rpcHandler_;
 
  216    RequestHandler(std::shared_ptr<web::AdminVerificationStrategy> adminVerifier, RpcHandlerType& rpcHandler)
 
  217        : adminVerifier_(std::move(adminVerifier)), rpcHandler_(rpcHandler)
 
 
  235        boost::asio::yield_context yield
 
  238        LOG(webServerLog_.info()) << connectionMetadata.
tag()
 
  239                                  << 
"Received request from ip = " << connectionMetadata.
ip()
 
  240                                  << 
" - posting to WorkQueue";
 
  242        connectionMetadata.
setIsAdmin([
this, &request, &connectionMetadata]() {
 
  243            return adminVerifier_->isAdmin(request.
httpHeaders(), connectionMetadata.
ip());
 
  247            return rpcHandler_(request, connectionMetadata, std::move(subscriptionContext), yield);
 
  248        } 
catch (std::exception 
const&) {
 
  250                boost::beast::http::status::internal_server_error,
 
 
 
web::ng::Response operator()(web::ng::Request const &request, web::ng::ConnectionMetadata &, web::SubscriptionContextPtr, boost::asio::yield_context)
The call of the function object.
Definition WebHandlers.cpp:118
CacheStateHandler(data::LedgerCacheInterface const &cache)
Construct a new CacheStateHandler object.
Definition WebHandlers.hpp:179
DisconnectHook(web::dosguard::DOSGuardInterface &dosguard)
Construct a new DisconnectHook object.
Definition WebHandlers.cpp:69
void operator()(web::ng::Connection const &connection)
The call of the function object.
Definition WebHandlers.cpp:74
A function object that handles the health check endpoint.
Definition WebHandlers.hpp:150
web::ng::Response operator()(web::ng::Request const &request, web::ng::ConnectionMetadata &, web::SubscriptionContextPtr, boost::asio::yield_context)
The call of the function object.
Definition WebHandlers.cpp:105
IpChangeHook(web::dosguard::DOSGuardInterface &dosguard)
Construct a new IpChangeHook object.
Definition WebHandlers.cpp:58
void operator()(std::string const &oldIp, std::string const &newIp)
The call of the function object.
Definition WebHandlers.cpp:63
MetricsHandler(std::shared_ptr< web::AdminVerificationStrategy > adminVerifier)
Construct a new MetricsHandler object.
Definition WebHandlers.cpp:79
web::ng::Response operator()(web::ng::Request const &request, web::ng::ConnectionMetadata &connectionMetadata, web::SubscriptionContextPtr, boost::asio::yield_context)
The call of the function object.
Definition WebHandlers.cpp:85
OnConnectCheck(web::dosguard::DOSGuardInterface &dosguard)
Construct a new OnConnectCheck object.
Definition WebHandlers.cpp:41
std::expected< void, web::ng::Response > operator()(web::ng::Connection const &connection)
Check if the connection is allowed to proceed.
Definition WebHandlers.cpp:46
RequestHandler(std::shared_ptr< web::AdminVerificationStrategy > adminVerifier, RpcHandlerType &rpcHandler)
Construct a new RequestHandler object.
Definition WebHandlers.hpp:216
web::ng::Response operator()(web::ng::Request const &request, web::ng::ConnectionMetadata &connectionMetadata, web::SubscriptionContextPtr subscriptionContext, boost::asio::yield_context yield)
The call of the function object.
Definition WebHandlers.hpp:231
Cache for an entire ledger.
Definition LedgerCacheInterface.hpp:38
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:95
BaseTagDecorator const & tag() const
Getter for tag decorator.
Definition Taggable.hpp:280
The interface of a denial of service guard.
Definition DOSGuardInterface.hpp:46
A class representing a connection to a client.
Definition Connection.hpp:112
Represents an HTTP or WebSocket request.
Definition Request.hpp:37
HttpHeaders const & httpHeaders() const
Get the headers of the request.
Definition Request.cpp:110
Represents an HTTP or Websocket response.
Definition Response.hpp:40
boost::json::object makeError(RippledError err, std::optional< std::string_view > customError, std::optional< std::string_view > customMessage)
Generate JSON from a rpc::RippledError.
Definition Errors.cpp:157
std::shared_ptr< SubscriptionContextInterface > SubscriptionContextPtr
An alias for shared pointer to a SubscriptionContextInterface.
Definition SubscriptionContextInterface.hpp:83