com.sshtools.j2ssh.connection
Class Channel

java.lang.Object
  |
  +--com.sshtools.j2ssh.connection.Channel

public class Channel
extends java.lang.Object

Implements an SSH connection protocol channel.

Version:
1.0
Author:
Lee David Painter ( lee@sshtools.com )

Constructor Summary
Channel(java.lang.String channelType, long remoteChannelId, long remoteWindowSize, long remotePacketSize)
           Constructor for the Channel when the channel request comes from the remote side.
Channel(java.lang.String channelName, java.lang.String channelType, long windowSize, long packetSize)
           The constructor for the Channel when the local side request the channel to be opened.
 
Method Summary
protected  void close()
           Closes the channel.
protected  void consumeLocalWindow(long count)
           Consumes local window space.
protected  void consumeRemoteWindow(long count)
           Consumes remote window space.
 java.lang.String getChannelName()
           Gets the channel name.
 byte[] getChannelOpenData()
           Gets the SSH_MSG_CHANNEL_OPEN message data.
 java.lang.String getChannelType()
           Gets the channel type.
 long getLocalChannelId()
           Returns the local channel id.
 long getLocalPacketSize()
           Gets the local maximum packet size.
 long getLocalWindowSize()
           Returns the current local window size.
 long getRemoteChannelId()
           Returns the remote channel id.
 long getRemotePacketSize()
           Gets the remote maximum packet size.
 long getRemoteWindowSize()
           Returns the current remote window size.
 void increaseLocalWindowSize(long count)
           Increases the local window size.
protected  void increaseRemoteWindowSize(long count)
           Increases the remote window size.
 boolean isClosed()
           Returns true if the channel is closed.
 boolean isLocalEOF()
           Returns true if the local side is EOF.
 boolean isRemoteEOF()
           Returns true if the remote side is EOF.
 void setChannelOpenData(byte[] data)
           Sets the SSH_MSG_CHANNEL_OPEN request data.
protected  void setLocalEOF()
           Sets the local side as End Of File.
protected  void setLocalPacketSize(long packetSize)
           Sets the local maximum packet size.
protected  void setRemoteChannelId(long channelId)
           Sets the remote channel id.
protected  void setRemoteEOF()
           Sets the remote side as End Of File.
protected  void setRemotePacketSize(long packetSize)
           Sets the remote maximum packet size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Channel

public Channel(java.lang.String channelName,
               java.lang.String channelType,
               long windowSize,
               long packetSize)

The constructor for the Channel when the local side request the channel to be opened.

Parameters:
channelName - The channel name (this can be anything you want to identify with)
channelType - The SSH channel type
windowSize - The local window size for the channel
packetSize - The maximum packet size

Channel

public Channel(java.lang.String channelType,
               long remoteChannelId,
               long remoteWindowSize,
               long remotePacketSize)

Constructor for the Channel when the channel request comes from the remote side.

Parameters:
channelType - The SSH channel type
remoteChannelId - The remote sides channel id
remoteWindowSize - The remote sides window size
remotePacketSize - The remote sides maximum packet size
Method Detail

setChannelOpenData

public void setChannelOpenData(byte[] data)

Sets the SSH_MSG_CHANNEL_OPEN request data.

Parameters:
data -

getChannelOpenData

public byte[] getChannelOpenData()

Gets the SSH_MSG_CHANNEL_OPEN message data.

Returns:

getChannelType

public java.lang.String getChannelType()

Gets the channel type.

Returns:

getChannelName

public java.lang.String getChannelName()

Gets the channel name. This is a descriptive name that you can use to identify the channel to your own application.

Returns:

getLocalChannelId

public long getLocalChannelId()

Returns the local channel id.

Returns:

getLocalWindowSize

public long getLocalWindowSize()

Returns the current local window size.

Returns:

getRemoteWindowSize

public long getRemoteWindowSize()

Returns the current remote window size.

Returns:

getRemoteChannelId

public long getRemoteChannelId()

Returns the remote channel id.

Returns:

increaseLocalWindowSize

public void increaseLocalWindowSize(long count)

Increases the local window size.

Parameters:
count - The number of bytes to add.

increaseRemoteWindowSize

protected void increaseRemoteWindowSize(long count)

Increases the remote window size.

Parameters:
count - The number of bytes to add.

consumeRemoteWindow

protected void consumeRemoteWindow(long count)

Consumes remote window space.

Parameters:
count - The number of bytes to consume.

consumeLocalWindow

protected void consumeLocalWindow(long count)

Consumes local window space.

Parameters:
count - The number of bytes to consume.

setRemoteChannelId

protected void setRemoteChannelId(long channelId)

Sets the remote channel id.

Parameters:
channelId -

getRemotePacketSize

public long getRemotePacketSize()

Gets the remote maximum packet size.

Returns:

getLocalPacketSize

public long getLocalPacketSize()

Gets the local maximum packet size.

Returns:

setRemotePacketSize

protected void setRemotePacketSize(long packetSize)

Sets the remote maximum packet size.

Parameters:
packetSize -

setLocalPacketSize

protected void setLocalPacketSize(long packetSize)

Sets the local maximum packet size.

Parameters:
packetSize -

close

protected void close()

Closes the channel.


isClosed

public boolean isClosed()

Returns true if the channel is closed.

Returns:

setLocalEOF

protected void setLocalEOF()

Sets the local side as End Of File. No data can be received.


isLocalEOF

public boolean isLocalEOF()

Returns true if the local side is EOF.

Returns:

setRemoteEOF

protected void setRemoteEOF()

Sets the remote side as End Of File. No data can be sent.


isRemoteEOF

public boolean isRemoteEOF()

Returns true if the remote side is EOF.

Returns:


Copyright © 2002 Sshtools.com. All Rights Reserved.