encode() публичный Метод

public encode ( )
 public function encode()
 {
     parent::encode();
     $this->buffer .= Binary::writeLong($this->clientID);
     $this->buffer .= Binary::writeLong($this->session);
     $this->buffer .= "";
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= RakLib::MAGIC;
     $this->buffer .= chr($this->protocol);
     $this->buffer .= str_repeat(chr(0x0), $this->mtuSize - 18);
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= \pack("NN", $this->clientID >> 32, $this->clientID & 0xffffffff);
     $this->buffer .= \pack("NN", $this->sendPing >> 32, $this->sendPing & 0xffffffff);
     $this->buffer .= \chr($this->useSecurity ? 1 : 0);
 }
 public function encode()
 {
     parent::encode();
     $this->put(RakLib::MAGIC);
     $this->putByte($this->protocol);
     $this->put(str_repeat(chr(0x0), $this->mtuSize - 18));
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= Binary::writeLong($this->clientID);
     $this->buffer .= Binary::writeLong($this->sendPing);
     $this->buffer .= \chr($this->useSecurity ? 1 : 0);
 }
Пример #6
0
 public function encode()
 {
     parent::encode();
     $this->buffer .= \substr(\pack("V", $this->seqNumber), 0, -1);
     foreach ($this->packets as $packet) {
         $this->buffer .= $packet instanceof EncapsulatedPacket ? $packet->toBinary() : (string) $packet;
     }
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= RakLib::MAGIC;
     $this->putAddress($this->serverAddress, $this->serverPort, 4);
     $this->buffer .= \pack("n", $this->mtuSize);
     $this->buffer .= \pack("NN", $this->clientID >> 32, $this->clientID & 0xffffffff);
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= \pack("NN", $this->pingID >> 32, $this->pingID & 4294967295.0);
     $this->buffer .= \pack("NN", $this->serverID >> 32, $this->serverID & 4294967295.0);
     $this->buffer .= RakLib::MAGIC;
     $this->putString($this->serverName);
 }
 public function encode()
 {
     parent::encode();
     $this->putLong($this->pingID);
     $this->putLong($this->serverID);
     $this->put(RakLib::MAGIC);
     $this->putString($this->serverName);
 }
 public function encode()
 {
     parent::encode();
     $this->put(RakLib::MAGIC);
     $this->putAddress($this->serverAddress, $this->serverPort, 4);
     $this->putShort($this->mtuSize);
     $this->putLong($this->clientID);
 }
Пример #11
0
 public function encode()
 {
     parent::encode();
     $this->buffer .= RakLib::MAGIC;
     $this->putAddress($this->serverAddress, $this->serverPort, 4);
     $this->buffer .= \pack("n", $this->mtuSize);
     $this->buffer .= Binary::writeLong($this->clientID);
 }
Пример #12
0
 public function encode()
 {
     parent::encode();
     $this->buffer .= Binary::writeLong($this->pingID);
     $this->buffer .= Binary::writeLong($this->serverID);
     $this->buffer .= RakLib::MAGIC;
     $this->putString($this->serverName);
 }
Пример #13
0
 public function encode()
 {
     parent::encode();
     $this->put(RakLib::MAGIC);
     $this->putLong($this->serverID);
     $this->putByte(0);
     //Server security
     $this->putShort($this->mtuSize);
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= RakLib::MAGIC;
     $this->buffer .= \pack("NN", $this->serverID >> 32, $this->serverID & 0xffffffff);
     $this->buffer .= \chr(0);
     //Server security
     $this->buffer .= \pack("n", $this->mtuSize);
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= RakLib::MAGIC;
     $this->buffer .= Binary::writeLong($this->serverID);
     $this->buffer .= \chr(0);
     //Server security
     $this->buffer .= \pack("n", $this->mtuSize);
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= RakLib::MAGIC;
     $this->buffer .= Binary::writeLong($this->serverID);
     $this->putAddress($this->clientAddress, $this->clientPort, 4);
     $this->buffer .= pack("n", $this->mtuSize);
     $this->buffer .= chr(0);
     //server security
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= RakLib::MAGIC;
     $this->buffer .= \pack("NN", $this->serverID >> 32, $this->serverID & 4294967295.0);
     $this->putAddress($this->clientAddress, $this->clientPort, 4);
     $this->buffer .= \pack("n", $this->mtuSize);
     $this->buffer .= \chr(0);
     //server security
 }
 public function encode()
 {
     parent::encode();
     $this->put(RakLib::MAGIC);
     $this->put(0);
     //client security (5 bytes?)
     $this->putShort($this->serverPort);
     $this->putShort($this->mtuSize);
     $this->putLong($this->clientID);
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= RakLib::MAGIC;
     $this->buffer .= chr("4");
     $this->buffer .= "3f57febe";
     $this->buffer .= pack("n", $this->serverPort);
     $this->buffer .= pack("n", $this->mtuSize);
     $this->buffer .= Binary::writeLong($this->clientID);
 }
Пример #20
0
 public function encode()
 {
     parent::encode();
     $this->put(RakLib::MAGIC);
     $this->putLong($this->serverID);
     $this->putAddress($this->clientAddress, $this->clientPort, 4);
     $this->putShort($this->mtuSize);
     $this->putByte(0);
     //server security
 }
 public function encode()
 {
     parent::encode();
     $this->putAddress($this->address, $this->port, 4);
     $this->buffer .= pack("n", 0);
     for ($i = 0; $i < 10; ++$i) {
         $this->putAddress($this->systemAddresses[$i][0], $this->systemAddresses[$i][1], $this->systemAddresses[$i][2]);
     }
     $this->buffer .= Binary::writeLong($this->sendPing);
     $this->buffer .= Binary::writeLong($this->sendPong);
 }
 public function encode()
 {
     parent::encode();
     $this->putAddress($this->address, $this->port, 4);
     $this->buffer .= \pack("n", 0);
     for ($i = 0; $i < 10; ++$i) {
         $this->putAddress($this->systemAddresses[$i][0], $this->systemAddresses[$i][1], $this->systemAddresses[$i][2]);
     }
     $this->buffer .= \pack("NN", $this->sendPing >> 32, $this->sendPing & 0xffffffff);
     $this->buffer .= \pack("NN", $this->sendPong >> 32, $this->sendPong & 0xffffffff);
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= "?Wþ";
     //cookie
     $this->buffer .= "Í";
     //security flags
     $this->buffer .= pack("n", $this->port);
     $this->putDataArray(["õÿÿõ", "ÿÿÿÿ", "ÿÿÿÿ", "ÿÿÿÿ", "ÿÿÿÿ", "ÿÿÿÿ", "ÿÿÿÿ", "ÿÿÿÿ", "ÿÿÿÿ", "ÿÿÿÿ"]);
     $this->buffer .= "";
     $this->buffer .= Binary::writeLong($this->session);
     $this->buffer .= Binary::writeLong($this->session2);
 }
 public function encode()
 {
     parent::encode();
     $payload = "";
     \sort($this->packets, SORT_NUMERIC);
     $count = \count($this->packets);
     $records = 0;
     if ($count > 0) {
         $pointer = 1;
         $start = $this->packets[0];
         $last = $this->packets[0];
         while ($pointer < $count) {
             $current = $this->packets[$pointer++];
             $diff = $current - $last;
             if ($diff === 1) {
                 $last = $current;
             } elseif ($diff > 1) {
                 //Forget about duplicated packets (bad queues?)
                 if ($start === $last) {
                     $payload .= "";
                     $payload .= \substr(\pack("V", $start), 0, -1);
                     $start = $last = $current;
                 } else {
                     $payload .= "";
                     $payload .= \substr(\pack("V", $start), 0, -1);
                     $payload .= \substr(\pack("V", $last), 0, -1);
                     $start = $last = $current;
                 }
                 ++$records;
             }
         }
         if ($start === $last) {
             $payload .= "";
             $payload .= \substr(\pack("V", $start), 0, -1);
         } else {
             $payload .= "";
             $payload .= \substr(\pack("V", $start), 0, -1);
             $payload .= \substr(\pack("V", $last), 0, -1);
         }
         ++$records;
     }
     $this->buffer .= \pack("n", $records);
     $this->buffer .= $payload;
 }
Пример #25
0
 public function encode()
 {
     parent::encode();
     $payload = "";
     sort($this->packets, SORT_NUMERIC);
     $count = count($this->packets);
     $records = 0;
     if ($count > 0) {
         $pointer = 1;
         $start = $this->packets[0];
         $last = $this->packets[0];
         while ($pointer < $count) {
             $current = $this->packets[$pointer++];
             $diff = $current - $last;
             if ($diff === 1) {
                 $last = $current;
             } elseif ($diff > 1) {
                 //Forget about duplicated packets (bad queues?)
                 if ($start === $last) {
                     $payload .= "";
                     $payload .= Binary::writeLTriad($start);
                     $start = $last = $current;
                 } else {
                     $payload .= "";
                     $payload .= Binary::writeLTriad($start);
                     $payload .= Binary::writeLTriad($last);
                     $start = $last = $current;
                 }
                 ++$records;
             }
         }
         if ($start === $last) {
             $payload .= "";
             $payload .= Binary::writeLTriad($start);
         } else {
             $payload .= "";
             $payload .= Binary::writeLTriad($start);
             $payload .= Binary::writeLTriad($last);
         }
         ++$records;
     }
     $this->putShort($records);
     $this->buffer .= $payload;
 }
Пример #26
0
 public function encode()
 {
     parent::encode();
     $this->buffer .= Binary::writeLong($this->pingID);
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= \pack("NN", $this->pingID >> 32, $this->pingID & 4294967295.0);
 }
 public function encode()
 {
     parent::encode();
     $this->buffer .= \pack("NN", $this->pingID >> 32, $this->pingID & 0xffffffff);
 }
Пример #29
0
 public function encode()
 {
     parent::encode();
     $this->putLong($this->pingID);
     $this->put(RakLib::MAGIC);
 }
Пример #30
0
 public function sendPacket(Packet $packet, $dest, $port)
 {
     $packet->encode();
     $this->sendBytes += $this->socket->writePacket($packet->buffer, $dest, $port);
 }