|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.sshtools.j2ssh.transport.Service
|
+--com.sshtools.j2ssh.connection.ConnectionProtocol
|
+--com.sshtools.j2ssh.client.SessionClient
The SessionClient object provides authenticated remote session access through the SSH connection protocol.
Using the methods contained it it possible to start the execution of the users shell, execute a program or start an SSH subsystem. Users should refer to [SSH_CONN] for further technical information.
| Constructor Summary | |
SessionClient()
Constructor for the SessionClient object |
|
| Method Summary | |
int |
authenticate(SshAuthentication auth)
Authenticates the user using the authentication method provided. |
void |
changeTerminalDimensions(PseudoTerminal term)
Changes the terminal dimensions to the newly provided settings |
void |
close()
Closes the session |
void |
connectAsynchronously(SshConnectionProperties properties,
HostKeyVerification hostVerification)
Connects to the remote computer asynchronously. |
void |
connectSynchronously(SshConnectionProperties properties,
HostKeyVerification hostVerification)
Connects to the remote host synchronously |
boolean |
executeCommand(java.lang.String command)
Requests that the remote server start the execution of the given command. |
java.lang.String |
getAuthenticationBanner()
Returns the authenticaiton banner supplied by the remote server. |
protected java.util.List |
getAvailableAuthMethods()
Provides the list of available authentication methods for the current user |
protected java.lang.Integer |
getExitCode()
Gets the exit code of the comman exectued. |
protected abstract void |
initSession()
Called by the framework when the service is started |
protected void |
onChannelClose(Channel channel)
Called by the framework when the remote server has closed the specified channel. |
protected void |
onChannelData(Channel channel,
byte[] data)
Called by the framework when channel data arrives. |
protected void |
onChannelEOF(Channel channel)
Called by the framework when the remote server has sent EOF for the given channel |
protected void |
onChannelExtData(Channel channel,
byte[] data)
Called by the framework when ext channel data arrives. |
protected boolean |
onChannelOpen(Channel channel,
byte[] requestData)
Called by the framework when the remote server wishes to open a channel |
protected void |
onChannelRequest(Channel channel,
java.lang.String requestType,
boolean wantReply,
byte[] requestData)
Called by the framework when a channel request arrives |
protected abstract void |
onConnectionComplete()
Called after the connect has completed. |
protected abstract void |
onDisconnect(java.lang.String reason)
Called when the session is disconnecting |
protected void |
onGlobalRequest(java.lang.String requestName,
boolean wantReply,
byte[] requestData)
Called when a SSH_MSG_GLOBAL_REQUEST is received |
protected void |
onGlobalRequestFailure()
Called when a SSH_MSG_REQUEST_FAILURE is recieved |
protected void |
onGlobalRequestSuccess(byte[] requestData)
Called when the SSH_MSG_REQUEST_SUCCESS message is received |
protected void |
onServiceAccept()
Called by the framework when the service has been accepted by the remote host |
protected void |
onServiceRequest()
Called by the framwork when the remote computer requests a service. |
protected abstract void |
onSessionData(byte[] data)
Called when session data arrives |
protected abstract void |
onSessionExtData(byte[] data)
Called when extended session data arrives |
boolean |
requestPseudoTerminal(PseudoTerminal term)
Requests that the remote server allocate a psuedo terminal for the session. |
void |
sendSessionData(byte[] data)
Sends session data to the remote server |
boolean |
setEnvironmentVariable(java.lang.String name,
java.lang.String value)
Sets the environment variable for the command or shell to be started |
boolean |
startShell()
Requests that the remote server start the users shell |
boolean |
startSubsystem(java.lang.String subsystem)
Requests that the remote server executes the predefined subsystem (for example SFTP). |
| Methods inherited from class com.sshtools.j2ssh.connection.ConnectionProtocol |
closeChannel, onMessageReceived, onServiceInit, openChannel, sendChannelData, sendChannelEOF, sendChannelExtData, sendChannelFailure, sendChannelOpenConfirmation, sendChannelOpenFailure, sendChannelRequest, sendChannelSuccess, sendChannelWindowAdjust, sendGlobalRequest, sendGlobalRequestFailure, sendGlobalRequestSuccess |
| Methods inherited from class com.sshtools.j2ssh.transport.Service |
getExchangeHash, getMessageStore, getServiceName, getTransportLayer, onThreadException, run, start, stop, waitForSingleMessage |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SessionClient()
| Method Detail |
protected abstract void initSession()
throws TransportProtocolException,
ServiceOperationException
ServiceOperationException - Throw if any service exception
occurs
TransportProtocolException - May be thrown by transport
protocol methods usedprotected java.util.List getAvailableAuthMethods()
protected java.lang.Integer getExitCode()
public boolean startShell()
throws TransportProtocolException,
ServiceOperationException
ServiceOperationException - Throw if any service exception
occurs
TransportProtocolException - May be thrown by transport
protocol methods used
public boolean setEnvironmentVariable(java.lang.String name,
java.lang.String value)
throws TransportProtocolException,
ServiceOperationException
name - The environment variable namevalue - The environment variable value
ServiceOperationException - Throw if any service exception
occurs
TransportProtocolException - May be thrown by transport
protocol methods used
public void changeTerminalDimensions(PseudoTerminal term)
throws TransportProtocolException,
ServiceOperationException
term - The pseudo terminal instance
ServiceOperationException - Throw if any service exception
occurs
TransportProtocolException - May be thrown by transport
protocol methods used
public boolean requestPseudoTerminal(PseudoTerminal term)
throws TransportProtocolException,
ServiceOperationException
term - The terminal answerback mode
ServiceOperationException - Throw if any service exception
occurs
TransportProtocolException - May be thrown by transport
protocol methods used
public boolean executeCommand(java.lang.String command)
throws TransportProtocolException,
ServiceOperationException
command - The command to execute
ServiceOperationException - Throw if any service exception
occurs
TransportProtocolException - May be thrown by transport
protocol methods used
public boolean startSubsystem(java.lang.String subsystem)
throws TransportProtocolException,
ServiceOperationException
subsystem - The predefined subsystem to start
ServiceOperationException - Throw if any service exception
occurs
TransportProtocolException - May be thrown by transport
protocol methods usedprotected void onChannelEOF(Channel channel)
onChannelEOF in class ConnectionProtocolchannel - The channel for which EOF was receivedprotected void onChannelClose(Channel channel)
onChannelClose in class ConnectionProtocolchannel - The channel to be closedprotected abstract void onDisconnect(java.lang.String reason)
onDisconnect in class Servicereason - The disconnection reason
protected boolean onChannelOpen(Channel channel,
byte[] requestData)
onChannelOpen in class ConnectionProtocolchannel - The channel for the requestrequestData - The extended channel open data
public void connectSynchronously(SshConnectionProperties properties,
HostKeyVerification hostVerification)
throws TransportProtocolException,
ServiceOperationException
properties - The connection propertieshostVerification - The host verification instance
ServiceOperationException - Throw if any service exception
occurs
TransportProtocolException - May be thrown by transport
protocol methods used
public void connectAsynchronously(SshConnectionProperties properties,
HostKeyVerification hostVerification)
onConnectionComplete when the connection has been
completed.
properties - The properties to connecthostVerification - The host verification instanceprotected abstract void onConnectionComplete()
public int authenticate(SshAuthentication auth)
throws TransportProtocolException,
AuthenticationProtocolException,
ServiceOperationException
auth - The authenticaiton method
instance
AuthenticationProtocolException
ServiceOperationException
TransportProtocolException
public void close()
throws TransportProtocolException,
ServiceOperationException
ServiceOperationException
TransportProtocolExceptionpublic java.lang.String getAuthenticationBanner()
protected void onGlobalRequest(java.lang.String requestName,
boolean wantReply,
byte[] requestData)
onGlobalRequest in class ConnectionProtocolrequestName - The request namewantReply - Does the remote computer wnat a reply?requestData - The request dataprotected void onGlobalRequestFailure()
onGlobalRequestFailure in class ConnectionProtocolprotected void onGlobalRequestSuccess(byte[] requestData)
onGlobalRequestSuccess in class ConnectionProtocolrequestData - The request data
protected void onChannelData(Channel channel,
byte[] data)
onChannelData in class ConnectionProtocolchannel - The channel receiving the datadata - The data receivedprotected abstract void onSessionData(byte[] data)
data - The unprocessed session data
protected void onChannelExtData(Channel channel,
byte[] data)
onChannelExtData in class ConnectionProtocolchannel - The channel for which the data has arriveddata - The extended dataprotected abstract void onSessionExtData(byte[] data)
data - The extended session data
protected void onChannelRequest(Channel channel,
java.lang.String requestType,
boolean wantReply,
byte[] requestData)
onChannelRequest in class ConnectionProtocolchannel - The channel for which the request was maderequestType - The request typewantReply - Whether the remote side wants an explicit replyrequestData - The request data
protected void onServiceAccept()
throws ServiceOperationException
onServiceAccept in class ServiceServiceOperationException - Thrownprotected void onServiceRequest()
onServiceRequest in class Service
public void sendSessionData(byte[] data)
throws WindowSpaceNotAvailableException,
TransportProtocolException
data - The data to send
WindowSpaceNotAvailableException
TransportProtocolException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||