pssht  latest
SSH server library written in PHP
OPEN.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 OPEN extends Base
18 {
19  // SSH_MSG_CHANNEL_OPEN = 90
20  public function handle(
21  $msgType,
22  \fpoirotte\Pssht\Wire\Decoder $decoder,
23  \fpoirotte\Pssht\Transport $transport,
24  array &$context
25  ) {
27  $recipientChannel = $message->getChannel();
28 
29  if ($message->getType() === 'session') {
30  $response = new \fpoirotte\Pssht\Messages\CHANNEL\OPEN\CONFIRMATION(
31  $recipientChannel,
32  $this->connection->allocateChannel($message),
33  0x200000,
34  0x800000
35  );
36  } else {
37  $response = new \fpoirotte\Pssht\Messages\CHANNEL\OPEN\FAILURE(
38  $recipientChannel,
39  \fpoirotte\Pssht\Messages\CHANNEL\OPEN\FAILURE::SSH_OPEN_UNKNOWN_CHANNEL_TYPE,
40  'No such channel type'
41  );
42  }
43  $transport->writeMessage($response);
44  return true;
45  }
46 }
handle($msgType,\fpoirotte\Pssht\Wire\Decoder $decoder,\fpoirotte\Pssht\Transport $transport, array &$context)
Definition: OPEN.php:20
static unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
Definition: OPEN.php:65