C++: Serialize/unserialize message