Add serialize/deserialize functions for the protocol classes

Each type of actions (= messages) can be (de)serialized (converted in byte array)