com.sun.slamd.message
Class ServerHelloMessage

java.lang.Object
  extended bycom.sun.slamd.message.Message
      extended bycom.sun.slamd.message.ServerHelloMessage

public class ServerHelloMessage
extends Message

This class defines a server hello message that the server uses to identify itself, and optionally authenticate itself, to the client.


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
ServerHelloMessage(int messageID, java.lang.String serverVersion, java.lang.String serverID)
          Creates a new server hello message that will only provide version and identification information but does not perform any authentication.
ServerHelloMessage(int messageID, java.lang.String serverVersion, java.lang.String serverID, int authType, java.lang.String authID, java.lang.String authCredentials)
          Creates a new server hello message with the specified information.
 
Method Summary
static ServerHelloMessage decodeServerHello(int messageID, ASN1Element element)
          Decodes the provided ASN.1 element as a server hello message.
 ASN1Element encode()
          Encodes this message into an ASN.1 element.
 java.lang.String getAuthCredentials()
          Retrieves the credentials that the server is using to authenticate itself.
 java.lang.String getAuthID()
          Retrives the ID that the server is using to authenticate itself.
 int getAuthType()
          Retrieves the type of authentication that the server is using.
 java.lang.String getServerID()
          Retrieves the human-readable ID for the server.
 java.lang.String getServerVersion()
          Retrieves the version of the server software being used.
 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

ServerHelloMessage

public ServerHelloMessage(int messageID,
                          java.lang.String serverVersion,
                          java.lang.String serverID)
Creates a new server hello message that will only provide version and identification information but does not perform any authentication.

Parameters:
messageID - The message ID for this message.
serverVersion - The version of the server software being used.
serverID - The human-readable text that can be used to identify the server.

ServerHelloMessage

public ServerHelloMessage(int messageID,
                          java.lang.String serverVersion,
                          java.lang.String serverID,
                          int authType,
                          java.lang.String authID,
                          java.lang.String authCredentials)
Creates a new server hello message with the specified information. Server authentication will not be requested.

Parameters:
messageID - The message ID for this message.
serverVersion - The version of the server software being used.
serverID - The human-readable text that can be used to identify this server.
authType - The type of authentication that the server is using.
authID - The ID that the server is using to authenticate.
authCredentials - The credentials that the server is using to authenticate.
Method Detail

getServerVersion

public java.lang.String getServerVersion()
Retrieves the version of the server software being used.

Returns:
The version of the server software being used.

getServerID

public java.lang.String getServerID()
Retrieves the human-readable ID for the server.

Returns:
The human-readable ID for the server.

getAuthType

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

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

getAuthID

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

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

getAuthCredentials

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

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

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.

decodeServerHello

public static ServerHelloMessage decodeServerHello(int messageID,
                                                   ASN1Element element)
                                            throws SLAMDException
Decodes the provided ASN.1 element as a server hello message.

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

encode

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

ServerHello ::= [APPLICATION 2] SEQUENCE { serverVersion OCTET STRING, serverID OCTET STRING, authentication Authentication OPTIONAL }

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