summaryrefslogtreecommitdiff
path: root/src/message.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/message.h')
-rw-r--r--src/message.h53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/message.h b/src/message.h
index d5e0590..3a6afdc 100644
--- a/src/message.h
+++ b/src/message.h
@@ -29,12 +29,12 @@
#include <list>
#include <string>
+#include <vector>
#include "node.h"
-namespace cmd
+enum class cmd
{
-typedef enum {
login,
logout,
subscribe,
@@ -45,58 +45,63 @@ typedef enum {
move,
update,
error,
-} cmd_t;
};
-typedef struct
+using cmd_t = cmd;
+
+struct login_t
{
std::string user;
std::string password;
-} login_t;
+};
-typedef struct
+struct logout_t
{
-} logout_t;
+};
-typedef struct
+struct subscribe_t
{
nodeid_t id;
-} subscribe_t;
+};
-typedef struct
+struct unsubscribe_t
{
nodeid_t id;
-} unsubscribe_t;
+};
-typedef struct
+struct create_t
{
nodeid_t id;
nodeid_t parentid;
nodeid_t insertbeforeid;
-} create_t;
-typedef struct
+ // for create_with_attributes
+ std::map<std::string, std::string> attributes;
+ std::vector<struct create_t> children;
+};
+
+struct remove_t
{
nodeid_t id;
-} remove_t;
+};
-typedef struct
+struct move_t
{
nodeid_t id;
nodeid_t parentid;
nodeid_t insertbeforeid;
-} move_t;
+};
-typedef struct
+struct update_t
{
nodeid_t id;
std::string attribute;
std::string value;
-} update_t;
+};
-typedef struct
+struct message_t
{
- cmd::cmd_t cmd;
+ cmd_t cmd;
login_t login;
logout_t logout;
@@ -107,13 +112,11 @@ typedef struct
move_t move;
update_t update;
- std::map<std::string, std::string> attributes; // for create_with_attributes
-
NodeIdList nodes;
// target node id (subscription node id) used for transmissions only.
nodeid_t tid;
-} message_t;
+};
-typedef std::list<message_t> MessageList;
+using MessageList = std::list<message_t>;