diff options
author | Trumeet <yuuta@yuuta.moe> | 2022-07-20 20:37:37 -0700 |
---|---|---|
committer | Trumeet <yuuta@yuuta.moe> | 2022-07-20 20:37:37 -0700 |
commit | 41ac44c30b9d165dd90255eec5b817fc21b8f7ff (patch) | |
tree | cf4fb9a61eef24a96365f54409f47e373ff2e3da /client/libacron/private/serializer.h | |
parent | e2452adee6ba683cbfe093301650503a936a1a94 (diff) | |
download | acron-41ac44c30b9d165dd90255eec5b817fc21b8f7ff.tar acron-41ac44c30b9d165dd90255eec5b817fc21b8f7ff.tar.gz acron-41ac44c30b9d165dd90255eec5b817fc21b8f7ff.tar.bz2 acron-41ac44c30b9d165dd90255eec5b817fc21b8f7ff.zip |
docs(libacron): add library docs
Signed-off-by: Trumeet <yuuta@yuuta.moe>
Diffstat (limited to 'client/libacron/private/serializer.h')
-rw-r--r-- | client/libacron/private/serializer.h | 20 |
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 */ |