Subject: Re: [hybi] hum #3: Message

From: Martin Sustrik <[email-masked]>
Date: Mon, 09 Aug 2010 18:45:44 +0200

Greg,

 > However, I do like having a very small minimal frame size for short
 > messages, so I would modify Johns proposal to:
 >
 >  1 bit - fragment
 >  2 bits - reserved
 >  5 bits - opcode
 >  8 bits - short length
 >  [if length = 255: 6 bytes length]
 >  length bytes of payload

Length should definitely go first. That way you can implement a simple 
frame reading/writing layer (in SW or HW) without bothering about all 
the other bits:

   8 bits - short length
   [if length = 255: 6 bytes length]
   length bytes of payload
   1 bit - fragment
   2 bits - reserved
   5 bits - opcode

Martin