#include <SCTPMessage.h>
Public Member Functions | |
SCTPMessage (const char *name=NULL, int32 kind=0) | |
SCTPMessage (const SCTPMessage &other) | |
~SCTPMessage () | |
SCTPMessage & | operator= (const SCTPMessage &other) |
virtual SCTPMessage * | dup () 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 |
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.
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; } }
void SCTPMessage::addChunk | ( | cPacket * | msg | ) | [virtual] |
Adds a message object to the SCTP packet. The packet length will be adjusted
Definition at line 74 of file SCTPMessage.cc.
Referenced by operator=(), SCTPAssociation::retransmitCookieEcho(), SCTPAssociation::retransmitInit(), SCTPAssociation::retransmitShutdown(), SCTPAssociation::retransmitShutdownAck(), SCTPAssociation::sendAbort(), SCTP::sendAbortFromMain(), SCTPAssociation::sendCookieAck(), SCTPAssociation::sendCookieEcho(), SCTPAssociation::sendHeartbeat(), SCTPAssociation::sendHeartbeatAck(), SCTPAssociation::sendInit(), SCTPAssociation::sendInitAck(), SCTPAssociation::sendOnPath(), SCTPAssociation::sendSack(), SCTPAssociation::sendShutdown(), SCTPAssociation::sendShutdownAck(), SCTPAssociation::sendShutdownComplete(), and SCTP::sendShutdownCompleteFromMain().
{ char str[256]; take(msg); if (this->chunkList.size()<9) { strcpy(str, this->getName()); snprintf(str, sizeof(str), "%s %s",this->getName(), msg->getName()); this->setName(str); } this->setBitLength(this->getBitLength()+ADD_PADDING(msg->getBitLength()/8)*8); chunkList.push_back(msg); }
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().
uint32 SCTPMessage::getChunksArraySize | ( | ) | const [virtual] |
Returns the number of chunks in this SCTP packet
Definition at line 55 of file SCTPMessage.cc.
Referenced by SCTPAssociation::disposeOf(), SCTPAssociation::process_RCV_Message(), SCTPAssociation::recordInPathVectors(), TCPDumper::sctpDump(), SCTP::sendAbortFromMain(), SCTPAssociation::storePacket(), and ~SCTPMessage().
{ return chunkList.size(); }
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().
cPacket * SCTPMessage::peekLastChunk | ( | ) | [virtual] |
Definition at line 121 of file SCTPMessage.cc.
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()"); }
std::list<cPacket*> SCTPMessage::chunkList [protected] |
Definition at line 33 of file SCTPMessage.h.
Referenced by addChunk(), getChunks(), getChunksArraySize(), operator=(), peekFirstChunk(), peekLastChunk(), removeChunk(), and removeLastChunk().