Hi all.
I'm making a protocol for communication between a PC and a peripheral device. The protocol is expected to, at first, run on raw Ethernet but I am also supposed to not make any blunders that would make it impossible to later use the exact same protocol on things like IP and friends.
Since I saw these kinds of things in many Internet protocols (DNS, DHCP, TCP options, off the top of my head - but note that these may have a different order of fields), I have decided to make it an array of type- length-value triplets encapsulated in the packet frame (no header). The commands would fill the "type" field, "length" would specify the length of data ("value") following the length field, and "value" would contain the data for the command.
But I would like to hear other (read: opposing) opinions. Particularly so since I am self-taught so there may be considerations obvious to graduated engineers that I am oblivious to.
BTW, the periphery that is on the other end is autonomous and rather intelligent, but very resource constrained. Really, resource constrainment of the periphery is my main problem here.
Some interesting questions: Is ommiting a packet header a good idea? In the long run?
If I put a packet header, what do I put in it? Since addressing and error detection and "recovery" is supposed to be done by underlying protocols, the only thing I can think of putting into the header is the total-length field, and maybe, maybe, maybe a packet-id or transaction-id field. But I really don't need any of these.
My reasoning with packet-id and transaction-id (and protocol-version, really) is that I don't need them now, so I can omit them, and if I ever do need them, I can just add a command which implements them. In doing this, am I setting myself up for a very nasty problem in the future?
Is using flexible packets like this one (opposed the the contents of, say, IP header which has strictly defined fields) a good idea, or am I better off rigidifying my packets?
Is there a special prefference or reason as to why some protocols do TLV and others do LTV? (Note that I am not trying to ignite a holy war, I'm just asking.)
Is it good practice to require aligning the beggining of a TLV with a boundary, say 16-bit word boundary?