Implemented erro packet encoding and decoding