net.sf.beep4j.internal.tcp
Interface ChannelController

All Known Implementing Classes:
DefaultChannelController

public interface ChannelController

Controller object that knows about the channel's send and receive buffers. It's main purpose is sending SEQ frames when the controller thinks that's necessary as well as to fragment / queue outgoing messages to respect the window of the other peer.

Author:
Simon Raess

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.
 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.
 

Method Detail

updateSendWindow

void updateSendWindow(long ackno,
                      int size)
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.

Parameters:
ackno - the acknowledged sequence number
size - the size of the window

sendANS

void sendANS(int messageNumber,
             int answerNumber,
             Message message)
Send an ANS message with the given messageNumber and answerNumber on the channel of this controller.

Parameters:
messageNumber - the message number of the message
answerNumber - the answer number of the message
message - the Message to be sent

sendNUL

void sendNUL(int messageNumber)
Sends an NUL message with the given messageNumber on the channel of this controller.

Parameters:
messageNumber - the message number of the Message

sendERR

void sendERR(int messageNumber,
             Message message)
Sends an ERR message with the given messageNumber on the channel of this controller.

Parameters:
messageNumber - the message number of the Message
message - the Message to be sent

sendMSG

void sendMSG(int messageNumber,
             Message message)
Sends an MSG message with the given messageNumber on the channel of this controller.

Parameters:
messageNumber - the message number of the Message
message - the Message to be sent

sendRPY

void sendRPY(int messageNumber,
             Message message)
Sends an RPY message with the given messageNumber on the channel of this controller.

Parameters:
messageNumber - the message number of the Message
message - the Message to be sent

checkFrame

void checkFrame(long seqno,
                int payloadSize)

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.


frameReceived

void frameReceived(long seqno,
                   int size)
Notifies the controller that the frame with sequence number seqno and size size has been completely received.

Parameters:
seqno - the sequence number of the frame
size - the size of the frame


Copyright © 2007 null. All Rights Reserved.