I agree. Thats one thing I noticed about the protocol when I was reading my email on the train this morning. <br><br>Keeping the original structure would make it difficult to change the fixed-width parameters given to a command.
<br><br>Having an offset would mean that the key can be found much easier. However, care should be taken that the offset given doesnt go out of the bounds of the message. I'm not in total favour of an offset either, because in this case, you're basically moving the calculation from the server to the client.
<br><br>What I prefer is:<br> * Magic byte / version<br> * Cmd byte<br> * 4 byte opaque id.<br> * Key len byte (if no key, 0)<br> * key, if key length above is non-zero.<br> * 4 byte body length (not including reserved byte at the end)
<br> * [ cmd-specific fixed-width fields ]<br> * [ cmd-specific variable-width field ]<br> * Reserved byte (should be 0)<br>
<br>What I additionally prefer, is a total packet length after the magic byte, but that might meet substantially more debate.<br><br>Note: I'm assuming that all variable length fields will have a representative length byte(s) somewhere in the protocol before it.
<br><br><div><span class="gmail_quote">On 7/11/07, <b class="gmail_sendername">Dustin Sallings</b> <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>On Jul 10, 2007, at 9:23, Brad Fitzpatrick wrote:<br><br>> REQUEST STRUCTURE:<br>><br>> * Magic byte / version<br>> * Cmd byte<br>> * Key len byte (if no key, 0)<br>> * Reserved byte (should be 0)
<br>><br>> * 4 byte opaque id. (will be copied back in response; means<br>> nothing to server)<br>><br>> * 4 byte body length (network order; not including 12 byte header)<br>><br>> [ cmd-specific fixed-width fields ]
<br>><br>> * key, if key length above is non-zero.<br>><br>> [ cmd-specific variable-width field ]<br><br> I found a problem when implementing this. Given the above<br>structure, we always know the length of a key, but we can't know the
<br>location of a key unless we know how to process the given command.<br><br> I don't know that this is a huge problem, but it thwarted some of my<br>generic lower-level packet handling code in my test server.
<br><br> Perhaps we could resurrect the reserved byte and use it as a fixed-<br>field word (or byte) count? I remember this coming up in the<br>discussion, but I think we decided it was redundant as the command<br>
should know what its headers are.<br><br> Any opinions?<br><br>--<br>Dustin Sallings<br><br><br></blockquote></div><br><br clear="all"><br>-- <br>"Be excellent to each other"