1#ifndef XRPL_APP_MISC_DETAIL_WORKBASE_H_INCLUDED 
    2#define XRPL_APP_MISC_DETAIL_WORKBASE_H_INCLUDED 
    4#include <xrpld/app/misc/detail/Work.h> 
    6#include <xrpl/basics/random.h> 
    7#include <xrpl/protocol/BuildInfo.h> 
    9#include <boost/asio.hpp> 
   10#include <boost/asio/strand.hpp> 
   11#include <boost/beast/core/multi_buffer.hpp> 
   12#include <boost/beast/http/empty_body.hpp> 
   13#include <boost/beast/http/read.hpp> 
   14#include <boost/beast/http/write.hpp> 
   36        boost::beast::http::request<boost::beast::http::empty_body>;
 
   42    boost::asio::io_context& 
ios_;
 
   43    boost::asio::strand<boost::asio::io_context::executor_type> 
strand_;
 
   57        boost::asio::io_context& ios,
 
   66        return *
static_cast<Impl*
>(
this);
 
 
  105    boost::asio::io_context& ios,
 
  114    , strand_(
boost::asio::make_strand(ios))
 
  117    , lastEndpoint_{lastEndpoint}
 
  118    , lastStatus_(lastStatus)
 
 
  136    if (!strand_.running_in_this_thread())
 
  137        return boost::asio::post(
 
  139            boost::asio::bind_executor(
 
  142    resolver_.async_resolve(
 
  145        boost::asio::bind_executor(
 
  149                impl().shared_from_this(),
 
  150                std::placeholders::_1,
 
  151                std::placeholders::_2)));
 
 
  158    if (!strand_.running_in_this_thread())
 
  160        return boost::asio::post(
 
  163            boost::asio::bind_executor(
 
 
  179        cb_(ec, lastEndpoint_, std::move(res_));
 
 
  191    boost::asio::async_connect(
 
  194        boost::asio::bind_executor(
 
  198                impl().shared_from_this(),
 
  199                std::placeholders::_1,
 
  200                std::placeholders::_2)));
 
 
  207    lastEndpoint_ = endpoint;
 
  212    impl().onConnect(ec);
 
 
  219    req_.method(boost::beast::http::verb::get);
 
  220    req_.target(path_.empty() ? 
"/" : path_);
 
  222    req_.set(
"Host", host_ + 
":" + port_);
 
  224    req_.prepare_payload();
 
  225    boost::beast::http::async_write(
 
  228        boost::asio::bind_executor(
 
  232                impl().shared_from_this(),
 
  233                std::placeholders::_1)));
 
 
  243    boost::beast::http::async_read(
 
  247        boost::asio::bind_executor(
 
  251                impl().shared_from_this(),
 
  252                std::placeholders::_1)));
 
 
  263    XRPL_ASSERT(cb_, 
"ripple::detail::WorkBase::onResponse : callback is set");
 
  264    cb_(ec, lastEndpoint_, std::move(res_));
 
 
  272    if (socket_.is_open())
 
  275        socket_.shutdown(boost::asio::socket_base::shutdown_send, ec);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
endpoint_type lastEndpoint_
 
boost::asio::ip::tcp::resolver::results_type results_type
 
boost::asio::io_context & ios_
 
boost::beast::http::request< boost::beast::http::empty_body > request_type
 
void onResolve(error_code const &ec, results_type results)
 
void onRequest(error_code const &ec)
 
boost::asio::ip::tcp::socket socket_type
 
void onResponse(error_code const &ec)
 
boost::asio::ip::tcp::endpoint endpoint_type
 
boost::asio::ip::tcp::resolver resolver_type
 
boost::system::error_code error_code
 
boost::asio::strand< boost::asio::io_context::executor_type > strand_
 
boost::beast::multi_buffer readBuf_
 
WorkBase(std::string const &host, std::string const &path, std::string const &port, boost::asio::io_context &ios, endpoint_type const &lastEndpoint, bool lastStatus, callback_type cb)
 
void onConnect(error_code const &ec, endpoint_type const &endpoint)
 
void fail(error_code const &ec)
 
std::string const & getFullVersionString()
Full server version string.
 
boost::beast::http::response< boost::beast::http::string_body > response_type
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
std::error_code make_error_code(ripple::TokenCodecErrc e)