20 #include <ripple/beast/core/LexicalCast.h>
21 #include <ripple/beast/rfc2616.h>
22 #include <ripple/overlay/impl/ProtocolVersion.h>
23 #include <boost/iterator/function_output_iterator.hpp>
24 #include <boost/regex.hpp>
48 []() constexpr->bool {
49 auto const len = std::distance(
50 std::begin(supportedProtocolList), std::end(supportedProtocolList));
60 for (auto i = 0; i != len - 1; ++i)
62 if (supportedProtocolList[i] >= supportedProtocolList[i + 1])
69 "The list of supported protocols isn't properly sorted.");
80 static boost::regex re(
83 "([2-9]|(?:[1-9][0-9]+))"
90 boost::regex_constants::optimize);
98 if (boost::regex_match(s, m, re))
112 if (to_string(proto) == s)
142 boost::make_function_output_iterator(pickVersion));
constexpr ProtocolVersion make_protocol(std::uint16_t major, std::uint16_t minor)
std::vector< ProtocolVersion > parseProtocolVersions(boost::beast::string_view const &value)
Parse a set of protocol versions.
std::pair< std::uint16_t, std::uint16_t > ProtocolVersion
Represents a particular version of the peer-to-peer protocol.
constexpr const ProtocolVersion supportedProtocolList[]
The list of protocol versions we speak and we prefer to use.
Result split_commas(FwdIt first, FwdIt last)
std::string const & supportedProtocolVersions()
The list of all the protocol versions we support.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool lexicalCastChecked(Out &out, In in)
Intelligently convert from one type to another.
bool isProtocolSupported(ProtocolVersion const &v)
Determine whether we support a specific protocol version.
T set_intersection(T... args)
std::optional< ProtocolVersion > negotiateProtocolVersion(std::vector< ProtocolVersion > const &versions)
Given a list of supported protocol versions, choose the one we prefer.