示例#1
0
 /**
  * Construct a new SSH connection layer.
  *
  *  \param fpoirotte::Pssht::Transport $transport
  *      SSH transport layer.
  */
 public function __construct(\fpoirotte\Pssht\Transport $transport)
 {
     $this->channels = array();
     $transport->setHandler(\fpoirotte\Pssht\Messages\CHANNEL\OPEN::getMessageId(), new \fpoirotte\Pssht\Handlers\CHANNEL\OPEN($this))->setHandler(\fpoirotte\Pssht\Messages\CHANNEL\CLOSE::getMessageId(), new \fpoirotte\Pssht\Handlers\CHANNEL\CLOSE($this))->setHandler(\fpoirotte\Pssht\Messages\CHANNEL\REQUEST\Base::getMessageId(), new \fpoirotte\Pssht\Handlers\CHANNEL\REQUEST($this));
     foreach (array_merge(range(91, 96), array(99, 100)) as $msgId) {
         $transport->setHandler($msgId, $this);
     }
 }
示例#2
0
文件: CLOSE.php 项目: fpoirotte/pssht
 public function handle($msgType, \fpoirotte\Pssht\Wire\Decoder $decoder, \fpoirotte\Pssht\Transport $transport, array &$context)
 {
     $message = \fpoirotte\Pssht\Messages\CHANNEL\CLOSE::unserialize($decoder);
     $channel = $message->getChannel();
     $response = new \fpoirotte\Pssht\Messages\CHANNEL\CLOSE($this->connection->getChannel($channel));
     $transport->writeMessage($response);
     $this->connection->freeChannel($channel);
     return true;
 }