src/Handlers/CHANNEL/OPEN.php
public function handle(
        $msgType,
        \fpoirotte\Pssht\Wire\Decoder $decoder,
        \fpoirotte\Pssht\Transport $transport,
        array &$context
    ) {
        $message            = \fpoirotte\Pssht\Messages\CHANNEL\OPEN::unserialize($decoder);
        $recipientChannel   = $message->getChannel();

        if ($message->getType() === 'session') {
            $response = new \fpoirotte\Pssht\Messages\CHANNEL\OPEN\CONFIRMATION(
                $recipientChannel,
                $this->connection->allocateChannel($message),
                0x200000,
                0x800000
            );
        } else {
            $response = new \fpoirotte\Pssht\Messages\CHANNEL\OPEN\FAILURE(
                $recipientChannel,
                \fpoirotte\Pssht\Messages\CHANNEL\OPEN\FAILURE::SSH_OPEN_UNKNOWN_CHANNEL_TYPE,
                'No such channel type'
            );
        }
        $transport->writeMessage($response);
        return true;
    }
public function handle(
        $msgType,
        \fpoirotte\Pssht\Wire\Decoder $decoder,
        \fpoirotte\Pssht\Transport $transport,
        array &$context
    ) {
        $message            = \fpoirotte\Pssht\Messages\CHANNEL\OPEN::unserialize($decoder);
        $recipientChannel   = $message->getChannel();

        if ($message->getType() === 'session') {
            $response = new \fpoirotte\Pssht\Messages\CHANNEL\OPEN\CONFIRMATION(
                $recipientChannel,
                $this->connection->allocateChannel($message),
                0x200000,
                0x800000
            );
        } else {
            $response = new \fpoirotte\Pssht\Messages\CHANNEL\OPEN\FAILURE(
                $recipientChannel,
                \fpoirotte\Pssht\Messages\CHANNEL\OPEN\FAILURE::SSH_OPEN_UNKNOWN_CHANNEL_TYPE,
                'No such channel type'
            );
        }
        $transport->writeMessage($response);
        return true;
    }
public function handle ( $ msgType , \ fpoirotte \ Pssht \ Wire \ Decoder $ decoder , \ fpoirotte \ Pssht \ Transport $ transport , array & $ context ) { $ message = \ fpoirotte \ Pssht \ Messages \ CHANNEL \ OPEN :: unserialize ( $ decoder ) ; $ recipientChannel = $ message -> getChannel ( ) ; if ( $ message -> getType ( ) === 'session' ) { $ response = new \ fpoirotte \ Pssht \ Messages \ CHANNEL \ OPEN \ CONFIRMATION ( $ recipientChannel , $ this -> connection -> allocateChannel ( $ message ) , 0x200000 , 0x800000 ) ; } else { $ response = new \ fpoirotte \ Pssht \ Messages \ CHANNEL \ OPEN \ FAILURE ( $ recipientChannel , \ fpoirotte \ Pssht \ Messages \ CHANNEL \ OPEN \ FAILURE :: SSH_OPEN_UNKNOWN_CHANNEL_TYPE , 'No such channel type' ) ; } $ transport -> writeMessage ( $ response ) ; return true ; }
SSH_MSG_CHANNEL_OPEN = 90
SSH_MSG_CHANNEL_OPEN = 90