That wasn't my idea!

Seriously though, let's assume a robot has just processed the last message and is waiting for new bits to arrive. Then a new message "flies" in. The robot listens to these bits and stores them until a fixed header size is reached (I think it would be best if the header size was fixed for all types of messages. Theoretically you could allow to send a message to change the expected header size. But I think to get started quickly a fixed header size is more convenient.).
The header tells the robot:
- The type of processing he has to apply
- The message length
- The checksum (if we want one)
- other stuff (which I do not figure out right now)
As soon as the robot knows how long the message is he is going to receive, he starts listening to incoming bits (and stores them im a buffer) until the message size is reached. At this point an error mechanism would be helpful as it might happen that bits get lost "on the way" and in this case the robot would listen forever or even get parts of the next message. An error checker for this issue could set a time frame in which the message has to be received or the message could have some zeros appended to compensate for potentially lost bits.
As soon as enough bits are received they are treated as a message. Everything that is received after those bits should be treated as part of another message and scanned for a header-pattern.
Since we now have all the required information (as read from the header) we can right away jump into our bucket (we assume it's broadcasting-mode now) and process what's inside. We don't have to process the whole message to scan for submessage IDs (they mark and assign submessages in "single addressing mode").
Should we employ an errorcheck mechanism via checksums then, of course, we have to at least look at the whole message and apply our checksum algorithm on it. Maybe this takes some of the performance gain we acheived by not having to look for IDs and message borders.
Ok I hope things are getting clearer..
Looking forward to hearing from you guys
Rafael