Interface Channel

    • Method Detail

      • getRecipient

        long getRecipient()
        Returns:
        Remote channel UITN32 identifier
      • getLocalWindow

        Window getLocalWindow()
      • getRemoteWindow

        Window getRemoteWindow()
      • handleClose

        void handleClose()
                  throws IOException
        Invoked when SSH_MSG_CHANNEL_CLOSE received
        Throws:
        IOException - If failed to handle the message
      • handleWindowAdjust

        void handleWindowAdjust​(Buffer buffer)
                         throws IOException
        Invoked when SSH_MSG_CHANNEL_WINDOW_ADJUST received
        Parameters:
        buffer - The rest of the message data Buffer after decoding the channel identifiers
        Throws:
        IOException - If failed to handle the message
      • handleRequest

        void handleRequest​(Buffer buffer)
                    throws IOException
        Invoked when SSH_MSG_CHANNEL_REQUEST received
        Parameters:
        buffer - The rest of the message data Buffer after decoding the channel identifiers
        Throws:
        IOException - If failed to handle the message
      • handleData

        void handleData​(Buffer buffer)
                 throws IOException
        Invoked when SSH_MSG_CHANNEL_DATA received
        Parameters:
        buffer - The rest of the message data Buffer after decoding the channel identifiers
        Throws:
        IOException - If failed to handle the message
      • handleExtendedData

        void handleExtendedData​(Buffer buffer)
                         throws IOException
        Invoked when SSH_MSG_CHANNEL_EXTENDED_DATA received
        Parameters:
        buffer - The rest of the message data Buffer after decoding the channel identifiers
        Throws:
        IOException - If failed to handle the message
      • handleEof

        void handleEof()
                throws IOException
        Invoked when SSH_MSG_CHANNEL_EOF received
        Throws:
        IOException - If failed to handle the message
      • handleSuccess

        void handleSuccess()
                    throws IOException
        Invoked when SSH_MSG_CHANNEL_SUCCESS received
        Throws:
        IOException - If failed to handle the message
      • handleFailure

        void handleFailure()
                    throws IOException
        Invoked when SSH_MSG_CHANNEL_FAILURE received
        Throws:
        IOException - If failed to handle the message
      • init

        void init​(ConnectionService service,
                  Session session,
                  long id)
           throws IOException
        Invoked when the local channel is initial created
        Parameters:
        service - The ConnectionService through which the channel is initialized
        session - The Session associated with the channel
        id - The locally assigned channel identifier (UINT32 represented as a long)
        Throws:
        IOException - If failed to process the initialization
      • handleChannelRegistrationResult

        void handleChannelRegistrationResult​(ConnectionService service,
                                             Session session,
                                             long id,
                                             boolean registered)
        Invoked after being successfully registered by the connection service - should throw a RuntimeException if not registered
        Parameters:
        service - The ConnectionService through which the channel is registered
        session - The Session associated with the channel
        id - The locally assigned channel identifier (UINT32 represented as a long)
        registered - Whether registration was successful or not
      • handleChannelUnregistration

        void handleChannelUnregistration​(ConnectionService service)
        Called by the connection service to inform the channel that it has bee unregistered.
        Parameters:
        service - The ConnectionService through which the channel is unregistered
      • open

        OpenFuture open​(long recipient,
                        long rwSize,
                        long packetSize,
                        Buffer buffer)
        For a server channel, this method will actually open the channel
        Parameters:
        recipient - Recipient identifier (UINT32 represented as a long)
        rwSize - Read/Write window size (uint32)
        packetSize - Preferred maximum packet size (uint32)
        buffer - Incoming Buffer that triggered the call. Note: the buffer's read position is exactly after the information that read to this call was decoded
        Returns:
        An OpenFuture for the channel open request
      • handleOpenSuccess

        void handleOpenSuccess​(long recipient,
                               long rwSize,
                               long packetSize,
                               Buffer buffer)
                        throws IOException
        For a client channel, this method will be called internally by the session when the confirmation has been received.
        Parameters:
        recipient - Recipient identifier (UINT32 represented as a long)
        rwSize - Read/Write window size (uint32)
        packetSize - Preferred maximum packet size (uint32)
        buffer - Incoming Buffer that triggered the call. Note: the buffer's read position is exactly after the information that read to this call was decoded
        Throws:
        IOException - If failed to handle the success
      • handleOpenFailure

        void handleOpenFailure​(Buffer buffer)
                        throws IOException
        For a client channel, this method will be called internally by the session when the server has rejected this channel opening.
        Parameters:
        buffer - Incoming Buffer that triggered the call. Note: the buffer's read position is exactly after the information that read to this call was decoded
        Throws:
        IOException - If failed to handle the success
      • writePacket

        IoWriteFuture writePacket​(Buffer buffer)
                           throws IOException
        Encode and send the given buffer. Note: for session packets the buffer has to have 5 bytes free at the beginning to allow the encoding to take place. Also, the write position of the buffer has to be set to the position of the last byte to write.
        Parameters:
        buffer - the buffer to encode and send. NOTE: the buffer must not be touched until the returned write future is completed.
        Returns:
        An IoWriteFuture that can be used to check when the packet has actually been sent
        Throws:
        IOException - if an error occurred when encoding or sending the packet