Secure iNet Factory

com.jscape.inet.ssh.transport
Class ProtocolVersion

java.lang.Object
  extended by com.jscape.inet.ssh.transport.ProtocolVersion
All Implemented Interfaces:
java.lang.Comparable

public class ProtocolVersion
extends java.lang.Object
implements java.lang.Comparable

SSH protocol identification string. This identification string must be
SSH-protoversion-softwareversion SP comments CR LF
Both the 'protoversion' and 'softwareversion' strings MUST consist of printable US-ASCII characters with the exception of whitespace characters and the minus sign (-). The 'softwareversion' string is primarily used to trigger compatibility extensions and to indicate the capabilities of an implementation. The 'comments' string SHOULD contain additional information that might be useful in solving user problems. As such, an example of a valid identification string is
SSH-2.0-billsSSH_3.6.3q3
This identification string does not contain the optional 'comments' string and is thusly terminated by a CR and LF immediately after the 'softwareversion' string.

Version:
1.0
Author:
Alex Usun

Constructor Summary
ProtocolVersion(java.lang.String banner, java.lang.String line)
           
ProtocolVersion(java.lang.String banner, java.lang.String softVersion, java.lang.String comments)
          Creates a new protocol version instance with default protocol version "2.0".
ProtocolVersion(java.lang.String banner, java.lang.String protocolVersion, java.lang.String softVersion, java.lang.String comments)
          Creates a new protocol version instance.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 java.lang.String getBanner()
          Returns the banner message.
 java.lang.String getComments()
          Returns the comments.
 java.lang.String getSoftVersion()
          Returns the software version.
 java.lang.String getVersion()
          Returns the SSH protocol version.
 int hashCode()
          Returns the object hash code.
 boolean isCompatible(ProtocolVersion that)
          Checks if two protocol version are compatible.
static ProtocolVersion readFrom(java.io.InputStream in)
           
 java.lang.String toString()
          Returns a string representation of the object.
 void writeTo(java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProtocolVersion

public ProtocolVersion(java.lang.String banner,
                       java.lang.String protocolVersion,
                       java.lang.String softVersion,
                       java.lang.String comments)
Creates a new protocol version instance.

Parameters:
banner - the banner message
protocolVersion - the current protocol version
softVersion - the software version
comments - the comments

ProtocolVersion

public ProtocolVersion(java.lang.String banner,
                       java.lang.String softVersion,
                       java.lang.String comments)
Creates a new protocol version instance with default protocol version "2.0".

Parameters:
banner - the banner message
softVersion - the software version
comments - the comments

ProtocolVersion

public ProtocolVersion(java.lang.String banner,
                       java.lang.String line)
Method Detail

readFrom

public static ProtocolVersion readFrom(java.io.InputStream in)
                                throws java.io.IOException
Parameters:
in -
Returns:
ProtocolVersion
Throws:
java.io.IOException

getBanner

public java.lang.String getBanner()
Returns the banner message.

Returns:
the banner message

getVersion

public java.lang.String getVersion()
Returns the SSH protocol version.

Returns:
the SSH protocol version

getSoftVersion

public java.lang.String getSoftVersion()
Returns the software version.

Returns:
the software version

getComments

public java.lang.String getComments()
Returns the comments.

Returns:
the comments

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object

isCompatible

public boolean isCompatible(ProtocolVersion that)
Checks if two protocol version are compatible.

Parameters:
that - peer version
Returns:
true if versions are compatible; false otherwise

hashCode

public int hashCode()
Returns the object hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
the object hash code

compareTo

public int compareTo(java.lang.Object o)
Compares this object with the specified object for order.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the object to be compared
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Parameters:
out -
Throws:
java.io.IOException

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved