INET Framework for OMNeT++/OMNEST
inet::sctp::SCTPMessage Class Reference

Represents a SCTP Message. More...

#include <SCTPMessage.h>

Inheritance diagram for inet::sctp::SCTPMessage:
inet::sctp::SCTPMessage_Base inet::ITransportPacket

Public Member Functions

 SCTPMessage (const char *name=nullptr, int32 kind=0)
 
 SCTPMessage (const SCTPMessage &other)
 
 ~SCTPMessage ()
 
SCTPMessage & operator= (const SCTPMessage &other)
 
virtual SCTPMessage * dup () const override
 
virtual void setChunksArraySize (uint32 size) override
 Generated but unused method, should not be called. More...
 
virtual void setChunks (uint32 k, const cPacketPtr &chunks_var) override
 Generated but unused method, should not be called. More...
 
virtual uint32 getChunksArraySize () const override
 Returns the number of chunks in this SCTP packet. More...
 
virtual cPacketPtr & getChunks (uint32 k) override
 Returns the kth chunk in this SCTP packet. More...
 
virtual void addChunk (cPacket *msg)
 Adds a message object to the SCTP packet. More...
 
virtual cPacket * removeChunk ()
 Removes and returns the first message object in this SCTP packet. More...
 
virtual cPacket * removeLastChunk ()
 
virtual cPacket * peekFirstChunk ()
 
virtual cPacket * peekLastChunk ()
 
virtual void replaceChunk (cPacket *msg, uint32 k)
 
virtual unsigned int getSourcePort () const override
 
virtual void setSourcePort (unsigned int port) override
 
virtual unsigned int getDestinationPort () const override
 
virtual void setDestinationPort (unsigned int port) override
 
- Public Member Functions inherited from inet::sctp::SCTPMessage_Base
virtual ~SCTPMessage_Base ()
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual uint16_t getSrcPort () const
 
virtual void setSrcPort (uint16_t srcPort)
 
virtual uint16_t getDestPort () const
 
virtual void setDestPort (uint16_t destPort)
 
virtual uint32_t getTag () const
 
virtual void setTag (uint32_t tag)
 
virtual bool getChecksumOk () const
 
virtual void setChecksumOk (bool checksumOk)
 
virtual void setChunksArraySize (unsigned int size)=0
 
virtual cPacketPtr & getChunks (unsigned int k)=0
 
virtual const cPacketPtr & getChunks (unsigned int k) const
 
virtual void setChunks (unsigned int k, const cPacketPtr &chunks)=0
 
- Public Member Functions inherited from inet::ITransportPacket
virtual ~ITransportPacket ()
 

Protected Attributes

std::vector< cPacket * > chunkList
 
- Protected Attributes inherited from inet::sctp::SCTPMessage_Base
uint16_t srcPort
 
uint16_t destPort
 
uint32_t tag
 
bool checksumOk
 

Private Member Functions

void copy (const SCTPMessage &other)
 
void clean ()
 

Additional Inherited Members

- Protected Member Functions inherited from inet::sctp::SCTPMessage_Base
bool operator== (const SCTPMessage_Base &)
 
 SCTPMessage_Base (const char *name=nullptr, short kind=0)
 
 SCTPMessage_Base (const SCTPMessage_Base &other)
 
SCTPMessage_Base & operator= (const SCTPMessage_Base &other)
 

Detailed Description

Represents a SCTP Message.

More info in the SCTPMessage.msg file (and the documentation generated from it).

Constructor & Destructor Documentation

inet::sctp::SCTPMessage::SCTPMessage ( const char *  name = nullptr,
int32  kind = 0 
)
inline
45 : SCTPMessage_Base(name, kind) {}
SCTPMessage_Base(const char *name=nullptr, short kind=0)
inet::sctp::SCTPMessage::SCTPMessage ( const SCTPMessage &  other)
inline
46 : SCTPMessage_Base(other) { copy(other); }
SCTPMessage_Base(const char *name=nullptr, short kind=0)
void copy(const SCTPMessage &other)
Definition: SCTPMessage.cc:39
inet::sctp::SCTPMessage::~SCTPMessage ( )
54 {
55  clean();
56 }
void clean()
Definition: SCTPMessage.cc:58

Member Function Documentation

void inet::sctp::SCTPMessage::addChunk ( cPacket *  msg)
virtual

Adds a message object to the SCTP packet.

The packet length will be adjusted

Referenced by inet::sctp::SCTPAssociation::addAuthChunkIfNecessary(), PacketDrill::buildSCTPPacket(), inet::PacketDrillApp::closeAllSockets(), inet::serializer::SCTPSerializer::parse(), inet::sctp::SCTPAssociation::processAddInAndOutResetRequestArrived(), inet::sctp::SCTPAssociation::processAsconfArrived(), inet::sctp::SCTPAssociation::processPacketDropArrived(), inet::sctp::SCTPAssociation::retransmitAsconf(), inet::sctp::SCTPAssociation::retransmitCookieEcho(), inet::sctp::SCTPAssociation::retransmitInit(), inet::sctp::SCTPAssociation::retransmitReset(), inet::sctp::SCTPAssociation::retransmitShutdown(), inet::sctp::SCTPAssociation::retransmitShutdownAck(), inet::sctp::SCTPAssociation::sendAbort(), inet::sctp::SCTP::sendAbortFromMain(), inet::sctp::SCTPAssociation::sendAddInAndOutStreamsRequest(), inet::sctp::SCTPAssociation::sendAddOutgoingStreamsRequest(), inet::sctp::SCTPAssociation::sendAsconf(), inet::sctp::SCTPAssociation::sendAsconfAck(), inet::sctp::SCTPNatHook::sendBackError(), inet::sctp::SCTPAssociation::sendBundledOutgoingResetAndResponse(), inet::sctp::SCTPAssociation::sendCookieAck(), inet::sctp::SCTPAssociation::sendCookieEcho(), inet::sctp::SCTPAssociation::sendDoubleStreamResetResponse(), inet::sctp::SCTPAssociation::sendHeartbeat(), inet::sctp::SCTPAssociation::sendHeartbeatAck(), inet::sctp::SCTPAssociation::sendHMacError(), inet::sctp::SCTPAssociation::sendInit(), inet::sctp::SCTPAssociation::sendInitAck(), inet::sctp::SCTPAssociation::sendInvalidStreamError(), inet::sctp::SCTPAssociation::sendOnPath(), inet::sctp::SCTPAssociation::sendOutgoingRequestAndResponse(), inet::sctp::SCTPAssociation::sendOutgoingResetRequest(), inet::sctp::SCTPAssociation::sendPacketDrop(), inet::sctp::SCTPAssociation::sendSack(), inet::sctp::SCTPAssociation::sendShutdown(), inet::sctp::SCTPAssociation::sendShutdownAck(), inet::sctp::SCTPAssociation::sendShutdownComplete(), inet::sctp::SCTP::sendShutdownCompleteFromMain(), inet::sctp::SCTPAssociation::sendStreamResetRequest(), and inet::sctp::SCTPAssociation::sendStreamResetResponse().

94 {
95  char str[256];
96  take(msg);
97  if (this->chunkList.size() < 9) {
98  snprintf(str, sizeof(str), "%s %s", this->getName(), msg->getName());
99  this->setName(str);
100  }
101  this->setByteLength(this->getByteLength() + ADD_PADDING(msg->getByteLength()));
102  chunkList.push_back(msg);
103 }
#define ADD_PADDING(x)
Definition: SCTPAssociation.h:261
std::vector< cPacket * > chunkList
Definition: SCTPMessage.h:38
void inet::sctp::SCTPMessage::clean ( )
private

Referenced by operator=(), inet::sctp::SCTPErrorChunk::operator=(), inet::sctp::SCTPErrorChunk::~SCTPErrorChunk(), ~SCTPMessage(), and inet::sctp::SCTPStreamResetChunk::~SCTPStreamResetChunk().

59 {
60  SCTPChunk *chunk;
61  if (this->getChunksArraySize() > 0)
62  for (uint32 i = 0; i < this->getChunksArraySize(); i++) {
63  chunk = (SCTPChunk *)this->getChunks(i);
64  dropAndDelete(chunk);
65  }
66 }
uint32_t uint32
Definition: Compat.h:30
virtual uint32 getChunksArraySize() const override
Returns the number of chunks in this SCTP packet.
Definition: SCTPMessage.cc:73
virtual cPacketPtr & getChunks(uint32 k) override
Returns the kth chunk in this SCTP packet.
Definition: SCTPMessage.cc:78
void inet::sctp::SCTPMessage::copy ( const SCTPMessage &  other)
private

Referenced by operator=(), and inet::sctp::SCTPErrorChunk::operator=().

40 {
41  setTag(other.getTag());
42  setSrcPort(other.getSrcPort());
43  setDestPort(other.getDestPort());
44  setChecksumOk(other.getChecksumOk());
45  for (const auto & elem : other.chunkList) {
46  cPacket *chunk = (elem)->dup();
47  take(chunk);
48  chunkList.push_back(chunk);
49  }
50  ASSERT(getByteLength() == other.getByteLength());
51 }
virtual void setTag(uint32_t tag)
virtual void setDestPort(uint16_t destPort)
std::vector< cPacket * > chunkList
Definition: SCTPMessage.h:38
virtual void setChecksumOk(bool checksumOk)
virtual void setSrcPort(uint16_t srcPort)
virtual SCTPMessage * dup() const override
Definition: SCTPMessage.h:49
cPacketPtr & inet::sctp::SCTPMessage::getChunks ( uint32  k)
overridevirtual
virtual unsigned int inet::sctp::SCTPMessage::getDestinationPort ( ) const
inlineoverridevirtual

Implements inet::ITransportPacket.

virtual uint16_t getDestPort() const
virtual unsigned int inet::sctp::SCTPMessage::getSourcePort ( ) const
inlineoverridevirtual

Implements inet::ITransportPacket.

77 { return SCTPMessage_Base::getSrcPort(); }
virtual uint16_t getSrcPort() const
SCTPMessage & inet::sctp::SCTPMessage::operator= ( const SCTPMessage &  other)
29 {
30  if (this == &other)
31  return *this;
32  clean();
34  copy(other);
35  return *this;
36 }
void clean()
Definition: SCTPMessage.cc:58
void copy(const SCTPMessage &other)
Definition: SCTPMessage.cc:39
SCTPMessage_Base & operator=(const SCTPMessage_Base &other)
cPacket * inet::sctp::SCTPMessage::peekFirstChunk ( )
virtual

Referenced by inet::sctp::SCTPNatHook::datagramForwardHook(), inet::sctp::SCTPNatHook::datagramPreRoutingHook(), inet::PacketDrillApp::runEvent(), and inet::sctp::SCTPAssociation::sendToIP().

130 {
131  if (chunkList.empty())
132  return nullptr;
133 
134  cPacket *msg = chunkList.front();
135  return msg;
136 }
std::vector< cPacket * > chunkList
Definition: SCTPMessage.h:38
cPacket * inet::sctp::SCTPMessage::peekLastChunk ( )
virtual

Referenced by inet::sctp::SCTPNatHook::datagramForwardHook(), and inet::sctp::SCTPNatHook::datagramPreRoutingHook().

139 {
140  if (chunkList.empty())
141  return nullptr;
142 
143  cPacket *msg = chunkList.back();
144  return msg;
145 }
std::vector< cPacket * > chunkList
Definition: SCTPMessage.h:38
cPacket * inet::sctp::SCTPMessage::removeChunk ( )
virtual

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

Referenced by inet::PacketDrillApp::compareSctpPacket(), inet::sctp::SCTPNatHook::datagramPreRoutingHook(), inet::sctp::SCTPAssociation::disposeOf(), inet::sctp::SCTPAssociation::process_RCV_Message(), inet::sctp::SCTPAssociation::processPacketDropArrived(), and inet::sctp::SCTPAssociation::sendOnPath().

106 {
107  if (chunkList.empty())
108  return nullptr;
109 
110  cPacket *msg = chunkList.front();
111  chunkList.erase(chunkList.begin());
112  drop(msg);
113  this->setByteLength(this->getByteLength() - ADD_PADDING(msg->getByteLength()));
114  return msg;
115 }
#define ADD_PADDING(x)
Definition: SCTPAssociation.h:261
std::vector< cPacket * > chunkList
Definition: SCTPMessage.h:38
cPacket * inet::sctp::SCTPMessage::removeLastChunk ( )
virtual

Referenced by inet::sctp::SCTPAssociation::sendPacketDrop().

118 {
119  if (chunkList.empty())
120  return nullptr;
121 
122  cPacket *msg = chunkList.back();
123  chunkList.pop_back();
124  drop(msg);
125  this->setByteLength(this->getByteLength() + ADD_PADDING(msg->getByteLength()));
126  return msg;
127 }
#define ADD_PADDING(x)
Definition: SCTPAssociation.h:261
std::vector< cPacket * > chunkList
Definition: SCTPMessage.h:38
void inet::sctp::SCTPMessage::replaceChunk ( cPacket *  msg,
uint32  k 
)
virtual

Referenced by inet::sctp::SCTPAssociation::sendOnPath().

84 {
85  chunkList[k] = msg;
86 }
std::vector< cPacket * > chunkList
Definition: SCTPMessage.h:38
const double k
Definition: QAM16Modulation.cc:24
void inet::sctp::SCTPMessage::setChunks ( uint32  k,
const cPacketPtr &  chunks_var 
)
overridevirtual

Generated but unused method, should not be called.

89 {
90  throw new cException(this, "setChunks() not supported, use addChunk()");
91 }
void inet::sctp::SCTPMessage::setChunksArraySize ( uint32  size)
overridevirtual

Generated but unused method, should not be called.

69 {
70  throw new cException(this, "setChunkArraySize() not supported, use addChunk()");
71 }
virtual void inet::sctp::SCTPMessage::setDestinationPort ( unsigned int  port)
inlineoverridevirtual

Implements inet::ITransportPacket.

virtual void setDestPort(uint16_t destPort)
virtual void inet::sctp::SCTPMessage::setSourcePort ( unsigned int  port)
inlineoverridevirtual

Implements inet::ITransportPacket.

virtual void setSrcPort(uint16_t srcPort)

Member Data Documentation

std::vector<cPacket *> inet::sctp::SCTPMessage::chunkList
protected

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