Implemented encoding and decoding of packet payloads.