diff options
Diffstat (limited to 'lib9p/include/lib9p/9p.h')
-rw-r--r-- | lib9p/include/lib9p/9p.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h index a55f08f..954498e 100644 --- a/lib9p/include/lib9p/9p.h +++ b/lib9p/include/lib9p/9p.h @@ -7,6 +7,9 @@ #ifndef _LIB9P_9P_H_ #define _LIB9P_9P_H_ +#include <stdbool.h> +#include <sys/types.h> /* for ssize_t */ + #include <lib9p/linux-errno.h> #include <lib9p/_types.h> @@ -14,8 +17,8 @@ #define LIB9P_NOFID ((uint32_t)~0U) struct lib9p_ctx; -enum lib9p_version lib9p_ctx_version(lib9p_ctx *); -uint32_t lib9p_ctx_max_msg_size(lib9p_ctx *); +enum lib9p_version lib9p_ctx_version(struct lib9p_ctx *); +uint32_t lib9p_ctx_max_msg_size(struct lib9p_ctx *); /** Write an static error into ctx, return -1. */ int lib9p_error(struct lib9p_ctx *ctx, uint32_t linux_errno, char const *msg); @@ -50,10 +53,9 @@ ssize_t lib9p_unmarshal_size(struct lib9p_ctx *ctx, uint8_t *net_bytes); * @return ret_typ : the mesage type * @return ret_tag : the message-ID tag * @return ret_body : the message body, must be at least lib9p_unmarshal_size() bytes - * @return the message type, or -1 on error */ -bool lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, - enum lib9p_msg_typ *ret_typ, uint16_t *ret_tag, void *ret_body); +void lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, + enum lib9p_msg_type *ret_typ, uint16_t *ret_tag, void *ret_body); /** * Marshal a `struct lib9p_msg_{typ}` structure into a byte-array. @@ -66,7 +68,7 @@ bool lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, * @return ret_bytes : the buffer to encode to, must be at be at least lib9p_ctx_max_msg_size(ctx) bytes * @return whether there was an error (false=success, true=error) */ -bool lib9p_marshal(struct lib9p_ctx *ctx, uint8_t typ, uint16_t tag, void *body, +bool lib9p_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, uint16_t tag, void *body, uint8_t *ret_bytes); #endif _LIB9P_9P_H_ |