public interface Connection
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(java.lang.String chanType) |
KeepAlive |
getKeepAlive() |
int |
getMaxPacketSize() |
int |
getTimeoutMs() |
Transport |
getTransport() |
long |
getWindowSize() |
void |
join()
Wait for the situation that no channels are attached (e.g., got closed).
|
int |
nextID() |
Promise<SSHPacket,ConnectionException> |
sendGlobalRequest(java.lang.String name,
boolean wantReply,
byte[] specifics)
Send an SSH global request.
|
void |
sendOpenFailure(int recipient,
OpenFailException.Reason reason,
java.lang.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 timeout)
|
void |
setWindowSize(long windowSize)
Set the size for the local window this connection recommends to any
Channel 's that ask for it. |
void attach(Channel chan)
Channel
to this connection. A channel must be attached to the connection if it is to receive any
channel-specific data that is received.chan
- the channelvoid attach(ForwardedChannelOpener opener)
ForwardedChannelOpener
to this connection, which will be delegated opening of any CHANNEL_OPEN
packets for which it is responsible
.opener
- an opener for forwarded channelsvoid forget(ForwardedChannelOpener opener)
ForwardedChannelOpener
.opener
- the opener to forgetChannel get(int id)
id
- number of the channel to retrieveChannel
of specified channel number, or null
if no such channel was attachedvoid join() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the thread is interruptedForwardedChannelOpener get(java.lang.String chanType)
chanType
- channel typeForwardedChannelOpener
of specified channel-type, or null
if no such channel
was attachedint nextID()
Channel
can rightfully claim.Promise<SSHPacket,ConnectionException> sendGlobalRequest(java.lang.String name, boolean wantReply, byte[] specifics) throws TransportException
name
- 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 requestvoid sendOpenFailure(int recipient, OpenFailException.Reason reason, java.lang.String message) throws TransportException
SSH_MSG_OPEN_FAILURE
for specified Reason
and message
.recipient
- number of the recipient channelreason
- a reason for the failuremessage
- an explanatory messageTransportException
- if there is a transport-layer errorint getMaxPacketSize()
Channel
's that ask
for it.void setMaxPacketSize(int maxPacketSize)
Channel
's that ask for
it.maxPacketSize
- maximum packet size in byteslong getWindowSize()
Channel
's that ask for it.void setWindowSize(long windowSize)
Channel
's that ask for it.windowSize
- window size in bytesint getTimeoutMs()
void setTimeoutMs(int timeout)
timeout
this connection uses for blocking operations and recommends to any other
classes
that ask for it.timeout
- timeout in milliseconds