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, username
AUTHED, 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, writePacket
public ClientSessionImpl(FactoryManager client, org.apache.mina.core.session.IoSession session) throws Exception
Exception
public ClientFactoryManager getClientFactoryManager()
public KeyExchange getKex()
public AuthFuture authAgent(String username) throws IOException
ClientSession
authAgent
in interface ClientSession
IOException
public AuthFuture authPassword(String username, String password) throws IOException
ClientSession
authPassword
in interface ClientSession
IOException
public AuthFuture authPublicKey(String username, KeyPair key) throws IOException
ClientSession
authPublicKey
in interface ClientSession
IOException
public ClientChannel createChannel(String type) throws Exception
ClientSession
createChannel(type, null)
.createChannel
in interface ClientSession
Exception
public ClientChannel createChannel(String type, String subType) throws Exception
ClientSession
createChannel
in interface ClientSession
Exception
public ChannelShell createShellChannel() throws Exception
ClientSession
createShellChannel
in interface ClientSession
Exception
public ChannelExec createExecChannel(String command) throws Exception
ClientSession
createExecChannel
in interface ClientSession
Exception
public ChannelSubsystem createSubsystemChannel(String subsystem) throws Exception
ClientSession
createSubsystemChannel
in interface ClientSession
Exception
public ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws Exception
ClientSession
createDirectTcpipChannel
in interface ClientSession
Exception
public void startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws Exception
ClientSession
startLocalPortForwarding
in interface ClientSession
Exception
public void stopLocalPortForwarding(SshdSocketAddress local) throws Exception
ClientSession
stopLocalPortForwarding
in interface ClientSession
Exception
public void startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws Exception
ClientSession
startRemotePortForwarding
in interface ClientSession
Exception
public void stopRemotePortForwarding(SshdSocketAddress remote) throws Exception
ClientSession
stopRemotePortForwarding
in interface ClientSession
Exception
public CloseFuture close(boolean immediately)
AbstractSession
close
in interface ClientSession
close
in class AbstractSession
protected void handleMessage(Buffer buffer) throws Exception
AbstractSession
handleMessage
in class AbstractSession
buffer
- the buffer containing the packetException
- if an exeption occurs while handling this packet.public int waitFor(int mask, long timeout)
ClientSession
waitFor
in interface ClientSession
public void setState(ClientSessionImpl.State newState)
protected void startHeartBeat()
protected void sendHeartBeat()
protected boolean readIdentification(Buffer buffer) throws IOException
AbstractSession
AbstractSession.doReadIdentification(org.apache.sshd.common.util.Buffer)
and
store the result in the needed property.readIdentification
in class AbstractSession
buffer
- 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()
ClientSession
getMetadataMap
in interface ClientSession
Copyright © 2008–2013 The Apache Software Foundation. All rights reserved.