SCTPMessage Class Reference

#include <SCTPMessage.h>

List of all members.


Detailed Description

Represents a SCTP Message. More info in the SCTPMessage.msg file (and the documentation generated from it).

Public Member Functions

 SCTPMessage (const char *name=NULL, int32 kind=0)
 SCTPMessage (const SCTPMessage &other)
 ~SCTPMessage ()
SCTPMessageoperator= (const SCTPMessage &other)
virtual SCTPMessagedup () const
virtual void setChunksArraySize (uint32 size)
virtual void setChunks (uint32 k, const cPacketPtr &chunks_var)
virtual uint32 getChunksArraySize () const
virtual cPacketPtr & getChunks (uint32 k)
virtual void addChunk (cPacket *msg)
virtual cPacket * removeChunk ()
virtual cPacket * removeLastChunk ()
virtual cPacket * peekFirstChunk ()
virtual cPacket * peekLastChunk ()

Protected Attributes

std::list< cPacket * > chunkList

Constructor & Destructor Documentation

SCTPMessage::SCTPMessage ( const char *  name = NULL,
int32  kind = 0 
) [inline]

Referenced by dup().

00036 : SCTPMessage_Base(name,kind) {}

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

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

SCTPMessage::~SCTPMessage (  ) 

00037 {
00038     SCTPChunk* chunk;
00039     for (uint32 i=0; i<this->getChunksArraySize(); i++)
00040     {
00041         chunk = (SCTPChunk*)this->getChunks(i);
00042         drop(chunk);
00043         delete chunk;
00044     }
00045 }


Member Function Documentation

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

Referenced by SCTPMessage().

00025 {
00026     SCTPMessage_Base::operator=(other);
00027 
00028     this->setBitLength(SCTP_COMMON_HEADER*8);
00029     this->setTag(0);
00030     for (std::list<cPacket*>::const_iterator i=other.chunkList.begin(); i!=other.chunkList.end(); ++i)
00031         addChunk((cPacket *)(*i)->dup());
00032 
00033     return *this;
00034 }

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

Referenced by SCTPAssociation::process_RCV_Message().

00040 {return new SCTPMessage(*this);}

void SCTPMessage::setChunksArraySize ( uint32  size  )  [virtual]

Generated but unused method, should not be called.

00048 {
00049     throw new cException(this, "setChunkArraySize() not supported, use addChunk()");
00050 }

void SCTPMessage::setChunks ( uint32  k,
const cPacketPtr &  chunks_var 
) [virtual]

Generated but unused method, should not be called.

00066 {
00067     throw new cException(this, "setChunks() not supported, use addChunk()");
00068 }

uint32 SCTPMessage::getChunksArraySize (  )  const [virtual]

Returns the number of chunks in this SCTP packet

Referenced by SCTPAssociation::disposeOf(), SCTPAssociation::process_RCV_Message(), TCPDumper::sctpDump(), SCTP::sendAbortFromMain(), and ~SCTPMessage().

00053 {
00054     return chunkList.size();
00055 }

cPacketPtr & SCTPMessage::getChunks ( uint32  k  )  [virtual]

Returns the kth chunk in this SCTP packet

Referenced by SCTP::handleMessage(), SCTPAssociation::process_RCV_Message(), TCPDumper::sctpDump(), SCTP::sendAbortFromMain(), and ~SCTPMessage().

00058 {
00059     std::list<cPacket*>::iterator i = chunkList.begin();
00060     while (k>0 && i!=chunkList.end())
00061         (++i, --k);
00062     return *i;
00063 }

void SCTPMessage::addChunk ( cPacket *  msg  )  [virtual]

Adds a message object to the SCTP packet. The packet length will be adjusted

Referenced by operator=(), SCTPAssociation::retransmitCookieEcho(), SCTPAssociation::retransmitInit(), SCTPAssociation::retransmitShutdown(), SCTPAssociation::retransmitShutdownAck(), SCTPAssociation::sendAbort(), SCTP::sendAbortFromMain(), SCTPAssociation::sendAll(), SCTPAssociation::sendCookieAck(), SCTPAssociation::sendCookieEcho(), SCTPAssociation::sendHeartbeat(), SCTPAssociation::sendHeartbeatAck(), SCTPAssociation::sendInit(), SCTPAssociation::sendInitAck(), SCTPAssociation::sendSack(), SCTPAssociation::sendShutdown(), SCTPAssociation::sendShutdownAck(), SCTPAssociation::sendShutdownComplete(), and SCTP::sendShutdownCompleteFromMain().

00072 {
00073     char str[200];
00074     take(msg);
00075     if (this->chunkList.size()<9)
00076     {
00077         strcpy(str, this->getName());
00078         sprintf(str, "%s %s",this->getName(), msg->getName());
00079         this->setName(str);
00080     }
00081     this->setBitLength(this->getBitLength()+ADD_PADDING(msg->getBitLength()/8)*8);
00082     chunkList.push_back(msg);
00083 }

cPacket * SCTPMessage::removeChunk (  )  [virtual]

Removes and returns the first message object in this SCTP packet.

Referenced by SCTPAssociation::disposeOf(), and SCTPAssociation::process_RCV_Message().

00086 {
00087     if (chunkList.empty())
00088         return NULL;
00089 
00090     cPacket *msg = chunkList.front();
00091     chunkList.pop_front();
00092     drop(msg);
00093     this->setBitLength(this->getBitLength()-ADD_PADDING(msg->getBitLength()/8)*8);
00094     return msg;
00095 }

cPacket * SCTPMessage::removeLastChunk (  )  [virtual]

00098 {
00099     if (chunkList.empty())
00100         return NULL;
00101 
00102     cPacket *msg = chunkList.back();
00103     chunkList.pop_back();
00104     drop(msg);
00105     this->setBitLength(this->getBitLength()-ADD_PADDING(msg->getBitLength()/8)*8);
00106     return msg;
00107 }

cPacket * SCTPMessage::peekFirstChunk (  )  [virtual]

Referenced by SCTPAssociation::sendToIP().

00110 {
00111     if (chunkList.empty())
00112         return NULL;
00113 
00114     cPacket *msg = chunkList.front();
00115     return msg;
00116 }

cPacket * SCTPMessage::peekLastChunk (  )  [virtual]

00119 {
00120     if (chunkList.empty())
00121         return NULL;
00122 
00123     cPacket *msg = chunkList.back();
00124     return msg;
00125 }


Member Data Documentation

std::list<cPacket*> SCTPMessage::chunkList [protected]


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

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