aboutsummaryrefslogtreecommitdiff
path: root/src/message.hpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2018-12-10 09:25:14 +0100
committerFelix Morgner <felix.morgner@gmail.com>2018-12-10 09:25:14 +0100
commitd3e691c9200b7b782c8acf17468068a699588a73 (patch)
tree44f179ebf773dc8536b220f2ffcc3d2eec374aa4 /src/message.hpp
parent7b940a39dfef6f19846fe357d4a5167c66c79e85 (diff)
downloadwanda-d3e691c9200b7b782c8acf17468068a699588a73.tar.xz
wanda-d3e691c9200b7b782c8acf17468068a699588a73.zip
doc: update documentation
Diffstat (limited to 'src/message.hpp')
-rw-r--r--src/message.hpp48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/message.hpp b/src/message.hpp
index 86a455c..866408f 100644
--- a/src/message.hpp
+++ b/src/message.hpp
@@ -1,3 +1,9 @@
+/**
+ * @file message.hpp
+ * @author Felix Morgner (felix.morgner@gmail.com)
+ * @since 1.0.0
+ */
+
#ifndef WANDA_MESSAGE_HPP
#define WANDA_MESSAGE_HPP
@@ -10,26 +16,66 @@ namespace wanda
{
inline namespace v1
{
+ /**
+ * @brief The version argument for the hello message reflecting the current version
+ */
auto constexpr message_argument_hello = "1.0.0";
- }
+ } // namespace v1
+ /**
+ * @brief A tag to mark messages originating from the controller
+ */
auto constexpr message_source_controller = "C";
+
+ /**
+ * @brief A tag to mark messages originating from the daemon
+ */
auto constexpr message_source_daemon = "D";
+ /**
+ * @brief The command of the hello message
+ */
auto constexpr message_command_hello = "HELLO";
+ /**
+ * @brief A control protocol message, consisting of a @p source, @p command, and @p arguments
+ */
struct message
{
+ /**
+ * @brief Serialize this message into a string
+ */
explicit operator std::string() const;
+ /**
+ * @brief Get the size of the message as if it was serialized
+ */
std::size_t size() const;
+ /**
+ * @brief The source of the message
+ */
std::string source;
+
+ /**
+ * @brief The command of the message
+ */
std::string command;
+
+ /**
+ * @brief The arguments of the message command
+ */
std::optional<std::string> argument;
};
+ /**
+ * @brief Deserialize a message from the given stream
+ */
std::istream & operator>>(std::istream & in, message & message);
+
+ /**
+ * @brief Serialize a message to the given stream
+ */
std::ostream & operator<<(std::ostream & out, message const & message);
} // namespace wanda