20 #ifndef RIPPLE_OVERLAY_MESSAGE_H_INCLUDED
21 #define RIPPLE_OVERLAY_MESSAGE_H_INCLUDED
23 #include <ripple/basics/ByteUtilities.h>
24 #include <ripple/overlay/Compression.h>
25 #include <ripple/protocol/PublicKey.h>
26 #include <ripple/protocol/messages.h>
27 #include <boost/asio/buffer.hpp>
28 #include <boost/asio/buffers_iterator.hpp>
66 ::google::protobuf::Message
const& message,
75 messageSize(::google::protobuf::Message
const& message);
78 totalSize(::google::protobuf::Message
const& message);
std::optional< PublicKey > validatorKey_
std::vector< uint8_t > const & getBuffer(Compressed tryCompressed)
Retrieve the packed message data.
void compress()
Try to compress the payload.
constexpr std::size_t maximiumMessageSize
static std::size_t totalSize(::google::protobuf::Message const &message)
static std::size_t messageSize(::google::protobuf::Message const &message)
int getType(std::uint8_t const *in) const
Get the message type from the payload header.
void setHeader(std::uint8_t *in, std::uint32_t payloadBytes, int type, Algorithm compression, std::uint32_t uncompressedBytes)
Set the payload header.
std::once_flag once_flag_
std::size_t getCategory() const
Get the traffic category.
constexpr auto megabytes(T value) noexcept
Message(::google::protobuf::Message const &message, int type, std::optional< PublicKey > const &validator={})
Constructor.
compression::Compressed Compressed
std::vector< uint8_t > buffer_
std::size_t getBufferSize()
Retrieve the size of the packed but uncompressed message data.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::vector< uint8_t > bufferCompressed_
std::optional< PublicKey > const & getValidatorKey() const
Get the validator's key.