Class ConnectionProtocol

  • All Implemented Interfaces:
    java.lang.Runnable

    public class ConnectionProtocol
    extends AsyncService
    Version:
    $Revision: 1.68 $
    Author:
    $author$
    • Constructor Detail

      • ConnectionProtocol

        public ConnectionProtocol()
        Creates a new ConnectionProtocol object.
    • Method Detail

      • addChannelFactory

        public void addChannelFactory​(java.lang.String channelName,
                                      ChannelFactory cf)
                               throws java.io.IOException
        Parameters:
        channelName -
        cf -
        Throws:
        java.io.IOException
      • removeChannelFactory

        public void removeChannelFactory​(java.lang.String channelName)
        Parameters:
        channelName -
      • containsChannelFactory

        public boolean containsChannelFactory​(java.lang.String channelName)
        Parameters:
        channelName -
        Returns:
      • allowGlobalRequest

        public void allowGlobalRequest​(java.lang.String requestName,
                                       GlobalRequestHandler handler)
        Parameters:
        requestName -
        handler -
      • openChannel

        public boolean openChannel​(Channel channel)
                            throws java.io.IOException
        Parameters:
        channel -
        Returns:
        Throws:
        java.io.IOException
      • isConnected

        public boolean isConnected()
        Returns:
      • openChannel

        public boolean openChannel​(Channel channel,
                                   ChannelEventListener eventListener)
                            throws java.io.IOException
        Parameters:
        channel -
        eventListener -
        Returns:
        Throws:
        java.io.IOException
        SshException
      • onStop

        protected void onStop()
        Description copied from class: AsyncService

        The service thread calls this method when the thread is exiting.

        Specified by:
        onStop in class AsyncService
      • sendChannelData

        public void sendChannelData​(Channel channel,
                                    byte[] data)
                             throws java.io.IOException
        Parameters:
        channel -
        data -
        Throws:
        java.io.IOException
      • sendChannelEOF

        public void sendChannelEOF​(Channel channel)
                            throws java.io.IOException
        Parameters:
        channel -
        Throws:
        java.io.IOException
      • sendChannelExtData

        public void sendChannelExtData​(Channel channel,
                                       int extendedType,
                                       byte[] data)
                                throws java.io.IOException
        Parameters:
        channel -
        extendedType -
        data -
        Throws:
        java.io.IOException
      • sendChannelRequest

        public boolean sendChannelRequest​(Channel channel,
                                          java.lang.String requestType,
                                          boolean wantReply,
                                          byte[] requestData)
                                   throws java.io.IOException
        Parameters:
        channel -
        requestType -
        wantReply -
        requestData -
        Returns:
        Throws:
        java.io.IOException
        SshException
      • sendChannelRequestFailure

        public void sendChannelRequestFailure​(Channel channel)
                                       throws java.io.IOException
        Parameters:
        channel -
        Throws:
        java.io.IOException
      • sendChannelRequestSuccess

        public void sendChannelRequestSuccess​(Channel channel)
                                       throws java.io.IOException
        Parameters:
        channel -
        Throws:
        java.io.IOException
      • sendChannelWindowAdjust

        public void sendChannelWindowAdjust​(Channel channel,
                                            long bytesToAdd)
                                     throws java.io.IOException
        Parameters:
        channel -
        bytesToAdd -
        Throws:
        java.io.IOException
      • sendGlobalRequest

        public byte[] sendGlobalRequest​(java.lang.String requestName,
                                        boolean wantReply,
                                        byte[] requestData)
                                 throws java.io.IOException
        Parameters:
        requestName -
        wantReply -
        requestData -
        Returns:
        Throws:
        java.io.IOException
        SshException
      • getAsyncMessageFilter

        protected int[] getAsyncMessageFilter()
        Description copied from class: AsyncService

        Implement this method by returning the message ids of the asyncrounous messages your implementation wants to receive.

        Specified by:
        getAsyncMessageFilter in class AsyncService
        Returns:
      • closeChannel

        protected void closeChannel​(Channel channel)
                             throws java.io.IOException
        Parameters:
        channel -
        Throws:
        java.io.IOException
      • onGlobalRequest

        protected void onGlobalRequest​(java.lang.String requestName,
                                       boolean wantReply,
                                       byte[] requestData)
                                throws java.io.IOException
        Parameters:
        requestName -
        wantReply -
        requestData -
        Throws:
        java.io.IOException
      • onMessageReceived

        protected void onMessageReceived​(SshMessage msg)
                                  throws java.io.IOException
        Description copied from class: AsyncService

        Called by the service thread when an asyncronous message is received.

        Specified by:
        onMessageReceived in class AsyncService
        Parameters:
        msg -
        Throws:
        java.io.IOException
      • onServiceAccept

        protected void onServiceAccept()
        Description copied from class: Service

        Called when the service is accepted by the remote server.

        Specified by:
        onServiceAccept in class Service
      • onServiceInit

        protected void onServiceInit​(int startMode)
                              throws java.io.IOException
        Description copied from class: Service

        Called when the service is intialized.

        Specified by:
        onServiceInit in class Service
        Parameters:
        startMode -
        Throws:
        java.io.IOException
      • sendChannelFailure

        protected void sendChannelFailure​(Channel channel)
                                   throws java.io.IOException
        Parameters:
        channel -
        Throws:
        java.io.IOException
      • sendChannelOpenConfirmation

        protected void sendChannelOpenConfirmation​(Channel channel)
                                            throws java.io.IOException
        Parameters:
        channel -
        Throws:
        java.io.IOException
      • sendChannelOpenFailure

        protected void sendChannelOpenFailure​(long remoteChannelId,
                                              long reasonCode,
                                              java.lang.String additionalInfo,
                                              java.lang.String languageTag)
                                       throws java.io.IOException
        Parameters:
        remoteChannelId -
        reasonCode -
        additionalInfo -
        languageTag -
        Throws:
        java.io.IOException
      • sendGlobalRequestFailure

        protected void sendGlobalRequestFailure()
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • sendGlobalRequestSuccess

        protected void sendGlobalRequestSuccess​(byte[] requestData)
                                         throws java.io.IOException
        Parameters:
        requestData -
        Throws:
        java.io.IOException
      • freeChannel

        protected void freeChannel​(Channel channel)
        Parameters:
        channel -