INET Framework for OMNeT++/OMNEST
inet::IPv4ControlInfo_Base Class Referenceabstract

Class generated from inet/networklayer/contract/ipv4/IPv4ControlInfo.msg:63 by nedtool. More...

#include <IPv4ControlInfo_m.h>

Inheritance diagram for inet::IPv4ControlInfo_Base:
inet::IPv4ControlInfo

Public Member Functions

virtual ~IPv4ControlInfo_Base ()
 
virtual IPv4ControlInfo_Basedup () const override
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual IPv4AddressgetDestAddr ()
 
virtual const IPv4AddressgetDestAddr () const
 
virtual void setDestAddr (const IPv4Address &destAddr)
 
virtual IPv4AddressgetSrcAddr ()
 
virtual const IPv4AddressgetSrcAddr () const
 
virtual void setSrcAddr (const IPv4Address &srcAddr)
 
virtual int getInterfaceId () const
 
virtual void setInterfaceId (int interfaceId)
 
virtual bool getMulticastLoop () const
 
virtual void setMulticastLoop (bool multicastLoop)
 
virtual short getProtocol () const
 
virtual void setProtocol (short protocol)
 
virtual unsigned char getTypeOfService () const
 
virtual void setTypeOfService (unsigned char typeOfService)
 
virtual int getDiffServCodePoint () const =0
 
virtual void setDiffServCodePoint (int diffServCodePoint)=0
 
virtual int getExplicitCongestionNotification () const =0
 
virtual void setExplicitCongestionNotification (int explicitCongestionNotification)=0
 
virtual short getTimeToLive () const
 
virtual void setTimeToLive (short timeToLive)
 
virtual bool getDontFragment () const
 
virtual void setDontFragment (bool dontFragment)
 

Protected Member Functions

bool operator== (const IPv4ControlInfo_Base &)
 
 IPv4ControlInfo_Base ()
 
 IPv4ControlInfo_Base (const IPv4ControlInfo_Base &other)
 
IPv4ControlInfo_Baseoperator= (const IPv4ControlInfo_Base &other)
 

Protected Attributes

IPv4Address destAddr
 
IPv4Address srcAddr
 
int interfaceId
 
bool multicastLoop
 
short protocol
 
unsigned char typeOfService
 
short timeToLive
 
bool dontFragment
 

Private Member Functions

void copy (const IPv4ControlInfo_Base &other)
 

Detailed Description

Class generated from inet/networklayer/contract/ipv4/IPv4ControlInfo.msg:63 by nedtool.

//
// Control information for sending/receiving packets over IPv4.
//
// To send a packet over IPv4, fill in an ~IPv4ControlInfo object,
// attach it to the packet with the C++ method setControlInfo(),
// the send it to the ~IPv4 module.
//
// When sending, the following fields are required:
// - protocol: a value from ~IPProtocolId
// - destAddr
//
// Optional fields:
// - srcAddr: it will be set to the address of the outgoing interface
// - typeOfService: (default: 0)
// - timeToLive: default defined as module parameter
// - dontFragment: default: false
//
// Not supported:
// - options: IPv4 Options currently not used
// - Identifier is currently always chosen by the IPv4 layer
//
// When ~IPv4 delivers a packet to higher layers, it also attaches an ~IPv4ControlInfo
// to it. It fills in the following fields:
//  - srcAddr, destAddr, protocol, TypeOfService: values from the original datagram
//  - interfaceId: the interface on which the datagram arrived, or -1 if it was
//    created locally
//
// ~IPv4 also puts the original datagram object into the control info, because
// it may be needed by higher layers (for example, by ~ICMP for error reporting).
//
class IPv4ControlInfo
{
    @customize(true);
    IPv4Address destAddr;   // destination IPv4 address
    IPv4Address srcAddr;    // source IPv4 address
    int interfaceId = -1; // interface on which the datagram was received, or
                          // should be sent (see ~InterfaceTable)
    bool multicastLoop;   // if true, sent multicast datagrams will be looped back
    short protocol @enum(IPProtocolId);  // encapsulated protocol
    unsigned char typeOfService;  // Type of Service byte (low 6 bits: DSCP)
    abstract int diffServCodePoint;  // maps to bits 0-5 of trafficClass
    abstract int explicitCongestionNotification;  // maps to bits 6-7 of trafficClass
    short timeToLive;     // maximum hop count
    bool dontFragment;    // "don't fragment" bit
}

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

class INET_API IPv4ControlInfo : public IPv4ControlInfo_Base
{
  private:
    void copy(const IPv4ControlInfo& other) { ... }
  public:
    IPv4ControlInfo() : IPv4ControlInfo_Base() {}
    IPv4ControlInfo(const IPv4ControlInfo& other) : IPv4ControlInfo_Base(other) {copy(other);}
    IPv4ControlInfo& operator=(const IPv4ControlInfo& other) {if (this==&other) return *this; IPv4ControlInfo_Base::operator=(other); copy(other); return *this;}
    virtual IPv4ControlInfo *dup() const override {return new IPv4ControlInfo(*this);}
    // ADD CODE HERE to redefine and implement pure virtual functions from IPv4ControlInfo_Base
};

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

Register_Class(IPv4ControlInfo)

Constructor & Destructor Documentation

inet::IPv4ControlInfo_Base::IPv4ControlInfo_Base ( )
protected
inet::IPv4ControlInfo_Base::IPv4ControlInfo_Base ( const IPv4ControlInfo_Base other)
protected
virtual inet::IPv4ControlInfo_Base::~IPv4ControlInfo_Base ( )
virtual

Member Function Documentation

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

Reimplemented in inet::IPv4ControlInfo.

139 {throw omnetpp::cRuntimeError("You forgot to manually add a dup() function to class IPv4ControlInfo");}
virtual const IPv4Address& inet::IPv4ControlInfo_Base::getDestAddr ( ) const
inlinevirtual

Referenced by getDestAddr().

145 {return const_cast<IPv4ControlInfo_Base*>(this)->getDestAddr();}
virtual IPv4Address & getDestAddr()
virtual int inet::IPv4ControlInfo_Base::getDiffServCodePoint ( ) const
pure virtual

Implemented in inet::IPv4ControlInfo.

virtual bool inet::IPv4ControlInfo_Base::getDontFragment ( ) const
virtual

Referenced by inet::IPv4::encapsulate().

virtual int inet::IPv4ControlInfo_Base::getExplicitCongestionNotification ( ) const
pure virtual

Implemented in inet::IPv4ControlInfo.

virtual int inet::IPv4ControlInfo_Base::getInterfaceId ( ) const
virtual
virtual bool inet::IPv4ControlInfo_Base::getMulticastLoop ( ) const
virtual
virtual short inet::IPv4ControlInfo_Base::getProtocol ( ) const
virtual
virtual const IPv4Address& inet::IPv4ControlInfo_Base::getSrcAddr ( ) const
inlinevirtual

Referenced by getSrcAddr().

148 {return const_cast<IPv4ControlInfo_Base*>(this)->getSrcAddr();}
virtual IPv4Address & getSrcAddr()
virtual short inet::IPv4ControlInfo_Base::getTimeToLive ( ) const
virtual
virtual unsigned char inet::IPv4ControlInfo_Base::getTypeOfService ( ) const
virtual
IPv4ControlInfo_Base& inet::IPv4ControlInfo_Base::operator= ( const IPv4ControlInfo_Base other)
protected
bool inet::IPv4ControlInfo_Base::operator== ( const IPv4ControlInfo_Base )
protected
virtual void inet::IPv4ControlInfo_Base::parsimPack ( omnetpp::cCommBuffer *  b) const
overridevirtual
virtual void inet::IPv4ControlInfo_Base::parsimUnpack ( omnetpp::cCommBuffer *  b)
overridevirtual
virtual void inet::IPv4ControlInfo_Base::setDiffServCodePoint ( int  diffServCodePoint)
pure virtual

Implemented in inet::IPv4ControlInfo.

virtual void inet::IPv4ControlInfo_Base::setDontFragment ( bool  dontFragment)
virtual
virtual void inet::IPv4ControlInfo_Base::setExplicitCongestionNotification ( int  explicitCongestionNotification)
pure virtual

Implemented in inet::IPv4ControlInfo.

virtual void inet::IPv4ControlInfo_Base::setInterfaceId ( int  interfaceId)
virtual
virtual void inet::IPv4ControlInfo_Base::setMulticastLoop ( bool  multicastLoop)
virtual

Referenced by inet::UDP::sendDown().

virtual void inet::IPv4ControlInfo_Base::setTypeOfService ( unsigned char  typeOfService)
virtual

Member Data Documentation

IPv4Address inet::IPv4ControlInfo_Base::destAddr
protected
bool inet::IPv4ControlInfo_Base::dontFragment
protected
int inet::IPv4ControlInfo_Base::interfaceId
protected
bool inet::IPv4ControlInfo_Base::multicastLoop
protected
short inet::IPv4ControlInfo_Base::protocol
protected
IPv4Address inet::IPv4ControlInfo_Base::srcAddr
protected
short inet::IPv4ControlInfo_Base::timeToLive
protected
unsigned char inet::IPv4ControlInfo_Base::typeOfService
protected

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