summaryrefslogtreecommitdiff
path: root/lib9p/include/lib9p/9p.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/include/lib9p/9p.h')
-rw-r--r--lib9p/include/lib9p/9p.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h
index 616a0e1..3ad52f1 100644
--- a/lib9p/include/lib9p/9p.h
+++ b/lib9p/include/lib9p/9p.h
@@ -11,7 +11,6 @@
#include <stdbool.h>
#include <sys/types.h> /* for ssize_t */
-#include <lib9p/9p.generated.h>
#include <lib9p/linux-errno.h>
/* configuration **************************************************************/
@@ -21,9 +20,14 @@
#ifndef CONFIG_9P_MAX_ERR_SIZE
# error config.h must define CONFIG_9P_MAX_ERR_SIZE
#endif
+#ifndef CONFIG_9P_ENABLE_9P2000
+# define CONFIG_9P_ENABLE_9P2000
+#endif
/******************************************************************************/
+#include <lib9p/9p.generated.h> /* *after* config.h */
+
#define LIB9P_NOTAG ((uint16_t)~0U)
#define LIB9P_NOFID ((uint32_t)~0U)
@@ -85,21 +89,22 @@ ssize_t lib9p_validate(struct lib9p_ctx *ctx, uint8_t *net_bytes);
* @param net_bytes : the complete message, starting with the "size[4]"
*
* @return ret_typ : the mesage type
- * @return ret_tag : the message-ID tag
* @return ret_body : the message body, must be at least lib9p_validate() bytes
*/
void lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes,
- enum lib9p_msg_type *ret_typ, uint16_t *ret_tag, void *ret_body);
+ enum lib9p_msg_type *ret_typ, void *ret_body);
/**
* Marshal a `struct lib9p_msg_{typ}` structure into a byte-array.
*
* lib9p_marshal does no validation; it trusts that the programmer
- * won't give it garbage input.
+ * won't give it garbage input. However, just as it doesn't marshal
+ * struct fields that aren't in ctx->version, it won't marshal
+ * bitfield bits that aren't in ctx->version; it applies a
+ * version-specific mask to bitfields.
*
* @param ctx : negotiated protocol parameters, where to record errors
* @param typ : the message type
- * @param tag : the message-ID tag
* @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
@@ -107,7 +112,7 @@ void lib9p_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes,
*
* @errno LINUX_ERANGE: reply does not fit in ctx->max_msg_size
*/
-bool lib9p_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, uint16_t tag, void *body,
+bool lib9p_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body,
uint8_t *ret_bytes);
#endif _LIB9P_9P_H_