#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 |
SCTPMessage::SCTPMessage | ( | const char * | name = NULL , |
|
int32 | kind = 0 | |||
) | [inline] |
SCTPMessage::SCTPMessage | ( | const SCTPMessage & | other | ) | [inline] |
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 }
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] |
void SCTPMessage::setChunksArraySize | ( | uint32 | size | ) | [virtual] |
void SCTPMessage::setChunks | ( | uint32 | k, | |
const cPacketPtr & | chunks_var | |||
) | [virtual] |
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] |
std::list<cPacket*> SCTPMessage::chunkList [protected] |
Referenced by addChunk(), getChunks(), getChunksArraySize(), operator=(), peekFirstChunk(), peekLastChunk(), removeChunk(), and removeLastChunk().