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

Class generated from inet/networklayer/ipv4/Ipv4Header.msg:170 by opp_msgtool. More...

#include <Ipv4Header_m.h>

Inheritance diagram for inet::Ipv4Header:
inet::NetworkHeaderBase inet::FieldsChunk inet::Chunk inet::IPrintableObject inet::IRegionTaggedObject

Public Member Functions

 Ipv4Header ()
 
 Ipv4Header (const Ipv4Header &other)
 
virtual ~Ipv4Header ()
 
Ipv4Headeroperator= (const Ipv4Header &other)
 
virtual Ipv4Headerdup () const override
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual short getVersion () const
 
virtual void setVersion (short version)
 
virtual B getHeaderLength () const
 
virtual void setHeaderLength (B headerLength)
 
virtual short getTypeOfService () const
 
virtual void setTypeOfService (short typeOfService)
 
virtual B getTotalLengthField () const
 
virtual void setTotalLengthField (B totalLengthField)
 
virtual uint16_t getIdentification () const
 
virtual void setIdentification (uint16_t identification)
 
virtual bool getReservedBit () const
 
virtual void setReservedBit (bool reservedBit)
 
virtual bool getMoreFragments () const
 
virtual void setMoreFragments (bool moreFragments)
 
virtual bool getDontFragment () const
 
virtual void setDontFragment (bool dontFragment)
 
virtual uint16_t getFragmentOffset () const
 
virtual void setFragmentOffset (uint16_t fragmentOffset)
 
virtual short getTimeToLive () const
 
virtual void setTimeToLive (short timeToLive)
 
virtual IpProtocolId getProtocolId () const
 
virtual void setProtocolId (IpProtocolId protocolId)
 
virtual uint16_t getCrc () const
 
virtual void setCrc (uint16_t crc)
 
virtual CrcMode getCrcMode () const
 
virtual void setCrcMode (CrcMode crcMode)
 
virtual const Ipv4AddressgetSrcAddress () const
 
virtual Ipv4AddressgetSrcAddressForUpdate ()
 
virtual void setSrcAddress (const Ipv4Address &srcAddress)
 
virtual const Ipv4AddressgetDestAddress () const
 
virtual Ipv4AddressgetDestAddressForUpdate ()
 
virtual void setDestAddress (const Ipv4Address &destAddress)
 
virtual const TlvOptionsgetOptions () const
 
virtual TlvOptionsgetOptionsForUpdate ()
 
virtual void setOptions (const TlvOptions &options)
 
virtual short getDscp () const
 
virtual void setDscp (short dscp)
 
virtual short getEcn () const
 
virtual void setEcn (short ecn)
 
virtual unsigned int getOptionArraySize () const
 Returns the number of extension headers in this datagram. More...
 
virtual TlvOptionBasegetOptionForUpdate (unsigned int k)
 Returns the kth extension header in this datagram. More...
 
virtual const TlvOptionBasegetOption (unsigned int k) const
 
virtual TlvOptionBasefindMutableOptionByType (short int optionType, int index=0)
 Returns the TlvOptionBase of the specified type, or nullptr. More...
 
virtual const TlvOptionBasefindOptionByType (short int optionType, int index=0) const
 
virtual void addOption (TlvOptionBase *opt)
 Adds an TlvOptionBase to the datagram. More...
 
virtual void addOption (TlvOptionBase *opt, int atPos)
 
virtual B calculateHeaderByteLength () const
 Calculates the length of the Ipv6 header plus the extension headers. More...
 
virtual L3Address getSourceAddress () const override
 
virtual void setSourceAddress (const L3Address &address) override
 
virtual L3Address getDestinationAddress () const override
 
virtual void setDestinationAddress (const L3Address &address) override
 
virtual const ProtocolgetProtocol () const override
 
virtual void setProtocol (const Protocol *protocol) override
 
virtual bool isFragment () const override
 
- Public Member Functions inherited from inet::NetworkHeaderBase
 NetworkHeaderBase ()
 
 NetworkHeaderBase (const NetworkHeaderBase &other)
 
- Public Member Functions inherited from inet::FieldsChunk
 FieldsChunk ()
 
 FieldsChunk (const FieldsChunk &other)
 
virtual ~FieldsChunk ()
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
virtual void handleChange () override
 
virtual ChunkType getChunkType () const override
 Returns the type of this chunk as an enum member. More...
 
virtual bool containsSameData (const Chunk &other) const override
 Returns true if the two chunks represent the same binary data. More...
 
virtual b getChunkLength () const override
 Returns the length of data represented by this chunk. More...
 
virtual void setChunkLength (b chunkLength)
 
virtual void addChunkLength (b chunkLength)
 
virtual std::ostream & printFieldsToStream (std::ostream &stream, int level, int evFlags=0) const override
 Prints an optinally formatted human readable string representation of the feilds of this chunk to the given stream. More...
 
- Public Member Functions inherited from inet::Chunk
 Chunk ()
 
 Chunk (const Chunk &other)
 
virtual const Ptr< ChunkdupShared () const
 Returns a mutable copy of this chunk in a shared pointer. More...
 
virtual void forEachChild (cVisitor *v) override
 
virtual bool isMutable () const
 
virtual bool isImmutable () const
 
virtual void markImmutable ()
 
void markMutableIfExclusivelyOwned ()
 
virtual bool isComplete () const
 
virtual bool isIncomplete () const
 
virtual void markIncomplete ()
 
virtual bool isCorrect () const
 
virtual bool isIncorrect () const
 
virtual void markIncorrect ()
 
virtual bool isProperlyRepresented () const
 
virtual bool isImproperlyRepresented () const
 
virtual void markImproperlyRepresented ()
 
virtual void moveIterator (Iterator &iterator, b length) const
 
virtual void seekIterator (Iterator &iterator, b position) const
 
virtual bool canInsertAtFront (const Ptr< const Chunk > &chunk) const
 Returns true if this chunk is capable of representing the result. More...
 
virtual bool canInsertAtBack (const Ptr< const Chunk > &chunk) const
 Returns true if this chunk is capable of representing the result. More...
 
virtual bool canInsertAt (const Ptr< const Chunk > &chunk, b offset) const
 Returns true if this chunk is capable of representing the result. More...
 
void insertAtFront (const Ptr< const Chunk > &chunk)
 Inserts the provided chunk at the beginning of this chunk. More...
 
void insertAtBack (const Ptr< const Chunk > &chunk)
 Inserts the provided chunk at the end of this chunk. More...
 
void insertAt (const Ptr< const Chunk > &chunk, b offset)
 Inserts the provided chunk into this chunk. More...
 
virtual bool canRemoveAtFront (b length) const
 Returns true if this chunk is capable of representing the result. More...
 
virtual bool canRemoveAtBack (b length) const
 Returns true if this chunk is capable of representing the result. More...
 
virtual bool canRemoveAt (b offset, b length) const
 Returns true if this chunk is capable of representing the result. More...
 
void removeAtFront (b length)
 Removes the requested part from the beginning of this chunk. More...
 
void removeAtBack (b length)
 Removes the requested part from the end of this chunk. More...
 
void removeAt (b offset, b length)
 Removes the requested part from this chunk. More...
 
int getChunkId () const
 Returns the sequentially assigned id. More...
 
virtual bool isEmpty () const
 Returns true if this chunk contains no data. More...
 
const Ptr< Chunksimplify () const
 Returns the simplified representation of this chunk eliminating all potential redundancies. More...
 
const Ptr< Chunkpeek (const Iterator &iterator, b length=unspecifiedLength, int flags=0) const
 Returns the designated part of the data represented by this chunk in its default representation. More...
 
template<typename T >
bool has (const Iterator &iterator, b length=unspecifiedLength) const
 Returns whether if the designated part of the data is available in the requested representation. More...
 
template<typename T >
const Ptr< Tpeek (const Iterator &iterator, b length=unspecifiedLength, int flags=0) const
 Returns the designated part of the data represented by this chunk in the requested representation. More...
 
virtual SharingRegionTagSetgetRegionTags () override
 Returns all region tags. More...
 
int getNumTags () const
 Returns the number of chunk tags. More...
 
const Ptr< const TagBasegetTag (int index) const
 Returns the chunk tag at the given index. More...
 
void clearTags (b offset=b(0), b length=b(-1))
 Clears the set of chunk tags in the given region. More...
 
void copyTags (const Chunk &source, b sourceOffset=b(0), b offset=b(0), b length=b(-1))
 Copies the set of chunk tags from the source region to the provided region. More...
 
template<typename T >
const Ptr< const TfindTag (b offset=b(0), b length=b(-1)) const
 Returns the chunk tag for the provided type and range, or returns nullptr if no such chunk tag is found. More...
 
template<typename T >
const Ptr< const TgetTag (b offset=b(0), b length=b(-1)) const
 Returns the chunk tag for the provided type and range, or throws an exception if no such chunk tag is found. More...
 
template<typename T >
void mapAllTags (b offset, b length, std::function< void(b, b, const Ptr< const T > &)> f) const
 Maps all tags in the provided range to to the function. More...
 
template<typename T >
void mapAllTagsForUpdate (b offset, b length, std::function< void(b, b, const Ptr< T > &)> f)
 Maps all tags in the provided range to to the function. More...
 
template<typename T >
std::vector< SharingRegionTagSet::RegionTag< const T > > getAllTags (b offset=b(0), b length=b(-1)) const
 Returns all chunk tags for the provided type and range in a detached vector of region tags. More...
 
template<typename T >
std::vector< SharingRegionTagSet::RegionTag< T > > getAllTagsForUpdate (b offset=b(0), b length=b(-1))
 Returns all chunk tags for the provided type and range in a detached vector of region tags. More...
 
template<typename T >
const Ptr< TaddTag (b offset=b(0), b length=b(-1))
 Returns a newly added chunk tag for the provided type and range, or throws an exception if such a chunk tag is already present. More...
 
template<typename T >
const Ptr< TaddTagIfAbsent (b offset=b(0), b length=b(-1))
 Returns a newly added chunk tag for the provided type and range if absent, or returns the chunk tag that is already present. More...
 
template<typename T >
std::vector< SharingRegionTagSet::RegionTag< T > > addTagsWhereAbsent (b offset=b(0), b length=b(-1))
 Returns the newly added chunk tags for the provided type and range where the tag is absent. More...
 
template<typename T >
const Ptr< TremoveTag (b offset, b length)
 Removes the chunk tag for the provided type and range, or throws an exception if no such chunk tag is found. More...
 
template<typename T >
const Ptr< TremoveTagIfPresent (b offset, b length)
 Removes the chunk tag for the provided type and range if present, or returns nullptr if no such chunk tag is found. More...
 
template<typename T >
std::vector< SharingRegionTagSet::RegionTag< T > > removeTagsWherePresent (b offset, b length)
 Removes and returns all chunk tags for the provided type and range. More...
 
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) const override
 Prints an optinally formatted human readable string representation of the data present in this chunk to the given stream. More...
 
virtual std::string str () const override
 Returns a human readable string representation of the data present in this chunk. More...
 
- Public Member Functions inherited from inet::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string printToString () const
 
virtual std::string printToString (int level, int evFlags=0) const
 
virtual std::string getInfoStringRepresentation (int evFlags=0) const
 
virtual std::string getDetailStringRepresentation (int evFlags=0) const
 
virtual std::string getDebugStringRepresentation (int evFlags=0) const
 
virtual std::string getTraceStringRepresentation (int evFlags=0) const
 
virtual std::string getCompleteStringRepresentation (int evFlags=0) const
 

Protected Member Functions

bool operator== (const Ipv4Header &)=delete
 
- Protected Member Functions inherited from inet::FieldsChunk
const std::vector< uint8_t > * getSerializedBytes () const
 
void setSerializedBytes (const std::vector< uint8_t > *bytes) const
 
virtual const Ptr< ChunkpeekUnchecked (PeekPredicate predicate, PeekConverter converter, const Iterator &iterator, b length, int flags) const override
 
- Protected Member Functions inherited from inet::Chunk
int getBinDumpNumLines () const
 
int getHexDumpNumLines () const
 
const char * getBinDumpLine (int index)
 
const char * getHexDumpLine (int index)
 
const SharingRegionTagSet::RegionTag< TagBase > & _getTag (int index) const
 
void checkMutable () const
 
virtual void doInsertAtFront (const Ptr< const Chunk > &chunk)
 
virtual void doInsertAtBack (const Ptr< const Chunk > &chunk)
 
virtual void doInsertAt (const Ptr< const Chunk > &chunk, b offset)
 
virtual void doRemoveAtFront (b length)
 
virtual void doRemoveAtBack (b length)
 
virtual void doRemoveAt (b offset, b length)
 
template<typename T >
const Ptr< TpeekConverted (const Iterator &iterator, b length, int flags) const
 
template<typename T >
const Ptr< TcheckPeekResult (const Ptr< T > &chunk, int flags) const
 

Protected Attributes

short version = 4
 
B headerLength = IPv4_MIN_HEADER_LENGTH
 
short typeOfService = 0
 
B totalLengthField = B(-1)
 
uint16_t identification = 0
 
bool reservedBit = false
 
bool moreFragments = false
 
bool dontFragment = false
 
uint16_t fragmentOffset = 0
 
short timeToLive = 0
 
IpProtocolId protocolId = IP_PROT_NONE
 
uint16_t crc = 0
 
CrcMode crcMode = CRC_MODE_UNDEFINED
 
Ipv4Address srcAddress
 
Ipv4Address destAddress
 
TlvOptions options
 
- Protected Attributes inherited from inet::FieldsChunk
b chunkLength
 
const std::vector< uint8_t > * serializedBytes
 The serialized representation of this chunk or nullptr if not available. More...
 
- Protected Attributes inherited from inet::Chunk
int id
 The id is automatically assigned sequentially during construction. More...
 
int flags
 The boolean chunk flags are merged into a single integer. More...
 
SharingRegionTagSet regionTags
 The set of region tags attached to the data represented by this chunk. More...
 
const typedef Ptr< Chunk >(* PeekConverter )(const Ptr< Chunk > &chunk, const Chunk::Iterator &iterator, b length, int flags)
 

Private Member Functions

void copy (const Ipv4Header &other)
 

Additional Inherited Members

- Public Types inherited from inet::Chunk
enum  ChunkType {
  CT_EMPTY, CT_BITCOUNT, CT_BITS, CT_BYTECOUNT,
  CT_BYTES, CT_SLICE, CT_ENCRYPTED, CT_CPACKET,
  CT_SEQUENCE, CT_FIELDS
}
 This enum is used to avoid std::dynamic_cast and dynamicPtrCast. More...
 
enum  PeekFlag {
  PF_ALLOW_NULLPTR = (1 << 0), PF_ALLOW_EMPTY = (1 << 1), PF_ALLOW_INCOMPLETE = (1 << 2), PF_ALLOW_INCORRECT = (1 << 3),
  PF_ALLOW_IMPROPERLY_REPRESENTED = (1 << 4), PF_ALLOW_SERIALIZATION = (1 << 5), PF_ALLOW_ALL = -1
}
 This enum specifies bitmasks for the flags argument of various peek functions. More...
 
- Public Types inherited from inet::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
enum  PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0), PRINT_FLAG_MULTILINE = (1 << 1) }
 
- Static Public Member Functions inherited from inet::Chunk
static void serialize (MemoryOutputStream &stream, const Ptr< const Chunk > &chunk, b offset=b(0), b length=b(-1))
 Serializes a chunk into the given stream. More...
 
static const Ptr< Chunkdeserialize (MemoryInputStream &stream, const std::type_info &typeInfo)
 Deserializes a chunk from the given stream. More...
 
- Static Public Attributes inherited from inet::Chunk
static const b unspecifiedLength = b(-std::numeric_limits<int64_t>::max())
 
static bool enableImplicitChunkSerialization = false
 Peeking some part into a chunk that requires automatic serialization will throw an exception when implicit chunk serialization is disabled. More...
 
static int nextId = 0
 
- Protected Types inherited from inet::Chunk
enum  ChunkFlag { CF_IMMUTABLE = (1 << 0), CF_INCOMPLETE = (1 << 1), CF_INCORRECT = (1 << 2), CF_IMPROPERLY_REPRESENTED = (1 << 3) }
 This enum specifies bitmasks for the flags field of Chunk. More...
 
typedef bool(* PeekPredicate) (const Ptr< Chunk > &)
 
- Static Protected Member Functions inherited from inet::FieldsChunk
static const Ptr< ChunkconvertChunk (const std::type_info &typeInfo, const Ptr< Chunk > &chunk, b offset, b length, int flags)
 
- Static Protected Member Functions inherited from inet::Chunk
static const Ptr< ChunkconvertChunk (const std::type_info &typeInfo, const Ptr< Chunk > &chunk, b offset, b length, int flags)
 Creates a new chunk of the given type that represents the designated part of the provided chunk. More...
 

Detailed Description

Class generated from inet/networklayer/ipv4/Ipv4Header.msg:170 by opp_msgtool.

//
// Represents an Ipv4 datagram.
//
// Uses the following cPacket fields:
//    - getByteLength() / setByteLength() to represent total datagram length
//    - hasBitError() / setBitError() to represent datagram correctness
//    - getTimestamp() / setTimestamp (simtime) used in timestamp option
//
// Additional length fields defined in this class are in bytes.
//
// Only one of the option fields can exist at a time.
//
// TODO cleanup order of fields
class Ipv4Header extends NetworkHeaderBase
{
    chunkLength = IPv4_MIN_HEADER_LENGTH;
    short version = 4;      // @bit(4)
    B headerLength = IPv4_MIN_HEADER_LENGTH;         // @bit(4), bytes, must be multiple of 4
    short typeOfService;    // @bit(8)
    // OMNeT++ 6.0:
    // short __dscp @custom @getter(getDscp) @setter(setDscp);  // @bit(6), maps to bits 0-5 of ToS, stored in typeOfService
    // short __ecn @custom @getter(getEcn) @setter(setEcn);  // @bit(2),  maps to bits 6-7 of ToS, stored in typeOfService
    B totalLengthField;    // @byte(2)
    uint16_t identification;    // @byte(2)
    bool reservedBit = false;    // @bit(1)
    bool moreFragments;    // @bit(1)
    bool dontFragment;    // @bit(1)
    uint16_t fragmentOffset;         // @bit(13), must be multiple of 8
    short timeToLive;    // @byte(1)
    IpProtocolId protocolId = IP_PROT_NONE;    // @byte(1)
    uint16_t crc = 0;    // @byte(2)
    CrcMode crcMode = CRC_MODE_UNDEFINED;
    Ipv4Address srcAddress;
    Ipv4Address destAddress;
    TlvOptions options; // array of option pointers, option pointers owned by datagram
}

Constructor & Destructor Documentation

◆ Ipv4Header() [1/2]

inet::Ipv4Header::Ipv4Header ( )

◆ Ipv4Header() [2/2]

inet::Ipv4Header::Ipv4Header ( const Ipv4Header other)

◆ ~Ipv4Header()

virtual inet::Ipv4Header::~Ipv4Header ( )
virtual

Member Function Documentation

◆ addOption() [1/2]

void inet::Ipv4Header::addOption ( TlvOptionBase opt)
virtual

Adds an TlvOptionBase to the datagram.

29 {
30  handleChange();
32 }

◆ addOption() [2/2]

void inet::Ipv4Header::addOption ( TlvOptionBase opt,
int  atPos 
)
virtual
35 {
36  handleChange();
37  options.insertTlvOption(atPos, opt);
38 }

◆ calculateHeaderByteLength()

B inet::Ipv4Header::calculateHeaderByteLength ( ) const
virtual

Calculates the length of the Ipv6 header plus the extension headers.

41 {
42  int length = utils::roundUp(20 + options.getLength(), 4);
43  ASSERT(length >= 20 && length <= 60 && (length % 4 == 0));
44 
45  return B(length);
46 }

◆ copy()

void inet::Ipv4Header::copy ( const Ipv4Header other)
private

◆ dup()

virtual Ipv4Header* inet::Ipv4Header::dup ( ) const
inlineoverridevirtual

Reimplemented from inet::NetworkHeaderBase.

611 {return new Ipv4Header(*this);}

Referenced by inet::Ipv4FragBuf::addFragment().

◆ findMutableOptionByType()

TlvOptionBase * inet::Ipv4Header::findMutableOptionByType ( short int  optionType,
int  index = 0 
)
virtual

Returns the TlvOptionBase of the specified type, or nullptr.

If index is 0, then the first, if 1 then the second option is returned.

16 {
17  handleChange();
18  int i = options.findByType(optionType, index);
19  return i >= 0 ? &getOptionForUpdate(i) : nullptr;
20 }

◆ findOptionByType()

const TlvOptionBase * inet::Ipv4Header::findOptionByType ( short int  optionType,
int  index = 0 
) const
virtual
23 {
24  int i = options.findByType(optionType, index);
25  return i >= 0 ? &getOption(i) : nullptr;
26 }

◆ getCrc()

virtual uint16_t inet::Ipv4Header::getCrc ( ) const
virtual

◆ getCrcMode()

virtual CrcMode inet::Ipv4Header::getCrcMode ( ) const
virtual

◆ getDestAddress()

virtual const Ipv4Address& inet::Ipv4Header::getDestAddress ( ) const
virtual

◆ getDestAddressForUpdate()

virtual Ipv4Address& inet::Ipv4Header::getDestAddressForUpdate ( )
inlinevirtual
659 { handleChange();return const_cast<Ipv4Address&>(const_cast<Ipv4Header*>(this)->getDestAddress());}

◆ getDestinationAddress()

virtual L3Address inet::Ipv4Header::getDestinationAddress ( ) const
inlineoverridevirtual

Implements inet::NetworkHeaderBase.

707 { return L3Address(getDestAddress()); }

◆ getDontFragment()

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

◆ getDscp()

short inet::Ipv4Header::getDscp ( ) const
virtual
49 {
50  return (typeOfService & 0xfc) >> 2;
51 }

◆ getEcn()

short inet::Ipv4Header::getEcn ( ) const
virtual
59 {
60  return typeOfService & 0x03;
61 }

◆ getFragmentOffset()

virtual uint16_t inet::Ipv4Header::getFragmentOffset ( ) const
virtual

◆ getHeaderLength()

virtual B inet::Ipv4Header::getHeaderLength ( ) const
virtual

◆ getIdentification()

virtual uint16_t inet::Ipv4Header::getIdentification ( ) const
virtual

◆ getMoreFragments()

virtual bool inet::Ipv4Header::getMoreFragments ( ) const
virtual

◆ getOption()

virtual const TlvOptionBase& inet::Ipv4Header::getOption ( unsigned int  k) const
inlinevirtual
682 { return *CHK((options.getTlvOption(k))); }

Referenced by findOptionByType().

◆ getOptionArraySize()

virtual unsigned int inet::Ipv4Header::getOptionArraySize ( ) const
inlinevirtual

Returns the number of extension headers in this datagram.

676 { return options.getTlvOptionArraySize(); }

◆ getOptionForUpdate()

virtual TlvOptionBase& inet::Ipv4Header::getOptionForUpdate ( unsigned int  k)
inlinevirtual

Returns the kth extension header in this datagram.

681 { handleChange(); return *CHK((options.getTlvOptionForUpdate(k))); }

Referenced by findMutableOptionByType().

◆ getOptions()

virtual const TlvOptions& inet::Ipv4Header::getOptions ( ) const
virtual

◆ getOptionsForUpdate()

virtual TlvOptions& inet::Ipv4Header::getOptionsForUpdate ( )
inlinevirtual
663 { handleChange();return const_cast<TlvOptions&>(const_cast<Ipv4Header*>(this)->getOptions());}

◆ getProtocol()

virtual const Protocol* inet::Ipv4Header::getProtocol ( ) const
inlineoverridevirtual

◆ getProtocolId()

virtual IpProtocolId inet::Ipv4Header::getProtocolId ( ) const
virtual

◆ getReservedBit()

virtual bool inet::Ipv4Header::getReservedBit ( ) const
virtual

◆ getSourceAddress()

virtual L3Address inet::Ipv4Header::getSourceAddress ( ) const
inlineoverridevirtual

Implements inet::NetworkHeaderBase.

705 { return L3Address(getSrcAddress()); }

◆ getSrcAddress()

virtual const Ipv4Address& inet::Ipv4Header::getSrcAddress ( ) const
virtual

◆ getSrcAddressForUpdate()

virtual Ipv4Address& inet::Ipv4Header::getSrcAddressForUpdate ( )
inlinevirtual
655 { handleChange();return const_cast<Ipv4Address&>(const_cast<Ipv4Header*>(this)->getSrcAddress());}

◆ getTimeToLive()

virtual short inet::Ipv4Header::getTimeToLive ( ) const
virtual

◆ getTotalLengthField()

virtual B inet::Ipv4Header::getTotalLengthField ( ) const
virtual

◆ getTypeOfService()

virtual short inet::Ipv4Header::getTypeOfService ( ) const
virtual

◆ getVersion()

virtual short inet::Ipv4Header::getVersion ( ) const
virtual

◆ isFragment()

virtual bool inet::Ipv4Header::isFragment ( ) const
inlineoverridevirtual

Implements inet::NetworkHeaderBase.

711 { return getMoreFragments() || (getFragmentOffset() != 0); }

◆ operator=()

Ipv4Header& inet::Ipv4Header::operator= ( const Ipv4Header other)

◆ operator==()

bool inet::Ipv4Header::operator== ( const Ipv4Header )
protecteddelete

◆ parsimPack()

virtual void inet::Ipv4Header::parsimPack ( omnetpp::cCommBuffer *  b) const
overridevirtual

Referenced by inet::doParsimPacking().

◆ parsimUnpack()

virtual void inet::Ipv4Header::parsimUnpack ( omnetpp::cCommBuffer *  b)
overridevirtual

Referenced by inet::doParsimUnpacking().

◆ setCrc()

virtual void inet::Ipv4Header::setCrc ( uint16_t  crc)
virtual

◆ setCrcMode()

virtual void inet::Ipv4Header::setCrcMode ( CrcMode  crcMode)
virtual

◆ setDestAddress()

virtual void inet::Ipv4Header::setDestAddress ( const Ipv4Address destAddress)
virtual

◆ setDestinationAddress()

virtual void inet::Ipv4Header::setDestinationAddress ( const L3Address address)
inlineoverridevirtual

Implements inet::NetworkHeaderBase.

708 { setDestAddress(address.toIpv4()); }

◆ setDontFragment()

virtual void inet::Ipv4Header::setDontFragment ( bool  dontFragment)
virtual

◆ setDscp()

void inet::Ipv4Header::setDscp ( short  dscp)
virtual
54 {
55  setTypeOfService(((dscp & 0x3f) << 2) | (typeOfService & 0x03));
56 }

◆ setEcn()

void inet::Ipv4Header::setEcn ( short  ecn)
virtual
64 {
65  setTypeOfService((typeOfService & 0xfc) | (ecn & 0x03));
66 }

◆ setFragmentOffset()

virtual void inet::Ipv4Header::setFragmentOffset ( uint16_t  fragmentOffset)
virtual

◆ setHeaderLength()

virtual void inet::Ipv4Header::setHeaderLength ( B  headerLength)
virtual

◆ setIdentification()

virtual void inet::Ipv4Header::setIdentification ( uint16_t  identification)
virtual

◆ setMoreFragments()

virtual void inet::Ipv4Header::setMoreFragments ( bool  moreFragments)
virtual

◆ setOptions()

virtual void inet::Ipv4Header::setOptions ( const TlvOptions options)
virtual

◆ setProtocol()

virtual void inet::Ipv4Header::setProtocol ( const Protocol protocol)
inlineoverridevirtual

Implements inet::NetworkHeaderBase.

710 { setProtocolId(static_cast<IpProtocolId>(ProtocolGroup::ipprotocol.getProtocolNumber(protocol))); }

◆ setProtocolId()

virtual void inet::Ipv4Header::setProtocolId ( IpProtocolId  protocolId)
virtual

◆ setReservedBit()

virtual void inet::Ipv4Header::setReservedBit ( bool  reservedBit)
virtual

◆ setSourceAddress()

virtual void inet::Ipv4Header::setSourceAddress ( const L3Address address)
inlineoverridevirtual

Implements inet::NetworkHeaderBase.

706 { setSrcAddress(address.toIpv4()); }

◆ setSrcAddress()

virtual void inet::Ipv4Header::setSrcAddress ( const Ipv4Address srcAddress)
virtual

◆ setTimeToLive()

virtual void inet::Ipv4Header::setTimeToLive ( short  timeToLive)
virtual

◆ setTotalLengthField()

virtual void inet::Ipv4Header::setTotalLengthField ( B  totalLengthField)
virtual

◆ setTypeOfService()

virtual void inet::Ipv4Header::setTypeOfService ( short  typeOfService)
virtual

Referenced by setDscp(), and setEcn().

◆ setVersion()

virtual void inet::Ipv4Header::setVersion ( short  version)
virtual

Member Data Documentation

◆ crc

uint16_t inet::Ipv4Header::crc = 0
protected

◆ crcMode

CrcMode inet::Ipv4Header::crcMode = CRC_MODE_UNDEFINED
protected

◆ destAddress

Ipv4Address inet::Ipv4Header::destAddress
protected

◆ dontFragment

bool inet::Ipv4Header::dontFragment = false
protected

◆ fragmentOffset

uint16_t inet::Ipv4Header::fragmentOffset = 0
protected

◆ headerLength

B inet::Ipv4Header::headerLength = IPv4_MIN_HEADER_LENGTH
protected

◆ identification

uint16_t inet::Ipv4Header::identification = 0
protected

◆ moreFragments

bool inet::Ipv4Header::moreFragments = false
protected

◆ options

TlvOptions inet::Ipv4Header::options
protected

◆ protocolId

IpProtocolId inet::Ipv4Header::protocolId = IP_PROT_NONE
protected

◆ reservedBit

bool inet::Ipv4Header::reservedBit = false
protected

◆ srcAddress

Ipv4Address inet::Ipv4Header::srcAddress
protected

◆ timeToLive

short inet::Ipv4Header::timeToLive = 0
protected

◆ totalLengthField

B inet::Ipv4Header::totalLengthField = B(-1)
protected

◆ typeOfService

short inet::Ipv4Header::typeOfService = 0
protected

Referenced by getDscp(), getEcn(), setDscp(), and setEcn().

◆ version

short inet::Ipv4Header::version = 4
protected

The documentation for this class was generated from the following files:
CHK
#define CHK(x)
Definition: INETDefs.h:87
protocol
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
inet::TlvOptions::getTlvOption
virtual const TlvOptionBase * getTlvOption(size_t k) const
inet::Ipv4Header::setDestAddress
virtual void setDestAddress(const Ipv4Address &destAddress)
inet::Ipv4Header::getSrcAddress
virtual const Ipv4Address & getSrcAddress() const
inet::Ipv4Header::getOptionForUpdate
virtual TlvOptionBase & getOptionForUpdate(unsigned int k)
Returns the kth extension header in this datagram.
Definition: Ipv4Header_m.h:681
inet::ProtocolGroup::findProtocol
const Protocol * findProtocol(int protocolNumber) const
Definition: ProtocolGroup.cc:25
inet::TlvOptions::appendTlvOption
virtual void appendTlvOption(TlvOptionBase *tlvOption)
inet::FieldsChunk::handleChange
virtual void handleChange() override
Definition: FieldsChunk.cc:50
inet::TlvOptions::insertTlvOption
virtual void insertTlvOption(size_t k, TlvOptionBase *tlvOption)
inet::TlvOptions::getTlvOptionArraySize
virtual size_t getTlvOptionArraySize() const
inet::TlvOptions::getTlvOptionForUpdate
virtual TlvOptionBase * getTlvOptionForUpdate(size_t k)
Definition: TlvOptions_m.h:163
inet::Ipv4Header::getOption
virtual const TlvOptionBase & getOption(unsigned int k) const
Definition: Ipv4Header_m.h:682
inet::Ipv4Header::Ipv4Header
Ipv4Header()
inet::Ipv4Header::getMoreFragments
virtual bool getMoreFragments() const
inet::TlvOptions::getLength
virtual int getLength() const
Definition: TlvOptions.cc:12
inet::units::units::B
intscale< b, 1, 8 > B
Definition: Units.h:1168
inet::Ipv4Header::setTypeOfService
virtual void setTypeOfService(short typeOfService)
inet::Ipv4Header::getProtocolId
virtual IpProtocolId getProtocolId() const
inet::Ipv4Header::getFragmentOffset
virtual uint16_t getFragmentOffset() const
inet::Ipv4Header::setSrcAddress
virtual void setSrcAddress(const Ipv4Address &srcAddress)
inet::utils::roundUp
int roundUp(int numToRound, int multiple)
Rounding up to the nearest multiple of a number.
Definition: INETUtils.h:70
inet::TlvOptions::findByType
int findByType(short int type, int firstPos=0) const
Definition: TlvOptions.cc:48
inet::Ipv4Header::options
TlvOptions options
Definition: Ipv4Header_m.h:598
inet::physicallayer::k
const double k
Definition: Qam1024Modulation.cc:14
inet::Ipv4Header::getDestAddress
virtual const Ipv4Address & getDestAddress() const
inet::Ipv4Header::typeOfService
short typeOfService
Definition: Ipv4Header_m.h:585
inet::ProtocolGroup::ipprotocol
static ProtocolGroup ipprotocol
Definition: ProtocolGroup.h:42
inet::Ipv4Header::setProtocolId
virtual void setProtocolId(IpProtocolId protocolId)
inet::IpProtocolId
IpProtocolId
Enum generated from inet/networklayer/common/IpProtocolId.msg:17 by opp_msgtool.
Definition: IpProtocolId_m.h:90
inet::Ipv4Header::getOptions
virtual const TlvOptions & getOptions() const