com.sun.slamd.message
Class ClientHelloMessage

java.lang.Object
  extended by com.sun.slamd.message.Message
      extended by com.sun.slamd.message.ClientHelloMessage

public class ClientHelloMessage
extends Message

This class defines a client hello message that the client uses to identify itself to the server and optionally perform authentication so that the server can verify the identity of the client.

Author:
Neil A. Wilson

Field Summary
 
Fields inherited from class com.sun.slamd.message.Message
ASN1_TYPE_CLASS_TRANSFER_REQUEST, ASN1_TYPE_CLASS_TRANSFER_RESPONSE, ASN1_TYPE_CLIENT_HELLO, ASN1_TYPE_CLIENT_MANAGER_HELLO, ASN1_TYPE_HELLO_RESPONSE, ASN1_TYPE_JOB_COMPLETED, ASN1_TYPE_JOB_CONTROL_REQUEST, ASN1_TYPE_JOB_CONTROL_RESPONSE, ASN1_TYPE_JOB_REQUEST, ASN1_TYPE_JOB_RESPONSE, ASN1_TYPE_KEEPALIVE, ASN1_TYPE_REGISTER_STAT, ASN1_TYPE_REPORT_STAT, ASN1_TYPE_SERVER_HELLO, ASN1_TYPE_SERVER_SHUTDOWN, ASN1_TYPE_START_CLIENT_REQUEST, ASN1_TYPE_START_CLIENT_RESPONSE, ASN1_TYPE_STATUS_REQUEST, ASN1_TYPE_STATUS_RESPONSE, ASN1_TYPE_STOP_CLIENT_REQUEST, ASN1_TYPE_STOP_CLIENT_RESPONSE, messageID
 
Constructor Summary
ClientHelloMessage(int messageID, java.lang.String clientVersion, java.lang.String clientID, boolean supportsTimeSync)
          Creates a new client hello message that will only provide client version and identification information but does not perform any authentication.
ClientHelloMessage(int messageID, java.lang.String clientVersion, java.lang.String clientID, int authType, java.lang.String authID, java.lang.String authCredentials, boolean supportsTimeSync)
          Creates a new client hello message with the specified information.
ClientHelloMessage(int messageID, java.lang.String clientVersion, java.lang.String clientID, int authType, java.lang.String authID, java.lang.String authCredentials, boolean requestServerAuth, boolean restrictedMode, boolean supportsTimeSync)
          Creates a new client hello message with the specified information.
 
Method Summary
static ClientHelloMessage decodeClientHello(int messageID, ASN1Element element)
          Decodes the provided ASN.1 element as a client hello message.
 ASN1Element encode()
          Encodes this message into an ASN.1 element.
 java.lang.String getAuthCredentials()
          Retrieves the credentials that the client is using to authenticate itself.
 java.lang.String getAuthID()
          Retrieves the ID that the client is using to authenticate itself.
 int getAuthType()
          Retrieves the type of authentication that the client is using.
 java.lang.String getClientID()
          Retrieves the human-readable ID for the client.
 java.lang.String getClientVersion()
          Retrieves the version of the client software being used.
 boolean requestServerAuth()
          Indicates whether the client is requesting server authentication.
 boolean restrictedMode()
          Indicates whether the client is operating in restricted mode, in which case the server should only give it jobs for which the client was explicitly requested.
 boolean supportsTimeSync()
          Indicates whether this client supports time synchronization with the server.
 java.lang.String toString()
          Retrieves a string representation of this message.
 
Methods inherited from class com.sun.slamd.message.Message
decode, getMessageID, getMessageType, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClientHelloMessage

public ClientHelloMessage(int messageID,
                          java.lang.String clientVersion,
                          java.lang.String clientID,
                          boolean supportsTimeSync)
Creates a new client hello message that will only provide client version and identification information but does not perform any authentication.

Parameters:
messageID - The message ID for this message.
clientVersion - The version of the client software being used.
clientID - The human-readable text that can be used to identify this client.
supportsTimeSync - Indicates whether the client supports time synchronization with the server.

ClientHelloMessage

public ClientHelloMessage(int messageID,
                          java.lang.String clientVersion,
                          java.lang.String clientID,
                          int authType,
                          java.lang.String authID,
                          java.lang.String authCredentials,
                          boolean supportsTimeSync)
Creates a new client hello message with the specified information. Server authentication will not be requested.

Parameters:
messageID - The message ID for this message.
clientVersion - The version of the client software being used.
clientID - The human-readable text that can be used to identify this client.
authType - The type of authentication that the client is using.
authID - The ID that the client is using to authenticate.
authCredentials - The credentials that the client is using to authenticate.
supportsTimeSync - Indicates whether the client supports time synchronization with the server.

ClientHelloMessage

public ClientHelloMessage(int messageID,
                          java.lang.String clientVersion,
                          java.lang.String clientID,
                          int authType,
                          java.lang.String authID,
                          java.lang.String authCredentials,
                          boolean requestServerAuth,
                          boolean restrictedMode,
                          boolean supportsTimeSync)
Creates a new client hello message with the specified information.

Parameters:
messageID - The message ID for this message.
clientVersion - The version of the client software being used.
clientID - The human-readable text that can be used to identify this client.
authType - The type of authentication that the client is using.
authID - The ID that the client is using to authenticate.
authCredentials - The credentials that the client is using to authenticate.
requestServerAuth - Indicates whether the client requests that the server authenticate itself.
restrictedMode - Indicates whether the client will operate in restricted mode, in which case it should only be used to run jobs for which it is explicitly requested.
supportsTimeSync - Indicates whether the client supports time synchronization with the server.
Method Detail

getClientVersion

public java.lang.String getClientVersion()
Retrieves the version of the client software being used.

Returns:
The version of the client software being used.

getClientID

public java.lang.String getClientID()
Retrieves the human-readable ID for the client.

Returns:
The human-readable ID for the client.

getAuthType

public int getAuthType()
Retrieves the type of authentication that the client is using.

Returns:
The type of authentication that the client is using.

getAuthID

public java.lang.String getAuthID()
Retrieves the ID that the client is using to authenticate itself.

Returns:
The ID that the client is using to authenticate itself.

getAuthCredentials

public java.lang.String getAuthCredentials()
Retrieves the credentials that the client is using to authenticate itself.

Returns:
The credentials that the client is using to authenticate itself.

requestServerAuth

public boolean requestServerAuth()
Indicates whether the client is requesting server authentication.

Returns:
true if the client is requesting server authentication, or false if not.

restrictedMode

public boolean restrictedMode()
Indicates whether the client is operating in restricted mode, in which case the server should only give it jobs for which the client was explicitly requested.

Returns:
true if the client is operating in restricted mode, or false if not.

supportsTimeSync

public boolean supportsTimeSync()
Indicates whether this client supports time synchronization with the server.

Returns:
true if the client supports time synchronization, or false if not.

toString

public java.lang.String toString()
Retrieves a string representation of this message.

Overrides:
toString in class Message
Returns:
A string representation of this message.

decodeClientHello

public static ClientHelloMessage decodeClientHello(int messageID,
                                                   ASN1Element element)
                                            throws SLAMDException
Decodes the provided ASN.1 element as a client hello message.

Parameters:
messageID - The message ID to use for this message.
element - The ASN.1 element containing the ClientHello sequence.
Returns:
The client hello message decoded from the ASN.1 element.
Throws:
SLAMDException - If the provided ASN.1 element cannot be decoded as a client hello message.

encode

public ASN1Element encode()
Encodes this message into an ASN.1 element. A client hello message has the following ASN.1 syntax:

ClientHello ::= [APPLICATION 0] SEQUENCE { clientVersion OCTET STRING, clientID OCTET STRING, authentication Authentication OPTIONAL, requestServerAuth BOOLEAN OPTIONAL DEFAULT FALSE, restrictedMode BOOLEAN OPTIONAL DEFAULT FALSE } supportsTimeSync BOOLEAN OPTIONAL DEFAULT FALSE }

Specified by:
encode in class Message
Returns:
An ASN.1 encoded representation of this message.