Class Service
- Direct Known Subclasses:
AsyncService,AuthenticationProtocolClient
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.
- Since:
- 0.2.0
- Version:
- $Revision: 1.42 $
- Author:
- Lee David Painter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSerivce start mode passed intoinitmethod when the service is operating in server mode.protected SshMessageStoreThe message store registered with the transport protocol to receive the service's message.static final intService start mode passed intoinitmethod when the service is operating in client mode.protected IntegerThis instances start modeprotected ServiceStateThe current state of the serviceprotected TransportProtocolThe underlying transport protocol -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StringReturns the service name.getState()Returns the state of the service.voidinit(int startMode, TransportProtocol transport) Initialize the service.protected abstract voidCalled when the service is accepted by the remote server.protected abstract voidonServiceInit(int startMode) Called when the service is intialized.protected abstract voidprotected abstract voidonStart()Called when the service is started.protected voidSends the SSH_MSG_SERVICE_ACCEPT message to the client to indicate that the local computer is accepting the remote computers service request.final voidstart()Starts the service.final voidstop()Stops the service.
-
Field Details
-
REQUESTING_SERVICE
public static final int REQUESTING_SERVICEService start mode passed intoinitmethod 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.- See Also:
-
ACCEPTING_SERVICE
public static final int ACCEPTING_SERVICESerivce start mode passed intoinitmethod 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.- See Also:
-
messageStore
The message store registered with the transport protocol to receive the service's message. -
transport
The underlying transport protocol -
startMode
This instances start mode -
state
The current state of the service
-
-
Constructor Details
-
Service
Constructs the service.
- Parameters:
serviceName- the name of the service- Since:
- 0.2.0
-
-
Method Details
-
getServiceName
Returns the service name.
- Returns:
- the serivce name
- Since:
- 0.2.0
-
start
Starts the service.
- Throws:
IOException- if an IO error occurs- Since:
- 0.2.0
-
onStart
Called when the service is started.
- Throws:
IOException- if an IO error occurs- Since:
- 0.2.0
-
getState
Returns the state of the service.
- Returns:
- the state of the service
- Since:
- 0.2.0
- See Also:
-
init
Initialize the service.
- Parameters:
startMode- the mode of the servicetransport- the underlying transport protocol- Throws:
IOException- if an IO error occurs- Since:
- 0.2.0
-
stop
public final void stop()Stops the service.
- Since:
- 0.2.0
-
onServiceAccept
Called when the service is accepted by the remote server.
- Throws:
IOException- Since:
- 0.2.0
-
onServiceInit
Called when the service is intialized.
- Parameters:
startMode- the mode of the service- Throws:
IOException- if an IO error occurs- Since:
- 0.2.0
-
onServiceRequest
- Throws:
IOException
-
sendServiceAccept
Sends the SSH_MSG_SERVICE_ACCEPT message to the client to indicate that the local computer is accepting the remote computers service request.
- Throws:
IOException- if an IO error occurs- Since:
- 0.2.0
-