12#include <nlohmann/json.hpp>
61 int version() const noexcept {
return _version; }
64 std::string
const &
command() const noexcept {
return _command; }
67 nlohmann::json
const &
params() const noexcept {
return _params; }
122 std::string _command;
123 nlohmann::json _params;
ControlMessage(MessagePtr const &parent=nullptr)
Construct an empty control message, optionally inheriting from a parent.
int version() const noexcept
Protocol version of this control message (default: 1).
Definition ControlMessage.hpp:61
Kind kind() const override
This message belongs to the control-plane connectivity domain.
Definition ControlMessage.hpp:83
std::string const & command() const noexcept
Command name carried by this message.
Definition ControlMessage.hpp:64
nlohmann::json const & params() const noexcept
JSON parameters carried by this message (may be null).
Definition ControlMessage.hpp:67
void cloneFromBase(Message const &base) override
Copy base and derived state from base into this instance.
ControlMessage(std::string command, nlohmann::json params={}, int version=1, MessagePtr const &parent=nullptr)
Construct a control message with command, params and version.
MessagePtr clone() const override
Clone this message (deep copy).
nlohmann::json toJson() const
Serialize this control message to JSON.
Definition Channel.hpp:22
std::unique_ptr< Message > MessagePtr
Unique ownership handle for messages.
Definition Message.hpp:27
Kind
Port kind (connection domain).
Definition Kind.hpp:29
@ Control
Control-plane ports.
Definition Kind.hpp:41