INET Framework for OMNeT++/OMNEST
inet::UDPPacket_Base Class Reference

Class generated from inet/transportlayer/udp/UDPPacket.msg:33 by nedtool. More...

#include <UDPPacket_m.h>

Inheritance diagram for inet::UDPPacket_Base:
inet::UDPPacket

Public Member Functions

virtual ~UDPPacket_Base ()
 
virtual UDPPacket_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 int getTotalLengthField () const
 
virtual void setTotalLengthField (int totalLengthField)
 

Protected Member Functions

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

Protected Attributes

unsigned short srcPort
 
unsigned short destPort
 
int totalLengthField
 

Private Member Functions

void copy (const UDPPacket_Base &other)
 

Detailed Description

Class generated from inet/transportlayer/udp/UDPPacket.msg:33 by nedtool.

//
// Represents an UDP packet, to be used with the ~UDP module.
//
packet UDPPacket
{
    @customize(true);
    unsigned short srcPort;
    unsigned short destPort;
    byteLength = UDP_HEADER_BYTES;
    int totalLengthField = -1;   // -1 means: getTotalLengthField() uses getByteLength()
}

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

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

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

Register_Class(UDPPacket)

Constructor & Destructor Documentation

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

Member Function Documentation

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

Reimplemented in inet::UDPPacket.

112 {throw omnetpp::cRuntimeError("You forgot to manually add a dup() function to class UDPPacket");}
virtual unsigned short inet::UDPPacket_Base::getDestPort ( ) const
virtual
virtual unsigned short inet::UDPPacket_Base::getSrcPort ( ) const
virtual
virtual int inet::UDPPacket_Base::getTotalLengthField ( ) const
virtual

Reimplemented in inet::UDPPacket.

UDPPacket_Base& inet::UDPPacket_Base::operator= ( const UDPPacket_Base other)
protected
bool inet::UDPPacket_Base::operator== ( const UDPPacket_Base )
protected
virtual void inet::UDPPacket_Base::parsimPack ( omnetpp::cCommBuffer *  b) const
overridevirtual
virtual void inet::UDPPacket_Base::parsimUnpack ( omnetpp::cCommBuffer *  b)
overridevirtual
virtual void inet::UDPPacket_Base::setDestPort ( unsigned short  destPort)
virtual
virtual void inet::UDPPacket_Base::setSrcPort ( unsigned short  srcPort)
virtual
virtual void inet::UDPPacket_Base::setTotalLengthField ( int  totalLengthField)
virtual

Member Data Documentation

unsigned short inet::UDPPacket_Base::destPort
protected
unsigned short inet::UDPPacket_Base::srcPort
protected
int inet::UDPPacket_Base::totalLengthField
protected

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