aboutsummaryrefslogtreecommitdiff
path: root/client/libacron/private/serializer.h
diff options
context:
space:
mode:
Diffstat (limited to 'client/libacron/private/serializer.h')
-rw-r--r--client/libacron/private/serializer.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/client/libacron/private/serializer.h b/client/libacron/private/serializer.h
index 1b9a38b..cbc9557 100644
--- a/client/libacron/private/serializer.h
+++ b/client/libacron/private/serializer.h
@@ -9,10 +9,30 @@
* Should not conflict with other error codes. */
#define AC_E_SERIALIZER_CONTINUE -1
+/**
+ * Deserialize an event or a response into ac_obj_t.
+ * @param string The partial or complete response.
+ * @param len The length to the string, excluding tailing NULL.
+ * @param out The final object. Not NULL if the return value is AC_E_OK.
+ * @return AC_E_OK or an error code. When failed, the *out is untouched.
+ * MT-Safe config
+ */
int deserialize(const char *string, unsigned int len, ac_obj_t **out);
+/**
+ * Force a deserializer reset.
+ * @return AC_E_OK or an error code.
+ * MT-Safe
+ */
int serializer_finalize(void);
+/**
+ * Serialize a request to a JSON object.
+ * @param req The request. Must be a valid ac_request.
+ * @param out The output json_object. Will not be NULL if the return value is AC_E_OK.
+ * @return AC_E_OK or an error code. When failed, the *out is untouched.
+ * MT-Safe
+ */
int serialize_request(const ac_request_t *req, json_object **out);
#endif /* LIBAC_SERIALIZER_H */