20#ifndef RIPPLE_OVERLAY_HANDSHAKE_H_INCLUDED
21#define RIPPLE_OVERLAY_HANDSHAKE_H_INCLUDED
23#include <xrpld/app/main/Application.h>
24#include <xrpld/overlay/detail/ProtocolVersion.h>
26#include <xrpl/beast/utility/Journal.h>
27#include <xrpl/protocol/BuildInfo.h>
29#include <boost/asio/ssl.hpp>
30#include <boost/beast/core/tcp_stream.hpp>
31#include <boost/beast/http/dynamic_body.hpp>
32#include <boost/beast/http/empty_body.hpp>
33#include <boost/beast/http/fields.hpp>
34#include <boost/beast/ssl/ssl_stream.hpp>
44 boost::beast::http::request<boost::beast::http::empty_body>;
46 boost::beast::http::request<boost::beast::http::dynamic_body>;
48 boost::beast::http::response<boost::beast::http::dynamic_body>;
66 boost::beast::http::fields& h,
86 boost::beast::http::fields
const& headers,
108 bool ledgerReplayEnabled,
109 bool txReduceRelayEnabled,
110 bool vpReduceRelayEnabled);
159 boost::beast::http::fields
const& headers,
172 boost::beast::http::fields
const& headers,
183 boost::beast::http::fields
const& headers,
196template <
typename headers>
199 headers
const& request,
208template <
typename headers>
211 headers
const& request,
230 bool ledgerReplayEnabled,
231 bool txReduceRelayEnabled,
232 bool vpReduceRelayEnabled);
252 bool ledgerReplayEnabled,
253 bool txReduceRelayEnabled,
254 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::ssl_stream< socket_type > stream_type
std::string makeFeaturesResponseHeader(http_request_type const &headers, bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, bool vpReduceRelayEnabled)
Make response header X-Protocol-Ctl value with supported features.
static constexpr char DELIM_FEATURE[]
boost::beast::http::response< boost::beast::http::dynamic_body > http_response_type
void buildHandshake(boost::beast::http::fields &h, ripple::uint256 const &sharedValue, std::optional< std::uint32_t > networkID, beast::IP::Address public_ip, beast::IP::Address remote_ip, Application &app)
Insert fields headers necessary for upgrading the link to the peer protocol.
static constexpr char FEATURE_COMPR[]
static constexpr char DELIM_VALUE[]
std::string makeFeaturesRequestHeader(bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, bool vpReduceRelayEnabled)
Make request header X-Protocol-Ctl value with supported features.
http_response_type makeResponse(bool crawlPublic, http_request_type const &req, beast::IP::Address public_ip, beast::IP::Address remote_ip, uint256 const &sharedValue, std::optional< std::uint32_t > networkID, ProtocolVersion protocol, Application &app)
Make http response.
static constexpr char FEATURE_LEDGER_REPLAY[]
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.
std::optional< uint256 > makeSharedValue(stream_type &ssl, beast::Journal journal)
Computes a shared value based on the SSL connection state.
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
bool featureEnabled(boost::beast::http::fields const &headers, std::string const &feature)
Check if a feature is enabled.
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.
static constexpr char FEATURE_TXRR[]
auto makeRequest(bool crawlPublic, bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, bool vpReduceRelayEnabled) -> request_type
Make outbound http request.
boost::beast::http::request< boost::beast::http::empty_body > request_type
PublicKey verifyHandshake(boost::beast::http::fields const &headers, ripple::uint256 const &sharedValue, std::optional< std::uint32_t > networkID, beast::IP::Address public_ip, beast::IP::Address remote, Application &app)
Validate header fields necessary for upgrading the link to the peer protocol.
boost::beast::tcp_stream socket_type
static constexpr char FEATURE_VPRR[]