org.ssonet.net.impl
Class SSONETProtocolImpl

java.lang.Object
  |
  +--org.ssonet.net.impl.SSONETProtocolImpl
All Implemented Interfaces:
IOStream, java.lang.Runnable, SSONETProtocolStream

public class SSONETProtocolImpl
extends java.lang.Object
implements IOStream, java.lang.Runnable, SSONETProtocolStream


Field Summary
(package private)  org.ssonet.io.IOStream basicIOStream
          The basic IOStream taken directly from the network socket (the IOStream, which is supplied, when the SSONETProtocolStream is initialized)
(package private)  org.ssonet.net.SSONETContext context
           
(package private)  org.ssonet.util.ByteFIFO dataBuffer
           
(package private)  int DATABUFFER_SIZE
           
static boolean debug
           
(package private)  boolean EOF
           
(package private)  java.io.IOException initException
           
(package private)  boolean initFinished
           
(package private)  org.ssonet.io.IOStream ioStream
          The working ioStream
(package private)  boolean isProtocolMode
           
(package private)  boolean isServer
           
(package private)  int negotiationRequested
           
(package private)  org.ssonet.io.IOStream newIOStream
          The IOStream created by a new negotiation
(package private)  java.lang.Thread protocolThread
           
(package private)  java.io.IOException readException
           
(package private)  boolean readingFinished
           
(package private)  java.lang.Object readSynchronizer
           
protected  org.ssonet.net.PhaseTwoResult securityGoalNegotiationResult
          Result of the security goal negotiation
(package private)  boolean waitForFirstNegotiationRequest
           
(package private)  boolean waitForStreamChange
           
(package private)  java.io.IOException writeException
           
(package private)  java.lang.Object writeSynchronizer
           
 
Constructor Summary
SSONETProtocolImpl(org.ssonet.io.IOStream ioStream, org.ssonet.net.SSONETContext context, boolean isServer)
          initializes a new SSONETProtocolStream.
 
Method Summary
 int available()
           
 void closeIn()
          Closes the Inputstream.
 void closeOut()
          Closes the outputStream.
 int getConnectionState()
          Returns the state the connection is in.
 org.ssonet.net.PhaseTwoResult getSecurityGoalNegotiationResult()
          Get the result of the security goal negotiation
 int read(byte[] buffer)
          Reads an array of bytes from a stream
 void requestMechanismNegotiation()
          This method can be called by an application to request a new mechanism negotation.
 void requestSecurityGoalNegotiation()
          This method can be called by an application to request a new security goal and a directly following mechanism negotation.
 void run()
          Processes messages for the ssonet protocol
 void setConnectionState(int connectionState)
          Don't call.
 void setSecurityGoalNegotiationResult(org.ssonet.net.PhaseTwoResult ptr)
          Set the result of the security goal negotiation
protected  void waitInitFinished()
          Waits until the first negotiation is finished.
 void write(byte[] buffer)
          Writes an array of bytes to a stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug

securityGoalNegotiationResult

protected org.ssonet.net.PhaseTwoResult securityGoalNegotiationResult
Result of the security goal negotiation


context

org.ssonet.net.SSONETContext context

isServer

boolean isServer

isProtocolMode

boolean isProtocolMode

ioStream

org.ssonet.io.IOStream ioStream
The working ioStream


newIOStream

org.ssonet.io.IOStream newIOStream
The IOStream created by a new negotiation


basicIOStream

org.ssonet.io.IOStream basicIOStream
The basic IOStream taken directly from the network socket (the IOStream, which is supplied, when the SSONETProtocolStream is initialized)


EOF

boolean EOF

readException

java.io.IOException readException

readSynchronizer

java.lang.Object readSynchronizer

writeException

java.io.IOException writeException

writeSynchronizer

java.lang.Object writeSynchronizer

protocolThread

java.lang.Thread protocolThread

initFinished

boolean initFinished

initException

java.io.IOException initException

waitForStreamChange

boolean waitForStreamChange

dataBuffer

org.ssonet.util.ByteFIFO dataBuffer

DATABUFFER_SIZE

int DATABUFFER_SIZE

negotiationRequested

int negotiationRequested

waitForFirstNegotiationRequest

boolean waitForFirstNegotiationRequest

readingFinished

boolean readingFinished
Constructor Detail

SSONETProtocolImpl

public SSONETProtocolImpl(org.ssonet.io.IOStream ioStream,
                          org.ssonet.net.SSONETContext context,
                          boolean isServer)
initializes a new SSONETProtocolStream.

Parameters:
isServer - true, if it is the server side, false, if it is the client side.
Method Detail

getSecurityGoalNegotiationResult

public org.ssonet.net.PhaseTwoResult getSecurityGoalNegotiationResult()
Get the result of the security goal negotiation


setSecurityGoalNegotiationResult

public void setSecurityGoalNegotiationResult(org.ssonet.net.PhaseTwoResult ptr)
Set the result of the security goal negotiation


run

public void run()
Processes messages for the ssonet protocol

Specified by:
run in interface java.lang.Runnable

read

public int read(byte[] buffer)
         throws java.io.IOException
Reads an array of bytes from a stream

Specified by:
read in interface IOStream
Parameters:
buffer - the buffer, which shall be filled with bytes read
Returns:
the number of bytes read, or -1 if the End Of Stream is reached.
Throws:
java.io.IOException - if an error occures while reading from the stream

write

public void write(byte[] buffer)
           throws java.io.IOException
Writes an array of bytes to a stream. It writes the users data. Each package gets a Header, which states, that it is a user data package

Specified by:
write in interface IOStream
Parameters:
buffer - the buffer holding the bytes to write to the stream
Throws:
java.io.IOException - if an error occures while writing to the stream

closeIn

public void closeIn()
             throws java.io.IOException
Closes the Inputstream.

Specified by:
closeIn in interface IOStream
java.io.IOException

closeOut

public void closeOut()
              throws java.io.IOException
Closes the outputStream.

Specified by:
closeOut in interface IOStream
java.io.IOException

available

public int available()
              throws java.io.IOException
Specified by:
available in interface IOStream
Returns:
the number of bytes currently available from the inputstream without blocking.
java.io.IOException

requestSecurityGoalNegotiation

public void requestSecurityGoalNegotiation()
                                    throws java.io.IOException
This method can be called by an application to request a new security goal and a directly following mechanism negotation. negotation. The security goal and mechanism configurations for this negotation must be set into the SSONETContext for this connection prior to the call to this method.

Specified by:
requestSecurityGoalNegotiation in interface SSONETProtocolStream
java.io.IOException

requestMechanismNegotiation

public void requestMechanismNegotiation()
                                 throws java.io.IOException
This method can be called by an application to request a new mechanism negotation. The mechanism configuration for this negotation must be set into the SSONETContext for this connection prior to the call to this method.

Specified by:
requestMechanismNegotiation in interface SSONETProtocolStream
java.io.IOException

waitInitFinished

protected void waitInitFinished()
                         throws java.io.IOException
Waits until the first negotiation is finished. If an exception occures during the negotiation and initialization, this method throws this exception.

java.io.IOException

setConnectionState

public void setConnectionState(int connectionState)
Description copied from interface: SSONETProtocolStream
Don't call. Sets the connections state to the given value.

Specified by:
setConnectionState in interface SSONETProtocolStream
Parameters:
connectionState - new state
See Also:
ConnectionListener

getConnectionState

public int getConnectionState()
Description copied from interface: SSONETProtocolStream
Returns the state the connection is in.

Specified by:
getConnectionState in interface SSONETProtocolStream
Returns:
connection's state
See Also:
ConnectionListener


Copyright © 2003 DRIM Team. All Rights Reserved.