net.sf.beep4j.internal.tcp
Class DefaultChannelController

java.lang.Object
  extended by net.sf.beep4j.internal.tcp.DefaultChannelController
All Implemented Interfaces:
ChannelController

public class DefaultChannelController
extends java.lang.Object
implements ChannelController


Field Summary
static int MINIMUM_FRAME_SIZE
           
 
Constructor Summary
DefaultChannelController(Transport transport, int channel, int window)
           
 
Method Summary
 void checkFrame(long seqno, int payloadSize)
          Validation of the sequence number according to the BEEP specification section 2.2.1.1.
 void frameReceived(long seqno, int size)
          Notifies the controller that the frame with sequence number seqno and size size has been completely received.
 void sendANS(int messageNumber, int answerNumber, Message message)
          Send an ANS message with the given messageNumber and answerNumber on the channel of this controller.
 void sendERR(int messageNumber, Message message)
          Sends an ERR message with the given messageNumber on the channel of this controller.
protected  int sendFrames(Transport transport)
           
 void sendMSG(int messageNumber, Message message)
          Sends an MSG message with the given messageNumber on the channel of this controller.
 void sendNUL(int messageNumber)
          Sends an NUL message with the given messageNumber on the channel of this controller.
 void sendRPY(int messageNumber, Message message)
          Sends an RPY message with the given messageNumber on the channel of this controller.
 void updateSendWindow(long ackno, int size)
          To be invoked whenever a SEQ frame is received to update the sender window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM_FRAME_SIZE

public static final int MINIMUM_FRAME_SIZE
See Also:
Constant Field Values
Constructor Detail

DefaultChannelController

public DefaultChannelController(Transport transport,
                                int channel,
                                int window)
Method Detail

updateSendWindow

public void updateSendWindow(long ackno,
                             int size)
Description copied from interface: ChannelController
To be invoked whenever a SEQ frame is received to update the sender window. The window start will be placed at ackno and the size will be updated to size. Note that the position will remain unaffected. If ackno is larger than the window size the communication with the other peer should be stopped as the peers lost the synchronization.

Specified by:
updateSendWindow in interface ChannelController
Parameters:
ackno - the acknowledged sequence number
size - the size of the window

sendANS

public void sendANS(int messageNumber,
                    int answerNumber,
                    Message message)
Description copied from interface: ChannelController
Send an ANS message with the given messageNumber and answerNumber on the channel of this controller.

Specified by:
sendANS in interface ChannelController
Parameters:
messageNumber - the message number of the message
answerNumber - the answer number of the message
message - the Message to be sent

sendERR

public void sendERR(int messageNumber,
                    Message message)
Description copied from interface: ChannelController
Sends an ERR message with the given messageNumber on the channel of this controller.

Specified by:
sendERR in interface ChannelController
Parameters:
messageNumber - the message number of the Message
message - the Message to be sent

sendMSG

public void sendMSG(int messageNumber,
                    Message message)
Description copied from interface: ChannelController
Sends an MSG message with the given messageNumber on the channel of this controller.

Specified by:
sendMSG in interface ChannelController
Parameters:
messageNumber - the message number of the Message
message - the Message to be sent

sendNUL

public void sendNUL(int messageNumber)
Description copied from interface: ChannelController
Sends an NUL message with the given messageNumber on the channel of this controller.

Specified by:
sendNUL in interface ChannelController
Parameters:
messageNumber - the message number of the Message

sendRPY

public void sendRPY(int messageNumber,
                    Message message)
Description copied from interface: ChannelController
Sends an RPY message with the given messageNumber on the channel of this controller.

Specified by:
sendRPY in interface ChannelController
Parameters:
messageNumber - the message number of the Message
message - the Message to be sent

checkFrame

public void checkFrame(long seqno,
                       int payloadSize)
Description copied from interface: ChannelController

Validation of the sequence number according to the BEEP specification section 2.2.1.1.

A frame is poorly formed if the value of the sequence number doesn't correspond to the expected value for the associated channel.

Further, this method checks that the payload size is not greater than the remaining buffer space.

Specified by:
checkFrame in interface ChannelController

frameReceived

public void frameReceived(long seqno,
                          int size)
Description copied from interface: ChannelController
Notifies the controller that the frame with sequence number seqno and size size has been completely received.

Specified by:
frameReceived in interface ChannelController
Parameters:
seqno - the sequence number of the frame
size - the size of the frame

sendFrames

protected int sendFrames(Transport transport)


Copyright © 2007 null. All Rights Reserved.