12#include <nlohmann/json.hpp>
62 int version() const noexcept {
return _version; }
65 std::string
const &
command() const noexcept {
return _command; }
68 nlohmann::json
const &
params() const noexcept {
return _params; }
126 std::string _command;
127 nlohmann::json _params;
ControlMessage(blank_construct_t) noexcept
Construct a completely blank message without any timestamp or UUID attached to it.
Definition ControlMessage.hpp:105
int version() const noexcept
Protocol version of this control message (default: 1).
Definition ControlMessage.hpp:62
Kind kind() const override
This message belongs to the control-plane connectivity domain.
Definition ControlMessage.hpp:84
std::string const & command() const noexcept
Command name carried by this message.
Definition ControlMessage.hpp:65
nlohmann::json const & params() const noexcept
JSON parameters carried by this message (may be null).
Definition ControlMessage.hpp:68
void cloneFromBase(Message const &base) override
Copy base and derived state from base into this instance.
MessagePtr clone() const override
Clone this message (deep copy).
ControlMessage(std::string command, nlohmann::json params={}, int version=1, Message const *parent=nullptr)
Construct a control message with command, params and version.
ControlMessage(Message const *parent=nullptr)
Construct an empty control message, optionally inheriting from a parent.
nlohmann::json toJson() const
Serialize this control message to JSON.
Abstract base class for messages exchanged between nodes.
Definition Message.hpp:86
Definition Unpacker.hpp:20
Definition Channel.hpp:25
std::unique_ptr< Message > MessagePtr
Unique ownership handle for messages.
Definition Message.hpp:27
constexpr blank_construct_t blank_construct
Tag used in constructor to indicate that the object should be as brut as possible.
Definition Message.hpp:41
Kind
Port kind (connection domain).
Definition Kind.hpp:29
@ Control
Control-plane ports.
Definition Kind.hpp:41
Struct used when you explicitely want an object to be as bare as possible.
Definition Message.hpp:39