added getPacketHeader and packet encoding.