PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
OpenConnectionRequest1.php
1<?php
2
3/*
4 * This file is part of RakLib.
5 * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/RakLib>
6 *
7 * RakLib is not affiliated with Jenkins Software LLC nor RakNet.
8 *
9 * RakLib is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 */
14
15declare(strict_types=1);
16
17namespace raklib\protocol;
18
20use function str_repeat;
21use function strlen;
22
25
26 public int $protocol = RakLib::DEFAULT_PROTOCOL_VERSION;
27 public int $mtuSize;
28
29 protected function encodePayload(PacketSerializer $out) : void{
30 $this->writeMagic($out);
31 $out->putByte($this->protocol);
32 $out->put(str_repeat("\x00", $this->mtuSize - strlen($out->getBuffer())));
33 }
34
35 protected function decodePayload(PacketSerializer $in) : void{
36 $this->readMagic($in);
37 $this->protocol = $in->getByte();
38 $this->mtuSize = strlen($in->getBuffer());
39 $in->getRemaining(); //silence unread warnings
40 }
41}
const DEFAULT_PROTOCOL_VERSION
Definition RakLib.php:24