4 ms·
A while back I needed to re-implement the wheel, an extremely minimalist routing protocol. I asked my smart friends what to do and one of them helpfully gave me
by Gibbon1 11y ago
A while back I needed to re-implement the wheel, an extremely minimalist routing protocol. I asked my smart friends what to do and one of them helpfully gave me a really good book by a guy that spent about 30 years implementing networking 'stuff'. Reading through it he pointed out that at the bits/bytes level a lot of protocols are broken because of the lack of a version field[1].
If you have proper versioning you can say; for packet format 001, the field foonarg[1:3] must be 000. And if it isn't it must treated as garbage and tossed. If you don't have versioning, you're kinda stuck with a bunch of ad-hock methods. Stuff like the this unused (we hope) bit in this field is never set this way for this format. Or this packet is 87 bytes long thus it must be this format. head desk
If you ever have to design binary or even text based data format that needs to be shared add a version field, you'll hate yourself less later.
- tilt_error 11y agoCould you shed some light on which book you are referring to?
- Gibbon1 11y agoDigging through my piles of books, it's this one, outdated if you're interested in current stuff. Interconnections Bridges Switches and Internetworking Protocols by Radia Perlman http://www.amazon.com/Interconnections-Bridges-Switches-Internetworking-Protocols/dp/0201634481 http://www.amazon.com/Interconnections-Bridges-Switches-Inte... https://en.wikipedia.org/wiki/Radia_Perlman https://en.wikipedia.org/wiki/Radia_Perlman
- geocar 11y agoA lot of things need to be considered when designing a new protocol. Versioning is clearly not enough: IP for example has many version fields, but that's not helping IPv6's adoption. You may not be able to "replace all the old versions" if your protocol becomes popular, so you need to consider how you will update it anyway. Tags are worth study: If ECN had been implemented as a new IP option instead of appropriating a bit that "everyone should be ignoring" we would've avoided a lot of problems a few years ago. Differentiating between "must implement to operate" and "may implement" is also useful. Sometimes you can add this with a flag or special notation (e.g. PNG and RIFF), but for protocols you can also use negotiation: Telnet's WILL/WON'T/DO/DON'T/CAN/CAN'T system, for example. Specifying failure cases is also good: To make sure people implement reliable systems, I often design into the spec the retry protocol and have a mode (used in interoperation) that causes random failures so they have to implement the retry protocol correctly.