rippled
Loading...
Searching...
No Matches
ProtocolVersion.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_OVERLAY_PROTOCOLVERSION_H_INCLUDED
21#define RIPPLE_OVERLAY_PROTOCOLVERSION_H_INCLUDED
22
23#include <boost/beast/core/string.hpp>
24
25#include <cstdint>
26#include <optional>
27#include <string>
28#include <utility>
29#include <vector>
30
31namespace ripple {
32
39
40inline constexpr ProtocolVersion
42{
43 return {major, minor};
44}
45
49
62parseProtocolVersions(boost::beast::string_view const& s);
63
67
70negotiateProtocolVersion(boost::beast::string_view const& versions);
71
73std::string const&
75
77bool
79
80} // namespace ripple
81
82#endif
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
std::optional< ProtocolVersion > negotiateProtocolVersion(std::vector< ProtocolVersion > const &versions)
Given a list of supported protocol versions, choose the one we prefer.
std::pair< std::uint16_t, std::uint16_t > ProtocolVersion
Represents a particular version of the peer-to-peer protocol.
std::vector< ProtocolVersion > parseProtocolVersions(boost::beast::string_view const &value)
Parse a set of protocol versions.
constexpr ProtocolVersion make_protocol(std::uint16_t major, std::uint16_t minor)
std::string const & supportedProtocolVersions()
The list of all the protocol versions we support.
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:630
bool isProtocolSupported(ProtocolVersion const &v)
Determine whether we support a specific protocol version.