public class ConnectionImpl extends AbstractService implements Connection
Connection implementation.ErrorNotifiable.Utillog, name, trans| Constructor and Description |
|---|
ConnectionImpl(Transport trans)
Create with an associated
Transport. |
| Modifier and Type | Method and Description |
|---|---|
void |
attach(Channel chan)
Attach a
Channel to this connection. |
void |
attach(ForwardedChannelOpener opener)
Attach a
ForwardedChannelOpener to this connection, which will be delegated opening of any CHANNEL_OPEN packets for which it is responsible. |
void |
forget(Channel chan)
Forget an attached
Channel. |
void |
forget(ForwardedChannelOpener opener)
Forget an attached
ForwardedChannelOpener. |
Channel |
get(int id) |
ForwardedChannelOpener |
get(String chanType) |
int |
getMaxPacketSize() |
int |
getTimeoutMs() |
Transport |
getTransport() |
long |
getWindowSize() |
void |
handle(Message msg,
SSHPacket buf)
Delegate handling of some SSH packet to this object.
|
void |
join()
Wait for the situation that no channels are attached (e.g., got closed).
|
int |
nextID() |
void |
notifyError(SSHException error)
Notifies this object of an
error. |
Promise<SSHPacket,ConnectionException> |
sendGlobalRequest(String name,
boolean wantReply,
byte[] specifics)
Send an SSH global request.
|
void |
sendOpenFailure(int recipient,
OpenFailException.Reason reason,
String message)
Send a
SSH_MSG_OPEN_FAILURE for specified Reason and message. |
void |
setMaxPacketSize(int maxPacketSize)
Set the maximum packet size for the local window this connection recommends to any
Channel's that ask for
it. |
void |
setTimeoutMs(int timeoutMs)
|
void |
setWindowSize(long windowSize)
Set the size for the local window this connection recommends to any
Channel's that ask for it. |
getName, notifyUnimplemented, requestpublic void attach(Channel chan)
ConnectionChannel to this connection. A channel must be attached to the connection if it is to receive any
channel-specific data that is received.attach in interface Connectionchan - the channelpublic Channel get(int id)
get in interface Connectionid - number of the channel to retrieveChannel of specified channel number, or null if no such channel was attachedpublic ForwardedChannelOpener get(String chanType)
get in interface ConnectionchanType - channel typeForwardedChannelOpener of specified channel-type, or null if no such channel
was attachedpublic void forget(Channel chan)
ConnectionChannel.forget in interface Connectionchan - the channelpublic void forget(ForwardedChannelOpener opener)
ConnectionForwardedChannelOpener.forget in interface Connectionopener - the opener to forgetpublic void attach(ForwardedChannelOpener opener)
ConnectionForwardedChannelOpener to this connection, which will be delegated opening of any CHANNEL_OPEN packets for which it is responsible.attach in interface Connectionopener - an opener for forwarded channelspublic void handle(Message msg, SSHPacket buf) throws SSHException
SSHPacketHandlerhandle in interface SSHPacketHandlerhandle in class AbstractServicemsg - the SSH message identifierbuf - SSHPacket containing rest of the requestSSHException - if there is a non-recoverable errorpublic int getMaxPacketSize()
getMaxPacketSize in interface ConnectionChannel's that ask
for it.public Transport getTransport()
getTransport in interface ConnectionTransport.public void setMaxPacketSize(int maxPacketSize)
ConnectionChannel's that ask for
it.setMaxPacketSize in interface ConnectionmaxPacketSize - maximum packet size in bytespublic long getWindowSize()
getWindowSize in interface ConnectionChannel's that ask for it.public void setWindowSize(long windowSize)
ConnectionChannel's that ask for it.setWindowSize in interface ConnectionwindowSize - window size in bytespublic void join()
throws InterruptedException
Connectionjoin in interface ConnectionInterruptedException - if the thread is interruptedpublic int nextID()
nextID in interface ConnectionChannel can rightfully claim.public Promise<SSHPacket,ConnectionException> sendGlobalRequest(String name, boolean wantReply, byte[] specifics) throws TransportException
ConnectionsendGlobalRequest in interface Connectionname - request namewantReply - whether a reply is requestedspecifics - SSHPacket containing fields specific to the requestPromise for the reply data (in case wantReply is true) which
allows waiting on the reply, or null if a reply is not requested.TransportException - if there is an error sending the requestpublic void sendOpenFailure(int recipient,
OpenFailException.Reason reason,
String message)
throws TransportException
ConnectionSSH_MSG_OPEN_FAILURE for specified Reason and message.sendOpenFailure in interface Connectionrecipient - number of the recipient channelreason - a reason for the failuremessage - an explanatory messageTransportException - if there is a transport-layer errorpublic void notifyError(SSHException error)
ErrorNotifiableerror.notifyError in interface ErrorNotifiablenotifyError in class AbstractServicepublic void setTimeoutMs(int timeoutMs)
Connectiontimeout this connection uses for blocking operations and recommends to any other
classes that ask for it.setTimeoutMs in interface ConnectiontimeoutMs - timeout in millisecondspublic int getTimeoutMs()
getTimeoutMs in interface Connectiontimeout in milliseconds that this connection uses for blocking operations and recommends to
any other classes that ask for it.Copyright © 2009–2014. All rights reserved.