diff options
Diffstat (limited to 'lib9p/include/lib9p/9p.h')
-rw-r--r-- | lib9p/include/lib9p/9p.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h index c3c6a8b..1e1667d 100644 --- a/lib9p/include/lib9p/9p.h +++ b/lib9p/include/lib9p/9p.h @@ -113,7 +113,7 @@ void lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, * @param typ : the message type * @param msg : the message to encode * - * @return ret_bytes : the buffer to encode to, must be at be at least lib9p_ctx_max_msg_size(ctx) bytes + * @return ret_bytes : the buffer to encode to, must be at be at least ctx->max_msg_size bytes * @return whether there was an error (false=success, true=error) * * @errno LINUX_ERANGE: reply does not fit in ctx->max_msg_size @@ -121,4 +121,31 @@ void lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes, bool lib9p_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body, uint8_t *ret_bytes); +/** + * TODO + * + * @return ret_net_size: number of bytes consumed; <=net_size + * @return ret_host_size: number of bytes that lib9p_unmarshal_stat would take + * @return whether there was an error + */ +bool lib9p_validate_stat(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes, + uint32_t *ret_net_size, ssize_t *ret_host_size); + +/** + * TODO + * + * @return ret_obj : where to put the stat object itself + * @return ret_extra : where to put strings for the stat object + * @return consumed net_bytes + */ +uint32_t lib9p_unmarshal_stat(struct lib9p_ctx *ctx, uint8_t *net_bytes, + struct lib9p_stat *ret_obj, void *ret_extra); + +/** + * @return ret_bytes: the buffer to encode into + * @return the number of bytes written, or 0 if the stat object does not fit in max_net_size + */ +uint32_t lib9p_marshal_stat(struct lib9p_ctx *ctx, uint32_t max_net_size, struct lib9p_stat *obj, + uint8_t *ret_bytes); + #endif _LIB9P_9P_H_ |