aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/linked-list.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-22 06:03:39 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-22 06:03:39 +0200
commitfbe2ea3c0dcfbfc30c3e3072e29deea67f688211 (patch)
tree628a94ae74d0911b039e8f4ac8eb4bf795e9ffd5 /src/libmdsserver/linked-list.h
parentfix error handling (diff)
downloadmds-fbe2ea3c0dcfbfc30c3e3072e29deea67f688211.tar.gz
mds-fbe2ea3c0dcfbfc30c3e3072e29deea67f688211.tar.bz2
mds-fbe2ea3c0dcfbfc30c3e3072e29deea67f688211.tar.xz
add marshaling for linked-list
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver/linked-list.h')
-rw-r--r--src/libmdsserver/linked-list.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/libmdsserver/linked-list.h b/src/libmdsserver/linked-list.h
index f1949a5..aac6799 100644
--- a/src/libmdsserver/linked-list.h
+++ b/src/libmdsserver/linked-list.h
@@ -132,7 +132,7 @@ void linked_list_destroy(linked_list_t* this);
* @param out Memory slot in which to store the new linked list
* @return Non-zero on error, `errno` will have been set accordingly
*/
-int linked_list_clone(linked_list_t* this, linked_list_t* out);
+int linked_list_clone(const linked_list_t* restrict this, linked_list_t* restrict out);
/**
* Pack the list so that there are no reusable
@@ -238,6 +238,32 @@ void linked_list_remove(linked_list_t* this, ssize_t node);
#define linked_list_remove_end(this) \
(linked_list_remove_before(this, this->edge))
+/**
+ * Calculate the buffer size need to marshal a linked list
+ *
+ * @param this The list
+ * @return The number of bytes to allocate to the output buffer
+ */
+size_t linked_list_marshal_size(const linked_list_t* this) __attribute__((pure));
+
+/**
+ * Marshals a linked list
+ *
+ * @param this The list
+ * @param data Output buffer for the marshalled data
+ */
+void linked_list_marshal(const linked_list_t* restrict this, char* restrict data);
+
+/**
+ * Unmarshals a linked list
+ *
+ * @param this Memory slot in which to store the new linked list
+ * @param data In buffer with the marshalled data
+ * @return Non-zero one error, errno will be set accordingly.
+ * Destroy the list on error.
+ */
+int linked_list_unmarshal(linked_list_t* restrict this, char* restrict data);
+
#endif