Public Member Functions | Protected Attributes

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

Definition at line 30 of file SCTPMessage.h.


Constructor & Destructor Documentation

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

Definition at line 36 of file SCTPMessage.h.

: SCTPMessage_Base(name,kind) {}

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

Definition at line 37 of file SCTPMessage.h.

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

SCTPMessage::~SCTPMessage (  ) 

Definition at line 38 of file SCTPMessage.cc.

{
    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]

Definition at line 40 of file SCTPMessage.h.

Referenced by SCTPAssociation::process_RCV_Message().

{return new SCTPMessage(*this);}

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

Returns the kth chunk in this SCTP packet

Definition at line 60 of file SCTPMessage.cc.

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  ) 

Definition at line 26 of file SCTPMessage.cc.

{
     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]

Definition at line 112 of file SCTPMessage.cc.

Referenced by SCTPAssociation::sendToIP().

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

    cPacket *msg = chunkList.front();
    return msg;
}

cPacket * SCTPMessage::peekLastChunk (  )  [virtual]

Definition at line 121 of file SCTPMessage.cc.

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

Definition at line 88 of file SCTPMessage.cc.

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]

Definition at line 100 of file SCTPMessage.cc.

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

Definition at line 68 of file SCTPMessage.cc.

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

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

Generated but unused method, should not be called.

Definition at line 50 of file SCTPMessage.cc.

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


Member Data Documentation

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

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