decode a message packet