Protocol message serialization/deserialization