public function decode() { parent::decode(); $this->buffers = []; $size = $this->getInt(); $this->payload = $this->get($size); $str = zlib_decode($this->payload, 1024 * 1024 * 64); //Max 64MB $len = strlen($str); $offset = 0; while ($offset < $len) { $pkLen = Binary::readInt(substr($str, $offset, 4)); $offset += 4; $buf = substr($str, $offset, $pkLen); $offset += $pkLen; $this->buffers[] = $buf; } //print_r($this); }
public function decode() { parent::decode(); $this->splitpackets = []; $this->packets = []; $this->seqNumber = $this->getLTriad(); while (!$this->feof()) { $offset = 0; $data = substr($this->buffer, $this->offset); $packet = EncapsulatedPacket::fromBinary($data, false, $offset); $this->offset += $offset; if (strlen($packet->buffer) === 0) { break; } if ($packet->hasSplit) { $this->splitpackets[] = $packet; } else { $this->packets[] = $packet; } } }