3#include <xrpld/app/main/Application.h>
4#include <xrpld/overlay/detail/ProtocolVersion.h>
6#include <xrpl/basics/base_uint.h>
7#include <xrpl/beast/net/IPAddress.h>
8#include <xrpl/beast/utility/Journal.h>
10#include <boost/asio/ssl.hpp>
11#include <boost/beast/core/tcp_stream.hpp>
12#include <boost/beast/http/dynamic_body.hpp>
13#include <boost/beast/http/empty_body.hpp>
14#include <boost/beast/http/fields.hpp>
15#include <boost/beast/ssl/ssl_stream.hpp>
25using RequestType = boost::beast::http::request<boost::beast::http::empty_body>;
26using HttpRequestType = boost::beast::http::request<boost::beast::http::dynamic_body>;
27using HttpResponseType = boost::beast::http::response<boost::beast::http::dynamic_body>;
47 boost::beast::http::fields& h,
68 boost::beast::http::fields
const& headers,
91 bool ledgerReplayEnabled,
92 bool txReduceRelayEnabled,
93 bool vpReduceRelayEnabled);
156 boost::beast::http::fields
const& headers,
180template <
typename Headers>
183 Headers
const& request,
194template <
typename Headers>
214 bool ledgerReplayEnabled,
215 bool txReduceRelayEnabled,
216 bool vpReduceRelayEnabled);
236 bool ledgerReplayEnabled,
237 bool txReduceRelayEnabled,
238 bool vpReduceRelayEnabled);
A generic endpoint for log messages.
boost::asio::ip::address Address
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
boost::beast::tcp_stream SocketType
std::string makeFeaturesResponseHeader(HttpRequestType const &headers, bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, bool vpReduceRelayEnabled)
Make response header X-Protocol-Ctl value with supported features.
static constexpr char kDelimFeature[]
bool featureEnabled(boost::beast::http::fields const &headers, std::string const &feature)
Check if a feature is enabled.
HttpResponseType makeResponse(bool crawlPublic, HttpRequestType const &req, beast::ip::Address publicIp, beast::ip::Address remoteIp, UInt256 const &sharedValue, std::optional< std::uint32_t > networkID, ProtocolVersion protocol, Application &app)
Make http response.
void buildHandshake(boost::beast::http::fields &h, xrpl::UInt256 const &sharedValue, std::optional< std::uint32_t > networkID, beast::ip::Address publicIp, beast::ip::Address remoteIp, Application &app)
Insert fields headers necessary for upgrading the link to the peer protocol.
auto makeRequest(bool crawlPublic, bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, bool vpReduceRelayEnabled) -> RequestType
Make outbound http request.
static constexpr char kFeatureLedgerReplay[]
static constexpr char kDelimValue[]
static constexpr char kFeatureTxrr[]
boost::beast::ssl_stream< SocketType > StreamType
boost::beast::http::request< boost::beast::http::dynamic_body > HttpRequestType
std::optional< UInt256 > makeSharedValue(StreamType &ssl, beast::Journal journal)
Computes a shared value based on the SSL connection state.
std::string makeFeaturesRequestHeader(bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, bool vpReduceRelayEnabled)
Make request header X-Protocol-Ctl value with supported features.
boost::beast::http::response< boost::beast::http::dynamic_body > HttpResponseType
std::optional< std::string > getFeatureValue(boost::beast::http::fields const &headers, std::string const &feature)
Get feature's header value.
bool peerFeatureEnabled(Headers const &request, std::string const &feature, std::string value, bool config)
Check if a feature should be enabled for a peer.
std::pair< std::uint16_t, std::uint16_t > ProtocolVersion
Represents a particular version of the peer-to-peer protocol.
static constexpr char kFeatureCompr[]
static constexpr char kFeatureVprr[]
bool isFeatureValue(boost::beast::http::fields const &headers, std::string const &feature, std::string const &value)
Check if a feature's value is equal to the specified value.
PublicKey verifyHandshake(boost::beast::http::fields const &headers, xrpl::UInt256 const &sharedValue, std::optional< std::uint32_t > networkID, beast::ip::Address publicIp, beast::ip::Address remote, Application &app)
Validate header fields necessary for upgrading the link to the peer protocol.
boost::beast::http::request< boost::beast::http::empty_body > RequestType