Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

SAR Class Reference

Segmentation and Reassembly. More...

#include <SAR.h>

Inheritance diagram for SAR::

BasicObject List of all members.

Public Methods

 SAR (PacketWriter *packetWriter, int serviceNumber)
 Constructor. More...

virtual ~SAR ()
 Destroy the internal send and receive windows. More...

TimeValue getAverageRtt ()
 Return the average round trip time in milliseconds for data on this connection. More...

void connectionClosed ()
 This function is called by its client(the object using it) to inform it that the connection is closed. More...

int reliableSend (u_char *data, int length)
 Breaks up the data into peices that will be sent over the network. More...

int receive (u_char *buffer, int bufferLength)
 Reassemble a message. More...

int sendDataPacket (TpPacket *packet)
 Call the service table "sendDataPacket" function. More...

void receivePacket (TpPacket *packet)
 Handle a packet appropriately by giving it to send of receive window. More...

virtual void toStream (std::ostream &)

Private Attributes

ReceiveWindowm_receive
 this is the queue to read packets from. More...

SendWindowm_send
 the queue to send packets out. More...

int m_serviceNumber
 The service number for this connection. More...

PacketWriterm_packetWriter
 a pointer to an object that can send a packet reliably. More...

u_char * m_buffer
 used as a buffer when reassembling a message. More...

int m_mesgLen
 length of buffer returned in fn reassemble. More...

int m_totalLen
 total length of message received. More...


Detailed Description

Segmentation and Reassembly.

Breaks up a message and/or reassembles a message.

Dependancies: Classes: TpPacket, Counter, Queue, ReceiveWindow, SendWindow defines: WINDOW_SIZE, SEGMENT_SIZE

Definition at line 9 of file SAR.h.


Constructor & Destructor Documentation

SAR::SAR PacketWriter * packetWriter,
int serviceNumber
 

Constructor.

Creates a send and receive window.

Parameters:
packetWriter   A pointer to a service that can send a packet over the network.
serviceNumber   The service number for the circuit we are serving.

Definition at line 18 of file SAR.cpp.

SAR::~SAR [virtual]
 

Destroy the internal send and receive windows.

Definition at line 33 of file SAR.cpp.


Member Function Documentation

void SAR::connectionClosed
 

This function is called by its client(the object using it) to inform it that the connection is closed.

Definition at line 124 of file SAR.cpp.

Referenced by ServiceEntry::toDisconnectedState(), and ~SAR().

TimeValue SAR::getAverageRtt
 

Return the average round trip time in milliseconds for data on this connection.

Definition at line 115 of file SAR.cpp.

Referenced by ServiceEntry::toStream().

int SAR::receive u_char * buffer,
int bufferLength
 

Reassemble a message.

This function will put as much data as it can into the buffer provided. If it is unable to fit the message in provided buffer, it will copy as much as it can into it, and save the rest for later. On the next call to the function it will continue from where it left off.

Parameters:
buffer   The buffer into which the data will be placed.
bufferLenth   The size of the buffer.
Returns:
The amount of data put into the buffer.

Definition at line 71 of file SAR.cpp.

Referenced by ServiceTable::receiveData().

void SAR::receivePacket TpPacket * packet
 

Handle a packet appropriately by giving it to send of receive window.

If it is a data packet, add it to our ReceiveWindow. If it is an ACK, modify the SendWindow appropriately.

Definition at line 82 of file SAR.cpp.

Referenced by ServiceTable::handleDataPacket().

int SAR::reliableSend u_char * data,
int dataLength
 

Breaks up the data into peices that will be sent over the network.

Creates a queue of TpPackets, with the last packet having the end-bit set.

Returns:
The number of bytes sent.

Definition at line 50 of file SAR.cpp.

Referenced by ServiceTable::sendData().

int SAR::sendDataPacket TpPacket * packet
 

Call the service table "sendDataPacket" function.

Returns:
The number of bytes sent, or PB_BAD_SERVICE if the service doesnt exist.

Definition at line 105 of file SAR.cpp.

Referenced by SendWindow::reliableSend(), ReceiveWindow::sendAck(), SendWindow::sendEmptyPacket(), and SendWindow::sentPacketTimeoutImpl().

void SAR::toStream std::ostream & s [virtual]
 

Reimplemented from BasicObject.

Definition at line 131 of file SAR.cpp.


Member Data Documentation

u_char* SAR::m_buffer [private]
 

used as a buffer when reassembling a message.

Definition at line 43 of file SAR.h.

int SAR::m_mesgLen [private]
 

length of buffer returned in fn reassemble.

Definition at line 46 of file SAR.h.

PacketWriter* SAR::m_packetWriter [private]
 

a pointer to an object that can send a packet reliably.

Definition at line 40 of file SAR.h.

ReceiveWindow* SAR::m_receive [private]
 

this is the queue to read packets from.

Definition at line 31 of file SAR.h.

SendWindow* SAR::m_send [private]
 

the queue to send packets out.

Definition at line 34 of file SAR.h.

int SAR::m_serviceNumber [private]
 

The service number for this connection.

Definition at line 37 of file SAR.h.

int SAR::m_totalLen [private]
 

total length of message received.

Definition at line 49 of file SAR.h.


The documentation for this class was generated from the following files:
Generated at Thu Jul 11 13:31:58 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001