com.maverick.sshd
Class ConnectionProtocol

java.lang.Object
  extended by com.maverick.sshd.ConnectionProtocol
All Implemented Interfaces:
Service

public class ConnectionProtocol
extends Object
implements Service

This class implements the SSH Connection Protocol as an SSH Transport Protocol service.

Author:
Lee David Painter

Field Summary
static String SERVICE_NAME
           
 
Constructor Summary
ConnectionProtocol(String username)
           
 
Method Summary
 void addGlobalRequestHandler(GlobalRequestHandler handler)
           
 void disconnect()
          Disconnect the current connection.
 List<Channel> getChannels()
           
 Connection getConnection()
           
 SshContext getContext()
          Get the connections ConfigurationContext.
 SocketAddress getLocalAddress()
          Get the local address to which the remote socket is connected.
 int getLocalPort()
          Get the local port ro which the remote socket is connected.
 SocketAddress getRemoteAddress()
          Get the address of the remote client.
 SshTransport getTransport()
          Get the underlying transport.
 String getUsername()
          Get the username for the connected user.
 String getUUID()
           
 void idle(org.apache.mina.core.session.IdleStatus status)
          Called when the transport layer has been idle for 10 seconds
 void init(org.apache.mina.core.session.IoSession session, SshTransport transport)
          Initialize the service.
 boolean openChannel(Channel channel)
           
 boolean processMessage(byte[] msg)
          Process a transport message.
 void sendChannelOpenConfirmation(Channel channel, byte[] responsedata)
           
 void sendChannelOpenFailure(Channel channel, int reason, String desc)
           
 void sendGlobalRequest(com.maverick.ssh.common.GlobalRequest request)
           
 void start()
          Start the service.
 void stop()
          Stop the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_NAME

public static final String SERVICE_NAME
See Also:
Constant Field Values
Constructor Detail

ConnectionProtocol

public ConnectionProtocol(String username)
Method Detail

init

public void init(org.apache.mina.core.session.IoSession session,
                 SshTransport transport)
          throws IOException
Description copied from interface: Service
Initialize the service.

Specified by:
init in interface Service
Throws:
IOException

addGlobalRequestHandler

public void addGlobalRequestHandler(GlobalRequestHandler handler)

getUUID

public String getUUID()

getRemoteAddress

public SocketAddress getRemoteAddress()
Get the address of the remote client.

Returns:
SocketAddress

getLocalAddress

public SocketAddress getLocalAddress()
Get the local address to which the remote socket is connected.

Returns:
InetAddress

getLocalPort

public int getLocalPort()
Get the local port ro which the remote socket is connected.

Returns:
int

getUsername

public String getUsername()
Get the username for the connected user.

Returns:
String

getChannels

public List<Channel> getChannels()

stop

public void stop()
Description copied from interface: Service
Stop the service

Specified by:
stop in interface Service

openChannel

public boolean openChannel(Channel channel)
                    throws com.maverick.ssh.common.ChannelOpenException
Throws:
com.maverick.ssh.common.ChannelOpenException

disconnect

public void disconnect()
Disconnect the current connection.


processMessage

public boolean processMessage(byte[] msg)
                       throws IOException
Description copied from interface: Service
Process a transport message. When a message is received by the TransportProtocol that is not a transport level message the message is passed onto the active service using this method. The service processes the message and returns a value to indicate whether the message was used.

Specified by:
processMessage in interface Service
Returns:
true if the message was processed, otherwise false
Throws:
IOException

sendGlobalRequest

public void sendGlobalRequest(com.maverick.ssh.common.GlobalRequest request)

sendChannelOpenConfirmation

public void sendChannelOpenConfirmation(Channel channel,
                                        byte[] responsedata)

sendChannelOpenFailure

public void sendChannelOpenFailure(Channel channel,
                                   int reason,
                                   String desc)

getContext

public SshContext getContext()
Get the connections ConfigurationContext.

Returns:
SshContext

getTransport

public SshTransport getTransport()
Get the underlying transport. Use with Caution.

Returns:
TransportProtocol

start

public void start()
Description copied from interface: Service
Start the service.

Specified by:
start in interface Service

getConnection

public Connection getConnection()

idle

public void idle(org.apache.mina.core.session.IdleStatus status)
Description copied from interface: Service
Called when the transport layer has been idle for 10 seconds

Specified by:
idle in interface Service


Copyright © 2012. All Rights Reserved.