com.maverick.ssh
Class SubsystemChannel

java.lang.Object
  extended bycom.maverick.ssh.SubsystemChannel
Direct Known Subclasses:
PublicKeySubsystem, SftpSubsystemChannel

public class SubsystemChannel
extends java.lang.Object

This class provides useful methods for implementing an SSH2 subsystem. Subsystems typically send messages in the following format.

 UINT           length
 byte           type
 byte[length-1] payload
 
Messages sent using the methods of this class will have the UINT length automatically added and messages received will be unwrapped with just the type and payload being returned. Although subsystems were defined within the SSH2 connection protocol this class takes a single SshChannel as an argument to its constructor which enables subsystems to run over both SSH1 and SSH2 channels.

Author:
Lee David Painter

Constructor Summary
SubsystemChannel(SshChannel channel)
          Create a new subsystem channel.
 
Method Summary
 void close()
          Close the subsystem
protected  Packet createPacket()
          Get a packet from the available pool or create if non available
 boolean isClosed()
          Is the subsystem closed?
 byte[] nextMessage()
          Read a subsystem message from the channel inputstream.
protected  void sendMessage(byte[] msg)
          Deprecated. This has changed internally to use a Packet and it is recommended that all implementations change to use Packet's as they provide a more efficent way of sending data.
protected  void sendMessage(Packet msg)
          Write a subsystem message to the channel outputstream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubsystemChannel

public SubsystemChannel(SshChannel channel)
                 throws SshException
Create a new subsystem channel.

Parameters:
channel -
Throws:
SshException
Method Detail

isClosed

public boolean isClosed()
Is the subsystem closed?

Returns:

close

public void close()
           throws java.io.IOException
Close the subsystem

Throws:
java.io.IOException

nextMessage

public byte[] nextMessage()
                   throws SshException
Read a subsystem message from the channel inputstream. Each

Returns:
Throws:
SshException

sendMessage

protected void sendMessage(Packet msg)
                    throws SshException
Write a subsystem message to the channel outputstream.

Parameters:
msg -
Throws:
SshException

sendMessage

protected void sendMessage(byte[] msg)
                    throws SshException
Deprecated. This has changed internally to use a Packet and it is recommended that all implementations change to use Packet's as they provide a more efficent way of sending data.

Send a byte array as a message.

Parameters:
msg -
Throws:
SshException

createPacket

protected Packet createPacket()
                       throws java.io.IOException
Get a packet from the available pool or create if non available

Returns:
Throws:
java.io.IOException


Copyright © 2003 3SP LTD. All Rights Reserved.