|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sshtools.j2ssh.transport.Service
public abstract class Service
This class implements the transport protocol service.
After the transport protocol negotiates the protocol version and performs
server authentication via key exchange, the client requests a service. The
service is identified by a name and currently there are 2 services defined.
ssh-userauth
ssh-connection
These 2 services are implemented by the SSH authentication protocol and SSH
connection protocol respectivley. Further services can be defined and a
similar local naming policy is applied to the service names, as is applied
to the algorithm names; a local service should use the
"servicename(at)domain" syntax.
Field Summary | |
---|---|
static int |
ACCEPTING_SERVICE
Serivce start mode passed into init method when the service
is operating in server mode. |
protected SshMessageStore |
messageStore
The message store registered with the transport protocol to receive the service's message. |
static int |
REQUESTING_SERVICE
Service start mode passed into init method when the service
is operating in client mode. |
protected java.lang.Integer |
startMode
This instances start mode |
protected ServiceState |
state
The current state of the service |
protected TransportProtocol |
transport
The underlying transport protocol |
Constructor Summary | |
---|---|
Service(java.lang.String serviceName)
Constructs the service. |
Method Summary | |
---|---|
java.lang.String |
getServiceName()
Returns the service name. |
ServiceState |
getState()
Returns the state of the service. |
void |
init(int startMode,
TransportProtocol transport)
Initialize the service. |
protected abstract void |
onServiceAccept()
Called when the service is accepted by the remote server. |
protected abstract void |
onServiceInit(int startMode)
Called when the service is intialized. |
protected abstract void |
onServiceRequest()
|
protected abstract void |
onStart()
Called when the service is started. |
protected void |
sendServiceAccept()
Sends the SSH_MSG_SERVICE_ACCEPT message to the client to indicate that the local computer is accepting the remote computers service request. |
void |
start()
Starts the service. |
void |
stop()
Stops the service. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int REQUESTING_SERVICE
init
method when the service
is operating in client mode. i.e its requesting a service to be started
on the remote server and requires a SSH_MSG_SERVICE_ACCEPT message.
public static final int ACCEPTING_SERVICE
init
method when the service
is operating in server mode. i.e a client is requesting a service to be
started on the local computer and requires the SSH_MSG_SERVICE_ACCEPT
message to be sent.
protected SshMessageStore messageStore
protected TransportProtocol transport
protected java.lang.Integer startMode
protected ServiceState state
Constructor Detail |
---|
public Service(java.lang.String serviceName)
Constructs the service.
serviceName
- the name of the serviceMethod Detail |
---|
public final java.lang.String getServiceName()
Returns the service name.
public final void start() throws java.io.IOException
Starts the service.
java.io.IOException
- if an IO error occursprotected abstract void onStart() throws java.io.IOException
Called when the service is started.
java.io.IOException
- if an IO error occurspublic ServiceState getState()
Returns the state of the service.
ServiceState
public void init(int startMode, TransportProtocol transport) throws java.io.IOException
Initialize the service.
startMode
- the mode of the servicetransport
- the underlying transport protocol
java.io.IOException
- if an IO error occurspublic final void stop()
Stops the service.
protected abstract void onServiceAccept() throws java.io.IOException
Called when the service is accepted by the remote server.
java.io.IOException
protected abstract void onServiceInit(int startMode) throws java.io.IOException
Called when the service is intialized.
startMode
- the mode of the service
java.io.IOException
- if an IO error occursprotected abstract void onServiceRequest() throws java.io.IOException
java.io.IOException
protected void sendServiceAccept() throws java.io.IOException
Sends the SSH_MSG_SERVICE_ACCEPT message to the client to indicate that the local computer is accepting the remote computers service request.
java.io.IOException
- if an IO error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |