Code

proto: Let unmarshal functions return the number of bytes processed.
[sysdb.git] / src / include / utils / proto.h
index fd842c1b0caf8c6f48b64b03a7c7d1c2db9f5488..a872dd51b309c6a05a659d9ea4e70a70933fdf35 100644 (file)
@@ -133,19 +133,23 @@ sdb_proto_marshal_attribute(char *buf, size_t buf_len,
  * Read and decode a message header from the specified string.
  *
  * Returns:
- *  - 0 on success
+ *  - the number of bytes read on success
  *  - a negative value else
  */
-int
+ssize_t
 sdb_proto_unmarshal_header(const char *buf, size_t buf_len,
                uint32_t *code, uint32_t *msg_len);
 
 /*
  * sdb_proto_unmarshal_int32:
  * Read and decode a 32-bit integer from the specified string.
+ *
+ * Returns:
+ *  - the number of bytes read on success
+ *  - a negative value else
  */
-uint32_t
-sdb_proto_unmarshal_int32(const char *buf, size_t buf_len);
+ssize_t
+sdb_proto_unmarshal_int32(const char *buf, size_t buf_len, uint32_t *v);
 
 #ifdef __cplusplus
 } /* extern "C" */