public class ClientSessionImpl extends AbstractSession implements ClientSession
| Modifier and Type | Class and Description |
|---|---|
static class |
ClientSessionImpl.State |
Session.AttributeKey<T>attributes, authed, channels, clientProposal, clientVersion, closeFuture, closing, decodeLock, decoderBuffer, decoderLength, decoderState, encodeLock, factoryManager, I_C, I_S, inCipher, inCipherSize, inCompression, inMac, inMacResult, ioSession, kex, listeners, lock, log, negociated, nextChannelId, outCipher, outCipherSize, outCompression, outMac, random, requestLock, requestResult, seqi, seqo, serverProposal, serverVersion, SESSION, sessionId, uncompressBuffer, usernameAUTHED, CLOSED, TIMEOUT, WAIT_AUTH| Constructor and Description |
|---|
ClientSessionImpl(FactoryManager client,
org.apache.mina.core.session.IoSession session) |
| Modifier and Type | Method and Description |
|---|---|
AuthFuture |
authAgent(String username)
Authenticate the session with the given username using an ssh agent.
|
AuthFuture |
authPassword(String username,
String password)
Authenticate the session with the given username and password.
|
AuthFuture |
authPublicKey(String username,
KeyPair key)
Authenticate the session with the gien username and public key.
|
CloseFuture |
close(boolean immediately)
Close this session.
|
ClientChannel |
createChannel(String type)
Create a channel of the given type.
|
ClientChannel |
createChannel(String type,
String subType)
Create a channel of the given type and subtype.
|
ChannelDirectTcpip |
createDirectTcpipChannel(SshdSocketAddress local,
SshdSocketAddress remote)
Create a direct tcp-ip channel which can be used to stream data to a remote port from the server.
|
ChannelExec |
createExecChannel(String command)
Create a channel to execute a command.
|
ChannelShell |
createShellChannel()
Create a channel to start a shell.
|
ChannelSubsystem |
createSubsystemChannel(String subsystem)
Create a subsystem channel.
|
protected void |
doHandleMessage(Buffer buffer) |
ClientFactoryManager |
getClientFactoryManager() |
KeyExchange |
getKex() |
Map<Object,Object> |
getMetadataMap()
Access to the metadata.
|
protected void |
handleMessage(Buffer buffer)
Abstract method for processing incoming decoded packets.
|
protected boolean |
readIdentification(Buffer buffer)
Read the other side identification.
|
protected void |
sendHeartBeat() |
void |
setState(ClientSessionImpl.State newState) |
protected void |
startHeartBeat() |
void |
startLocalPortForwarding(SshdSocketAddress local,
SshdSocketAddress remote)
Start forwarding the given local address on the client to the given address on the server.
|
void |
startRemotePortForwarding(SshdSocketAddress remote,
SshdSocketAddress local)
Start forwarding tcpip from the given address on the server to the
given address on the client.
|
void |
stopLocalPortForwarding(SshdSocketAddress local)
Stop forwarding the given local address.
|
void |
stopRemotePortForwarding(SshdSocketAddress remote)
Stop forwarding of the given remote address.
|
int |
waitFor(int mask,
long timeout)
Wait for a specific state.
|
addListener, attachSession, channelClose, channelData, channelEof, channelExtendedData, channelFailure, channelOpenConfirmation, channelOpenFailure, channelRequest, channelWindowAdjust, createBuffer, createProposal, decode, disconnect, doReadIdentification, exceptionCaught, getAttribute, getChannel, getFactoryManager, getIntProperty, getIoSession, getNextChannelId, getSession, getSession, getUsername, messageReceived, negociate, notImplemented, receiveKexInit, receiveNewKeys, registerChannel, removeListener, request, requestFailure, requestSuccess, sendIdentification, sendKexInit, sendNewKeys, setAttribute, unregisterChannel, writePacketpublic ClientSessionImpl(FactoryManager client, org.apache.mina.core.session.IoSession session) throws Exception
Exceptionpublic ClientFactoryManager getClientFactoryManager()
public KeyExchange getKex()
public AuthFuture authAgent(String username) throws IOException
ClientSessionauthAgent in interface ClientSessionIOExceptionpublic AuthFuture authPassword(String username, String password) throws IOException
ClientSessionauthPassword in interface ClientSessionIOExceptionpublic AuthFuture authPublicKey(String username, KeyPair key) throws IOException
ClientSessionauthPublicKey in interface ClientSessionIOExceptionpublic ClientChannel createChannel(String type) throws Exception
ClientSessioncreateChannel(type, null).createChannel in interface ClientSessionExceptionpublic ClientChannel createChannel(String type, String subType) throws Exception
ClientSessioncreateChannel in interface ClientSessionExceptionpublic ChannelShell createShellChannel() throws Exception
ClientSessioncreateShellChannel in interface ClientSessionExceptionpublic ChannelExec createExecChannel(String command) throws Exception
ClientSessioncreateExecChannel in interface ClientSessionExceptionpublic ChannelSubsystem createSubsystemChannel(String subsystem) throws Exception
ClientSessioncreateSubsystemChannel in interface ClientSessionExceptionpublic ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws Exception
ClientSessioncreateDirectTcpipChannel in interface ClientSessionExceptionpublic void startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws Exception
ClientSessionstartLocalPortForwarding in interface ClientSessionExceptionpublic void stopLocalPortForwarding(SshdSocketAddress local) throws Exception
ClientSessionstopLocalPortForwarding in interface ClientSessionExceptionpublic void startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws Exception
ClientSessionstartRemotePortForwarding in interface ClientSessionExceptionpublic void stopRemotePortForwarding(SshdSocketAddress remote) throws Exception
ClientSessionstopRemotePortForwarding in interface ClientSessionExceptionpublic CloseFuture close(boolean immediately)
AbstractSessionclose in interface ClientSessionclose in class AbstractSessionprotected void handleMessage(Buffer buffer) throws Exception
AbstractSessionhandleMessage in class AbstractSessionbuffer - the buffer containing the packetException - if an exeption occurs while handling this packet.public int waitFor(int mask,
long timeout)
ClientSessionwaitFor in interface ClientSessionpublic void setState(ClientSessionImpl.State newState)
protected void startHeartBeat()
protected void sendHeartBeat()
protected boolean readIdentification(Buffer buffer) throws IOException
AbstractSessionAbstractSession.doReadIdentification(org.apache.sshd.common.util.Buffer) and
store the result in the needed property.readIdentification in class AbstractSessionbuffer - the buffer containing the remote identificationtrue if the identification has been fully read or
false if more data is neededIOException - if an error occurs such as a bad protocol versionpublic Map<Object,Object> getMetadataMap()
ClientSessiongetMetadataMap in interface ClientSessionCopyright © 2008–2013 The Apache Software Foundation. All rights reserved.