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

Class generated from inet/networklayer/ipv6/Ipv6Header.msg:50 by opp_msgtool. More...

#include <Ipv6Header_m.h>

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

Public Member Functions

 Ipv6Header ()
 
 Ipv6Header (const Ipv6Header &other)
 
virtual ~Ipv6Header ()
 
Ipv6Headeroperator= (const Ipv6Header &other)
 
virtual Ipv6Headerdup () const override
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual uint8_t getVersion () const
 
virtual void setVersion (uint8_t version)
 
virtual const Ipv6AddressgetSrcAddress () const
 
virtual Ipv6AddressgetSrcAddressForUpdate ()
 
virtual void setSrcAddress (const Ipv6Address &srcAddress)
 
virtual const Ipv6AddressgetDestAddress () const
 
virtual Ipv6AddressgetDestAddressForUpdate ()
 
virtual void setDestAddress (const Ipv6Address &destAddress)
 
virtual B getPayloadLength () const
 
virtual void setPayloadLength (B payloadLength)
 
virtual short getTrafficClass () const
 
virtual void setTrafficClass (short trafficClass)
 
virtual unsigned int getFlowLabel () const
 
virtual void setFlowLabel (unsigned int flowLabel)
 
virtual short getHopLimit () const
 
virtual void setHopLimit (short hopLimit)
 
virtual IpProtocolId getProtocolId () const
 
virtual void setProtocolId (IpProtocolId protocolId)
 
virtual void setExtensionHeaderArraySize (size_t size)
 
virtual size_t getExtensionHeaderArraySize () const
 
virtual const Ipv6ExtensionHeadergetExtensionHeader (size_t k) const
 
virtual Ipv6ExtensionHeadergetExtensionHeaderForUpdate (size_t k)
 
virtual void setExtensionHeader (size_t k, Ipv6ExtensionHeader *extensionHeader)
 
virtual Ipv6ExtensionHeaderremoveExtensionHeader (size_t k)
 
Ipv6ExtensionHeaderdropExtensionHeader (size_t k)
 
virtual void insertExtensionHeader (size_t k, Ipv6ExtensionHeader *extensionHeader)
 
void insertExtensionHeader (Ipv6ExtensionHeader *extensionHeader)
 
virtual void appendExtensionHeader (Ipv6ExtensionHeader *extensionHeader)
 
virtual void eraseExtensionHeader (size_t k)
 
virtual short getDscp () const
 
virtual void setDscp (short dscp)
 
virtual short getEcn () const
 
virtual void setEcn (short ecn)
 
virtual Ipv6ExtensionHeaderfindExtensionHeaderByTypeForUpdate (IpProtocolId extensionType, int index=0)
 Returns the extension header of the specified type, or nullptr. More...
 
virtual const Ipv6ExtensionHeaderfindExtensionHeaderByType (IpProtocolId extensionType, int index=0) const
 
virtual void addExtensionHeader (Ipv6ExtensionHeader *eh)
 Adds an extension header to the datagram. More...
 
virtual B calculateHeaderByteLength () const
 Calculates the length of the Ipv6 header plus the extension headers. More...
 
virtual B calculateUnfragmentableHeaderByteLength () const
 Calculates the length of the unfragmentable part of Ipv6 header plus the extension headers. More...
 
virtual B calculateFragmentLength () const
 Calculates the length of the payload and extension headers after the Fragment Header. More...
 
virtual Ipv6ExtensionHeaderremoveFirstExtensionHeader ()
 Removes and returns the first extension header of this datagram. More...
 
virtual Ipv6ExtensionHeaderremoveExtensionHeader (IpProtocolId extensionType)
 Removes and returns the first extension header with the given type. 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 Ipv6Header &)=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

uint8_t version = 6
 
Ipv6Address srcAddress
 
Ipv6Address destAddress
 
B payloadLength = B(-1)
 
short trafficClass = 0
 
unsigned int flowLabel = 0
 
short hopLimit = 0
 
IpProtocolId protocolId = IP_PROT_NONE
 
Ipv6ExtensionHeader ** extensionHeader = nullptr
 
size_t extensionHeader_arraysize = 0
 
- 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 Ipv6Header &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/ipv6/Ipv6Header.msg:50 by opp_msgtool.

//
// Ipv6 datagram. RFC 2460 Section 3.
//
// Header fields not explicitly modelled:
//    - payload length: will be calculated from encapsulated message length
//      and extension headers' length
//
class Ipv6Header extends NetworkHeaderBase
{
    chunkLength = IPv6_HEADER_BYTES;
    uint8_t version = 6;
    Ipv6Address srcAddress;
    Ipv6Address destAddress;
    B payloadLength = B(-1);    // The size of the payload in octets, including any extension headers. The length is set to zero when a Hop-by-Hop extension header carries a Jumbo Payload option.
    short trafficClass;    // @bits(8) Traffic Class
    // OMNeT++ 6.0:
    // short __dscp @custom @getter(getDscp) @setter(setDscp);  // @bit(6), maps to bits 0-5 of trafficClass
    // short __ecn @custom @getter(getEcn) @setter(setEcn);  // @bit(2),  maps to bits 6-7 of trafficClass
    unsigned int flowLabel;
    short hopLimit = 0;
    IpProtocolId protocolId = IP_PROT_NONE;
    Ipv6ExtensionHeader *extensionHeader[] @owned; // array of extension headers, subclassed from ~Ipv6ExtensionHeader
}

Constructor & Destructor Documentation

◆ Ipv6Header() [1/2]

inet::Ipv6Header::Ipv6Header ( )

◆ Ipv6Header() [2/2]

inet::Ipv6Header::Ipv6Header ( const Ipv6Header other)

◆ ~Ipv6Header()

virtual inet::Ipv6Header::~Ipv6Header ( )
virtual

Member Function Documentation

◆ addExtensionHeader()

void inet::Ipv6Header::addExtensionHeader ( Ipv6ExtensionHeader eh)
virtual

Adds an extension header to the datagram.

The extension headers are stored in the order specified in RFC 2460 4.1.

38 {
39  ASSERT((eh->getByteLength() >= B(1)) && (eh->getByteLength().get() % 8 == 0));
40  int thisOrder = eh->getOrder();
41  size_t i;
42  for (i = 0; i < extensionHeader_arraysize; i++) {
43  int thatOrder = extensionHeader[i]->getOrder();
44  if (thisOrder != -1 && thatOrder > thisOrder)
45  break;
46  else if (thisOrder == thatOrder) {
47  if (thisOrder == 1) // first IP_PROT_IPv6EXT_DEST has order 1, second IP_PROT_IPv6EXT_DEST has order 6
48  thisOrder = 6;
49  else if (thisOrder != -1)
50  throw cRuntimeError(this, "addExtensionHeader() duplicate extension header: %d",
51  eh->getExtensionType());
52  }
53  }
54 
55  // insert at position atPos, shift up the rest of the array
56  insertExtensionHeader(i, eh);
57 }

◆ appendExtensionHeader()

virtual void inet::Ipv6Header::appendExtensionHeader ( Ipv6ExtensionHeader extensionHeader)
virtual

◆ calculateFragmentLength()

B inet::Ipv6Header::calculateFragmentLength ( ) const
virtual

Calculates the length of the payload and extension headers after the Fragment Header.

Note: it is assumed that headers are ordered as described in RFC 2460 4.1.

127 {
129  size_t i;
130  for (i = 0; i < extensionHeader_arraysize; i++) {
131  len -= extensionHeader[i]->getByteLength();
132  if (extensionHeader[i]->getExtensionType() == IP_PROT_IPv6EXT_FRAGMENT)
133  break;
134  }
135  ASSERT2(i < extensionHeader_arraysize, "IPv6Datagram::calculateFragmentLength() called on non-fragment datagram");
136  return len;
137 }

◆ calculateHeaderByteLength()

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

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

96 {
97  B len = B(40);
98  for (size_t i = 0; i < extensionHeader_arraysize; i++)
99  len += extensionHeader[i]->getByteLength();
100  return len;
101 }

◆ calculateUnfragmentableHeaderByteLength()

B inet::Ipv6Header::calculateUnfragmentableHeaderByteLength ( ) const
virtual

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

Note: it is assumed that headers are ordered as described in RFC 2460 4.1.

107 {
108  size_t firstFragmentableExtensionIndex = 0;
109  for (size_t i = extensionHeader_arraysize; i > 0; i--) {
110  int type = extensionHeader[i - 1]->getExtensionType();
112  firstFragmentableExtensionIndex = i;
113  break;
114  }
115  }
116 
117  B len = B(40);
118  for (size_t i = 0; i < firstFragmentableExtensionIndex; i++)
119  len += extensionHeader[i]->getByteLength();
120  return len;
121 }

◆ copy()

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

◆ dropExtensionHeader()

Ipv6ExtensionHeader* inet::Ipv6Header::dropExtensionHeader ( size_t  k)
inline
200 {return removeExtensionHeader(k);}

◆ dup()

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

Reimplemented from inet::NetworkHeaderBase.

164 {return new Ipv6Header(*this);}

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

◆ eraseExtensionHeader()

virtual void inet::Ipv6Header::eraseExtensionHeader ( size_t  k)
virtual

◆ findExtensionHeaderByType()

const Ipv6ExtensionHeader * inet::Ipv6Header::findExtensionHeaderByType ( IpProtocolId  extensionType,
int  index = 0 
) const
virtual
26 {
27  for (size_t i = 0; i < extensionHeader_arraysize; i++)
28  if (extensionHeader[i]->getExtensionType() == extensionType) {
29  if (index == 0)
30  return extensionHeader[i];
31  else
32  index--;
33  }
34  return nullptr;
35 }

Referenced by findExtensionHeaderByTypeForUpdate().

◆ findExtensionHeaderByTypeForUpdate()

Ipv6ExtensionHeader * inet::Ipv6Header::findExtensionHeaderByTypeForUpdate ( IpProtocolId  extensionType,
int  index = 0 
)
virtual

Returns the extension header of the specified type, or nullptr.

If index is 0, then the first, if 1 then the second extension is returned. (The datagram might contain two Destination Options extension.)

20 {
21  handleChange();
22  return const_cast<Ipv6ExtensionHeader *>(const_cast<Ipv6Header *>(this)->findExtensionHeaderByType(extensionType, index));
23 }

◆ getDestAddress()

virtual const Ipv6Address& inet::Ipv6Header::getDestAddress ( ) const
virtual

◆ getDestAddressForUpdate()

virtual Ipv6Address& inet::Ipv6Header::getDestAddressForUpdate ( )
inlinevirtual
176 { handleChange();return const_cast<Ipv6Address&>(const_cast<Ipv6Header*>(this)->getDestAddress());}

◆ getDestinationAddress()

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

Implements inet::NetworkHeaderBase.

259 { return L3Address(getDestAddress()); }

◆ getDscp()

short inet::Ipv6Header::getDscp ( ) const
virtual
166 {
167  return (trafficClass & 0xfc) >> 2;
168 }

◆ getEcn()

short inet::Ipv6Header::getEcn ( ) const
virtual
176 {
177  return trafficClass & 0x03;
178 }

◆ getExtensionHeader()

virtual const Ipv6ExtensionHeader* inet::Ipv6Header::getExtensionHeader ( size_t  k) const
virtual

◆ getExtensionHeaderArraySize()

virtual size_t inet::Ipv6Header::getExtensionHeaderArraySize ( ) const
virtual

◆ getExtensionHeaderForUpdate()

virtual Ipv6ExtensionHeader* inet::Ipv6Header::getExtensionHeaderForUpdate ( size_t  k)
inlinevirtual
197 { handleChange();return const_cast<Ipv6ExtensionHeader *>(const_cast<Ipv6Header*>(this)->getExtensionHeader(k));}

◆ getFlowLabel()

virtual unsigned int inet::Ipv6Header::getFlowLabel ( ) const
virtual

◆ getHopLimit()

virtual short inet::Ipv6Header::getHopLimit ( ) const
virtual

◆ getPayloadLength()

virtual B inet::Ipv6Header::getPayloadLength ( ) const
virtual

◆ getProtocol()

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

◆ getProtocolId()

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

◆ getSourceAddress()

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

Implements inet::NetworkHeaderBase.

257 { return L3Address(getSrcAddress()); }

◆ getSrcAddress()

virtual const Ipv6Address& inet::Ipv6Header::getSrcAddress ( ) const
virtual

◆ getSrcAddressForUpdate()

virtual Ipv6Address& inet::Ipv6Header::getSrcAddressForUpdate ( )
inlinevirtual
172 { handleChange();return const_cast<Ipv6Address&>(const_cast<Ipv6Header*>(this)->getSrcAddress());}

◆ getTrafficClass()

virtual short inet::Ipv6Header::getTrafficClass ( ) const
virtual

◆ getVersion()

virtual uint8_t inet::Ipv6Header::getVersion ( ) const
virtual

◆ insertExtensionHeader() [1/2]

void inet::Ipv6Header::insertExtensionHeader ( Ipv6ExtensionHeader extensionHeader)
inline

◆ insertExtensionHeader() [2/2]

virtual void inet::Ipv6Header::insertExtensionHeader ( size_t  k,
Ipv6ExtensionHeader extensionHeader 
)
virtual

Referenced by addExtensionHeader().

◆ isFragment()

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

◆ operator=()

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

◆ operator==()

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

◆ parsimPack()

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

Referenced by inet::doParsimPacking().

◆ parsimUnpack()

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

Referenced by inet::doParsimUnpacking().

◆ removeExtensionHeader() [1/2]

Ipv6ExtensionHeader * inet::Ipv6Header::removeExtensionHeader ( IpProtocolId  extensionType)
virtual

Removes and returns the first extension header with the given type.

150 {
151  handleChange();
152  if (extensionHeader_arraysize == 0)
153  return nullptr;
154 
155  for (size_t i = 0; i < extensionHeader_arraysize; i++) {
156  if (extensionHeader[i]->getExtensionType() == extensionType) {
157  Ipv6ExtensionHeader *eh = removeExtensionHeader(i);
159  return eh;
160  }
161  }
162  return nullptr;
163 }

◆ removeExtensionHeader() [2/2]

virtual Ipv6ExtensionHeader* inet::Ipv6Header::removeExtensionHeader ( size_t  k)
virtual

◆ removeFirstExtensionHeader()

Ipv6ExtensionHeader * inet::Ipv6Header::removeFirstExtensionHeader ( )
virtual

Removes and returns the first extension header of this datagram.

140 {
141  handleChange();
142  if (extensionHeader_arraysize == 0)
143  return nullptr;
144  Ipv6ExtensionHeader *eh = removeExtensionHeader(0);
146  return eh;
147 }

◆ setDestAddress()

virtual void inet::Ipv6Header::setDestAddress ( const Ipv6Address destAddress)
virtual

◆ setDestinationAddress()

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

Implements inet::NetworkHeaderBase.

260 { setDestAddress(address.toIpv6()); }

◆ setDscp()

void inet::Ipv6Header::setDscp ( short  dscp)
virtual
171 {
172  setTrafficClass(((dscp & 0x3f) << 2) | (trafficClass & 0x03));
173 }

◆ setEcn()

void inet::Ipv6Header::setEcn ( short  ecn)
virtual
181 {
182  setTrafficClass((trafficClass & 0xfc) | (ecn & 0x03));
183 }

◆ setExtensionHeader()

virtual void inet::Ipv6Header::setExtensionHeader ( size_t  k,
Ipv6ExtensionHeader extensionHeader 
)
virtual

◆ setExtensionHeaderArraySize()

virtual void inet::Ipv6Header::setExtensionHeaderArraySize ( size_t  size)
virtual

◆ setFlowLabel()

virtual void inet::Ipv6Header::setFlowLabel ( unsigned int  flowLabel)
virtual

◆ setHopLimit()

virtual void inet::Ipv6Header::setHopLimit ( short  hopLimit)
virtual

◆ setPayloadLength()

virtual void inet::Ipv6Header::setPayloadLength ( B  payloadLength)
virtual

◆ setProtocol()

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

Implements inet::NetworkHeaderBase.

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

◆ setProtocolId()

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

◆ setSourceAddress()

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

Implements inet::NetworkHeaderBase.

258 { setSrcAddress(address.toIpv6()); }

◆ setSrcAddress()

virtual void inet::Ipv6Header::setSrcAddress ( const Ipv6Address srcAddress)
virtual

◆ setTrafficClass()

virtual void inet::Ipv6Header::setTrafficClass ( short  trafficClass)
virtual

Referenced by setDscp(), and setEcn().

◆ setVersion()

virtual void inet::Ipv6Header::setVersion ( uint8_t  version)
virtual

Member Data Documentation

◆ destAddress

Ipv6Address inet::Ipv6Header::destAddress
protected

◆ extensionHeader

◆ extensionHeader_arraysize

◆ flowLabel

unsigned int inet::Ipv6Header::flowLabel = 0
protected

◆ hopLimit

short inet::Ipv6Header::hopLimit = 0
protected

◆ payloadLength

B inet::Ipv6Header::payloadLength = B(-1)
protected

◆ protocolId

IpProtocolId inet::Ipv6Header::protocolId = IP_PROT_NONE
protected

◆ srcAddress

Ipv6Address inet::Ipv6Header::srcAddress
protected

◆ trafficClass

short inet::Ipv6Header::trafficClass = 0
protected

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

◆ version

uint8_t inet::Ipv6Header::version = 6
protected

The documentation for this class was generated from the following files:
inet::IP_PROT_IPv6EXT_HOP
@ IP_PROT_IPv6EXT_HOP
Definition: IpProtocolId_m.h:111
inet::Ipv6Header::removeExtensionHeader
virtual Ipv6ExtensionHeader * removeExtensionHeader(size_t k)
inet::Ipv6Header::getProtocolId
virtual IpProtocolId getProtocolId() const
inet::Ipv6Header::findExtensionHeaderByType
virtual const Ipv6ExtensionHeader * findExtensionHeaderByType(IpProtocolId extensionType, int index=0) const
Definition: Ipv6Header.cc:25
protocol
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
inet::ProtocolGroup::findProtocol
const Protocol * findProtocol(int protocolNumber) const
Definition: ProtocolGroup.cc:25
inet::Ipv6Header::setTrafficClass
virtual void setTrafficClass(short trafficClass)
inet::FieldsChunk::handleChange
virtual void handleChange() override
Definition: FieldsChunk.cc:50
inet::Ipv6ExtensionHeader::getExtensionType
virtual uint8_t getExtensionType() const
inet::IP_PROT_IPv6EXT_FRAGMENT
@ IP_PROT_IPv6EXT_FRAGMENT
Definition: IpProtocolId_m.h:114
inet::Ipv6Header::extensionHeader_arraysize
size_t extensionHeader_arraysize
Definition: Ipv6Header_m.h:151
inet::Ipv6Header::trafficClass
short trafficClass
Definition: Ipv6Header_m.h:146
inet::units::units::B
intscale< b, 1, 8 > B
Definition: Units.h:1168
inet::Ipv6Header::setDestAddress
virtual void setDestAddress(const Ipv6Address &destAddress)
inet::FieldsChunk::getChunkLength
virtual b getChunkLength() const override
Returns the length of data represented by this chunk.
Definition: FieldsChunk.h:67
inet::Ipv6Header::eraseExtensionHeader
virtual void eraseExtensionHeader(size_t k)
type
removed type
Definition: IUdp-gates.txt:7
inet::IP_PROT_IPv6EXT_ROUTING
@ IP_PROT_IPv6EXT_ROUTING
Definition: IpProtocolId_m.h:113
inet::Ipv6Header::Ipv6Header
Ipv6Header()
inet::IPv6_HEADER_BYTES
const B IPv6_HEADER_BYTES
Definition: Ipv6Consts.h:15
inet::Ipv6Header::insertExtensionHeader
virtual void insertExtensionHeader(size_t k, Ipv6ExtensionHeader *extensionHeader)
inet::physicallayer::k
const double k
Definition: Qam1024Modulation.cc:14
inet::Ipv6Header::setSrcAddress
virtual void setSrcAddress(const Ipv6Address &srcAddress)
inet::Ipv6ExtensionHeader::getByteLength
virtual B getByteLength() const
inet::ProtocolGroup::ipprotocol
static ProtocolGroup ipprotocol
Definition: ProtocolGroup.h:42
inet::Ipv6Header::getExtensionHeader
virtual const Ipv6ExtensionHeader * getExtensionHeader(size_t k) const
inet::Ipv6Header::getSrcAddress
virtual const Ipv6Address & getSrcAddress() const
inet::IpProtocolId
IpProtocolId
Enum generated from inet/networklayer/common/IpProtocolId.msg:17 by opp_msgtool.
Definition: IpProtocolId_m.h:90
inet::Ipv6Header::getDestAddress
virtual const Ipv6Address & getDestAddress() const
inet::Ipv6Header::extensionHeader
Ipv6ExtensionHeader ** extensionHeader
Definition: Ipv6Header_m.h:150
inet::Ipv6Header::setProtocolId
virtual void setProtocolId(IpProtocolId protocolId)
inet::Ipv6ExtensionHeader::getOrder
int getOrder() const
Definition: Ipv6Header.cc:64
inet::Ipv6Header::appendExtensionHeader
virtual void appendExtensionHeader(Ipv6ExtensionHeader *extensionHeader)