|
static | fromBinary ($binary, $internal=false, &$offset=null) |
|
◆ __toString()
◆ fromBinary()
static fromBinary |
( |
|
$binary, |
|
|
|
$internal = false , |
|
|
& |
$offset = null |
|
) |
| |
|
static |
- Parameters
-
string | $binary | |
bool | $internal | |
int | &$offset | |
- Returns
- EncapsulatedPacket
55 $packet =
new EncapsulatedPacket();
57 $flags = ord($binary{0});
58 $packet->reliability =
$reliability = ($flags & 0b11100000) >> 5;
59 $packet->hasSplit =
$hasSplit = ($flags & 0b00010000) > 0;
67 $packet->identifierACK = null;
79 $packet->orderChannel = ord($binary{$offset++});
92 $packet->buffer = substr($binary, $offset,
$length);
◆ getTotalLength()
99 return 3 + strlen($this->buffer) + ($this->messageIndex !== null ? 3 : 0) + ($this->orderIndex !== null ? 4 : 0) + ($this->hasSplit ? 10 : 0);
◆ toBinary()
toBinary |
( |
|
$internal = false | ) |
|
- Parameters
-
- Returns
- string
109 chr(($this->reliability << 5) | ($this->hasSplit ? 0b00010000 : 0)) .
111 ($this->reliability > PacketReliability::UNRELIABLE ?
112 (($this->reliability >= PacketReliability::RELIABLE and $this->reliability !== PacketReliability::UNRELIABLE_WITH_ACK_RECEIPT) ? Binary::writeLTriad($this->messageIndex) :
"") .
113 (($this->reliability <= PacketReliability::RELIABLE_SEQUENCED and $this->reliability !== PacketReliability::RELIABLE) ? Binary::writeLTriad($this->orderIndex) . chr($this->orderChannel) :
"")
116 ($this->hasSplit ? Binary::writeInt($this->splitCount) . Binary::writeShort($this->splitID) . Binary::writeInt($this->splitIndex) :
"")
◆ $buffer
◆ $hasSplit
◆ $identifierACK
◆ $length
◆ $messageIndex
◆ $needACK
◆ $orderChannel
◆ $orderIndex
◆ $reliability
◆ $splitCount
◆ $splitID
◆ $splitIndex
The documentation for this class was generated from the following file:
- src/raklib/protocol/EncapsulatedPacket.php