REformatted

This commit is contained in:
Jeroen van Erp
2016-09-02 16:08:26 +02:00
parent c0d49cf6b3
commit b90be512e7

View File

@@ -26,13 +26,15 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** A channel is the basic medium for application-layer data on top of an SSH transport. */ /**
public interface Channel * A channel is the basic medium for application-layer data on top of an SSH transport.
extends Closeable, SSHPacketHandler, ErrorNotifiable { */
public interface Channel extends Closeable, SSHPacketHandler, ErrorNotifiable {
/** Direct channels are those that are initiated by us. */ /**
interface Direct * Direct channels are those that are initiated by us.
extends Channel { */
interface Direct extends Channel {
/** /**
* Request opening this channel from remote end. * Request opening this channel from remote end.
@@ -41,27 +43,30 @@ public interface Channel
* @throws ConnectionException other connection-layer error * @throws ConnectionException other connection-layer error
* @throws TransportException error writing packets etc. * @throws TransportException error writing packets etc.
*/ */
void open() void open() throws ConnectionException, TransportException;
throws ConnectionException, TransportException;
} }
/** Forwarded channels are those that are initiated by the server. */ /**
interface Forwarded * Forwarded channels are those that are initiated by the server.
extends Channel { */
interface Forwarded extends Channel {
/** /**
* Confirm {@code CHANNEL_OPEN} request. * Confirm {@code CHANNEL_OPEN} request.
* *
* @throws TransportException error sending confirmation packet * @throws TransportException error sending confirmation packet
*/ */
void confirm() void confirm() throws TransportException;
throws TransportException;
/** @return the IP of where the forwarded connection originates. */ /**
* @return the IP of where the forwarded connection originates.
*/
String getOriginatorIP(); String getOriginatorIP();
/** @return port from which the forwarded connection originates. */ /**
* @return port from which the forwarded connection originates.
*/
int getOriginatorPort(); int getOriginatorPort();
/** /**
@@ -69,55 +74,73 @@ public interface Channel
* *
* @param reason indicate {@link OpenFailException.Reason reason} for rejection of the request * @param reason indicate {@link OpenFailException.Reason reason} for rejection of the request
* @param message indicate a message for why the request is rejected * @param message indicate a message for why the request is rejected
*
* @throws TransportException error sending rejection packet * @throws TransportException error sending rejection packet
*/ */
void reject(OpenFailException.Reason reason, String message) void reject(OpenFailException.Reason reason, String message) throws TransportException;
throws TransportException;
} }
/** Close this channel. */ /**
* Close this channel.
*/
@Override @Override
void close() void close() throws TransportException, ConnectionException;
throws TransportException, ConnectionException;
/** /**
* @return whether auto-expansion of local window is set. * @return whether auto-expansion of local window is set.
*
* @see #setAutoExpand(boolean) * @see #setAutoExpand(boolean)
*/ */
boolean getAutoExpand(); boolean getAutoExpand();
/** @return the channel ID */ /**
* @return the channel ID
*/
int getID(); int getID();
/** @return the {@code InputStream} for this channel. */ /**
* @return the {@code InputStream} for this channel.
*/
InputStream getInputStream(); InputStream getInputStream();
/** @return the maximum packet size that we have specified. */ /**
* @return the maximum packet size that we have specified.
*/
int getLocalMaxPacketSize(); int getLocalMaxPacketSize();
/** @return the current local window size. */ /**
* @return the current local window size.
*/
long getLocalWinSize(); long getLocalWinSize();
/** @return an {@code OutputStream} for this channel. */ /**
* @return an {@code OutputStream} for this channel.
*/
OutputStream getOutputStream(); OutputStream getOutputStream();
/** @return the channel ID at the remote end. */ /**
* @return the channel ID at the remote end.
*/
int getRecipient(); int getRecipient();
/** @return the maximum packet size as specified by the remote end. */ /**
* @return the maximum packet size as specified by the remote end.
*/
int getRemoteMaxPacketSize(); int getRemoteMaxPacketSize();
/** @return the current remote window size. */ /**
* @return the current remote window size.
*/
long getRemoteWinSize(); long getRemoteWinSize();
/** @return the channel type identifier. */ /**
* @return the channel type identifier.
*/
String getType(); String getType();
/** @return whether the channel is open. */ /**
* @return whether the channel is open.
*/
boolean isOpen(); boolean isOpen();
/** /**
@@ -129,11 +152,9 @@ public interface Channel
*/ */
void setAutoExpand(boolean autoExpand); void setAutoExpand(boolean autoExpand);
void join() void join() throws ConnectionException;
throws ConnectionException;
void join(long timeout, TimeUnit unit) void join(long timeout, TimeUnit unit) throws ConnectionException;
throws ConnectionException;
/** /**
* Get the LoggerFactory associated with the SSH client. * Get the LoggerFactory associated with the SSH client.