aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/mds-message.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-15 15:45:13 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-15 15:45:13 +0200
commit566054194d82b4bfabaaca44d14008a073e29a6b (patch)
tree5fc6f39d75cc49402071906151d3b0b6b41f1f00 /src/libmdsserver/mds-message.h
parentDo not echo back messages to the sender (diff)
downloadmds-566054194d82b4bfabaaca44d14008a073e29a6b.tar.gz
mds-566054194d82b4bfabaaca44d14008a073e29a6b.tar.bz2
mds-566054194d82b4bfabaaca44d14008a073e29a6b.tar.xz
m + fix message sending
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver/mds-message.h')
-rw-r--r--src/libmdsserver/mds-message.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/libmdsserver/mds-message.h b/src/libmdsserver/mds-message.h
index 885dd03..6f0a61d 100644
--- a/src/libmdsserver/mds-message.h
+++ b/src/libmdsserver/mds-message.h
@@ -83,7 +83,7 @@ typedef struct mds_message
/**
- * Initialsie a message slot so that it can
+ * Initialise a message slot so that it can
* be used by `mds_message_read`
*
* @param this Memory slot in which to store the new message
@@ -119,25 +119,21 @@ int mds_message_read(mds_message_t* restrict this, int fd);
* Get the required allocation size for `data` of the
* function `mds_message_marshal`
*
- * @param this The message
- * @param include_buffer Whether buffer should be marshalled (state serialisation, not communication)
- * @return The size of the message when marshalled
+ * @param this The message
+ * @return The size of the message when marshalled
*/
-size_t mds_message_marshal_size(const mds_message_t* restrict this, int include_buffer) __attribute__((pure));
+size_t mds_message_marshal_size(const mds_message_t* restrict this) __attribute__((pure));
/**
- * Marshal a message, this can be used both when serialising
- * the servers state or to get the byte stream to send to
- * the recipient of the message
+ * Marshal a message for state serialisation
*
- * @param this The message
- * @param data Output buffer for the marshalled data
- * @param include_buffer Whether buffer should be marshalled (state serialisation, not communication)
+ * @param this The message
+ * @param data Output buffer for the marshalled data
*/
-void mds_message_marshal(const mds_message_t* restrict this, char* restrict data, int include_buffer);
+void mds_message_marshal(const mds_message_t* restrict this, char* restrict data);
/**
- * Unmarshal a message, it is assumed that the buffer is marshalled
+ * Unmarshal a message for state deserialisation
*
* @param this Memory slot in which to store the new message
* @param data In buffer with the marshalled data
@@ -146,6 +142,23 @@ void mds_message_marshal(const mds_message_t* restrict this, char* restrict data
*/
int mds_message_unmarshal(mds_message_t* restrict this, char* restrict data);
+/**
+ * Get the required allocation size for `data` of the
+ * function `mds_message_compose`
+ *
+ * @param this The message
+ * @return The size of the message when marshalled
+ */
+size_t mds_message_compose_size(const mds_message_t* restrict this) __attribute__((pure));
+
+/**
+ * Marshal a message for communication
+ *
+ * @param this The message
+ * @param data Output buffer for the marshalled data
+ */
+void mds_message_compose(const mds_message_t* restrict this, char* restrict data);
+
#endif