INET Framework for OMNeT++/OMNEST
inet::tcp::TCPSegment_Base Class Referenceabstract

Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:202 by nedtool. More...

#include <TCPSegment_m.h>

Inheritance diagram for inet::tcp::TCPSegment_Base:
inet::tcp::TCPSegment

Public Member Functions

virtual ~TCPSegment_Base ()
 
virtual TCPSegment_Basedup () const override
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual unsigned short getSrcPort () const
 
virtual void setSrcPort (unsigned short srcPort)
 
virtual unsigned short getDestPort () const
 
virtual void setDestPort (unsigned short destPort)
 
virtual unsigned int getSequenceNo () const
 
virtual void setSequenceNo (unsigned int sequenceNo)
 
virtual unsigned int getAckNo () const
 
virtual void setAckNo (unsigned int ackNo)
 
virtual unsigned short getHeaderLength () const
 
virtual void setHeaderLength (unsigned short headerLength)
 
virtual bool getUrgBit () const
 
virtual void setUrgBit (bool urgBit)
 
virtual bool getAckBit () const
 
virtual void setAckBit (bool ackBit)
 
virtual bool getPshBit () const
 
virtual void setPshBit (bool pshBit)
 
virtual bool getRstBit () const
 
virtual void setRstBit (bool rstBit)
 
virtual bool getSynBit () const
 
virtual void setSynBit (bool synBit)
 
virtual bool getFinBit () const
 
virtual void setFinBit (bool finBit)
 
virtual unsigned short getWindow () const
 
virtual void setWindow (unsigned short window)
 
virtual unsigned short getUrgentPointer () const
 
virtual void setUrgentPointer (unsigned short urgentPointer)
 
virtual void setHeaderOptionArraySize (unsigned int size)=0
 
virtual unsigned int getHeaderOptionArraySize () const =0
 
virtual TCPOptionPtrgetHeaderOption (unsigned int k)=0
 
virtual const TCPOptionPtrgetHeaderOption (unsigned int k) const
 
virtual void setHeaderOption (unsigned int k, const TCPOptionPtr &headerOption)=0
 
virtual unsigned long getPayloadLength () const
 
virtual void setPayloadLength (unsigned long payloadLength)
 
virtual void setPayloadArraySize (unsigned int size)=0
 
virtual unsigned int getPayloadArraySize () const =0
 
virtual TCPPayloadMessagegetPayload (unsigned int k)=0
 
virtual const TCPPayloadMessagegetPayload (unsigned int k) const
 
virtual void setPayload (unsigned int k, const TCPPayloadMessage &payload)=0
 
virtual ByteArraygetByteArray ()
 
virtual const ByteArraygetByteArray () const
 
virtual void setByteArray (const ByteArray &byteArray)
 

Protected Member Functions

bool operator== (const TCPSegment_Base &)
 
 TCPSegment_Base (const char *name=nullptr, short kind=0)
 
 TCPSegment_Base (const TCPSegment_Base &other)
 
TCPSegment_Baseoperator= (const TCPSegment_Base &other)
 

Protected Attributes

unsigned short srcPort
 
unsigned short destPort
 
unsigned int sequenceNo
 
unsigned int ackNo
 
unsigned short headerLength
 
bool urgBit
 
bool ackBit
 
bool pshBit
 
bool rstBit
 
bool synBit
 
bool finBit
 
unsigned short window
 
unsigned short urgentPointer
 
unsigned long payloadLength
 
ByteArray byteArray
 

Private Member Functions

void copy (const TCPSegment_Base &other)
 

Detailed Description

Class generated from inet/transportlayer/tcp_common/TCPSegment.msg:202 by nedtool.

//
// Represents a TCP segment, to be used with the ~TCP module.
//
// TCP header fields not explicitly modelled: work on going
// - Data Offset (number of 32 bit words in the header): represented
//   by cMessage::length().
// - Reserved (reserved for future use)
// - Checksum (header checksum): modelled by cMessage::hasBitError()
// - Header Options: Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented
// - Padding
//
// cMessage::getKind() may be set to an arbitrary value: TCP entities will
// ignore it and use only the header fields (synBit, ackBit, rstBit).
//
packet TCPSegment
{
    @customize(true);
    // Source Port
    unsigned short srcPort;
    // Destination Port
    unsigned short destPort;
    // Sequence Number: first sequence number of the first data octet
    // in the respective segment (except if SYN is set; then the the
    // seq. number is the initial seq. number (ISS) and the first data
    // octet is ISS + 1)
    unsigned int sequenceNo;
    // Acknowledgement Number: if ACK flag is set, this field contains
    // the next sequence number the sender of this segment is expecting
    // to receive
    unsigned int ackNo;
    // TCP Header Length - default: 20 bytes
    // if header options are used the headerLength is greater than 20 bytes (default)
    unsigned short headerLength = TCP_HEADER_OCTETS; // TCP_HEADER_OCTETS = 20
    bool urgBit; // URG: urgent pointer field significant if set
    bool ackBit; // ACK: ackNo significant if set
    bool pshBit; // PSH: push function
    bool rstBit; // RST: reset the connection
    bool synBit; // SYN: synchronize seq. numbers
    bool finBit; // FIN: finish - no more data from sender
    // Window Size: the number of data octets beginning with the one indicated
    // in the acknowledgement field which the sender of this segment is
    // willing to accept
    unsigned short window;
    // Urgent Pointer: communicates the current value of the urgent pointer
    // as a positive offset from the sequence number in this segment. The
    // urgent pointer points to the sequence number of the octet following
    // the urgent data. This field is only be interpreted in segments with
    // the URG control bit set.
    unsigned short urgentPointer;
    // Header options (optional)
    // Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented
    abstract TCPOptionPtr headerOption[];
    // Payload length in octets (not an actual TCP header field).
    // This may not always be the same as encapsulatedPacket()->getByteLength();
    // e.g. when simulating a virtual data stream there's no encapsulated
    // packet at all.
    unsigned long payloadLength;
    // Message objects (cMessages) that travel in this segment as data.
    // This field is used only when the ~TCPDataTransferMode is TCP_TRANSFER_OBJECT.
    // Every message object is put into the TCPSegment that would (in real life)
    // carry its first octet. That is, if message object 'msg' with length=100 bytes
    // occupies stream offset number range 10000..10099, it will travel in the
    // TCPSegment which carries the octet 10000. This way it is easily achieved
    // that the receiving TCP passes up the message object to its client
    // when the last byte of the message has arrived.
    abstract TCPPayloadMessage payload[];
    // Message bytes that travel in this segment as data.
    // This field is used only when the ~TCPDataTransferMode is TCP_TRANSFER_BYTESTREAM.
    ByteArray byteArray;
}

TCPSegment_Base is only useful if it gets subclassed, and TCPSegment is derived from it. The minimum code to be written for TCPSegment is the following:

class INET_API TCPSegment : public TCPSegment_Base
{
  private:
    void copy(const TCPSegment& other) { ... }
  public:
    TCPSegment(const char *name=nullptr, short kind=0) : TCPSegment_Base(name,kind) {}
    TCPSegment(const TCPSegment& other) : TCPSegment_Base(other) {copy(other);}
    TCPSegment& operator=(const TCPSegment& other) {if (this==&other) return *this; TCPSegment_Base::operator=(other); copy(other); return *this;}
    virtual TCPSegment *dup() const override {return new TCPSegment(*this);}
    // ADD CODE HERE to redefine and implement pure virtual functions from TCPSegment_Base
};

The following should go into a .cc (.cpp) file:

Register_Class(TCPSegment)

Constructor & Destructor Documentation

inet::tcp::TCPSegment_Base::TCPSegment_Base ( const char *  name = nullptr,
short  kind = 0 
)
protected
inet::tcp::TCPSegment_Base::TCPSegment_Base ( const TCPSegment_Base other)
protected
virtual inet::tcp::TCPSegment_Base::~TCPSegment_Base ( )
virtual

Member Function Documentation

void inet::tcp::TCPSegment_Base::copy ( const TCPSegment_Base other)
private
virtual TCPSegment_Base* inet::tcp::TCPSegment_Base::dup ( ) const
inlineoverridevirtual

Reimplemented in inet::tcp::TCPSegment.

728 {throw omnetpp::cRuntimeError("You forgot to manually add a dup() function to class TCPSegment");}
virtual const ByteArray& inet::tcp::TCPSegment_Base::getByteArray ( ) const
inlinevirtual

Referenced by getByteArray().

772 {return const_cast<TCPSegment_Base*>(this)->getByteArray();}
virtual ByteArray & getByteArray()
TCPSegment_Base(const char *name=nullptr, short kind=0)
virtual TCPOptionPtr& inet::tcp::TCPSegment_Base::getHeaderOption ( unsigned int  k)
pure virtual

Implemented in inet::tcp::TCPSegment.

virtual const TCPOptionPtr& inet::tcp::TCPSegment_Base::getHeaderOption ( unsigned int  k) const
inlinevirtual

Reimplemented in inet::tcp::TCPSegment.

Referenced by getHeaderOption().

762 {return const_cast<TCPSegment_Base*>(this)->getHeaderOption(k);}
virtual TCPOptionPtr & getHeaderOption(unsigned int k)=0
TCPSegment_Base(const char *name=nullptr, short kind=0)
const double k
Definition: QAM16Modulation.cc:24
virtual unsigned int inet::tcp::TCPSegment_Base::getHeaderOptionArraySize ( ) const
pure virtual

Implemented in inet::tcp::TCPSegment.

virtual TCPPayloadMessage& inet::tcp::TCPSegment_Base::getPayload ( unsigned int  k)
pure virtual

Implemented in inet::tcp::TCPSegment.

virtual const TCPPayloadMessage& inet::tcp::TCPSegment_Base::getPayload ( unsigned int  k) const
inlinevirtual

Referenced by getPayload().

769 {return const_cast<TCPSegment_Base*>(this)->getPayload(k);}
TCPSegment_Base(const char *name=nullptr, short kind=0)
virtual TCPPayloadMessage & getPayload(unsigned int k)=0
const double k
Definition: QAM16Modulation.cc:24
virtual unsigned int inet::tcp::TCPSegment_Base::getPayloadArraySize ( ) const
pure virtual

Implemented in inet::tcp::TCPSegment.

TCPSegment_Base& inet::tcp::TCPSegment_Base::operator= ( const TCPSegment_Base other)
protected
bool inet::tcp::TCPSegment_Base::operator== ( const TCPSegment_Base )
protected
virtual void inet::tcp::TCPSegment_Base::parsimPack ( omnetpp::cCommBuffer *  b) const
overridevirtual
virtual void inet::tcp::TCPSegment_Base::parsimUnpack ( omnetpp::cCommBuffer *  b)
overridevirtual
virtual void inet::tcp::TCPSegment_Base::setByteArray ( const ByteArray byteArray)
virtual
virtual void inet::tcp::TCPSegment_Base::setFinBit ( bool  finBit)
virtual
virtual void inet::tcp::TCPSegment_Base::setHeaderLength ( unsigned short  headerLength)
virtual
virtual void inet::tcp::TCPSegment_Base::setHeaderOption ( unsigned int  k,
const TCPOptionPtr headerOption 
)
pure virtual

Implemented in inet::tcp::TCPSegment.

virtual void inet::tcp::TCPSegment_Base::setHeaderOptionArraySize ( unsigned int  size)
pure virtual

Implemented in inet::tcp::TCPSegment.

virtual void inet::tcp::TCPSegment_Base::setPayload ( unsigned int  k,
const TCPPayloadMessage payload 
)
pure virtual

Implemented in inet::tcp::TCPSegment.

virtual void inet::tcp::TCPSegment_Base::setPayloadArraySize ( unsigned int  size)
pure virtual

Implemented in inet::tcp::TCPSegment.

virtual void inet::tcp::TCPSegment_Base::setPshBit ( bool  pshBit)
virtual
virtual void inet::tcp::TCPSegment_Base::setRstBit ( bool  rstBit)
virtual
virtual void inet::tcp::TCPSegment_Base::setUrgBit ( bool  urgBit)
virtual
virtual void inet::tcp::TCPSegment_Base::setUrgentPointer ( unsigned short  urgentPointer)
virtual

Member Data Documentation

bool inet::tcp::TCPSegment_Base::ackBit
protected
unsigned int inet::tcp::TCPSegment_Base::ackNo
protected
ByteArray inet::tcp::TCPSegment_Base::byteArray
protected
unsigned short inet::tcp::TCPSegment_Base::destPort
protected
bool inet::tcp::TCPSegment_Base::finBit
protected
unsigned short inet::tcp::TCPSegment_Base::headerLength
protected
unsigned long inet::tcp::TCPSegment_Base::payloadLength
protected
bool inet::tcp::TCPSegment_Base::pshBit
protected
bool inet::tcp::TCPSegment_Base::rstBit
protected
unsigned int inet::tcp::TCPSegment_Base::sequenceNo
protected
unsigned short inet::tcp::TCPSegment_Base::srcPort
protected
bool inet::tcp::TCPSegment_Base::synBit
protected
bool inet::tcp::TCPSegment_Base::urgBit
protected
unsigned short inet::tcp::TCPSegment_Base::urgentPointer
protected
unsigned short inet::tcp::TCPSegment_Base::window
protected

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