aboutsummaryrefslogtreecommitdiff
path: root/src/message.hpp
blob: 86a455cb55bf01846095a8fbbfba31b6a382455d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef WANDA_MESSAGE_HPP
#define WANDA_MESSAGE_HPP

#include <cstddef>
#include <istream>
#include <optional>
#include <string>

namespace wanda
{
  inline namespace v1
  {
    auto constexpr message_argument_hello = "1.0.0";
  }

  auto constexpr message_source_controller = "C";
  auto constexpr message_source_daemon = "D";

  auto constexpr message_command_hello = "HELLO";

  struct message
  {
    explicit operator std::string() const;

    std::size_t size() const;

    std::string source;
    std::string command;
    std::optional<std::string> argument;
  };

  std::istream & operator>>(std::istream & in, message & message);
  std::ostream & operator<<(std::ostream & out, message const & message);

}  // namespace wanda

#endif