Here’s what I was thinking. The message structure as a class. Class and attribute mark that allow the code to match the byte stream representation.
You probably have something more complex, where a header has to be unpacked before the rest of the message can be processed, which makes my solution a mess of bridge calls. Maybe it’s a bad problem space for xtUML.