TCPSegment Class Reference

#include <TCPSegment.h>

List of all members.


Detailed Description

Represents a TCP segment. More info in the TCPSegment.msg file (and the documentation generated from it).

Public Member Functions

 TCPSegment (const char *name=NULL, int kind=0)
 TCPSegment (const TCPSegment &other)
virtual ~TCPSegment ()
TCPSegmentoperator= (const TCPSegment &other)
virtual TCPSegmentdup () const
virtual void parsimPack (cCommBuffer *b)
virtual void parsimUnpack (cCommBuffer *b)
virtual void setPayloadArraySize (unsigned int size)
virtual void setPayload (unsigned int k, const TCPPayloadMessage &payload_var)
virtual unsigned int getPayloadArraySize () const
virtual TCPPayloadMessage & getPayload (unsigned int k)
virtual void addPayloadMessage (cPacket *msg, uint32 endSequenceNo)
virtual cPacket * removeFirstPayloadMessage (uint32 &outEndSequenceNo)

Protected Attributes

std::list< TCPPayloadMessage > payloadList

Constructor & Destructor Documentation

TCPSegment::TCPSegment ( const char *  name = NULL,
int  kind = 0 
) [inline]

00036 : TCPSegment_Base(name,kind) {}

TCPSegment::TCPSegment ( const TCPSegment other  )  [inline]

00037 : TCPSegment_Base(other.getName()) {operator=(other);}

TCPSegment::~TCPSegment (  )  [virtual]

00035 {
00036     while (!payloadList.empty())
00037     {
00038         cPacket *msg = payloadList.front().msg;
00039         payloadList.pop_front();
00040         dropAndDelete(msg);
00041     }
00042 }


Member Function Documentation

TCPSegment & TCPSegment::operator= ( const TCPSegment other  ) 

00025 {
00026     TCPSegment_Base::operator=(other);
00027 
00028     for (std::list<TCPPayloadMessage>::const_iterator i=other.payloadList.begin(); i!=other.payloadList.end(); ++i)
00029         addPayloadMessage(i->msg->dup(), i->endSequenceNo);
00030 
00031     return *this;
00032 }

virtual TCPSegment* TCPSegment::dup (  )  const [inline, virtual]

00040 {return new TCPSegment(*this);}

void TCPSegment::parsimPack ( cCommBuffer *  b  )  [virtual]

00045 {
00046     TCPSegment_Base::parsimPack(b);
00047     doPacking(b, payloadList);
00048 }

void TCPSegment::parsimUnpack ( cCommBuffer *  b  )  [virtual]

00051 {
00052     TCPSegment_Base::parsimUnpack(b);
00053     doUnpacking(b, payloadList);
00054 }

void TCPSegment::setPayloadArraySize ( unsigned int  size  )  [virtual]

Generated but unused method, should not be called.

00057 {
00058     throw cRuntimeError(this, "setPayloadArraySize() not supported, use addPayloadMessage()");
00059 }

void TCPSegment::setPayload ( unsigned int  k,
const TCPPayloadMessage &  payload_var 
) [virtual]

Generated but unused method, should not be called.

00075 {
00076     throw cRuntimeError(this, "setPayload() not supported, use addPayloadMessage()");
00077 }

unsigned int TCPSegment::getPayloadArraySize (  )  const [virtual]

Returns the number of payload messages in this TCP segment

Referenced by TCPMsgBasedSendQueue::createSegmentWithBytes().

00062 {
00063     return payloadList.size();
00064 }

TCPPayloadMessage & TCPSegment::getPayload ( unsigned int  k  )  [virtual]

Returns the kth payload message in this TCP segment

00067 {
00068     std::list<TCPPayloadMessage>::iterator i = payloadList.begin();
00069     while (k>0 && i!=payloadList.end())
00070         (++i, --k);
00071     return *i;
00072 }

void TCPSegment::addPayloadMessage ( cPacket *  msg,
uint32  endSequenceNo 
) [virtual]

Adds a message object to the TCP segment. The sequence number+1 of the last byte of the message should be passed as 2nd argument

Referenced by TCPMsgBasedSendQueue::createSegmentWithBytes(), and operator=().

00080 {
00081     take(msg);
00082 
00083     TCPPayloadMessage payload;
00084     payload.endSequenceNo = endSequenceNo;
00085     payload.msg = msg;
00086     payloadList.push_back(payload);
00087 }

cPacket * TCPSegment::removeFirstPayloadMessage ( uint32 &  outEndSequenceNo  )  [virtual]

Removes and returns the first message object in this TCP segment. It also returns the sequence number+1 of its last octet in outEndSequenceNo.

Referenced by TCPMsgBasedRcvQueue::insertBytesFromSegment().

00090 {
00091     if (payloadList.empty())
00092         return NULL;
00093 
00094     cPacket *msg = payloadList.front().msg;
00095     endSequenceNo = payloadList.front().endSequenceNo;
00096     payloadList.pop_front();
00097     drop(msg);
00098     return msg;
00099 }


Member Data Documentation

std::list<TCPPayloadMessage> TCPSegment::payloadList [protected]


The documentation for this class was generated from the following files:

Generated on Fri Mar 20 18:51:22 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5