|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindbright.ssh2.SSH2Channel
This is the abstract base class for all channels as defined in the connection
protocol spec. Each channel has a specific type (e.g. session). Each channel
type is implemented by a subclass to this class. This base class makes no
assumptions as to how data is handled by the channel it only implements
methods which are used from the multiplexing code in
SSH2Connection
.
When implementing a new channel type or implementing an existing one
differntly from what available one typically subclasses
SSH2StreamChannel
instead of SSH2Channel
directly
since it implements the notion of streams (through use of
java.io.InputStream
and java.io.OutputStream
) and
flow control. Only a very specific implementation of a channel would need to
subclass SSH2Channel
directly.
SSH2Connection
,
SSH2StreamChannel
Field Summary | |
protected int |
channelId
|
protected int |
channelType
|
protected java.util.Vector |
closeListeners
|
protected boolean |
closeReceived
|
protected boolean |
closeSent
|
protected SSH2Connection |
connection
|
protected java.lang.Object |
creator
|
protected boolean |
deleted
|
protected boolean |
eofReceived
|
protected boolean |
eofSent
|
protected java.lang.Object |
openMonitor
|
protected int |
openStatus
|
protected int |
peerChanId
|
protected int |
rxCurrWinSz
|
protected int |
rxInitWinSz
|
protected int |
rxMaxPktSz
|
static int |
STATUS_CLOSED
|
static int |
STATUS_FAILED
|
static int |
STATUS_OPEN
|
static int |
STATUS_UNDEFINED
|
protected int |
txCurrWinSz
|
protected int |
txInitWinSz
|
protected int |
txMaxPktSz
|
Constructor Summary | |
protected |
SSH2Channel(int channelType,
SSH2Connection connection,
java.lang.Object creator)
Create a new channel of the given type. |
Method Summary | |
void |
addCloseListener(SSH2ChannelCloseListener closeListener)
Add a listener which is notified when the channel is closed. |
void |
close()
Close the channel. |
protected abstract void |
closeImpl()
Channel specific handler for the recipent of a channel close message. |
protected void |
data(SSH2TransportPDU pdu)
Handle incoming data on the channel. |
protected abstract void |
eofImpl()
Channel specific handler for the recipent of an EOF. |
protected void |
extData(SSH2TransportPDU pdu)
Handle incoming extended data on the channel. |
SSH2Connection |
getConnection()
Get the connection a channel is using. |
java.lang.Object |
getCreator()
Get the channel creator object reference. |
int |
getId()
Get the local id of the channel. |
int |
getPeerId()
Get the peer if of the channel. |
java.lang.String |
getType()
Get the type of channel. |
protected void |
handleRequest(SSH2TransportPDU pdu)
Handle incoming channel request. |
protected abstract void |
handleRequestImpl(java.lang.String reqType,
boolean wantReply,
SSH2TransportPDU pdu)
Channel specific handler for incoming channel requests. |
protected void |
init(int peerChanId,
int txInitWinSz,
int txMaxPktSz)
|
protected void |
openConfirmation(SSH2TransportPDU pdu)
Handle the open confirmation packet from the transport layer. |
protected abstract void |
openConfirmationImpl(SSH2TransportPDU pdu)
Channel specific handling of open confirmations. |
protected void |
openFailure(int reasonCode,
java.lang.String reasonText,
java.lang.String langTag)
Called when the channel open failed. |
protected abstract boolean |
openFailureImpl(int reasonCode,
java.lang.String reasonText,
java.lang.String langTag)
Channel specific handling of open failures. |
int |
openStatus()
Checks if the channel currently is open or not. |
protected void |
recvClose()
Handle the recipent of an channel close message. |
protected void |
recvEOF()
Handle the recipent of an EOF. |
void |
removeCloseListener(SSH2ChannelCloseListener closeListener)
Remove a listener which were to be notified when the channel were closed. |
protected void |
requestFailure(SSH2TransportPDU pdu)
Handle negative request response. |
protected void |
requestSuccess(SSH2TransportPDU pdu)
Handle positive request response. |
protected void |
sendClose()
Send a channel close request. |
protected void |
sendEOF()
Send channel EOF. |
protected void |
transmit(SSH2TransportPDU pdu)
|
void |
waitUntilClosed()
Wait until the channel is closed. |
protected void |
windowAdjust(SSH2TransportPDU pdu)
Handle a window adjust message. |
protected abstract void |
windowAdjustImpl(int inc)
Channel specific implementation of window adjust messages. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int STATUS_UNDEFINED
public static final int STATUS_OPEN
public static final int STATUS_CLOSED
public static final int STATUS_FAILED
protected SSH2Connection connection
protected java.util.Vector closeListeners
protected int channelType
protected int channelId
protected int peerChanId
protected int rxMaxPktSz
protected int rxInitWinSz
protected int rxCurrWinSz
protected int txInitWinSz
protected int txCurrWinSz
protected int txMaxPktSz
protected volatile boolean eofSent
protected volatile boolean eofReceived
protected volatile boolean closeReceived
protected volatile boolean closeSent
protected volatile boolean deleted
protected java.lang.Object creator
protected java.lang.Object openMonitor
protected int openStatus
Constructor Detail |
protected SSH2Channel(int channelType, SSH2Connection connection, java.lang.Object creator)
channelType
- Type of channel to create. Channel types are
defined in SSH2Connection
and starts with
CH_TYPE
.connection
- The ssh connection to associate the channel with.creator
- The object the channel is created from.Method Detail |
protected final void openConfirmation(SSH2TransportPDU pdu)
pdu
- Confirmation packet.protected final void openFailure(int reasonCode, java.lang.String reasonText, java.lang.String langTag)
reasonCode
- Code which tells why the open failed. See the
ssh protocol drafts for values.reasonText
- A text explaining why the open failed.langTag
- Tag identifying the language of the reason text.protected final void windowAdjust(SSH2TransportPDU pdu)
pdu
- The window adjust packet.protected void data(SSH2TransportPDU pdu)
pdu
- The data packet.protected void extData(SSH2TransportPDU pdu)
pdu
- The data packet.protected final void handleRequest(SSH2TransportPDU pdu)
pdu
- The request packet.protected void requestSuccess(SSH2TransportPDU pdu)
pdu
- The response packet.protected void requestFailure(SSH2TransportPDU pdu)
pdu
- The response packet.protected final void recvEOF()
protected final void recvClose()
protected final void sendEOF()
protected final void sendClose()
protected void init(int peerChanId, int txInitWinSz, int txMaxPktSz)
protected void transmit(SSH2TransportPDU pdu)
public int openStatus()
STATUS_OPEN
,
STATUS_CLOSED
or STATUS_FAILED
public void waitUntilClosed()
public final void close()
public java.lang.String getType()
public int getId()
public int getPeerId()
public java.lang.Object getCreator()
public SSH2Connection getConnection()
protected abstract void openConfirmationImpl(SSH2TransportPDU pdu)
pdu
- Confirmation packet.protected abstract boolean openFailureImpl(int reasonCode, java.lang.String reasonText, java.lang.String langTag)
reasonCode
- Code which tells why the open failed. See the
ssh protocol drafts for values.reasonText
- A text explaining why the open failed.langTag
- Tag identifying the language of the reason text.protected abstract void windowAdjustImpl(int inc)
inc
- The amount to increase the window with.protected abstract void eofImpl()
protected abstract void closeImpl()
protected abstract void handleRequestImpl(java.lang.String reqType, boolean wantReply, SSH2TransportPDU pdu)
reqType
- The type of request.wantReply
- True if an reply is expected.pdu
- The actual channel request.public final void addCloseListener(SSH2ChannelCloseListener closeListener)
closeListener
- The listener to add.public void removeCloseListener(SSH2ChannelCloseListener closeListener)
closeListener
- The listener to remove.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |