pssht  latest
SSH server library written in PHP
DATA.php
1 <?php
2 
3 /*
4 * This file is part of pssht.
5 *
6 * (c) François Poirotte <clicky@erebot.net>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 
13 
17 class DATA extends Base
18 {
20  protected $data;
21 
22 
31  public function __construct($channel, $data)
32  {
33  parent::__construct($channel);
34  $this->data = $data;
35  }
36 
37  public static function getMessageId()
38  {
39  return 94;
40  }
41 
42  public function serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
43  {
44  parent::serialize($encoder);
45  $encoder->encodeString($this->data);
46  return $this;
47  }
48 
49  public static function unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
50  {
51  return new static(
52  $decoder->decodeUint32(), // channel
53  $decoder->decodeString()
54  );
55  }
56 
63  public function getData()
64  {
65  return $this->data;
66  }
67 }
$channel
Local channel identifier.
Definition: Base.php:20
__construct($channel, $data)
Definition: DATA.php:31
$data
Payload for this message.
Definition: DATA.php:20
serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
Definition: DATA.php:42
static unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
Definition: DATA.php:49