INET Framework for OMNeT++/OMNEST
SCTPMessage Class Reference

#include <SCTPMessage.h>

List of all members.

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

Detailed Description

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


Constructor & Destructor Documentation

SCTPMessage::SCTPMessage ( const char *  name = NULL,
int32  kind = 0 
) [inline]
: SCTPMessage_Base(name,kind) {}
SCTPMessage::SCTPMessage ( const SCTPMessage other) [inline]
: SCTPMessage_Base(other.getName()) {operator=(other);}
SCTPMessage::~SCTPMessage ( )
{
    SCTPChunk* chunk;
    if (this->getChunksArraySize()>0)
    for (uint32 i=0; i < this->getChunksArraySize(); i++)
    {
        chunk = (SCTPChunk*)this->getChunks(i);
        drop(chunk);
        delete chunk;
    }
}

Member Function Documentation

void SCTPMessage::addChunk ( cPacket *  msg) [virtual]
virtual SCTPMessage* SCTPMessage::dup ( ) const [inline, virtual]

Referenced by SCTPAssociation::process_RCV_Message().

{return new SCTPMessage(*this);}
cPacketPtr & SCTPMessage::getChunks ( uint32  k) [virtual]

Returns the kth chunk in this SCTP packet

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

{
     std::list<cPacket*>::iterator i = chunkList.begin();
     while (k>0 && i!=chunkList.end())
          (++i, --k);
     return *i;
}
uint32 SCTPMessage::getChunksArraySize ( ) const [virtual]
SCTPMessage & SCTPMessage::operator= ( const SCTPMessage other)
{
     SCTPMessage_Base::operator=(other);

     this->setBitLength(SCTP_COMMON_HEADER*8);
     this->setTag(other.getTag());
     for (std::list<cPacket*>::const_iterator i=other.chunkList.begin(); i!=other.chunkList.end(); ++i)
          addChunk((cPacket *)(*i)->dup());

     return *this;
}
cPacket * SCTPMessage::peekFirstChunk ( ) [virtual]

Referenced by SCTPAssociation::sendToIP().

{
    if (chunkList.empty())
        return NULL;

    cPacket *msg = chunkList.front();
    return msg;
}
cPacket * SCTPMessage::peekLastChunk ( ) [virtual]
{
    if (chunkList.empty())
        return NULL;

    cPacket *msg = chunkList.back();
    return msg;
}
cPacket * SCTPMessage::removeChunk ( ) [virtual]

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

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

{
    if (chunkList.empty())
        return NULL;

    cPacket *msg = chunkList.front();
    chunkList.pop_front();
    drop(msg);
    this->setBitLength(this->getBitLength()-ADD_PADDING(msg->getBitLength()/8)*8);
    return msg;
}
cPacket * SCTPMessage::removeLastChunk ( ) [virtual]
{
    if (chunkList.empty())
        return NULL;

    cPacket *msg = chunkList.back();
    chunkList.pop_back();
    drop(msg);
    this->setBitLength(this->getBitLength()-ADD_PADDING(msg->getBitLength()/8)*8);
    return msg;
}
void SCTPMessage::setChunks ( uint32  k,
const cPacketPtr &  chunks_var 
) [virtual]

Generated but unused method, should not be called.

{
     throw new cException(this, "setChunks() not supported, use addChunk()");
}
void SCTPMessage::setChunksArraySize ( uint32  size) [virtual]

Generated but unused method, should not be called.

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

Member Data Documentation


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