org.beepcore.beep.transport.tcp
Class TCPSession

java.lang.Object
  |
  +--org.beepcore.beep.core.Session
        |
        +--org.beepcore.beep.transport.tcp.TCPSession

public class TCPSession
extends Session

Provides the TCP transport mapping for BEEP according to RFC 3081.


Field Summary
 
Fields inherited from class org.beepcore.beep.core.Session
SESSION_STATE_ABORTED, SESSION_STATE_ACTIVE, SESSION_STATE_CLOSE_PENDING, SESSION_STATE_CLOSED, SESSION_STATE_CLOSING, SESSION_STATE_GREETING_SENT, SESSION_STATE_INITIALIZED, SESSION_STATE_TUNING, SESSION_STATE_TUNING_PENDING
 
Method Summary
 void close()
          Closes the Session gracefully.
static TCPSession createInitiator(java.net.Socket sock, ProfileRegistry registry)
          Creates a TCPSession for a Socket that was created by initiating a connection.
static TCPSession createListener(java.net.Socket sock, ProfileRegistry registry)
          Creates a TCPSession for a Socket that was created by listening and accepting a connection.
protected  void disableIO()
          Method disableIO
protected  void enableIO()
          Method enableIO
protected  int getMaxFrameSize()
          Returns the maximum frame size that a channel should send for this session.
 java.net.Socket getSocket()
           
protected  Session reset(SessionCredential localCred, SessionCredential peerCred, SessionTuningProperties tuning, ProfileRegistry reg, java.lang.Object argument)
          This method is used by a tuning profile to reset the session after the tuning is complete.
protected  void sendFrame(Frame f)
          Generates a header, then writes the header, payload, and trailer to the wire.
 void terminate(java.lang.String reason)
          This method is used to terminate the session when there is an non-recoverable error in the BEEP protocol (framing error, etc.).
protected  boolean updateMyReceiveBufferSize(Channel channel, long previouslySeq, long currentSeq, int previouslyUsed, int currentlyUsed, int bufferSize)
          Update the channel window size with the remote peer by sending SEQ frames as per RFC 3081.
 
Methods inherited from class org.beepcore.beep.core.Session
addChannelListener, addSessionListener, createFrame, getChannelAvailableWindow, getChannelNumberAsString, getLocalCredential, getPeerCredential, getPeerSupportedProfiles, getProfileRegistry, getState, getTuningProperties, init, isInitiator, postFrame, removeChannelListener, removeSessionListener, setLocalCredential, setPeerCredential, setTuningProperties, startChannel, startChannel, startChannel, startChannel, tuningInit, updatePeerReceiveBufferSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInitiator

public static TCPSession createInitiator(java.net.Socket sock,
                                         ProfileRegistry registry)
                                  throws BEEPException
Creates a TCPSession for a Socket that was created by initiating a connection.

Parameters:
sock -
registry -
Throws:
BEEPException

createListener

public static TCPSession createListener(java.net.Socket sock,
                                        ProfileRegistry registry)
                                 throws BEEPException
Creates a TCPSession for a Socket that was created by listening and accepting a connection.

Parameters:
sock -
registry -
Throws:
BEEPException

close

public void close()
           throws BEEPException
Description copied from class: Session
Closes the Session gracefully. The profiles for the open channels on the session may veto the close request.

Overrides:
close in class Session
Throws:
BEEPException

getSocket

public java.net.Socket getSocket()

terminate

public void terminate(java.lang.String reason)
Description copied from class: Session
This method is used to terminate the session when there is an non-recoverable error in the BEEP protocol (framing error, etc.).

Overrides:
terminate in class Session
Parameters:
reason -

disableIO

protected void disableIO()
Description copied from class: Session
Method disableIO

Specified by:
disableIO in class Session

enableIO

protected void enableIO()
Description copied from class: Session
Method enableIO

Specified by:
enableIO in class Session

getMaxFrameSize

protected int getMaxFrameSize()
Description copied from class: Session
Returns the maximum frame size that a channel should send for this session.

Specified by:
getMaxFrameSize in class Session

sendFrame

protected void sendFrame(Frame f)
                  throws BEEPException
Generates a header, then writes the header, payload, and trailer to the wire.

Specified by:
sendFrame in class Session
Parameters:
f - the Frame to send.
Returns:
boolean true of the frame was sent, false otherwise.
Throws:
BEEPException

reset

protected Session reset(SessionCredential localCred,
                        SessionCredential peerCred,
                        SessionTuningProperties tuning,
                        ProfileRegistry reg,
                        java.lang.Object argument)
                 throws BEEPException
Description copied from class: Session
This method is used by a tuning profile to reset the session after the tuning is complete.

Specified by:
reset in class Session
Returns:
A new Session with the tuning complete.
BEEPException

updateMyReceiveBufferSize

protected boolean updateMyReceiveBufferSize(Channel channel,
                                            long previouslySeq,
                                            long currentSeq,
                                            int previouslyUsed,
                                            int currentlyUsed,
                                            int bufferSize)
                                     throws BEEPException
Update the channel window size with the remote peer by sending SEQ frames as per RFC 3081.

Specified by:
updateMyReceiveBufferSize in class Session
Parameters:
channel -
previouslySeq -
currentSeq -
previouslyUsed -
currentlyUsed -
bufferSize -
Returns:
true if the Receive Buffer Size was updated
Throws:
BEEPException - if a specified buffer size is larger than what's available on the Socket.


Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.