Log in

No account? Create an account

Protocol design question - Journal of Omnifarious

Jan. 27th, 2007

11:58 am - Protocol design question

Previous Entry Share Next Entry


[User Picture]
Date:January 30th, 2007 11:18 pm (UTC)

The messages are datagrams, but it's unlikely that they will ever be sent directly over Ethernet. So the size of the frame of the medium they are sent with isn't very important. Each message would likely be a 'transactional unit' for whatever protocol is being implemented. For example, in the case of email each message would likely be a complete email message.

Now, message chunks are something completely different. For example in HTTP a web server will run a script that does not have an output length that's known in advance. So what the webserver does is capture the output of the script and periodically send the output its collected so far to the client. It prefixes this chunk with a length. There is a special tag (in HTTPs case, a 0 length chunk) indicating that no more chunks are to follow.

Someone else pointed out, there is no reason for intermediate nodes to be able to combine or split message chunks. It buys you very little in the way of storage or bandwidth efficiency, especially if you use a very compact encoding for the chunk lengths and intermediate hashes.

So, having all the lengths as trailers defeats the purpose in several ways. First, it requires that there be an EOM delimeter that's outside the protocol. Secondly, it is still vulnerable to message truncation, since a router can just drop trailing message chunks without invalidating things. Lastly it would be nice if the thing generating the message didn't have to keep track of all the chunks its sent so it can send a trailer with all that data.

Also, I will be using MACs, not signatures. This is because MACs can be spoofed by the recipient, and I explicitly want this. If you sign every single message you send then there is a log by which the person who gets your messages can later prove to the whole world that you sent them. One of the things about having a conversation that supposedly includes you outed on the Internet is that you can claim that you didn't necessarily say all that and that someone edited the conversation. With signatures instead of MACs, that can be proven to be a lie.

(Reply) (Parent) (Thread)