carve out bits out of op code for future use.
Mark flags as a field for future use.
#include <tinycbor/cbor.h>
#include <inttypes.h>
#include <os/os.h>
+#include <os/endian.h>
#ifdef __cplusplus
extern "C" {
@@ -34,8 +35,15 @@ extern "C" {
#define NMGR_OP_WRITE_RSP (3)
struct nmgr_hdr {
- uint8_t nh_op; /* NMGR_OP_XXX */
- uint8_t nh_flags;
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ uint8_t nh_op:3; /* NMGR_OP_XXX */
+ uint8_t _res1:5;
+#endif
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ uint8_t _res1:5;
+ uint8_t nh_op:3; /* NMGR_OP_XXX */
+#endif
+ uint8_t nh_flags; /* XXX reserved for future flags */
uint16_t nh_len; /* length of the payload */
uint16_t nh_group; /* NMGR_GROUP_XXX */
uint8_t nh_seq; /* sequence number */
