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 
18 {
21 
23  protected $code;
24 
26  protected $data;
27 
28 
41  public function __construct($channel, $code, $data)
42  {
43  parent::__construct($channel);
44  $this->code = $code;
45  $this->data = $data;
46  }
47 
48  public static function getMessageId()
49  {
50  return 95;
51  }
52 
53  public function serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
54  {
55  parent::serialize($encoder);
56  $encoder->encodeUint32($this->code);
57  $encoder->encodeString($this->data);
58  return $this;
59  }
60 
61  public static function unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
62  {
63  return new static(
64  $decoder->decodeUint32(), // channel
65  $decoder->decodeUint32(),
66  $decoder->decodeString()
67  );
68  }
69 
76  public function getCode()
77  {
78  return $this->code;
79  }
80 
87  public function getData()
88  {
89  return $this->data;
90  }
91 }
__construct($channel, $code, $data)
Definition: DATA.php:41
$channel
Local channel identifier.
Definition: Base.php:20
const SSH_EXTENDED_DATA_STDERR
Assume the extended data stream is stderr.
Definition: DATA.php:20
$code
Code designating the extended data stream.
Definition: DATA.php:23
static unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
Definition: DATA.php:61
serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
Definition: DATA.php:53