Generating and encoding messages with dynamic allocaiton