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

This class represents network packets, datagrams, frames and other kinds of data used by communication protocols. More...

#include <Packet.h>

Inheritance diagram for inet::Packet:
inet::IPrintableObject inet::ITaggedObject inet::IRegionTaggedObject

Public Member Functions

Constructors
 Packet (const char *name=nullptr, short kind=0)
 
 Packet (const char *name, const Ptr< const Chunk > &content)
 
 Packet (const Packet &other)
 
Supported cPacket interface functions
virtual Packetdup () const override
 
virtual void forEachChild (cVisitor *v) override
 
virtual bool hasBitError () const override
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
Unsupported cPacket interface functions
virtual void encapsulate (cPacket *packet) override
 
virtual cPacket * decapsulate () override
 
virtual cPacket * getEncapsulatedPacket () const override
 
virtual void setControlInfo (cObject *p) override
 
virtual void setBitLength (int64_t value) override
 
Length querying functions
b getTotalLength () const
 Returns the total packet length ignoring front and back offsets. More...
 
virtual int64_t getBitLength () const override
 Returns the length in bits between the front and back offsets. More...
 
b getDataLength () const
 Returns the current length of the data part of the packet. More...
 
Front and back offset related functions
b getFrontOffset () const
 Returns the front offset measured from the beginning of the packet. More...
 
void setFrontOffset (b offset)
 Changes the front offset measured from the beginning of the packet. More...
 
b getBackOffset () const
 Returns the back offset measured from the beginning of the packet. More...
 
void setBackOffset (b offset)
 Changes the back offset measured from the beginning of the packet. More...
 
Content peeking functions
const Ptr< const ChunkpeekAtFront (b length=b(-1), int flags=0) const
 Returns the designated part from the beginning of the data part of the packet as an immutable chunk in the current representation. More...
 
const Ptr< const ChunkpeekAtBack (b length=b(-1), int flags=0) const
 Returns the designated part from the end of the data part of the packet as an immutable chunk in the current representation. More...
 
const Ptr< const ChunkpeekData (int flags=0) const
 Returns the whole data part (excluding front and back popped parts) in the current representation. More...
 
const Ptr< const BitsChunkpeekDataAsBits (int flags=0) const
 Returns the whole data part (excluding front and back popped parts) as a sequence of bits. More...
 
const Ptr< const BytesChunkpeekDataAsBytes (int flags=0) const
 Returns the whole data part (excluding front and back popped parts) as a sequence of bytes. More...
 
const Ptr< const ChunkpeekAll (int flags=0) const
 Returns the whole packet (including front and back popped parts) in the current representation. More...
 
const Ptr< const BitsChunkpeekAllAsBits (int flags=0) const
 Returns the whole packet (including front and back popped parts) as a sequence of bits. More...
 
const Ptr< const BytesChunkpeekAllAsBytes (int flags=0) const
 Returns the whole packet (including front and back popped parts) as a sequence of bytes. More...
 
const Ptr< const ChunkpeekDataAt (b offset, b length=b(-1), int flags=0) const
 Returns the designated data part as an immutable chunk in the current representation. More...
 
const Ptr< const ChunkpeekAt (b offset, b length=b(-1), int flags=0) const
 Returns the designated part of the packet as an immutable chunk in the current representation. More...
 
template<typename T >
const Ptr< const TpeekAtFront (b length=b(-1), int flags=0) const
 Returns the designated part from the beginning of the data part of the packet as an immutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< const TpeekAtBack (b length, int flags=0) const
 Returns the designated part from the end of the data part of the packet as an immutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< const TpeekData (int flags=0) const
 Returns the data part (excluding front and back popped parts) in the requested representation. More...
 
template<typename T >
const Ptr< const TpeekAll (int flags=0) const
 Returns the whole packet (including front and back popped parts) in the requested representation. More...
 
template<typename T >
const Ptr< const TpeekDataAt (b offset, b length=b(-1), int flags=0) const
 Returns the designated data part as an immutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< const TpeekAt (b offset, b length=b(-1), int flags=0) const
 Returns the designated part of the packet as an immutable chunk in the requested representation. More...
 
Content popping functions
const Ptr< const ChunkpopAtFront (b length=b(-1), int flags=0)
 Pops the designated part from the beginning of the data part of the packet and returns it as an immutable chunk in the current representation. More...
 
const Ptr< const ChunkpopAtBack (b length=b(-1), int flags=0)
 Pops the designated part from the end of the data part of the packet and returns it as an immutable chunk in the current representation. More...
 
template<typename T >
const Ptr< const TpopAtFront (b length=b(-1), int flags=0)
 Pops the designated part from the beginning of the data part of the packet and returns it as an immutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< const TpopAtBack (b length, int flags=0)
 Pops the designated part from the end of the data part of the packet and returns it as an immutable chunk in the requested representation. More...
 
Content presence checking functions
template<typename T >
bool hasAtFront (b length=b(-1)) const
 Returns true if the designated part at the beginning of the data part of the packet is completely available in the requested representation. More...
 
template<typename T >
bool hasAtBack (b length) const
 Returns true if the designated part at the end of the data part of the packet is completely available in the requested representation. More...
 
template<typename T >
bool hasData () const
 Returns true if the whole data part of the packet is completely available in the requested representation. More...
 
template<typename T >
bool hasAll () const
 Returns true if the whole content of the packet is completely available in the requested representation. More...
 
template<typename T >
bool hasDataAt (b offset, b length=b(-1)) const
 Returns true if the designated data part is completely available in the requested representation. More...
 
template<typename T >
bool hasAt (b offset, b length=b(-1)) const
 Returns true if the designated part of the packet is completely available in the requested representation. More...
 
Content insertion functions
void insertAtFront (const Ptr< const Chunk > &chunk)
 Inserts the provided chunk at the beginning of the data part of the packet. More...
 
void insertAtBack (const Ptr< const Chunk > &chunk)
 Inserts the provided chunk at the end of the data part of the packet. More...
 
void insertData (const Ptr< const Chunk > &chunk)
 Inserts the provided chunk as the data part of the packet. More...
 
void insertAll (const Ptr< const Chunk > &chunk)
 Inserts the provided chunk as the content of the packet. More...
 
void insertDataAt (const Ptr< const Chunk > &chunk, b offset)
 Inserts the provided chunk at the given offset of the data part of the packet. More...
 
void insertAt (const Ptr< const Chunk > &chunk, b offset)
 Inserts the provided chunk at the given offset of the packet. More...
 
Content removing functions
const Ptr< ChunkremoveAtFront (b length=b(-1), int flags=0)
 Removes the designated part from the beginning of the data part of the packet and returns it as a mutable chunk in the current representation. More...
 
const Ptr< ChunkremoveAtBack (b length=b(-1), int flags=0)
 Removes the designated part from the end of the data part of the packet and returns it as a mutable chunk in the current representation. More...
 
const Ptr< ChunkremoveData (int flags=0)
 Removes the data part of the packet and returns it as a mutable chunk in the current representation. More...
 
const Ptr< ChunkremoveAll (int flags=0)
 Removes all content from the packet and returns it as a mutable chunk in the current representation. More...
 
const Ptr< ChunkremoveDataAt (b offset, b length=b(-1), int flags=0)
 Removes the designated part of the data part of the packet and returns it as a mutable chunk in the current representation. More...
 
const Ptr< ChunkremoveAt (b offset, b length=b(-1), int flags=0)
 Removes the designated part of the packet and returns it as a mutable chunk in the current representation. More...
 
template<typename T >
const Ptr< TremoveAtFront (b length=b(-1), int flags=0)
 Removes the designated part from the beginning of the data part of the packet and returns it as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TremoveAtBack (b length, int flags=0)
 Removes the designated part from the end of the data part of the packet and returns it as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TremoveData (int flags=0)
 Removes the data part of the packet and returns it as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TremoveAll (int flags=0)
 Removes all content from the packet and returns it as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TremoveDataAt (b offset, b length=b(-1), int flags=0)
 Removes the designated part of the data part of the packet and returns it as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TremoveAt (b offset, b length=b(-1), int flags=0)
 Removes the designated part of the packet and returns it as a mutable chunk in the requested representation. More...
 
Content replacing functions
const Ptr< ChunkreplaceAtFront (const Ptr< const Chunk > &chunk, b length=b(-1), int flags=0)
 Replaces the designated part at the beginning of the data part of the packet with the provided chunk and returns the old part as a mutable chunk in the current representation. More...
 
const Ptr< ChunkreplaceAtBack (const Ptr< const Chunk > &chunk, b length=b(-1), int flags=0)
 Replaces the designated part at the end of the data part of the packet with the provided chunk and returns the old part as a mutable chunk in the current representation. More...
 
const Ptr< ChunkreplaceData (const Ptr< const Chunk > &chunk, int flags=0)
 Replaces the data part of the packet with the provided chunk and returns the old content as a mutable chunk in the current representation. More...
 
const Ptr< ChunkreplaceAll (const Ptr< const Chunk > &chunk, int flags=0)
 Replaces all content in the packet with the provided chunk and returns the old part as a mutable chunk in the current representation. More...
 
const Ptr< ChunkreplaceDataAt (const Ptr< const Chunk > &chunk, b offset, b length=b(-1), int flags=0)
 Replaces the designated part of the data part of the packet with the provided chunk and returns the old content as a mutable chunk in the current representation. More...
 
const Ptr< ChunkreplaceAt (const Ptr< const Chunk > &chunk, b offset, b length=b(-1), int flags=0)
 Replaces the designated part of the packet with the provided chunk and returns the old content as a mutable chunk in the current representation. More...
 
template<typename T >
const Ptr< TreplaceAtFront (const Ptr< const Chunk > &chunk, b length=b(-1), int flags=0)
 Replaces the designated part at the beginning of the data part of the packet with the provided chunk and returns the old part as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TreplaceAtBack (const Ptr< const Chunk > &chunk, b length, int flags=0)
 Replaces the designated part at the end of the data part of the packet with the provided chunk and returns the old part as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TreplaceData (const Ptr< const Chunk > &chunk, int flags=0)
 Replaces the data part of the packet with the provided chunk and returns the old content as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TreplaceAll (const Ptr< const Chunk > &chunk, int flags=0)
 Replaces all content in the packet with the provided chunk and returns the old content as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TreplaceDataAt (const Ptr< const Chunk > &chunk, b offset, b length=b(-1), int flags=0)
 Replaces the designated part of the data part of the packet with the provided chunk and returns the old content as a mutable chunk in the requested representation. More...
 
template<typename T >
const Ptr< TreplaceAt (const Ptr< const Chunk > &chunk, b offset, b length=b(-1), int flags=0)
 Replaces the designated part of the packet with the provided chunk and returns the old content as a mutable chunk in the requested representation. More...
 
Content updating functions
void updateAtFront (std::function< void(const Ptr< Chunk > &)> f, b length=b(-1), int flags=0)
 Updates the designated part at the beginning of the data part of the packet by applying the provided function on the requested mutable representation. More...
 
void updateAtBack (std::function< void(const Ptr< Chunk > &)> f, b length=b(-1), int flags=0)
 Updates the designated part at the end of the data part of the packet by applying the provided function on the requested mutable representation. More...
 
void updateData (std::function< void(const Ptr< Chunk > &)> f, int flags=0)
 Updates the data part of the packet by applying the provided function on the requested mutable representation. More...
 
void updateAll (std::function< void(const Ptr< Chunk > &)> f, int flags=0)
 Updates the designated part by applying the provided function on the requested mutable representation. More...
 
void updateDataAt (std::function< void(const Ptr< Chunk > &)> f, b offset, b length=b(-1), int flags=0)
 Updates the designated part by applying the provided function on the requested mutable representation. More...
 
void updateAt (std::function< void(const Ptr< Chunk > &)> f, b offset, b length=b(-1), int flags=0)
 Updates the designated part by applying the provided function on the requested mutable representation. More...
 
template<typename T >
void updateAtFront (std::function< void(const Ptr< T > &)> f, b length=b(-1), int flags=0)
 Updates the designated part at the beginning of the data part of the packet by applying the provided function on the requested mutable representation. More...
 
template<typename T >
void updateAtBack (std::function< void(const Ptr< T > &)> f, b length, int flags=0)
 Updates the designated part at the end of the data part of the packet by applying the provided function on the requested mutable representation. More...
 
template<typename T >
void updateData (std::function< void(const Ptr< T > &)> f, int flags=0)
 Updates the designated part by applying the provided function on the requested mutable representation. More...
 
template<typename T >
void updateAll (std::function< void(const Ptr< T > &)> f, int flags=0)
 Updates the designated part by applying the provided function on the requested mutable representation. More...
 
template<typename T >
void updateDataAt (std::function< void(const Ptr< T > &)> f, b offset, b length=b(-1), int flags=0)
 Updates the designated part by applying the provided function on the requested mutable representation. More...
 
template<typename T >
void updateAt (std::function< void(const Ptr< T > &)> f, b offset, b length=b(-1), int flags=0)
 Updates the designated part by applying the provided function on the requested mutable representation. More...
 
Content erasing functions
void eraseAtFront (b length)
 Erases the requested amount of data from the beginning of the data part of the packet. More...
 
void eraseAtBack (b length)
 Erases the requested amount of data from the end of the data part of the packet. More...
 
void eraseData ()
 Erases the whole data part of the packet. More...
 
void eraseAll ()
 Erases all content from the packet and sets both front and back offsets to zero. More...
 
void eraseDataAt (b offset, b length)
 Erases the designated part of the data part of the packet. More...
 
void eraseAt (b offset, b length)
 Erases the designated content of the packet. More...
 
void trimFront ()
 Erases the front popped part of the packet and sets the front offset to zero. More...
 
void trimBack ()
 Erases the back popped part of the packet and sets the back offset to zero. More...
 
void trim ()
 Erases both the front and the back popped parts of the packet and sets both the front and the back offsets to zero. More...
 
Whole tagging functions
virtual SharingTagSetgetTags () override
 Returns all tags. More...
 
int getNumTags () const
 Returns the number of packet tags. More...
 
const Ptr< const TagBasegetTag (int index) const
 Returns the packet tag at the given index. More...
 
void clearTags ()
 Clears the set of packet tags. More...
 
void copyTags (const Packet &source)
 Copies the set of packet tags from the other packet. More...
 
template<typename T >
const Ptr< const TfindTag () const
 Returns the packet tag for the provided type or returns nullptr if no such packet tag is found. More...
 
template<typename T >
const Ptr< TfindTagForUpdate ()
 Returns the packet tag for the provided type or returns nullptr if no such packet tag is found. More...
 
template<typename T >
const Ptr< const TgetTag () const
 Returns the packet tag for the provided type or throws an exception if no such packet tag is found. More...
 
template<typename T >
const Ptr< TgetTagForUpdate ()
 Returns the packet tag for the provided type or throws an exception if no such packet tag is found. More...
 
template<typename T >
const Ptr< TaddTag ()
 Returns a newly added packet tag for the provided type, or throws an exception if such a packet tag is already present. More...
 
template<typename T >
const Ptr< TaddTagIfAbsent ()
 Returns a newly added packet tag for the provided type if absent, or returns the packet tag that is already present. More...
 
template<typename T >
const Ptr< TremoveTag ()
 Removes the packet tag for the provided type, or throws an exception if no such packet tag is found. More...
 
template<typename T >
const Ptr< TremoveTagIfPresent ()
 Removes the packet tag for the provided type if present, or returns nullptr if no such packet tag is found. More...
 
Region tagging functions
virtual SharingRegionTagSetgetRegionTags () override
 Returns all region tags. More...
 
int getNumRegionTags () const
 Returns the number of region tags. More...
 
const Ptr< const TagBasegetRegionTag (int index) const
 Returns the region tag at the given index. More...
 
void clearRegionTags (b offset=b(0), b length=b(-1))
 Clears the set of region tags in the given region. More...
 
void copyRegionTags (const Packet &source, b sourceOffset=b(0), b offset=b(0), b length=b(-1))
 Copies the set of region tags from the source region to the provided region. More...
 
template<typename T >
const Ptr< const TfindRegionTag (b offset=b(0), b length=b(-1)) const
 Returns the region tag for the provided type and range, or returns nullptr if no such region tag is found. More...
 
template<typename T >
const Ptr< const TgetRegionTag (b offset=b(0), b length=b(-1)) const
 Returns the region tag for the provided type and range, or throws an exception if no such region tag is found. More...
 
template<typename T >
void mapAllRegionTags (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 mapAllRegionTagsForUpdate (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 > > getAllRegionTags (b offset=b(0), b length=b(-1)) const
 Returns all region tags for the provided type and range in a detached vector of region tags. More...
 
template<typename T >
std::vector< SharingRegionTagSet::RegionTag< T > > getAllRegionTagsForUpdate (b offset=b(0), b length=b(-1))
 Returns all region tags for the provided type and range in a detached vector of region tags. More...
 
template<typename T >
const Ptr< TaddRegionTag (b offset=b(0), b length=b(-1))
 Returns a newly added region tag for the provided type and range, or throws an exception if such a region tag is already present. More...
 
template<typename T >
const Ptr< TaddRegionTagIfAbsent (b offset=b(0), b length=b(-1))
 Returns a newly added region tag for the provided type and range if absent, or returns the region tag that is already present. More...
 
template<typename T >
std::vector< SharingRegionTagSet::RegionTag< T > > addRegionTagsWhereAbsent (b offset=b(0), b length=b(-1))
 Returns the newly added region tags for the provided type and range where the tag is absent. More...
 
template<typename T >
const Ptr< TremoveRegionTag (b offset, b length)
 Removes the region tag for the provided type and range, or throws an exception if no such region tag is found. More...
 
template<typename T >
const Ptr< TremoveRegionTagIfPresent (b offset, b length)
 Removes the region tag for the provided type and range if present, or returns nullptr if no such region tag is found. More...
 
template<typename T >
std::vector< SharingRegionTagSet::RegionTag< T > > removeRegionTagsWherePresent (b offset, b length)
 Removes and returns all region tags for the provided type and range. More...
 
Utility functions
virtual const char * getFullName () const override
 Returns the full name of the packet. More...
 
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) const override
 Prints a human readable string representation to the output stream. More...
 
virtual std::string str () const override
 Returns a human readable string representation. 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

Class descriptor functions
const ChunkgetContent () const
 
const ChunkTemporarySharedPtrgetDissection () const
 
const ChunkTemporarySharedPtrgetFront () const
 
const ChunkTemporarySharedPtrgetData () const
 
const ChunkTemporarySharedPtrgetBack () const
 
const TagBase_getTag (int index)
 
const SharingRegionTagSet::RegionTag< TagBase > & _getRegionTag (int index)
 
Self checking functions
bool isConsistent ()
 
bool isIteratorConsistent (const Chunk::Iterator &iterator)
 

Protected Attributes

Ptr< const Chunkcontent
 This chunk is always immutable to allow arbitrary peeking. More...
 
Chunk::ForwardIterator frontIterator
 Position of the front separator measured from the front of the packet. More...
 
Chunk::BackwardIterator backIterator
 Position of the back separator measured from the back of the packet. More...
 
b totalLength
 Cached total length of the packet including the popped frond and back parts. More...
 
SharingTagSet tags
 The set of tags attached to the packet as whole. More...
 
SharingRegionTagSet regionTags
 The set of tags attached to regions of the content of the packet. More...
 

Friends

class PacketDescriptor
 

Additional Inherited Members

- 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) }
 

Detailed Description

This class represents network packets, datagrams, frames and other kinds of data used by communication protocols.

The underlying data structure supports efficient construction, duplication, encapsulation, aggregation, fragmentation and serialization. The data structure also supports dual representation by default: data can be accessed as raw bytes and also as field based classes.

Internally, packet stores the data in different kind of chunks. See the Chunk class and its subclasses for details. All chunks are immutable in a packet. Chunks are automatically merged if possible as they are inserted into a packet, and they are also shared among packets when duplicating.

Packets are conceptually divided into three parts during processing: front popped part, data part, and back popped part. These parts are separated by iterators called front and back pointer, which are stored within the packet.

+----------------------------------------------------------------+
|                                                                |
|             Packet content is divided into 3 parts             |
|                                                                |
+---------------------+---------------------+--------------------+
|                     |                     |                    |
|  Front popped part  |      Data part      |  Back popped part  |
|                     |                     |                    |
+----------------------------------------------------------------+
                      ^                     ^
                      |                     |
                 Front pointer          Back pointer

During packet processing, as the packet is passed through the protocol layers at the receiver, headers and trailers are popped from the beginning and the end. This effectively reduces the remaining unprocessed part called the data part, but it doesn't affect the data stored in the packet. Popping headers and trailers is most often a very efficient operation, because it doesn't require copying or changing chunks, only updating the front and back iterators.

In general, this class supports the following operations:

  • query the length of the packet and the data part
  • get and set the front and back offsets
  • peek content anywhere in the packet
  • pop content from the front or the back of the packet
  • check the presense of content anywhere in the packet
  • insert content anywhere in the packet
  • remove and return content anywhere in the packet
  • update content in place destructively anywhere in the packet
  • replace content destructively anywhere in the packet
  • erase content destructively anywhere in the packet
  • serialize to and deserialize from a sequence of bits or bytes
  • copy the packet
  • attach tags (metadata) to the packet as a whole
  • attache tags (metadata) to regions of the content of the packet
  • convert to a human readable string

Constructor & Destructor Documentation

◆ Packet() [1/3]

inet::Packet::Packet ( const char *  name = nullptr,
short  kind = 0 
)
explicit
47  :
48  cPacket(name, kind),
50  frontIterator(Chunk::ForwardIterator(b(0), 0)),
51  backIterator(Chunk::BackwardIterator(b(0), 0)),
52  totalLength(b(0))
53 {
55 }

◆ Packet() [2/3]

inet::Packet::Packet ( const char *  name,
const Ptr< const Chunk > &  content 
)
57  :
58  cPacket(name),
60  frontIterator(Chunk::ForwardIterator(b(0), 0)),
61  backIterator(Chunk::BackwardIterator(b(0), 0)),
62  totalLength(content->getChunkLength())
63 {
64  constPtrCast<Chunk>(content)->markImmutable();
66 }

◆ Packet() [3/3]

inet::Packet::Packet ( const Packet other)
68  :
69  cPacket(other),
70  content(other.content),
71  frontIterator(other.frontIterator),
72  backIterator(other.backIterator),
73  totalLength(other.totalLength),
74  tags(other.tags),
75  regionTags(other.regionTags)
76 {
78 }

Member Function Documentation

◆ _getRegionTag()

const SharingRegionTagSet::RegionTag<TagBase>& inet::Packet::_getRegionTag ( int  index)
inlineprotected
134 { return regionTags.getRegionTag(index); }

◆ _getTag()

const TagBase* inet::Packet::_getTag ( int  index)
inlineprotected
133 { return tags.getTag(index).get(); }

◆ addRegionTag()

template<typename T >
const Ptr<T> inet::Packet::addRegionTag ( b  offset = b(0),
b  length = b(-1) 
)
inline

Returns a newly added region tag for the provided type and range, or throws an exception if such a region tag is already present.

1417  {
1418  return regionTags.addTag<T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1419  }

◆ addRegionTagIfAbsent()

template<typename T >
const Ptr<T> inet::Packet::addRegionTagIfAbsent ( b  offset = b(0),
b  length = b(-1) 
)
inline

Returns a newly added region tag for the provided type and range if absent, or returns the region tag that is already present.

1424  {
1425  return regionTags.addTagIfAbsent<T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1426  }

◆ addRegionTagsWhereAbsent()

template<typename T >
std::vector<SharingRegionTagSet::RegionTag<T> > inet::Packet::addRegionTagsWhereAbsent ( b  offset = b(0),
b  length = b(-1) 
)
inline

Returns the newly added region tags for the provided type and range where the tag is absent.

1431  {
1432  return regionTags.addTagsWhereAbsent<T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1433  }

Referenced by inet::queueing::FlowMeasurementStarter::startMeasurement(), inet::queueing::FlowMeasurementStarter::startMeasurements(), and inet::startPacketFlow().

◆ addTag()

template<typename T >
const Ptr<T> inet::Packet::addTag ( )
inline

Returns a newly added packet tag for the provided type, or throws an exception if such a packet tag is already present.

1310  {
1311  return tags.addTag<T>();
1312  }

Referenced by inet::L3NetworkConfiguratorBase::computeWirelessLinkWeight(), inet::TcpEchoAppThread::dataArrived(), inet::Ipv4::encapsulate(), inet::Stp::generateBPDU(), inet::UdpBasicBurst::generateBurst(), inet::Stp::generateTCN(), inet::EthernetCutthroughSource::handleMessage(), inet::TcpGenericServerApp::handleMessage(), inet::NetPerfMeter::handleMessage(), inet::SctpNatPeer::handleMessage(), inet::LMac::handleSelfMessage(), inet::Stp::handleTCN(), inet::Tun::handleUpperPacket(), inet::Udp::handleUpperPacket(), inet::tcp::TcpLwip::ip_output(), inet::tcp::TcpConnection::process_READ_REQUEST(), inet::Arp::processArpPacket(), inet::ReceiveWithHopLimit::processPacket(), inet::PacketDirectionReverser::processPacket(), inet::physicallayer::EthernetFragmentPhyHeaderChecker::processPacket(), inet::StreamIdentifier::processPacket(), inet::StreamDecoder::processPacket(), inet::queueing::CreditBasedGate::processPacket(), inet::PreemptableStreamer::pullPacketStart(), inet::EthernetCutthroughSource::pushPacketEnd(), inet::ShortcutMac::receiveFromPeer(), inet::sctp::Sctp::sendAbortFromMain(), inet::aodv::Aodv::sendAODVPacket(), inet::Arp::sendArpGratuitous(), inet::Arp::sendArpProbe(), inet::Arp::sendArpRequest(), inet::Gpsr::sendBeacon(), inet::Rstp::sendBPDU(), inet::EtherTrafGen::sendBurstPackets(), inet::dymo::Dymo::sendDymoPacket(), inet::Icmpv6::sendErrorMessage(), inet::PimBase::sendHelloPacket(), inet::Igmpv2::sendLeave(), inet::Icmp::sendOrProcessIcmpPacket(), inet::RelayInterfaceSelector::sendPacket(), inet::EtherAppServer::sendPacket(), inet::IpvxTrafGen::sendPacket(), inet::UdpBasicApp::sendPacket(), inet::EtherAppClient::sendPacket(), inet::Gptp::sendPacketToNIC(), inet::PingApp::sendPingRequest(), inet::Igmpv3::sendQueryToIP(), inet::Igmpv2::sendReport(), inet::Igmpv3::sendReportToIP(), inet::sctp::Sctp::sendShutdownCompleteFromMain(), inet::Rstp::sendTCNtoRoot(), inet::tcp::TcpConnection::sendToIP(), inet::ShortcutMac::sendToPeer(), inet::TunnelApp::socketDataArrived(), inet::EthernetMac::startFrameTransmission(), and inet::EthernetCsmaMac::startFrameTransmission().

◆ addTagIfAbsent()

template<typename T >
const Ptr<T> inet::Packet::addTagIfAbsent ( )
inline

Returns a newly added packet tag for the provided type if absent, or returns the packet tag that is already present.

1317  {
1318  return tags.addTagIfAbsent<T>();
1319  }

Referenced by inet::Ipv4::arpResolutionCompleted(), inet::physicallayer::Ieee80211ReceiverBase::computeReceptionResult(), inet::physicallayer::ApskLayeredReceiver::computeReceptionResult(), inet::physicallayer::Ieee80211LayeredOfdmReceiver::computeReceptionResult(), inet::sctp::SctpNatHook::datagramForwardHook(), inet::Ipv4::datagramLocalOut(), inet::sctp::SctpUdpHook::datagramPreRoutingHook(), inet::physicallayer::UnitDiskRadio::decapsulate(), inet::physicallayer::Ieee80211OfdmRadio::decapsulate(), inet::ieee80211::Ieee80211LlcEpd::decapsulate(), inet::ieee80211::Ieee80211Portal::decapsulate(), inet::physicallayer::ApskRadio::decapsulate(), inet::Ipv4Encap::decapsulate(), inet::Ieee8022Llc::decapsulate(), inet::AckingMac::decapsulate(), inet::Ppp::decapsulate(), inet::ieee80211::Ieee80211Mac::decapsulate(), inet::ProbabilisticBroadcast::decapsulate(), inet::LMac::decapsulate(), inet::Flooding::decapsulate(), inet::NextHopForwarding::decapsulate(), inet::CsmaCaMac::decapsulate(), inet::Ipv6::decapsulate(), inet::EthernetMacBase::decapsulate(), inet::Ipv4::decapsulate(), inet::BMac::decapsulate(), inet::XMac::decapsulate(), inet::Ieee802154Mac::decapsulate(), inet::Ieee8022Llc::deliverCopyToSockets(), inet::ieee80211::Ieee80211LlcLpd::encapsulate(), inet::ieee80211::Ieee80211LlcEpd::encapsulate(), inet::ieee80211::Ieee80211Portal::encapsulate(), inet::Ieee8022Llc::encapsulate(), inet::AckingMac::encapsulate(), inet::Ppp::encapsulate(), inet::ieee80211::Ieee80211Mac::encapsulate(), inet::CsmaCaMac::encapsulate(), inet::EthernetMacBase::encapsulate(), inet::BMac::encapsulate(), inet::Ipv6Tunneling::encapsulateDatagram(), inet::PimSm::forwardMulticastData(), inet::Ipv4::forwardMulticastPacket(), inet::Ipv4::fragmentAndSend(), inet::Ipv4::handleIncomingDatagram(), inet::Ppp::handleLowerPacket(), inet::physicallayer::EthernetPhy::handleMessage(), inet::EthernetCutthroughSource::handleMessage(), inet::NextHopForwarding::handlePacketFromNetwork(), inet::Udp::handleUpperPacket(), inet::insertNetworkProtocolHeader(), inet::insertProtocolHeader(), inet::insertTransportProtocolHeader(), inet::queueing::TokenBucketMeterMixin< TokenBucketMixin< PacketMeterBase > >::labelPacket(), inet::Ipv6::localDeliver(), inet::queueing::ContentBasedLabeler::markPacket(), inet::queueing::PacketLabeler::markPacket(), inet::queueing::PacketTaggerBase::markPacket(), inet::DscpMarker::markPacket(), inet::queueing::MultiTokenBucketMeter::meterPacket(), inet::queueing::ExponentialRateMeter::meterPacket(), inet::queueing::SlidingWindowRateMeter::meterPacket(), inet::EligibilityTimeMeter::meterPacket(), inet::Ipv4::preroutingFinish(), inet::Icmp::processIcmpMessage(), inet::Icmpv6::processICMPv6Message(), inet::Mpls::processMplsPacketFromL2(), inet::eigrp::EigrpIpv4Pdm::processMsgFromRtp(), inet::eigrp::EigrpIpv6Pdm::processMsgFromRtp(), inet::Ieee8021aeTagEpdHeaderChecker::processPacket(), inet::EthernetTypeOrLengthChecker::processPacket(), inet::ReceiveWithHopLimit::processPacket(), inet::EthernetFcsInserter::processPacket(), inet::PacketDirectionReverser::processPacket(), inet::physicallayer::EthernetPhyHeaderChecker::processPacket(), inet::physicallayer::EthernetPhyHeaderInserter::processPacket(), inet::Ieee8022LlcChecker::processPacket(), inet::Ieee8022LlcInserter::processPacket(), inet::SequenceNumbering::processPacket(), inet::Ieee8022SnapChecker::processPacket(), inet::Ieee8022SnapInserter::processPacket(), inet::SendWithHopLimit::processPacket(), inet::ReceiveAtMacAddress::processPacket(), inet::CrcHeaderInserter::processPacket(), inet::Ieee8021qTagTpidHeaderChecker::processPacket(), inet::Ieee8021rTagEpdHeaderChecker::processPacket(), inet::Ieee8021rTagEpdHeaderInserter::processPacket(), inet::SendToL3Address::processPacket(), inet::SendToMacAddress::processPacket(), inet::FcsHeaderInserter::processPacket(), inet::FragmentNumberHeaderInserter::processPacket(), inet::physicallayer::EthernetFragmentPhyHeaderInserter::processPacket(), inet::EthernetMacHeaderChecker::processPacket(), inet::EthernetAddressChecker::processPacket(), inet::FragmentNumberHeaderChecker::processPacket(), inet::physicallayer::EthernetFragmentPhyHeaderChecker::processPacket(), inet::Ieee8021qTagEpdHeaderChecker::processPacket(), inet::SendWithAcknowledge::processPacket(), inet::VlanReqMapper::processPacket(), inet::Ieee8021qTagEpdHeaderInserter::processPacket(), inet::Ieee8021qTagTpidHeaderInserter::processPacket(), inet::PacketEmitter::processPacket(), inet::StreamEncoder::processPacket(), inet::EthernetEncapsulation::processPacketFromHigherLayer(), inet::EthernetEncapsulation::processPacketFromMac(), inet::EthernetMac::processReceivedDataFrame(), inet::EthernetCsmaMac::processReceivedDataFrame(), inet::InterpacketGapInserter::pushOrSendOrSchedulePacketProgress(), inet::queueing::PacketProcessorBase::pushOrSendPacketEnd(), inet::queueing::PacketProcessorBase::pushOrSendPacketProgress(), inet::queueing::PacketProcessorBase::pushOrSendPacketStart(), inet::ReceiveWithProtocol::pushPacket(), inet::StreamSplitter::pushPacket(), inet::EthernetSocketPacketProcessor::pushPacket(), inet::Ieee8021qSocketPacketProcessor::pushPacket(), inet::Forwarding::pushPacket(), inet::Ieee8022LlcSocketPacketProcessor::pushPacket(), inet::NetworkInterface::pushPacket(), inet::EthernetCutthroughInterface::pushPacketEnd(), inet::EthernetCutthroughSource::pushPacketEnd(), inet::NetworkInterface::pushPacketEnd(), inet::EthernetCutthroughInterface::pushPacketStart(), inet::NetworkInterface::pushPacketStart(), inet::Ipv4::reassembleAndDeliverFinish(), inet::Gpsr::routeDatagram(), inet::Ipv4::routeLocalBroadcastPacket(), inet::Ipv4::routeUnicastPacket(), inet::SctpSocket::send(), inet::NextHopForwarding::sendDatagramToHL(), inet::NextHopForwarding::sendDatagramToOutput(), inet::Ipv6::sendDatagramToOutput(), inet::Ipv4::sendDatagramToOutput(), inet::TcpEchoApp::sendDown(), inet::ieee80211::Ieee80211MgmtBase::sendDown(), inet::ieee80211::Ieee80211Mac::sendDownFrame(), inet::xMIPv6::sendMobilityMessageToIPv6Module(), inet::SctpServer::sendOrSchedule(), inet::RelayInterfaceSelector::sendPacket(), inet::MacRelayUnitBase::sendPacket(), inet::ospfv2::MessageHandler::sendPacket(), inet::ospfv3::Ospfv3Process::sendPacket(), inet::Rip::sendPacket(), inet::Ipv6NeighbourDiscovery::sendPacketToIpv6Module(), inet::Gptp::sendPacketToNIC(), inet::Ipv4::sendPacketToNIC(), inet::Igmpv3::sendQueryToIP(), inet::Igmpv3::sendReportToIP(), inet::Ipv6Socket::sendTo(), inet::Ipv4Socket::sendTo(), inet::L3Socket::sendTo(), inet::UdpSocket::sendTo(), inet::tcp::TcpSpoof::sendToIP(), inet::Icmp::sendToIP(), inet::Icmpv6::sendToIP(), inet::LinkStateRouting::sendToIP(), inet::Igmpv2::sendToIP(), inet::PimDm::sendToIP(), inet::RsvpTe::sendToIP(), inet::PimSm::sendToIP(), inet::tcp::TcpConnection::sendToIP(), inet::sctp::SctpAssociation::sendToIP(), inet::DhcpServer::sendToUDP(), inet::DhcpClient::sendToUdp(), inet::Udp::sendUp(), inet::ProbabilisticBroadcast::setDownControlInfo(), inet::Flooding::setDownControlInfo(), inet::queueing::EcnMarker::setEcn(), inet::ieee80211::RateSelection::setFrameMode(), inet::ieee80211::Hcf::setFrameMode(), inet::ieee80211::Tx::transmitFrame(), and inet::Mpls::tryLabelAndForwardIpv4Datagram().

◆ clearRegionTags()

void inet::Packet::clearRegionTags ( b  offset = b(0),
b  length = b(-1) 
)
inline

Clears the set of region tags in the given region.

1361  {
1362  regionTags.clearTags(offset, length == b(-1) ? getTotalLength() - offset : length);
1363  }

◆ clearTags()

◆ copyRegionTags()

void inet::Packet::copyRegionTags ( const Packet source,
b  sourceOffset = b(0),
b  offset = b(0),
b  length = b(-1) 
)
inline

Copies the set of region tags from the source region to the provided region.

1368  {
1369  regionTags.copyTags(source.regionTags, sourceOffset, offset, length == b(-1) ? getTotalLength() - offset : length);
1370  }

◆ copyTags()

void inet::Packet::copyTags ( const Packet source)
inline

◆ decapsulate()

virtual cPacket* inet::Packet::decapsulate ( )
inlineoverridevirtual
181 { throw cRuntimeError("Invalid operation"); }

◆ dup()

virtual Packet* inet::Packet::dup ( ) const
inlineoverridevirtual
171 { return new Packet(*this); }

Referenced by inet::RelayInterfaceSelector::broadcastPacket(), inet::MacRelayUnitBase::broadcastPacket(), inet::physicallayer::ReceiverBase::computeReceivedPacket(), inet::physicallayer::ErrorModelBase::corruptPacket(), inet::physicallayer::Ieee80211LayeredOfdmReceiver::createCompletePacketModel(), inet::physicallayer::RadioMedium::createReceiverSignal(), inet::Ipv4::datagramLocalOut(), inet::DefragmenterBase::defragmentPacket(), inet::Ieee8022Llc::deliverCopyToSockets(), inet::Ipv4::forwardMulticastPacket(), inet::MacRelayUnit::handleLowerPacket(), inet::Ieee8021dRelay::handleLowerPacket(), inet::ProbabilisticBroadcast::handleLowerPacket(), inet::Flooding::handleLowerPacket(), inet::Resending::handleMessage(), inet::ieee80211::Tx::handleMessage(), inet::Resending::handlePushPacketProcessed(), inet::Tun::handleUpperPacket(), inet::ShortcutMac::handleUpperPacket(), inet::physicallayer::ShortcutRadio::handleUpperPacket(), inet::Ieee8021dRelay::handleUpperPacket(), inet::CsmaCaMac::handleWithFsm(), inet::Ipv6::localDeliver(), inet::Ipv4::preroutingFinish(), inet::PacketEmitter::processPacket(), inet::EthernetEncapsulation::processPacketFromMac(), inet::PimSm::processRegisterPacket(), inet::Udp::processUDPPacket(), inet::PacketStreamer::pullPacketProgress(), inet::PreemptableStreamer::pullPacketProgress(), inet::PacketStreamer::pullPacketStart(), inet::PreemptableStreamer::pullPacketStart(), inet::queueing::PacketDuplicator::pushPacket(), inet::StreamSplitter::pushPacket(), inet::EthernetSocketPacketProcessor::pushPacket(), inet::Ieee8021qSocketPacketProcessor::pushPacket(), inet::Ieee8022LlcSocketPacketProcessor::pushPacket(), inet::RelayInterfaceSelector::pushPacket(), inet::queueing::PacketDuplicatorBase::pushPacket(), inet::queueing::PacketCloner::pushPacket(), inet::PacketStreamer::pushPacket(), inet::PreemptableStreamer::pushPacket(), inet::rtp::Rtp::readRet(), inet::Ipv4::reassembleAndDeliverFinish(), inet::physicallayer::RadioMedium::receivePacket(), inet::Ipv4::routeLocalBroadcastPacket(), inet::NextHopForwarding::routeMulticastPacket(), inet::Ipv6::routeMulticastPacket(), inet::ospfv2::Neighbor::sendDatabaseDescriptionPacket(), inet::CsmaCaMac::sendDataFrame(), inet::NextHopForwarding::sendDatagramToHL(), inet::BMac::sendDataPacket(), inet::Ldp::sendHelloTo(), inet::EthernetMac::startFrameTransmission(), inet::EthernetCsmaMac::startFrameTransmission(), inet::queueing::PreemptingServer::startStreaming(), inet::AckingMac::startTransmitting(), inet::Ppp::startTransmitting(), inet::ieee80211::Tx::transmitFrame(), inet::AckingMacToEthernetPcapRecorderHelper::tryConvertToLinkType(), and inet::Ieee802154Mac::updateStatusCCA().

◆ encapsulate()

virtual void inet::Packet::encapsulate ( cPacket *  packet)
inlineoverridevirtual
180 { throw cRuntimeError("Invalid operation"); }

Referenced by inet::SctpNatPeer::handleMessage().

◆ eraseAll()

void inet::Packet::eraseAll ( )
inline

Erases all content from the packet and sets both front and back offsets to zero.

1199  {
1201  eraseAt(b(0), getTotalLength());
1202  }

Referenced by inet::physicallayer::Radio::createSignal(), inet::PacketDeserializer::processPacket(), and inet::PacketSerializer::processPacket().

◆ eraseAt()

void inet::Packet::eraseAt ( b  offset,
b  length 
)

Erases the designated content of the packet.

The front and back offsets are updated according to the offset and length parameters. The designated part must be in the range [0, getTotalLength()].

221 {
223  auto totalLength = getTotalLength();
224  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= totalLength, "offset is out of range");
225  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= totalLength, "length is invalid");
226  if (content->getChunkLength() == length)
228  else if (offset == b(0) && content->canRemoveAtFront(length)) {
229  const auto& newContent = makeExclusivelyOwnedMutableChunk(content);
230  newContent->removeAtFront(length);
231  newContent->markImmutable();
232  content = newContent->simplify();
233  }
234  else if (offset + length == totalLength && content->canRemoveAtBack(length)) {
235  const auto& newContent = makeExclusivelyOwnedMutableChunk(content);
236  newContent->removeAtBack(length);
237  newContent->markImmutable();
238  content = newContent->simplify();
239  }
240  else if (content->canRemoveAt(offset, length)) {
241  const auto& newContent = makeExclusivelyOwnedMutableChunk(content);
242  newContent->removeAt(offset, offset);
243  newContent->markImmutable();
244  content = newContent->simplify();
245  }
246  else {
247  auto sequenceChunk = makeShared<SequenceChunk>();
248  if (offset != b(0))
249  sequenceChunk->insertAtBack(content->peek(Chunk::ForwardIterator(b(0), 0), offset));
250  if (offset != totalLength)
251  sequenceChunk->insertAtBack(content->peek(Chunk::ForwardIterator(offset + length, -1), totalLength - length));
252  sequenceChunk->markImmutable();
253  content = sequenceChunk;
254  }
255  b frontEraseLength = getFrontOffset() - offset;
256  b backEraseLength = offset + length - getBackOffset();
257  if (frontEraseLength > b(0))
258  content->moveIterator(frontIterator, -frontEraseLength);
259  if (backEraseLength > b(0))
260  content->moveIterator(backIterator, -backEraseLength);
261  this->totalLength -= length;
263 }

◆ eraseAtBack()

void inet::Packet::eraseAtBack ( b  length)
inline

Erases the requested amount of data from the end of the data part of the packet.

The front and back offsets are not affected. The length parameter must be in the range [0, getDataLength()].

1180  {
1182  CHUNK_CHECK_USAGE(b(-1) <= length && length <= getDataLength(), "length is invalid");
1183  eraseAt(getBackOffset() - length, length);
1184  }

Referenced by trimBack().

◆ eraseAtFront()

void inet::Packet::eraseAtFront ( b  length)
inline

Erases the requested amount of data from the beginning of the data part of the packet.

The front and back offsets are not affected. The length parameter must be in the range [0, getDataLength()].

1169  {
1171  CHUNK_CHECK_USAGE(b(-1) <= length && length <= getDataLength(), "length is invalid");
1172  eraseAt(getFrontOffset(), length);
1173  }

Referenced by inet::PimCrcInsertionHook::datagramPostRoutingHook(), inet::tcp::TcpCrcInsertionHook::datagramPostRoutingHook(), inet::sctp::SctpCrcInsertion::datagramPostRoutingHook(), inet::UdpCrcInsertionHook::datagramPostRoutingHook(), inet::ieee80211::Ieee80211Portal::decapsulate(), inet::Ipv6::fragmentAndSend(), and trimFront().

◆ eraseData()

void inet::Packet::eraseData ( )
inline

Erases the whole data part of the packet.

The front and back offsets are not affected.

1190  {
1193  }

◆ eraseDataAt()

void inet::Packet::eraseDataAt ( b  offset,
b  length 
)
inline

Erases the designated part of the data part of the packet.

The front and back offsets are not affected. The designated part must be in the range [0, getDataLength()].

1209  {
1211  auto dataLength = getDataLength();
1212  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= dataLength, "offset is out of range");
1213  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= dataLength, "length is invalid");
1214  eraseAt(getFrontOffset() + offset, length);
1215  }

◆ findRegionTag()

template<typename T >
const Ptr<const T> inet::Packet::findRegionTag ( b  offset = b(0),
b  length = b(-1) 
) const
inline

Returns the region tag for the provided type and range, or returns nullptr if no such region tag is found.

1375  {
1376  return regionTags.findTag<T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1377  }

◆ findTag()

template<typename T >
const Ptr<const T> inet::Packet::findTag ( ) const
inline

Returns the packet tag for the provided type or returns nullptr if no such packet tag is found.

1282  {
1283  return tags.findTag<T>();
1284  }

Referenced by inet::PcpClassifier::classifyPacket(), inet::PcpTrafficClassClassifier::classifyPacket(), inet::StreamClassifier::classifyPacket(), inet::Ieee80211MacProtocolDissector::computeLlcProtocol(), inet::sctp::SctpNatHook::datagramForwardHook(), inet::Ipv4::datagramLocalOut(), inet::NetfilterInfoHook::datagramLocalOutHook(), inet::PimCrcInsertionHook::datagramPostRoutingHook(), inet::tcp::TcpCrcInsertionHook::datagramPostRoutingHook(), inet::sctp::SctpCrcInsertion::datagramPostRoutingHook(), inet::NetfilterInfoHook::datagramPostRoutingHook(), inet::UdpCrcInsertionHook::datagramPostRoutingHook(), inet::Ieee8022Llc::deliverCopyToSockets(), inet::PacketDissector::dissectPacket(), inet::ProtocolChecker::dropPacket(), inet::Ipv4Encap::encapsulate(), inet::Ieee8022Llc::encapsulate(), inet::ieee80211::Ieee80211Mac::encapsulate(), inet::Ipv6::encapsulate(), inet::NextHopForwarding::encapsulate(), inet::Flooding::encapsulate(), inet::Ipv4::encapsulate(), inet::CsmaCaMac::encapsulate(), inet::findNetworkProtocol(), inet::findNetworkProtocolHeader(), inet::findTransportProtocol(), inet::findTransportProtocolHeader(), inet::Ipv4::getDestInterface(), inet::ieee80211::RateSelection::getMode(), inet::ieee80211::QosRateSelection::getMode(), inet::Ipv4::getNextHop(), inet::StreamSplitter::getNumPacketDuplicates(), inet::UdpSocket::getReceivedPacketInfo(), inet::Ipv4::getSourceInterface(), inet::NextHopForwarding::getSourceInterfaceFrom(), inet::Ipv6::getSourceInterfaceFrom(), inet::MacRelayUnit::handleLowerPacket(), inet::Ieee8021dRelay::handleLowerPacket(), inet::tcp::Tcp::handleLowerPacket(), inet::SctpNatPeer::handleMessage(), inet::Ipv6::handleMessageFromHL(), inet::MessageDispatcher::handlePacket(), inet::NextHopForwarding::handlePacketFromHL(), inet::NextHopForwarding::handlePacketFromNetwork(), inet::Tun::handleUpperPacket(), inet::Ieee8021dRelay::handleUpperPacket(), inet::Udp::handleUpperPacket(), inet::Udp::isCorrectPacket(), inet::Ieee8022Llc::isDeliverableToUpperLayer(), inet::queueing::EcnMarker::markPacket(), inet::StreamFilter::matchesPacket(), inet::queueing::LabelFilter::matchesPacket(), inet::EligibilityTimeFilter::matchesPacket(), inet::StreamMerger::matchesPacket(), inet::ProtocolChecker::matchesPacket(), inet::VlanReqFilter::matchesPacket(), inet::VlanIndFilter::matchesPacket(), inet::IpvxTrafSink::printPacket(), inet::IpvxTrafGen::printPacket(), inet::PacketDeserializer::processPacket(), inet::PacketDirectionReverser::processPacket(), inet::Ieee8022LlcInserter::processPacket(), inet::Ieee8022SnapInserter::processPacket(), inet::SendToMacAddress::processPacket(), inet::VlanReqMapper::processPacket(), inet::StreamIdentifier::processPacket(), inet::StreamMerger::processPacket(), inet::RelayInterfaceLearner::processPacket(), inet::StreamEncoder::processPacket(), inet::StreamDecoder::processPacket(), inet::ExtLowerUdp::processPacketFromUpper(), inet::PingApp::processPingResponse(), inet::StreamSplitter::pushPacket(), inet::EthernetSocketPacketProcessor::pushPacket(), inet::Ieee8022LlcSocketPacketProcessor::pushPacket(), inet::Ieee8021qSocketPacketProcessor::pushPacket(), inet::RelayInterfaceSelector::pushPacket(), inet::Ipv4::routeLocalBroadcastPacket(), inet::RelayInterfaceSelector::sendPacket(), inet::Ipv4::sendPacketToNIC(), inet::tcp::TcpConnection::sendToIP(), inet::Mpls::sendToL2(), and inet::Mpls::sendToL3().

◆ findTagForUpdate()

template<typename T >
const Ptr<T> inet::Packet::findTagForUpdate ( )
inline

◆ forEachChild()

void inet::Packet::forEachChild ( cVisitor *  v)
overridevirtual
111 {
112  cPacket::forEachChild(v);
113  v->visit(const_cast<Chunk *>(content.get()));
114  for (int i = 0; i < tags.getNumTags(); i++)
115  v->visit(const_cast<TagBase *>(tags.getTag(i).get()));
116  for (int i = 0; i < regionTags.getNumTags(); i++)
117  v->visit(const_cast<TagBase *>(regionTags.getTag(i).get()));
118 }

◆ getAllRegionTags()

template<typename T >
std::vector<SharingRegionTagSet::RegionTag<const T> > inet::Packet::getAllRegionTags ( b  offset = b(0),
b  length = b(-1) 
) const
inline

Returns all region tags for the provided type and range in a detached vector of region tags.

1403  {
1404  return regionTags.getAllTags<const T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1405  }

◆ getAllRegionTagsForUpdate()

template<typename T >
std::vector<SharingRegionTagSet::RegionTag<T> > inet::Packet::getAllRegionTagsForUpdate ( b  offset = b(0),
b  length = b(-1) 
)
inline

Returns all region tags for the provided type and range in a detached vector of region tags.

1410  {
1411  return regionTags.getAllTagsForUpdate<T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1412  }

◆ getBack()

const ChunkTemporarySharedPtr * inet::Packet::getBack ( ) const
protected
103 {
105  return chunk == nullptr ? nullptr : new ChunkTemporarySharedPtr(chunk);
106 }

◆ getBackOffset()

◆ getBitLength()

◆ getContent()

const Chunk* inet::Packet::getContent ( ) const
inlineprotected
128 { return content.get(); }

◆ getData()

const ChunkTemporarySharedPtr * inet::Packet::getData ( ) const
protected
97 {
98  const auto& chunk = peekData(Chunk::PF_ALLOW_ALL);
99  return chunk == nullptr ? nullptr : new ChunkTemporarySharedPtr(chunk);
100 }

◆ getDataLength()

b inet::Packet::getDataLength ( ) const
inline

Returns the current length of the data part of the packet.

This is the same as the difference between the front and back offsets. The returned value is in the range [0, getTotalLength()].

Referenced by inet::queueing::PacketProcessorBase::animatePacketStart(), inet::queueing::PeriodicGate::canPacketFlowThrough(), inet::queueing::CompoundPacketQueueBase::canPushPacket(), inet::queueing::PacketQueue::canPushPacket(), inet::ieee80211::OriginatorProtectionMechanism::computeDataFrameDurationField(), inet::ieee80211::SingleProtectionMechanism::computeDataOrMgmtFrameDurationField(), inet::ieee80211::OriginatorProtectionMechanism::computeMgmtFrameDurationField(), inet::ieee80211::OriginatorProtectionMechanism::computeRtsDurationField(), inet::ieee80211::SingleProtectionMechanism::computeRtsDurationField(), inet::queueing::PassivePacketSink::consumePacket(), inet::SubpacketLengthHeaderBasedAggregator::continueAggregation(), inet::AggregatorBase::continueAggregation(), inet::DefragmenterBase::continueDefragmentation(), inet::physicallayer::Ieee80211UnitDiskTransmitter::createTransmission(), inet::SubpacketLengthHeaderBasedDeaggregator::deaggregatePacket(), inet::physicallayer::Ieee80211OfdmRadio::decapsulate(), inet::physicallayer::ApskRadio::decapsulate(), inet::ProbabilisticBroadcast::decapsulate(), inet::NextHopForwarding::decapsulate(), inet::Flooding::decapsulate(), inet::EthernetMacBase::decapsulate(), inet::CsmaCaMacProtocolDissector::dissect(), inet::Ieee80211PhyProtocolDissector::dissect(), inet::PimProtocolDissector::dissect(), inet::ProbabilisticProtocolDissector::dissect(), inet::RsvpProtocolDissector::dissect(), inet::XMacProtocolDissector::dissect(), inet::Ipv4ProtocolDissector::dissect(), inet::TcpProtocolDissector::dissect(), inet::AckingMacProtocolDissector::dissect(), inet::EthernetMacProtocolDissector::dissect(), inet::UdpProtocolDissector::dissect(), inet::Ipv6ProtocolDissector::dissect(), inet::WiseRouteProtocolDissector::dissect(), inet::LMacProtocolDissector::dissect(), inet::LsrProtocolDissector::dissect(), inet::BMacProtocolDissector::dissect(), inet::FloodingProtocolDissector::dissect(), inet::NextHopProtocolDissector::dissect(), inet::EchoProtocolDissector::dissect(), inet::ApskProtocolDissector::dissect(), inet::UnitDiskProtocolDissector::dissect(), inet::Icmpv6ProtocolDissector::dissect(), inet::sctp::SctpProtocolDissector::dissect(), inet::Ieee80211MacProtocolDissector::dissect(), inet::PacketDissector::dissectPacket(), inet::ieee80211::Ieee80211Portal::encapsulate(), inet::physicallayer::ApskRadio::encapsulate(), inet::Ipv4Encap::encapsulate(), inet::ProbabilisticBroadcast::encapsulate(), inet::Ipv6::encapsulate(), inet::NextHopForwarding::encapsulate(), inet::Flooding::encapsulate(), inet::Ipv4::encapsulate(), inet::queueing::PacketServer::endProcessingPacket(), inet::tcp::TcpSendQueue::enqueueAppData(), inet::Ipv6::fragmentAndSend(), inet::Ipv4::fragmentAndSend(), inet::queueing::TokenBucketClassifierMixin< MultiTokenBucketMixin< PacketClassifierBase > >::getNumPacketTokens(), inet::queueing::TokenBucketMeterMixin< TokenBucketMixin< PacketMeterBase > >::getNumPacketTokens(), inet::Ipv4::handleIncomingDatagram(), inet::Flooding::handleLowerPacket(), inet::NextHopForwarding::handlePacketFromNetwork(), inet::queueing::PacketProcessorBase::handlePacketProcessed(), inet::EthernetMac::handleUpperPacket(), inet::EthernetCsmaMac::handleUpperPacket(), inet::tcp::TcpReceiveQueue::insertBytesFromSegment(), inet::Igmpv3::insertCrc(), inet::tcp::TcpLwip::ip_output(), inet::ieee80211::Rx::isFcsOk(), inet::CsmaCaMac::isFcsOk(), inet::queueing::SlidingWindowRateMeter::meterPacket(), inet::EligibilityTimeMeter::meterPacket(), printToStream(), inet::EthernetEncapsulation::processPacketFromHigherLayer(), inet::EthernetEncapsulation::processPacketFromMac(), inet::PingApp::processPingResponse(), inet::dymo::Dymo::processUdpPacket(), inet::Udp::processUDPPacket(), inet::DeaggregatorBase::pushPacket(), inet::FragmenterBase::pushPacket(), inet::queueing::PcapFilePacketConsumer::pushPacket(), inet::queueing::PacketBasedTokenGenerator::pushPacket(), inet::queueing::MarkovScheduler::pushPacket(), inet::InterpacketGapInserter::pushPacketEnd(), inet::Ppp::refreshOutGateConnection(), inet::Icmpv6::sendErrorMessage(), inet::Icmp::sendErrorMessage(), inet::PimSm::sendPIMRegister(), inet::Icmp::sendPtbMessage(), inet::EthernetCsmaMac::startFrameTransmission(), str(), and inet::EthernetMacBase::verifyCrcAndLength().

◆ getDissection()

const ChunkTemporarySharedPtr * inet::Packet::getDissection ( ) const
protected
83 {
84  PacketDissector::ChunkBuilder builder;
85  PacketDissector packetDissector(ProtocolDissectorRegistry::globalRegistry, builder);
86  packetDissector.dissectPacket(const_cast<Packet *>(this));
87  return new ChunkTemporarySharedPtr(builder.getContent());
88 }

◆ getEncapsulatedPacket()

virtual cPacket* inet::Packet::getEncapsulatedPacket ( ) const
inlineoverridevirtual
182 { return nullptr; }

◆ getFront()

const ChunkTemporarySharedPtr * inet::Packet::getFront ( ) const
protected
91 {
92  const auto& chunk = peekAt(b(0), getFrontOffset(), Chunk::PF_ALLOW_ALL);
93  return chunk == nullptr ? nullptr : new ChunkTemporarySharedPtr(chunk);
94 }

◆ getFrontOffset()

◆ getFullName()

const char * inet::Packet::getFullName ( ) const
overridevirtual

Returns the full name of the packet.

The full name consists of packet name followed by either 'start', 'progress', or 'end'.

291 {
292  if (!isUpdate())
293  return getName();
294  else {
295  const char *suffix;
296  if (getRemainingDuration().isZero())
297  suffix = ":end";
298  else if (getRemainingDuration() == getDuration())
299  suffix = ":start";
300  else
301  suffix = ":progress";
302  static std::set<std::string> pool;
303  std::string fullname = std::string(getName()) + suffix;
304  auto it = pool.insert(fullname).first;
305  return it->c_str();
306  }
307 }

Referenced by inet::AckingMac::acked(), inet::Ipv4::datagramLocalInHook(), inet::NextHopForwarding::datagramPreRoutingHook(), inet::ieee80211::Ieee80211Portal::encapsulate(), inet::NextHopForwarding::encapsulate(), inet::Ipv4::encapsulate(), inet::Ipv6Tunneling::handleMessage(), inet::Ipv6::handleMessageFromHL(), inet::EthernetMac::handleUpperPacket(), inet::EthernetCsmaMac::handleUpperPacket(), and inet::queueing::PacketQueueBase::resolveDirective().

◆ getNumRegionTags()

int inet::Packet::getNumRegionTags ( ) const
inline

Returns the number of region tags.

1347  {
1348  return regionTags.getNumTags();
1349  }

◆ getNumTags()

int inet::Packet::getNumTags ( ) const
inline

Returns the number of packet tags.

1254  {
1255  return tags.getNumTags();
1256  }

◆ getRegionTag() [1/2]

template<typename T >
const Ptr<const T> inet::Packet::getRegionTag ( b  offset = b(0),
b  length = b(-1) 
) const
inline

Returns the region tag for the provided type and range, or throws an exception if no such region tag is found.

1382  {
1383  return regionTags.getTag<T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1384  }

◆ getRegionTag() [2/2]

const Ptr<const TagBase> inet::Packet::getRegionTag ( int  index) const
inline

Returns the region tag at the given index.

1354  {
1355  return regionTags.getTag(index);
1356  }

◆ getRegionTags()

virtual SharingRegionTagSet& inet::Packet::getRegionTags ( )
inlineoverridevirtual

Returns all region tags.

Implements inet::IRegionTaggedObject.

1342 { return regionTags; }

◆ getTag() [1/2]

template<typename T >
const Ptr<const T> inet::Packet::getTag ( ) const
inline

Returns the packet tag for the provided type or throws an exception if no such packet tag is found.

1296  {
1297  return tags.getTag<T>();
1298  }

◆ getTag() [2/2]

const Ptr<const TagBase> inet::Packet::getTag ( int  index) const
inline

Returns the packet tag at the given index.

1261  {
1262  return tags.getTag(index);
1263  }

Referenced by inet::EthernetFragmentFcsChecker::checkComputedFcs(), inet::tcp::Tcp::checkCrc(), inet::VoipStreamReceiver::checkSourceAndParameters(), inet::queueing::LabelClassifier::classifyPacket(), inet::EthernetFragmentFcsInserter::computeComputedFcs(), inet::L3NetworkConfiguratorBase::computeWirelessLinkWeight(), inet::VoipStreamReceiver::createConnection(), inet::TcpEchoAppThread::dataArrived(), inet::CloudDelayerBase::datagramForwardHook(), inet::NetfilterInfoHook::datagramForwardHook(), inet::NetfilterInfoHook::datagramLocalInHook(), inet::PimCrcInsertionHook::datagramPostRoutingHook(), inet::tcp::TcpCrcInsertionHook::datagramPostRoutingHook(), inet::sctp::SctpCrcInsertion::datagramPostRoutingHook(), inet::NetfilterInfoHook::datagramPostRoutingHook(), inet::UdpCrcInsertionHook::datagramPostRoutingHook(), inet::NetfilterInfoHook::datagramPreRoutingHook(), inet::ieee80211::Ieee80211Portal::decapsulate(), inet::physicallayer::Ieee80211Radio::decapsulate(), inet::Ipv6Tunneling::decapsulateDatagram(), inet::Ieee80211PhyProtocolDissector::dissect(), inet::physicallayer::UnitDiskRadio::encapsulate(), inet::ieee80211::Ieee80211LlcEpd::encapsulate(), inet::physicallayer::ApskRadio::encapsulate(), inet::Ipv4Encap::encapsulate(), inet::AckingMac::encapsulate(), inet::Ppp::encapsulate(), inet::ieee80211::Ieee80211Mac::encapsulate(), inet::ProbabilisticBroadcast::encapsulate(), inet::LMac::encapsulate(), inet::Ipv6::encapsulate(), inet::NextHopForwarding::encapsulate(), inet::Flooding::encapsulate(), inet::Ipv4::encapsulate(), inet::CsmaCaMac::encapsulate(), inet::BMac::encapsulate(), inet::XMac::encapsulate(), inet::Ieee802154Mac::encapsulate(), inet::findPacketProtocol(), inet::Ipv4::forwardMulticastPacket(), inet::Ipv4::fragmentAndSend(), inet::Ipv6::fragmentPostRouting(), inet::Ipv4::fragmentPostRouting(), inet::queueing::EcnMarker::getEcn(), inet::eigrp::EigrpRtpT< Ipv4Address >::getNeighborId(), inet::UdpSocket::getReceivedPacketInfo(), inet::Stp::handleBPDU(), inet::Ipv4::handleIncomingDatagram(), inet::Rstp::handleIncomingFrame(), inet::MacRelayUnit::handleLowerPacket(), inet::Ieee8021dRelay::handleLowerPacket(), inet::ProbabilisticBroadcast::handleLowerPacket(), inet::tcp::TcpLwip::handleLowerPacket(), inet::tcp::Tcp::handleLowerPacket(), inet::Udp::handleLowerPacket(), inet::InterpacketGapInserter::handleMessage(), inet::eigrp::EigrpSplitter::handleMessage(), inet::TcpGenericServerApp::handleMessage(), inet::PimSplitter::handleMessage(), inet::tcp::TcpLwip::handleMessage(), inet::ospfv3::Ospfv3Splitter::handleMessage(), inet::Gptp::handleMessage(), inet::ospfv3::Ospfv3Process::handleMessage(), inet::sctp::Sctp::handleMessage(), inet::Ipv6::handleMessageFromHL(), inet::ieee80211::Ieee80211Mac::handleMgmtPacket(), inet::NextHopForwarding::handlePacketFromNetwork(), inet::physicallayer::EthernetFragmentPhyHeaderInserter::handlePacketProcessed(), inet::Stp::handleTCN(), inet::Tun::handleUpperPacket(), inet::physicallayer::ApskRadio::handleUpperPacket(), inet::ShortcutMac::handleUpperPacket(), inet::physicallayer::ShortcutRadio::handleUpperPacket(), inet::Ieee8021dRelay::handleUpperPacket(), inet::CsmaCaMac::handleUpperPacket(), inet::Rip::isValidResponse(), inet::DscpMarker::markPacket(), inet::EthernetEncapsulation::Socket::matches(), inet::queueing::StatisticalRateLimiter::matchesPacket(), inet::StreamMerger::matchesPacket(), inet::EthernetMacHeaderChecker::matchesPacket(), inet::EthernetAddressChecker::matchesPacket(), inet::ospfv2::MessageHandler::messageReceived(), inet::physicallayer::Ieee80211Radio::peekIeee80211PhyHeaderAtFront(), inet::dymo::Dymo::permissibleRteMsg(), inet::physicallayer::Ieee80211Radio::popIeee80211PhyHeaderAtFront(), inet::Mpls::popLabel(), inet::Ipv4::preroutingFinish(), inet::IpvxTrafSink::printPacket(), inet::IpvxTrafGen::printPacket(), inet::PimDm::processAssertPacket(), inet::PimSm::processAssertPacket(), inet::xMIPv6::processBAMessage(), inet::xMIPv6::processBRRMessage(), inet::xMIPv6::processBUMessage(), inet::xMIPv6::processCoTIMessage(), inet::xMIPv6::processCoTMessage(), inet::DhcpServer::processDhcpMessage(), inet::EchoProtocol::processEchoRequest(), inet::Icmp::processEchoRequest(), inet::Icmpv6::processEchoRequest(), inet::PimDm::processGraftAckPacket(), inet::PimDm::processGraftPacket(), inet::RsvpTe::processHelloMsg(), inet::ospfv3::Ospfv3Interface::processHelloPacket(), inet::PimBase::processHelloPacket(), inet::xMIPv6::processHoTIMessage(), inet::xMIPv6::processHoTMessage(), inet::Igmpv2::processIgmpMessage(), inet::PimDm::processJoinPrunePacket(), inet::PimSm::processJoinPrunePacket(), inet::Ldp::processLDPHello(), inet::Mpls::processMplsPacketFromL2(), inet::eigrp::EigrpIpv4Pdm::processMsgFromNetwork(), inet::eigrp::EigrpIpv6Pdm::processMsgFromNetwork(), inet::Ipv6NeighbourDiscovery::processNaPacket(), inet::Ipv6NeighbourDiscovery::processNsForNonTentativeAddress(), inet::Ipv6NeighbourDiscovery::processNsForTentativeAddress(), inet::Ipv6NeighbourDiscovery::processNsPacket(), inet::Ipv6NeighbourDiscovery::processNsWithSpecifiedSrcAddr(), inet::EthernetTypeOrLengthInserter::processPacket(), inet::SendWithProtocol::processPacket(), inet::ospfv2::HelloHandler::processPacket(), inet::Ieee8022LlcInserter::processPacket(), inet::FragmentNumberHeaderInserter::processPacket(), inet::EthernetMacHeaderInserter::processPacket(), inet::EthernetFragmentFcsInserter::processPacket(), inet::EthernetAddressInserter::processPacket(), inet::physicallayer::EthernetFragmentPhyHeaderInserter::processPacket(), inet::SendWithAcknowledge::processPacket(), inet::StreamMerger::processPacket(), inet::RelayInterfaceLearner::processPacket(), inet::ospfv2::MessageHandler::processPacket(), inet::ospfv3::Ospfv3Instance::processPacket(), inet::aodv::Aodv::processPacket(), inet::EthernetEncapsulation::processPacketFromHigherLayer(), inet::Mpls::processPacketFromL2(), inet::Mpls::processPacketFromL3(), inet::EthernetEncapsulation::processPacketFromMac(), inet::ExtLowerUdp::processPacketFromUpper(), inet::Gptp::processPdelayReq(), inet::Gptp::processPdelayResp(), inet::PimSplitter::processPIMPacket(), inet::PingApp::processPingResponse(), inet::Igmpv2::processQuery(), inet::Igmpv3::processQuery(), inet::Ipv6NeighbourDiscovery::processRaForRouterUpdates(), inet::Ipv6NeighbourDiscovery::processRaPacket(), inet::PimSm::processRegisterPacket(), inet::Igmpv3::processReport(), inet::Rip::processRequest(), inet::dymo::Dymo::processRerr(), inet::Rip::processResponse(), inet::Ipv6NeighbourDiscovery::processRsPacket(), inet::PimDm::processStateRefreshPacket(), inet::UdpVideoStreamServer::processStreamRequest(), inet::Gptp::processSync(), inet::Udp::processUDPPacket(), inet::Udp::processUndeliverablePacket(), inet::Mpls::pushLabel(), inet::FragmentTagBasedDefragmenter::pushPacket(), inet::RelayInterfaceSelector::pushPacket(), inet::Ipv4::sendDatagramToOutput(), inet::TcpEchoApp::sendDown(), inet::PimDm::sendGraftAckPacket(), inet::Ipv4::sendPacketToNIC(), inet::Ipv6NeighbourDiscovery::sendSolicitedNa(), inet::ShortcutMac::sendToPeer(), inet::physicallayer::ApskRadio::sendUp(), inet::queueing::EcnMarker::setEcn(), inet::UdpEchoApp::socketDataArrived(), inet::TunnelApp::socketDataArrived(), inet::EtherAppServer::socketDataArrived(), inet::SctpClient::socketDataArrived(), inet::PingApp::socketDataArrived(), inet::ieee80211::Ieee80211MgmtSta::storeAPInfo(), inet::Mpls::swapLabel(), inet::dymo::Dymo::updateRoute(), inet::xMIPv6::validateBAck(), inet::xMIPv6::validateBUMessage(), inet::xMIPv6::validateCoTMessage(), inet::xMIPv6::validateHoTMessage(), inet::Ipv6NeighbourDiscovery::validateNaPacket(), inet::Ipv6NeighbourDiscovery::validateNsPacket(), inet::Ipv6NeighbourDiscovery::validateRaPacket(), inet::Ipv6NeighbourDiscovery::validateRsPacket(), inet::Pim::verifyCrc(), and inet::Udp::verifyCrc().

◆ getTagForUpdate()

template<typename T >
const Ptr<T> inet::Packet::getTagForUpdate ( )
inline

◆ getTags()

◆ getTotalLength()

b inet::Packet::getTotalLength ( ) const
inline

Returns the total packet length ignoring front and back offsets.

The returned value is in the range [0, +infinity).

193 { return totalLength; }

Referenced by inet::PacketTransmitterBase::calculateClockTimeDuration(), inet::LengthBasedFragmenterPolicy::computeFragmentLengths(), inet::physicallayer::ApskScalarTransmitter::createTransmission(), inet::physicallayer::Ieee802154NarrowbandScalarTransmitter::createTransmission(), inet::physicallayer::Ieee802154NarrowbandDimensionalTransmitter::createTransmission(), inet::physicallayer::ApskDimensionalTransmitter::createTransmission(), inet::physicallayer::UnitDiskTransmitter::createTransmission(), inet::physicallayer::Ieee802154UwbIrTransmitter::createTransmission(), inet::queueing::PacketFilterBase::dropPacket(), inet::physicallayer::Ieee80211OfdmRadio::encapsulate(), inet::physicallayer::Ieee80211Radio::encapsulate(), inet::physicallayer::Ieee80211OfdmEncoder::encode(), inet::PacketTransmitterBase::encodePacket(), inet::queueing::FlowMeasurementRecorder::endMeasurements(), inet::endPacketFlow(), inet::PacketStreamer::endStreaming(), inet::PreemptableStreamer::endStreaming(), eraseAt(), inet::Ipv6::fragmentAndSend(), inet::TcpGenericServerApp::handleMessage(), inet::Udp::handleUpperPacket(), inet::increaseTimeTag(), insertAt(), inet::insertPacketEvent(), inet::LengthBasedAggregatorPolicy::isAggregatablePacket(), inet::ieee80211::BasicMsduAggregationPolicy::isEligible(), inet::queueing::ExponentialRateMeter::meterPacket(), inet::PaddingInserter::processPacket(), inet::visualizer::PacketFlowCanvasVisualizer::processPathElement(), inet::visualizer::PathVisualizerBase::processPathElement(), inet::visualizer::PathVisualizerBase::processPathEnd(), inet::visualizer::PathVisualizerBase::processPathStart(), inet::StreamThroughTransmitter::progressTx(), inet::InterpacketGapInserter::pushOrSendOrSchedulePacketProgress(), inet::queueing::PacketProcessorBase::pushOrSendPacketEnd(), inet::queueing::PacketProcessorBase::pushOrSendPacketProgress(), inet::queueing::PacketProcessorBase::pushOrSendPacketStart(), inet::queueing::PacketBasedTokenGenerator::pushPacket(), inet::PacketStreamer::pushPacket(), inet::PreemptableStreamer::pushPacket(), inet::StreamThroughTransmitter::pushPacketEnd(), inet::PacketDestreamer::pushPacketEnd(), inet::queueing::PacketMultiplexer::pushPacketProgress(), inet::queueing::PacketFlowBase::pushPacketProgress(), inet::queueing::PacketClassifierBase::pushPacketProgress(), inet::queueing::PacketFilterBase::pushPacketProgress(), inet::utils::filters::DemuxFlowFilter::receiveSignal(), inet::queueing::PacketServer::scheduleProcessingTimer(), inet::Icmpv6::sendErrorMessage(), inet::sctp::SctpAssociation::sendToIP(), setBackOffset(), setFrontOffset(), inet::queueing::FlowMeasurementStarter::startMeasurement(), inet::queueing::FlowMeasurementStarter::startMeasurements(), inet::startPacketFlow(), inet::queueing::PreemptingServer::startStreaming(), and trimBack().

◆ hasAll()

template<typename T >
bool inet::Packet::hasAll ( ) const
inline

Returns true if the whole content of the packet is completely available in the requested representation.

542  {
544  return content->has<T>(Chunk::ForwardIterator(b(0)), getTotalLength());
545  }

◆ hasAt()

template<typename T >
bool inet::Packet::hasAt ( b  offset,
b  length = b(-1) 
) const
inline

Returns true if the designated part of the packet is completely available in the requested representation.

If the length is unspecified, then the length of the result is chosen according to the current representation.

567  {
569  auto totalLength = getTotalLength();
570  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= totalLength, "offset is out of range");
571  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= totalLength, "length is invalid");
572  return content->has<T>(Chunk::Iterator(true, b(offset), -1), length == b(-1) ? -(totalLength - offset) : length);
573  }

◆ hasAtBack()

template<typename T >
bool inet::Packet::hasAtBack ( b  length) const
inline

Returns true if the designated part at the end of the data part of the packet is completely available in the requested representation.

521  {
523  CHUNK_CHECK_USAGE(b(0) <= length && length <= getDataLength(), "length is invalid");
524  return content->has<T>(backIterator, length);
525  }

◆ hasAtFront()

template<typename T >
bool inet::Packet::hasAtFront ( b  length = b(-1)) const
inline

Returns true if the designated part at the beginning of the data part of the packet is completely available in the requested representation.

If the length is unspecified, then the length of the result is chosen according to the current representation.

509  {
511  auto dataLength = getDataLength();
512  CHUNK_CHECK_USAGE(b(-1) <= length && length <= dataLength, "length is invalid");
513  return content->has<T>(frontIterator, length == b(-1) ? -dataLength : length);
514  }

◆ hasBitError()

◆ hasData()

template<typename T >
bool inet::Packet::hasData ( ) const
inline

Returns true if the whole data part of the packet is completely available in the requested representation.

532  {
534  return content->has<T>(frontIterator, getDataLength());
535  }

◆ hasDataAt()

template<typename T >
bool inet::Packet::hasDataAt ( b  offset,
b  length = b(-1) 
) const
inline

Returns true if the designated data part is completely available in the requested representation.

If the length is unspecified, then the length of the result is chosen according to the current representation.

553  {
555  auto dataLength = getDataLength();
556  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= dataLength, "offset is out of range");
557  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= dataLength, "length is invalid");
558  return content->has<T>(Chunk::Iterator(true, frontIterator.getPosition() + offset, -1), length == b(-1) ? -(dataLength - offset) : length);
559  }

◆ insertAll()

void inet::Packet::insertAll ( const Ptr< const Chunk > &  chunk)
inline

Inserts the provided chunk as the content of the packet.

The inserted chunk is automatically marked immutable. The front and back offsets are not affected. The packet must be completely empty before calling this function.

616  {
617  SELFDOC_FUNCTION_CHUNK(chunk);
618  CHUNK_CHECK_USAGE(getTotalLength() == b(0), "content is not empty");
619  insertAt(chunk, b(0));
620  }

◆ insertAt()

void inet::Packet::insertAt ( const Ptr< const Chunk > &  chunk,
b  offset 
)

Inserts the provided chunk at the given offset of the packet.

The inserted chunk is automatically marked immutable. The front and back offsets are updated according to the offset parameter. The offset must be in the range [0, getTotalLength()].

172 {
173  SELFDOC_FUNCTION_CHUNK(chunk);
174  auto totalLength = getTotalLength();
175  CHUNK_CHECK_USAGE(chunk != nullptr, "chunk is nullptr");
176  CHUNK_CHECK_USAGE(chunk->getChunkLength() > b(0), "chunk is empty");
177  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= totalLength, "offset is out of range");
178  constPtrCast<Chunk>(chunk)->markImmutable();
180  content = chunk;
181  else if (offset == b(0) && content->canInsertAtFront(chunk)) {
182  const auto& newContent = makeExclusivelyOwnedMutableChunk(content);
183  newContent->insertAtFront(chunk);
184  newContent->markImmutable();
185  content = newContent->simplify();
186  }
187  else if (offset == totalLength && content->canInsertAtBack(chunk)) {
188  const auto& newContent = makeExclusivelyOwnedMutableChunk(content);
189  newContent->insertAtBack(chunk);
190  newContent->markImmutable();
191  content = newContent->simplify();
192  }
193  else if (content->canInsertAt(chunk, offset)) {
194  const auto& newContent = makeExclusivelyOwnedMutableChunk(content);
195  newContent->insertAt(chunk, offset);
196  newContent->markImmutable();
197  content = newContent->simplify();
198  }
199  else {
200  auto sequenceChunk = makeShared<SequenceChunk>();
201  if (offset != b(0))
202  sequenceChunk->insertAtBack(content->peek(Chunk::ForwardIterator(b(0), 0), offset, Chunk::PF_ALLOW_ALL));
203  sequenceChunk->insertAtBack(chunk);
204  if (offset != totalLength)
205  sequenceChunk->insertAtBack(content->peek(Chunk::ForwardIterator(offset, -1), totalLength, Chunk::PF_ALLOW_ALL));
206  sequenceChunk->markImmutable();
207  content = sequenceChunk;
208  }
209  b chunkLength = chunk->getChunkLength();
210  if (offset < getFrontOffset())
211  content->moveIterator(frontIterator, chunkLength);
212  if (offset > getBackOffset())
213  content->moveIterator(backIterator, chunkLength);
214  this->totalLength += chunkLength;
216 }

◆ insertAtBack()

void inet::Packet::insertAtBack ( const Ptr< const Chunk > &  chunk)
inline

Inserts the provided chunk at the end of the data part of the packet.

The inserted chunk is automatically marked immutable. The front and back offsets are not affected.

593  {
594  SELFDOC_FUNCTION_CHUNK(chunk);
595  insertAt(chunk, getBackOffset());
596  }

Referenced by inet::ospfv2::LinkStateUpdateHandler::acknowledgeLSA(), inet::ospfv3::Ospfv3Interface::acknowledgeLSA(), inet::Ipv4FragBuf::addFragment(), inet::Ipv6FragBuf::addFragment(), inet::EthernetMacBase::addPaddingAndSetFcs(), inet::L3NetworkConfiguratorBase::computeWirelessLinkWeight(), inet::SubpacketLengthHeaderBasedAggregator::continueAggregation(), inet::DefragmenterBase::continueDefragmentation(), inet::eigrp::EigrpIpv4Pdm::createAckPacket(), inet::eigrp::EigrpIpv6Pdm::createAckPacket(), inet::physicallayer::Ieee80211LayeredOfdmReceiver::createCompletePacketModel(), inet::eigrp::EigrpIpv4Pdm::createHelloPacket(), inet::eigrp::EigrpIpv6Pdm::createHelloPacket(), inet::UdpBasicBurst::createPacket(), inet::rtp::Rtcp::createPacket(), inet::eigrp::EigrpIpv4Pdm::createQueryPacket(), inet::eigrp::EigrpIpv6Pdm::createQueryPacket(), inet::eigrp::EigrpIpv4Pdm::createReplyPacket(), inet::eigrp::EigrpIpv6Pdm::createReplyPacket(), inet::tcp::TcpSendQueue::createSegmentWithBytes(), inet::eigrp::EigrpIpv4Pdm::createUpdatePacket(), inet::ospfv2::Ospfv2Interface::createUpdatePacket(), inet::eigrp::EigrpIpv6Pdm::createUpdatePacket(), inet::TcpGenericServerThread::dataArrived(), inet::TcpEchoAppThread::dataArrived(), inet::ieee80211::Ieee80211Portal::decapsulate(), inet::physicallayer::Ieee80211OfdmRadio::encapsulate(), inet::physicallayer::ApskRadio::encapsulate(), inet::physicallayer::Ieee80211Radio::encapsulate(), inet::Ppp::encapsulate(), inet::ieee80211::Ieee80211Mac::encapsulate(), inet::CsmaCaMac::encapsulate(), inet::tcp::TcpReceiveQueue::extractBytesUpTo(), inet::tcp::TcpLwipReceiveQueue::extractBytesUpTo(), inet::Ipv6::fragmentAndSend(), inet::Ipv4::fragmentAndSend(), inet::Stp::generateBPDU(), inet::Stp::generateTCN(), inet::TcpGenericServerApp::handleMessage(), inet::ieee80211::Ieee80211Mac::handleMgmtPacket(), inet::LMac::handleSelfMessage(), inet::Stp::handleTCN(), inet::insertHeader(), inet::ospfv3::Ospfv3Interface::prepareHello(), inet::ospfv3::Ospfv3Interface::prepareLSUHeader(), inet::ospfv3::Ospfv3Interface::prepareUpdatePacket(), inet::RsvpTe::processHELLO_TIMER(), inet::ieee80211::Hcf::processMgmtFrame(), inet::EthernetFcsInserter::processPacket(), inet::EthernetFragmentFcsInserter::processPacket(), inet::EthernetEncapsulation::processPacketFromHigherLayer(), inet::Rip::processRequest(), inet::RsvpTe::refreshPath(), inet::RsvpTe::refreshResv(), inet::UdpVideoStreamClient::requestStream(), inet::ospfv3::Ospfv3Neighbor::retransmitUpdatePacket(), inet::ospfv2::Neighbor::retransmitUpdatePacket(), inet::DhcpServer::sendAck(), inet::aodv::Aodv::sendAODVPacket(), inet::Gpsr::sendBeacon(), inet::Rstp::sendBPDU(), inet::EtherTrafGen::sendBurstPackets(), inet::ospfv2::Neighbor::sendDatabaseDescriptionPacket(), inet::ospfv3::Ospfv3Neighbor::sendDDPacket(), inet::DhcpClient::sendDecline(), inet::ospfv3::Ospfv3Interface::sendDelayedAcknowledgements(), inet::ospfv2::Ospfv2Interface::sendDelayedAcknowledgements(), inet::DhcpClient::sendDiscover(), inet::dymo::Dymo::sendDymoPacket(), inet::Icmpv6::sendErrorMessage(), inet::Icmp::sendErrorMessage(), inet::TelnetApp::sendGenericAppMsg(), inet::ospfv2::Ospfv2Interface::sendHelloPacket(), inet::Ldp::sendHelloTo(), inet::ospfv3::Ospfv3Neighbor::sendLinkStateRequestPacket(), inet::ospfv2::Neighbor::sendLinkStateRequestPacket(), inet::ospfv2::Ospfv2Interface::sendLsAcknowledgement(), inet::ospfv3::Ospfv3Interface::sendLSAcknowledgement(), inet::Ldp::sendMapping(), inet::Ldp::sendMappingRequest(), inet::DhcpServer::sendNak(), inet::Ldp::sendNotify(), inet::DhcpServer::sendOffer(), inet::IpvxTrafGen::sendPacket(), inet::UdpBasicApp::sendPacket(), inet::EtherAppClient::sendPacket(), inet::RsvpTe::sendPathErrorMessage(), inet::RsvpTe::sendPathTearMessage(), inet::PimSm::sendPIMRegister(), inet::PimSm::sendPIMRegisterNull(), inet::PingApp::sendPingRequest(), inet::Icmp::sendPtbMessage(), inet::TcpBasicClientApp::sendRequest(), inet::DhcpClient::sendRequest(), inet::Rip::sendRIPRequest(), inet::Rip::sendRoutes(), inet::UdpVideoStreamServer::sendStreamData(), inet::Rstp::sendTCNtoRoot(), inet::LinkStateRouting::sendToPeer(), inet::SimpleVoipSender::sendVoIPPacket(), inet::EtherAppServer::socketDataArrived(), inet::ieee80211::Dcf::transmitControlResponseFrame(), inet::ieee80211::Hcf::transmitControlResponseFrame(), and inet::ieee80211::Tx::transmitFrame().

◆ insertAtFront()

void inet::Packet::insertAtFront ( const Ptr< const Chunk > &  chunk)
inline

Inserts the provided chunk at the beginning of the data part of the packet.

The inserted chunk is automatically marked immutable. The front and back offsets are not affected.

583  {
584  SELFDOC_FUNCTION_CHUNK(chunk);
585  insertAt(chunk, getFrontOffset());
586  }

Referenced by inet::Ipv4FragBuf::addFragment(), inet::Ipv6FragBuf::addFragment(), inet::physicallayer::Radio::createSignal(), inet::PimCrcInsertionHook::datagramPostRoutingHook(), inet::tcp::TcpCrcInsertionHook::datagramPostRoutingHook(), inet::sctp::SctpCrcInsertion::datagramPostRoutingHook(), inet::UdpCrcInsertionHook::datagramPostRoutingHook(), inet::ieee80211::Ieee80211Portal::decapsulate(), inet::physicallayer::Ieee80211OfdmRadio::encapsulate(), inet::physicallayer::UnitDiskRadio::encapsulate(), inet::ieee80211::Ieee80211LlcEpd::encapsulate(), inet::ieee80211::Ieee80211Portal::encapsulate(), inet::physicallayer::ApskRadio::encapsulate(), inet::physicallayer::Ieee80211Radio::encapsulate(), inet::Ieee8022Llc::encapsulate(), inet::AckingMac::encapsulate(), inet::Ppp::encapsulate(), inet::ieee80211::Ieee80211Mac::encapsulate(), inet::ProbabilisticBroadcast::encapsulate(), inet::LMac::encapsulate(), inet::Flooding::encapsulate(), inet::CsmaCaMac::encapsulate(), inet::EthernetMacBase::encapsulate(), inet::BMac::encapsulate(), inet::XMac::encapsulate(), inet::Ieee802154Mac::encapsulate(), inet::ieee80211::OriginatorMacDataService::extractFramesToTransmit(), inet::ieee80211::OriginatorQosMacDataService::extractFramesToTransmit(), inet::Ipv6::fragmentAndSend(), inet::Ipv4::fragmentAndSend(), inet::VoipStreamSender::generatePacket(), inet::ProbabilisticBroadcast::handleLowerPacket(), inet::tcp::TcpLwip::handleLowerPacket(), inet::physicallayer::EthernetPhy::handleMessage(), inet::ieee80211::Ieee80211Mac::handleMgmtPacket(), inet::LMac::handleSelfMessage(), inet::EthernetMac::handleUpperPacket(), inet::EthernetCsmaMac::handleUpperPacket(), inet::insertHeader(), inet::ProbabilisticBroadcast::insertMessage(), inet::insertProtocolHeader(), inet::tcp::TcpLwip::ip_output(), inet::ieee80211::Dcf::originatorProcessFailedFrame(), inet::ieee80211::Hcf::originatorProcessFailedFrame(), inet::Arp::processArpPacket(), inet::Igmpv3::processHostGeneralQueryTimer(), inet::PacketDeserializer::processPacket(), inet::PacketSerializer::processPacket(), inet::Ieee8021aeTagEpdHeaderInserter::processPacket(), inet::SendWithProtocol::processPacket(), inet::EthernetTypeOrLengthInserter::processPacket(), inet::physicallayer::EthernetPhyHeaderInserter::processPacket(), inet::Ieee8022LlcInserter::processPacket(), inet::SequenceNumbering::processPacket(), inet::SendToPort::processPacket(), inet::SendWithHopLimit::processPacket(), inet::Ieee8022SnapInserter::processPacket(), inet::SendToL3Address::processPacket(), inet::Ieee8021rTagEpdHeaderInserter::processPacket(), inet::SendToMacAddress::processPacket(), inet::physicallayer::EthernetFragmentPhyHeaderInserter::processPacket(), inet::EthernetMacHeaderInserter::processPacket(), inet::EthernetAddressInserter::processPacket(), inet::SendWithAcknowledge::processPacket(), inet::Ieee8021qTagTpidHeaderInserter::processPacket(), inet::Ieee8021qTagEpdHeaderInserter::processPacket(), inet::EthernetEncapsulation::processPacketFromHigherLayer(), inet::Udp::processUndeliverablePacket(), inet::Mpls::pushLabel(), inet::Arp::sendArpGratuitous(), inet::Arp::sendArpProbe(), inet::Arp::sendArpRequest(), inet::PimDm::sendAssertPacket(), inet::Gpsr::sendBeacon(), inet::dymo::Dymo::sendDymoPacket(), inet::Icmpv6::sendErrorMessage(), inet::Icmp::sendErrorMessage(), inet::Igmpv3::sendGeneralQuery(), inet::PimDm::sendGraftAckPacket(), inet::PimDm::sendGraftPacket(), inet::Igmpv3::sendGroupAndSourceSpecificQuery(), inet::Igmpv3::sendGroupReport(), inet::Igmpv3::sendGroupSpecificQuery(), inet::PimBase::sendHelloPacket(), inet::PimDm::sendJoinPacket(), inet::bgp::BgpSession::sendKeepAliveMessage(), inet::Igmpv2::sendLeave(), inet::bgp::BgpSession::sendOpenMessage(), inet::PimSm::sendPIMAssert(), inet::PimSm::sendPIMRegister(), inet::PimSm::sendPIMRegisterNull(), inet::PimSm::sendPIMRegisterStop(), inet::PingApp::sendPingRequest(), inet::PimDm::sendPrunePacket(), inet::Icmp::sendPtbMessage(), inet::Igmpv2::sendQuery(), inet::Igmpv2::sendReport(), inet::PimDm::sendStateRefreshPacket(), inet::physicallayer::ShortcutRadio::sendToPeer(), inet::ShortcutMac::sendToPeer(), inet::bgp::BgpSession::sendUpdateMessage(), inet::Mpls::swapLabel(), inet::ieee80211::Tx::transmitFrame(), inet::ieee80211::Dcf::transmitFrame(), and inet::ieee80211::Hcf::transmitFrame().

◆ insertData()

void inet::Packet::insertData ( const Ptr< const Chunk > &  chunk)
inline

Inserts the provided chunk as the data part of the packet.

The inserted chunk is automatically marked immutable. The front and back offsets are not affected. The data part of the packet must be empty before calling this function.

604  {
605  SELFDOC_FUNCTION_CHUNK(chunk);
606  CHUNK_CHECK_USAGE(getDataLength() == b(0), "data part is not empty");
607  insertAt(chunk, getFrontOffset());
608  }

Referenced by inet::Ieee8021aeTagEpdHeaderInserter::processPacket().

◆ insertDataAt()

void inet::Packet::insertDataAt ( const Ptr< const Chunk > &  chunk,
b  offset 
)
inline

Inserts the provided chunk at the given offset of the data part of the packet.

The inserted chunk is automatically marked immutable. The front and back offsets are not affected. The offset must be in the range [0, getDataLength()].

628  {
629  SELFDOC_FUNCTION_CHUNK(chunk);
630  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= getDataLength(), "offset is out of range");
631  insertAt(chunk, getFrontOffset() + offset);
632  }

Referenced by inet::DscpMarker::markPacket(), and inet::queueing::EcnMarker::setEcn().

◆ isConsistent()

◆ isIteratorConsistent()

bool inet::Packet::isIteratorConsistent ( const Chunk::Iterator iterator)
inlineprotected
150  {
151  Chunk::Iterator copy(iterator);
152  content->seekIterator(copy, iterator.getPosition());
153  return iterator.getPosition() == copy.getPosition() && (iterator.getIndex() == -1 || iterator.getIndex() == copy.getIndex());
154  }

◆ mapAllRegionTags()

template<typename T >
void inet::Packet::mapAllRegionTags ( b  offset,
b  length,
std::function< void(b, b, const Ptr< const T > &)>  f 
) const
inline

Maps all tags in the provided range to to the function.

1389  {
1390  return regionTags.mapAllTags<const T>(offset, length == b(-1) ? getTotalLength() - offset : length, f);
1391  }

Referenced by inet::queueing::FlowMeasurementRecorder::makeMeasurement(), inet::visualizer::PacketFlowCanvasVisualizer::processPathElement(), and inet::utils::filters::DemuxFlowFilter::receiveSignal().

◆ mapAllRegionTagsForUpdate()

template<typename T >
void inet::Packet::mapAllRegionTagsForUpdate ( b  offset,
b  length,
std::function< void(b, b, const Ptr< T > &)>  f 
)
inline

◆ parsimPack()

void inet::Packet::parsimPack ( cCommBuffer *  buffer) const
overridevirtual
121 {
122  cPacket::parsimPack(buffer);
123  buffer->packObject(const_cast<Chunk *>(content.get()));
124  buffer->pack(frontIterator.getIndex());
125  buffer->pack(frontIterator.getPosition().get());
126  buffer->pack(backIterator.getIndex());
127  buffer->pack(backIterator.getPosition().get());
128  tags.parsimPack(buffer);
129  regionTags.parsimPack(buffer);
130 }

◆ parsimUnpack()

void inet::Packet::parsimUnpack ( cCommBuffer *  buffer)
overridevirtual
133 {
134  cPacket::parsimUnpack(buffer);
135  content = check_and_cast<Chunk *>(buffer->unpackObject())->shared_from_this();
136  totalLength = content->getChunkLength();
137  int index;
138  buffer->unpack(index);
139  frontIterator.setIndex(index);
140  uint64_t position;
141  buffer->unpack(position);
142  frontIterator.setPosition(b(position));
143  buffer->unpack(index);
144  backIterator.setIndex(index);
145  buffer->unpack(position);
146  backIterator.setPosition(b(position));
147  tags.parsimUnpack(buffer);
148  regionTags.parsimUnpack(buffer);
149 }

◆ peekAll() [1/2]

const Ptr<const Chunk> inet::Packet::peekAll ( int  flags = 0) const
inline

Returns the whole packet (including front and back popped parts) in the current representation.

The length of the returned chunk is the same as the value returned by getTotalLength(). The flags parameter is a combination of Chunk::PeekFlag enumeration members.

299  {
301  return peekAt(b(0), getTotalLength(), flags);
302  }

Referenced by inet::StreamThroughTransmitter::progressTx().

◆ peekAll() [2/2]

template<typename T >
const Ptr<const T> inet::Packet::peekAll ( int  flags = 0) const
inline

Returns the whole packet (including front and back popped parts) in the requested representation.

The length of the returned chunk is the same as the value returned by getTotalLength(). The flags parameter is a combination of Chunk::PeekFlag enumeration members.

399  {
401  return peekAt<T>(b(0), getTotalLength(), flags);
402  }

◆ peekAllAsBits()

const Ptr<const BitsChunk> inet::Packet::peekAllAsBits ( int  flags = 0) const
inline

Returns the whole packet (including front and back popped parts) as a sequence of bits.

The length of the returned chunk is the same as the value returned by getTotalLength(). The flags parameter is a combination of Chunk::PeekFlag enumeration members.

310  {
312  return peekAt<BitsChunk>(b(0), getTotalLength(), flags);
313  }

Referenced by inet::physicallayer::ErrorModelBase::corruptBits(), and inet::physicallayer::Ieee80211LayeredOfdmReceiver::createCompletePacketModel().

◆ peekAllAsBytes()

const Ptr<const BytesChunk> inet::Packet::peekAllAsBytes ( int  flags = 0) const
inline

Returns the whole packet (including front and back popped parts) as a sequence of bytes.

The length of the returned chunk is the same as the value returned by getTotalLength(). The flags parameter is a combination of Chunk::PeekFlag enumeration members.

321  {
323  return peekAt<BytesChunk>(b(0), getTotalLength(), flags);
324  }

Referenced by inet::FingerprintCalculator::addEventIngredient(), inet::physicallayer::Ieee80211LayeredOfdmReceiver::computeReceptionResult(), inet::physicallayer::ErrorModelBase::corruptBytes(), inet::physicallayer::Ieee80211LayeredOfdmReceiver::createDataFieldBitModel(), inet::CsmaCaMac::encapsulate(), inet::PacketSerializer::processPacket(), inet::ExtLowerUdp::processPacketFromUpper(), and inet::ieee80211::Tx::transmitFrame().

◆ peekAt() [1/2]

const Ptr<const Chunk> inet::Packet::peekAt ( b  offset,
b  length = b(-1),
int  flags = 0 
) const
inline

Returns the designated part of the packet as an immutable chunk in the current representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

343  {
345  return peekAt<Chunk>(offset, length, flags);
346  }

Referenced by inet::physicallayer::ErrorModelBase::corruptChunks(), inet::physicallayer::Ieee80211LayeredOfdmTransmitter::createDataFieldPacketModel(), inet::physicallayer::Ieee80211LayeredOfdmTransmitter::createSignalFieldPacketModel(), getBack(), getFront(), inet::visualizer::PacketFlowCanvasVisualizer::processPathElement(), inet::visualizer::PathVisualizerBase::processPathElement(), inet::visualizer::PathVisualizerBase::processPathEnd(), and inet::visualizer::PathVisualizerBase::processPathStart().

◆ peekAt() [2/2]

template<typename T >
const Ptr<const T> inet::Packet::peekAt ( b  offset,
b  length = b(-1),
int  flags = 0 
) const
inline

Returns the designated part of the packet as an immutable chunk in the requested representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

426  {
428  auto totalLength = getTotalLength();
429  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= totalLength, "offset is out of range");
430  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= totalLength, "length is invalid");
431  return content->peek<T>(Chunk::Iterator(true, b(offset), -1), length == b(-1) ? -(totalLength - offset) : length, flags);
432  }

◆ peekAtBack() [1/2]

template<typename T >
const Ptr<const T> inet::Packet::peekAtBack ( b  length,
int  flags = 0 
) const
inline

Returns the designated part from the end of the data part of the packet as an immutable chunk in the requested representation.

The flags parameter is a combination of Chunk::PeekFlag enumeration members.

371  {
373  auto dataLength = getDataLength();
374  CHUNK_CHECK_USAGE(b(0) <= length && length <= dataLength, "length is invalid");
375  const auto& chunk = content->peek<T>(backIterator, length, flags);
376  CHUNK_CHECK_IMPLEMENTATION(chunk == nullptr || chunk->getChunkLength() <= dataLength);
377  return chunk;
378  }

◆ peekAtBack() [2/2]

const Ptr<const Chunk> inet::Packet::peekAtBack ( b  length = b(-1),
int  flags = 0 
) const
inline

Returns the designated part from the end of the data part of the packet as an immutable chunk in the current representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

256  {
257  return peekAtBack<Chunk>(length, flags);
258  }

Referenced by inet::ieee80211::Rx::isFcsOk(), inet::CsmaCaMac::isFcsOk(), inet::EthernetFcsChecker::matchesPacket(), inet::EthernetFragmentFcsChecker::matchesPacket(), inet::peekHeader(), and inet::EthernetMacBase::verifyCrcAndLength().

◆ peekAtFront() [1/2]

const Ptr<const Chunk> inet::Packet::peekAtFront ( b  length = b(-1),
int  flags = 0 
) const
inline

Returns the designated part from the beginning of the data part of the packet as an immutable chunk in the current representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

245  {
246  return peekAtFront<Chunk>(length, flags);
247  }

Referenced by inet::ieee80211::BasicReassembly::addFragment(), inet::Ipv4FragBuf::addFragment(), inet::Ipv6FragBuf::addFragment(), inet::ieee80211::MsduAggregation::aggregateFrames(), inet::tcp::Tcp::checkCrc(), inet::VoipStreamReceiver::checkSourceAndParameters(), inet::SequenceNumberPacketClassifierFunction::classifyPacket(), inet::EthernetFrameClassifier::classifyPacket(), inet::ieee80211::BasicFragmentationPolicy::computeFragmentSizes(), inet::Ieee80211MacProtocolDissector::computeLlcProtocol(), inet::VoipStreamReceiver::createConnection(), inet::physicallayer::ApskScalarTransmitter::createTransmission(), inet::physicallayer::ApskDimensionalTransmitter::createTransmission(), inet::physicallayer::UnitDiskTransmitter::createTransmission(), inet::Ipv6::datagramLocalOut(), inet::NextHopForwarding::datagramLocalOut(), inet::Ipv4::datagramLocalOut(), inet::NextHopForwarding::datagramPreRouting(), inet::sctp::SctpUdpHook::datagramPreRoutingHook(), inet::rtp::RtpProfile::dataIn(), inet::ieee80211::Ieee80211Portal::decapsulate(), inet::Ipv6Tunneling::decapsulateDatagram(), inet::ieee80211::RecipientMacDataService::defragment(), inet::AckingMac::dropFrameNotForUs(), inet::ieee80211::Ieee80211Portal::encapsulate(), inet::Ipv6Tunneling::encapsulateDatagram(), inet::physicallayer::ApskEncoder::encode(), inet::Ipv4::forwardMulticastPacket(), inet::Ipv6::fragmentAndSend(), inet::Ipv4::fragmentAndSend(), inet::Ipv6::fragmentPostRouting(), inet::Ipv4::fragmentPostRouting(), inet::ieee80211::InProgressFrames::getPendingFrameFor(), inet::DhcpClient::handleDhcpMessage(), inet::EthernetMac::handleEndTxPeriod(), inet::EthernetCsmaMac::handleEndTxPeriod(), inet::Ipv4::handleIncomingDatagram(), inet::Rstp::handleIncomingFrame(), inet::ieee80211::Hcf::handleInternalCollision(), inet::AdaptiveProbabilisticBroadcast::handleLowerPacket(), inet::AckingMac::handleLowerPacket(), inet::BMac::handleLowerPacket(), inet::XMac::handleLowerPacket(), inet::ieee80211::Ieee80211Mac::handleLowerPacket(), inet::tcp::TcpLwip::handleLowerPacket(), inet::Ieee802154Mac::handleLowerPacket(), inet::LMac::handleLowerPacket(), inet::Flooding::handleLowerPacket(), inet::tcp::Tcp::handleLowerPacket(), inet::EthernetCutthroughSource::handleMessage(), inet::Gptp::handleMessage(), inet::ospfv3::Ospfv3Process::handleMessage(), inet::sctp::Sctp::handleMessage(), inet::Ipv6::handleMessageFromHL(), inet::Stp::handleMessageWhenUp(), inet::Rip::handleMessageWhenUp(), inet::PimSm::handleMessageWhenUp(), inet::PimDm::handleMessageWhenUp(), inet::NextHopForwarding::handlePacketFromNetwork(), inet::Ipv6::handleReceivedIcmp(), inet::ProbabilisticBroadcast::handleSelfMessage(), inet::EthernetMac::handleUpperPacket(), inet::ProbabilisticBroadcast::handleUpperPacket(), inet::ieee80211::Ieee80211Mac::handleUpperPacket(), inet::EthernetCsmaMac::handleUpperPacket(), inet::Flooding::handleUpperPacket(), inet::ieee80211::DcfFs::hasMoreFragments(), inet::ieee80211::HcfFs::hasMoreTxOps(), inet::ieee80211::HcfFs::hasMoreTxOpsAndMulticast(), inet::ProbabilisticBroadcast::insertNewMessage(), inet::CsmaCaMac::isAck(), inet::CsmaCaMac::isBroadcast(), inet::ieee80211::DcfFs::isBroadcastManagementOrGroupDataSequenceNeeded(), inet::CsmaCaMac::isForUs(), inet::ieee80211::DcfFs::isFragFrameSequenceNeeded(), inet::Rip::isValidResponse(), inet::Ipv6::localDeliver(), inet::RsvpClassifier::lookupLabel(), inet::Ldp::lookupLabel(), inet::ieee80211::Rx::lowerFrameReceived(), inet::Ieee8021aeTagEpdHeaderChecker::matchesPacket(), inet::ReceiveWithHopLimit::matchesPacket(), inet::EthernetTypeOrLengthChecker::matchesPacket(), inet::physicallayer::EthernetFragmentPhyHeaderChecker::matchesPacket(), inet::physicallayer::EthernetPhyHeaderChecker::matchesPacket(), inet::ReceiveAtPort::matchesPacket(), inet::Ieee8022LlcChecker::matchesPacket(), inet::ReceiveAtMacAddress::matchesPacket(), inet::Ieee8022SnapChecker::matchesPacket(), inet::ReceiveAtL3Address::matchesPacket(), inet::Ieee8021qTagTpidHeaderChecker::matchesPacket(), inet::Ieee8021rTagEpdHeaderChecker::matchesPacket(), inet::EthernetAddressChecker::matchesPacket(), inet::EthernetMacHeaderChecker::matchesPacket(), inet::Ieee8021qTagEpdHeaderChecker::matchesPacket(), inet::Icmp::maySendErrorMessage(), inet::PimSm::multicastPacketForwarded(), inet::tcp::TcpLwip::notifyAboutIncomingSegmentProcessing(), inet::ieee80211::Dcf::originatorProcessFailedFrame(), inet::ieee80211::Hcf::originatorProcessFailedFrame(), inet::ieee80211::Dcf::originatorProcessReceivedFrame(), inet::ieee80211::Hcf::originatorProcessReceivedFrame(), inet::ieee80211::Dcf::originatorProcessRtsProtectionFailed(), inet::ieee80211::Hcf::originatorProcessRtsProtectionFailed(), inet::ieee80211::Dcf::originatorProcessTransmittedFrame(), inet::ieee80211::Hcf::originatorProcessTransmittedFrame(), inet::peekHeader(), inet::physicallayer::Ieee80211Radio::peekIeee80211PhyHeaderAtFront(), inet::peekNetworkProtocolHeader(), inet::peekTransportProtocolHeader(), inet::ieee80211::RtsCtsFs::prepareStep(), inet::ospfv3::Ospfv3Interface::preProcessDDPacket(), inet::Ipv6::preroutingFinish(), inet::Ipv4::preroutingFinish(), inet::eigrp::EigrpIpv4Pdm::processAckPacket(), inet::eigrp::EigrpIpv6Pdm::processAckPacket(), inet::Arp::processArpPacket(), inet::PimDm::processAssertPacket(), inet::PimSm::processAssertPacket(), inet::Gpsr::processBeacon(), inet::ospfv3::Ospfv3Interface::processDDPacket(), inet::DhcpServer::processDhcpMessage(), inet::PimDm::processGraftAckPacket(), inet::PimDm::processGraftPacket(), inet::eigrp::EigrpRtpT< Ipv4Address >::processHeader(), inet::RsvpTe::processHelloMsg(), inet::eigrp::EigrpIpv4Pdm::processHelloPacket(), inet::ospfv3::Ospfv3Interface::processHelloPacket(), inet::eigrp::EigrpIpv6Pdm::processHelloPacket(), inet::PimBase::processHelloPacket(), inet::xMIPv6::processHoAOpt(), inet::Icmp::processIcmpMessage(), inet::Udp::processICMPv4Error(), inet::Udp::processICMPv6Error(), inet::Icmpv6::processICMPv6Message(), inet::Igmpv2::processIgmpMessage(), inet::Igmpv3::processIgmpMessage(), inet::rtp::Rtcp::processIncomingRTPPacket(), inet::Ipv6NeighbourDiscovery::processIpv6Datagram(), inet::PimDm::processJoinPrunePacket(), inet::PimSm::processJoinPrunePacket(), inet::Ldp::processLDPHello(), inet::Igmpv2::processLeave(), inet::LinkStateRouting::processLINK_STATE_MESSAGE(), inet::ospfv3::Ospfv3Interface::processLSAck(), inet::ospfv3::Ospfv3Interface::processLSR(), inet::ospfv3::Ospfv3Interface::processLSU(), inet::xMIPv6::processMobilityMessage(), inet::Mpls::processMplsPacketFromL2(), inet::eigrp::EigrpIpv4Pdm::processMsgFromNetwork(), inet::eigrp::EigrpIpv6Pdm::processMsgFromNetwork(), inet::ospfv2::LinkStateAcknowledgementHandler::processPacket(), inet::ospfv2::HelloHandler::processPacket(), inet::ospfv2::LinkStateRequestHandler::processPacket(), inet::EchoProtocol::processPacket(), inet::ospfv2::DatabaseDescriptionHandler::processPacket(), inet::ospfv2::LinkStateUpdateHandler::processPacket(), inet::ospfv2::MessageHandler::processPacket(), inet::ospfv3::Ospfv3Instance::processPacket(), inet::Mpls::processPacketFromL3(), inet::RsvpTe::processPathErrMsg(), inet::RsvpTe::processPathMsg(), inet::RsvpTe::processPathTearMsg(), inet::PimSplitter::processPIMPacket(), inet::Igmpv2::processQuery(), inet::Igmpv3::processQuery(), inet::eigrp::EigrpIpv4Pdm::processQueryPacket(), inet::eigrp::EigrpIpv6Pdm::processQueryPacket(), inet::EthernetCsmaMac::processReceivedControlFrame(), inet::PimSm::processRegisterPacket(), inet::PimSm::processRegisterStopPacket(), inet::eigrp::EigrpIpv4Pdm::processReplyPacket(), inet::eigrp::EigrpIpv6Pdm::processReplyPacket(), inet::Igmpv3::processReport(), inet::Rip::processRequest(), inet::Rip::processResponse(), inet::RsvpTe::processRSVPMessage(), inet::rtp::RtpSenderInfo::processRTPPacket(), inet::rtp::RtpPayloadReceiver::processRtpPacket(), inet::rtp::RtpReceiverInfo::processRTPPacket(), inet::rtp::RtpAvProfilePayload32Receiver::processRtpPacket(), inet::rtp::RtpParticipantInfo::processRTPPacket(), inet::PimDm::processStateRefreshPacket(), inet::xMIPv6::processType2RH(), inet::Udp::processUndeliverablePacket(), inet::eigrp::EigrpIpv4Pdm::processUpdatePacket(), inet::eigrp::EigrpIpv6Pdm::processUpdatePacket(), inet::Igmpv2::processV2Report(), inet::Forwarding::pushPacket(), inet::EthernetCutthroughSource::pushPacketEnd(), inet::ieee80211::Tx::radioTransmissionFinished(), inet::rtp::Rtp::readRet(), inet::Ipv4::reassembleAndDeliver(), inet::Ipv4::reassembleAndDeliverFinish(), inet::PimSm::receiveSignal(), inet::Ipv6::resolveMACAddressAndSendPacket(), inet::Ipv4::routeLocalBroadcastPacket(), inet::NextHopForwarding::routeMulticastPacket(), inet::Ipv6::routeMulticastPacket(), inet::NextHopForwarding::routePacket(), inet::Ipv6::routePacket(), inet::Ipv4::routeUnicastPacket(), inet::ieee80211::HcfFs::selectDataOrManagementSequence(), inet::ieee80211::HcfFs::selectHcfSequence(), inet::ieee80211::TxOpFs::selectTxOpSequence(), inet::NextHopForwarding::sendDatagramToHL(), inet::NextHopForwarding::sendDatagramToOutput(), inet::BMac::sendDataPacket(), inet::Icmpv6::sendErrorMessage(), inet::Icmp::sendErrorMessage(), inet::ospfv2::MessageHandler::sendPacket(), inet::ospfv3::Ospfv3Process::sendPacket(), inet::PimSm::sendPIMRegister(), inet::Icmp::sendPtbMessage(), inet::ieee80211::Ieee80211Mac::sendUpFrame(), inet::EtherAppServer::socketDataArrived(), inet::VoipStreamReceiver::socketDataArrived(), inet::SimpleVoipReceiver::socketDataArrived(), inet::EthernetMac::startFrameTransmission(), inet::EthernetCsmaMac::startFrameTransmission(), inet::SimpleVoipReceiver::startTalkspurt(), inet::ieee80211::Dcf::transmitFrame(), inet::ieee80211::Hcf::transmitFrame(), inet::Mpls::tryLabelAndForwardIpv4Datagram(), inet::Ieee802154Mac::updateStatusTransmitFrame(), inet::Icmpv6::validateDatagramPromptingError(), inet::Icmpv6::verifyCrc(), inet::Icmp::verifyCrc(), inet::Igmpv2::verifyCrc(), inet::Igmpv3::verifyCrc(), and inet::EthernetMacBase::verifyCrcAndLength().

◆ peekAtFront() [2/2]

template<typename T >
const Ptr<const T> inet::Packet::peekAtFront ( b  length = b(-1),
int  flags = 0 
) const
inline

Returns the designated part from the beginning of the data part of the packet as an immutable chunk in the requested representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

356  {
358  auto dataLength = getDataLength();
359  CHUNK_CHECK_USAGE(b(-1) <= length && length <= dataLength, "length is invalid");
360  const auto& chunk = content->peek<T>(frontIterator, length == b(-1) ? -dataLength : length, flags);
361  CHUNK_CHECK_IMPLEMENTATION(chunk == nullptr || chunk->getChunkLength() <= dataLength);
362  return chunk;
363  }

◆ peekData() [1/2]

const Ptr<const Chunk> inet::Packet::peekData ( int  flags = 0) const
inline

Returns the whole data part (excluding front and back popped parts) in the current representation.

The length of the returned chunk is the same as the value returned by getDataLength(). The flags parameter is a combination of Chunk::PeekFlag enumeration members.

266  {
268  return peekDataAt(b(0), getDataLength(), flags);
269  }

Referenced by inet::tcp::Tcp::checkCrc(), inet::CrcCheckerBase::checkDeclaredCorrectCrc(), inet::FcsCheckerBase::checkDeclaredCorrectFcs(), inet::SubpacketLengthHeaderBasedAggregator::continueAggregation(), inet::DefragmenterBase::continueDefragmentation(), inet::TcpGenericServerThread::dataArrived(), inet::Ieee80211MgmtProtocolDissector::dissect(), inet::DefaultProtocolDissector::dissect(), inet::ieee80211::Ds::distributeDataFrame(), getData(), inet::ieee80211::Ieee80211MgmtSta::handleAssociationResponseFrame(), inet::ieee80211::Ieee80211MgmtAp::handleAuthenticationFrame(), inet::ieee80211::Ieee80211MgmtSta::handleAuthenticationFrame(), inet::ieee80211::Ieee80211MgmtSta::handleBeaconFrame(), inet::SctpServer::handleMessage(), inet::SctpPeer::handleMessage(), inet::Dsdv::handleMessageWhenUp(), inet::ieee80211::Ieee80211MgmtAp::handleProbeRequestFrame(), inet::ieee80211::Ieee80211MgmtSta::handleProbeResponseFrame(), inet::tcp::TcpCrcInsertionHook::insertCrc(), inet::sctp::SctpCrcInsertion::insertCrc(), inet::Udp::insertCrc(), inet::Igmpv2::insertCrc(), inet::ieee80211::Rx::isFcsOk(), inet::CsmaCaMac::isFcsOk(), inet::EchoProtocol::processEchoRequest(), inet::Icmp::processEchoRequest(), inet::Icmpv6::processEchoRequest(), inet::Ipv4NatTable::processPacket(), inet::SctpClient::socketDataArrived(), inet::SctpPeer::socketDataArrived(), inet::SctpNatPeer::socketDataArrived(), and inet::TcpSocket::ReceiveQueueBasedCallback::socketDataArrived().

◆ peekData() [2/2]

template<typename T >
const Ptr<const T> inet::Packet::peekData ( int  flags = 0) const
inline

Returns the data part (excluding front and back popped parts) in the requested representation.

The length of the returned chunk is the same as the value returned by getDataLength(). The flags parameter is a combination of Chunk::PeekFlag enumeration members.

387  {
389  return peekDataAt<T>(b(0), getDataLength(), flags);
390  }

◆ peekDataAsBits()

const Ptr<const BitsChunk> inet::Packet::peekDataAsBits ( int  flags = 0) const
inline

Returns the whole data part (excluding front and back popped parts) as a sequence of bits.

The length of the returned chunk is the same as the value returned by getDataLength(). The flags parameter is a combination of Chunk::PeekFlag enumeration members.

277  {
279  return peekDataAt<BitsChunk>(b(0), getDataLength(), flags);
280  }

◆ peekDataAsBytes()

◆ peekDataAt() [1/2]

const Ptr<const Chunk> inet::Packet::peekDataAt ( b  offset,
b  length = b(-1),
int  flags = 0 
) const
inline

Returns the designated data part as an immutable chunk in the current representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

332  {
334  return peekDataAt<Chunk>(offset, length, flags);
335  }

Referenced by inet::Ipv4FragBuf::addFragment(), inet::Ipv6FragBuf::addFragment(), inet::FragmenterBase::createFragmentPacket(), inet::TcpEchoAppThread::dataArrived(), inet::VoipStreamReceiver::decodePacket(), inet::tcp::TcpSendQueue::enqueueAppData(), inet::tcp::TcpLwipSendQueue::enqueueAppData(), inet::Ipv6::fragmentAndSend(), inet::Ipv4::fragmentAndSend(), inet::ieee80211::Fragmentation::fragmentFrame(), inet::queueing::EcnMarker::getEcn(), inet::EthernetMac::handleEndTxPeriod(), inet::EthernetCsmaMac::handleEndTxPeriod(), inet::Flooding::handleLowerPacket(), inet::TcpGenericServerApp::handleMessage(), inet::tcp::TcpReceiveQueue::insertBytesFromSegment(), inet::ieee80211::Rx::isFcsOk(), inet::CsmaCaMac::isFcsOk(), inet::Ldp::lookupLabel(), inet::DscpMarker::markPacket(), inet::Icmp::maySendErrorMessage(), inet::Icmp::processIcmpMessage(), inet::Icmpv6::processICMPv6Message(), inet::EthernetMac::processMsgFromNetwork(), inet::Mpls::processPacketFromL3(), inet::PingApp::processPingResponse(), inet::dymo::Dymo::processUdpPacket(), inet::Icmpv6::sendErrorMessage(), inet::Icmp::sendErrorMessage(), inet::PimSm::sendPIMRegister(), inet::Icmp::sendPtbMessage(), inet::queueing::EcnMarker::setEcn(), inet::Icmpv6::validateDatagramPromptingError(), inet::Pim::verifyCrc(), inet::Udp::verifyCrc(), and inet::EthernetMacBase::verifyCrcAndLength().

◆ peekDataAt() [2/2]

template<typename T >
const Ptr<const T> inet::Packet::peekDataAt ( b  offset,
b  length = b(-1),
int  flags = 0 
) const
inline

Returns the designated data part as an immutable chunk in the requested representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

411  {
413  auto dataLength = getDataLength();
414  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= dataLength, "offset is out of range");
415  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= dataLength, "length is invalid");
416  return content->peek<T>(Chunk::Iterator(true, frontIterator.getPosition() + offset, -1), length == b(-1) ? -(dataLength - offset) : length, flags);
417  }

◆ popAtBack() [1/2]

template<typename T >
const Ptr<const T> inet::Packet::popAtBack ( b  length,
int  flags = 0 
)
inline

Pops the designated part from the end of the data part of the packet and returns it as an immutable chunk in the requested representation.

Decreases the back offset with the length of the returned chunk. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

488  {
490  CHUNK_CHECK_USAGE(b(0) <= length && length <= getDataLength(), "length is invalid");
491  const auto& chunk = peekAtBack<T>(length, flags);
492  if (chunk != nullptr) {
493  content->moveIterator(backIterator, chunk->getChunkLength());
495  }
496  return chunk;
497  }

◆ popAtBack() [2/2]

const Ptr<const Chunk> inet::Packet::popAtBack ( b  length = b(-1),
int  flags = 0 
)
inline

Pops the designated part from the end of the data part of the packet and returns it as an immutable chunk in the current representation.

Decreases the back offset with the length of the returned chunk. If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

457  {
458  return popAtBack<Chunk>(length, flags);
459  }

Referenced by inet::physicallayer::Ieee80211OfdmRadio::decapsulate(), inet::physicallayer::ApskRadio::decapsulate(), inet::physicallayer::Ieee80211Radio::decapsulate(), inet::Ppp::decapsulate(), inet::ieee80211::Ieee80211Mac::decapsulate(), inet::CsmaCaMac::decapsulate(), inet::CsmaCaMacProtocolDissector::dissect(), inet::ApskProtocolDissector::dissect(), inet::EthernetMacProtocolDissector::dissect(), inet::PppProtocolDissector::dissect(), inet::Ieee80211MacProtocolDissector::dissect(), inet::ieee80211::Ieee80211Portal::encapsulate(), inet::ieee80211::Fragmentation::fragmentFrame(), inet::popHeader(), inet::EthernetFcsChecker::processPacket(), inet::EthernetFragmentFcsChecker::processPacket(), and inet::EthernetEncapsulation::processPacketFromMac().

◆ popAtFront() [1/2]

const Ptr<const Chunk> inet::Packet::popAtFront ( b  length = b(-1),
int  flags = 0 
)
inline

Pops the designated part from the beginning of the data part of the packet and returns it as an immutable chunk in the current representation.

Increases the front offset with the length of the returned chunk. If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

445  {
446  return popAtFront<Chunk>(length, flags);
447  }

Referenced by inet::SubpacketLengthHeaderBasedDeaggregator::deaggregatePacket(), inet::physicallayer::Ieee80211OfdmRadio::decapsulate(), inet::physicallayer::UnitDiskRadio::decapsulate(), inet::ieee80211::Ieee80211LlcEpd::decapsulate(), inet::physicallayer::ApskRadio::decapsulate(), inet::Ipv4Encap::decapsulate(), inet::Ieee8022Llc::decapsulate(), inet::AckingMac::decapsulate(), inet::Ppp::decapsulate(), inet::ieee80211::Ieee80211Mac::decapsulate(), inet::ProbabilisticBroadcast::decapsulate(), inet::LMac::decapsulate(), inet::NextHopForwarding::decapsulate(), inet::Flooding::decapsulate(), inet::CsmaCaMac::decapsulate(), inet::Ipv6::decapsulate(), inet::EthernetMacBase::decapsulate(), inet::Ipv4::decapsulate(), inet::BMac::decapsulate(), inet::XMac::decapsulate(), inet::Ieee802154Mac::decapsulate(), inet::VoipStreamReceiver::decodePacket(), inet::Ieee802EpdProtocolDissector::dissect(), inet::RsvpProtocolDissector::dissect(), inet::RipProtocolDissector::dissect(), inet::IcmpProtocolDissector::dissect(), inet::LMacProtocolDissector::dissect(), inet::LsrProtocolDissector::dissect(), inet::MplsProtocolDissector::dissect(), inet::BMacProtocolDissector::dissect(), inet::NextHopProtocolDissector::dissect(), inet::Icmpv6ProtocolDissector::dissect(), inet::PimProtocolDissector::dissect(), inet::ApskProtocolDissector::dissect(), inet::PppProtocolDissector::dissect(), inet::WiseRouteProtocolDissector::dissect(), inet::Ieee80211PhyProtocolDissector::dissect(), inet::ProbabilisticProtocolDissector::dissect(), inet::CsmaCaMacProtocolDissector::dissect(), inet::EthernetMacProtocolDissector::dissect(), inet::Ieee802154ProtocolDissector::dissect(), inet::ShortcutPhyProtocolDissector::dissect(), inet::ShortcutMacProtocolDissector::dissect(), inet::StpProtocolDissector::dissect(), inet::TcpProtocolDissector::dissect(), inet::AckingMacProtocolDissector::dissect(), inet::UdpProtocolDissector::dissect(), inet::UnitDiskProtocolDissector::dissect(), inet::FloodingProtocolDissector::dissect(), inet::XMacProtocolDissector::dissect(), inet::IgmpProtocolDissector::dissect(), inet::ArpProtocolDissector::dissect(), inet::Ieee802LlcDissector::dissect(), inet::EchoProtocolDissector::dissect(), inet::Ipv4ProtocolDissector::dissect(), inet::Ipv6ProtocolDissector::dissect(), inet::ospf::OspfProtocolDissector::dissect(), inet::sctp::SctpProtocolDissector::dissect(), inet::physicallayer::Ieee8021qTagEpdProtocolDissector::dissect(), inet::physicallayer::EthernetPhyProtocolDissector::dissect(), inet::physicallayer::Ieee8021rTagEpdProtocolDissector::dissect(), inet::physicallayer::GptpProtocolDissector::dissect(), inet::Ieee80211MacProtocolDissector::dissect(), inet::ieee80211::Ieee80211Portal::encapsulate(), inet::Ipv6Tunneling::encapsulateDatagram(), inet::PimSm::forwardMulticastData(), inet::Ipv6::fragmentAndSend(), inet::ieee80211::Fragmentation::fragmentFrame(), inet::ProbabilisticBroadcast::handleLowerPacket(), inet::tcp::TcpLwip::ip_output(), inet::popHeader(), inet::physicallayer::Ieee80211Radio::popIeee80211PhyHeaderAtFront(), inet::Mpls::popLabel(), inet::EchoProtocol::processEchoRequest(), inet::Icmp::processEchoRequest(), inet::Udp::processICMPv4Error(), inet::Udp::processICMPv6Error(), inet::Icmpv6::processICMPv6Message(), inet::rtp::Rtcp::processIncomingRTCPPacket(), inet::Mpls::processMplsPacketFromL2(), inet::EthernetTypeOrLengthChecker::processPacket(), inet::Ieee8021aeTagEpdHeaderChecker::processPacket(), inet::ReceiveWithHopLimit::processPacket(), inet::physicallayer::EthernetPhyHeaderChecker::processPacket(), inet::Ieee8022LlcChecker::processPacket(), inet::ReceiveAtPort::processPacket(), inet::Ieee8022SnapChecker::processPacket(), inet::ReceiveAtMacAddress::processPacket(), inet::Ieee8021rTagEpdHeaderChecker::processPacket(), inet::ReceiveAtL3Address::processPacket(), inet::Ieee8021qTagTpidHeaderChecker::processPacket(), inet::EthernetMacHeaderChecker::processPacket(), inet::physicallayer::EthernetFragmentPhyHeaderChecker::processPacket(), inet::EthernetAddressChecker::processPacket(), inet::Ieee8021qTagEpdHeaderChecker::processPacket(), inet::SendWithAcknowledge::processPacket(), inet::aodv::Aodv::processPacket(), inet::EthernetEncapsulation::processPacketFromMac(), inet::EthernetCsmaMac::processReceivedControlFrame(), inet::PimSm::processRegisterPacket(), inet::rtp::RtpAvProfilePayload32Receiver::processRtpPacket(), inet::Gpsr::processUdpPacket(), inet::dymo::Dymo::processUdpPacket(), inet::Udp::processUDPPacket(), inet::ReceiveWithProtocol::pushPacket(), inet::ReceiveWithAcknowledge::pushPacket(), inet::DuplicateRemoval::pushPacket(), inet::Reordering::pushPacket(), inet::Forwarding::pushPacket(), inet::physicallayer::ShortcutRadio::receiveFromPeer(), inet::ShortcutMac::receiveFromPeer(), inet::PingApp::socketDataArrived(), and inet::AckingMacToEthernetPcapRecorderHelper::tryConvertToLinkType().

◆ popAtFront() [2/2]

template<typename T >
const Ptr<const T> inet::Packet::popAtFront ( b  length = b(-1),
int  flags = 0 
)
inline

Pops the designated part from the beginning of the data part of the packet and returns it as an immutable chunk in the requested representation.

Increases the front offset with the length of the returned chunk. If the length is unspecified, then the length of the result is chosen according to the current representation. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

470  {
472  CHUNK_CHECK_USAGE(b(-1) <= length && length <= getDataLength(), "length is invalid");
473  const auto& chunk = peekAtFront<T>(length, flags);
474  if (chunk != nullptr) {
475  content->moveIterator(frontIterator, chunk->getChunkLength());
477  }
478  return chunk;
479  }

◆ printToStream()

std::ostream & inet::Packet::printToStream ( std::ostream &  stream,
int  level,
int  evFlags = 0 
) const
overridevirtual

Prints a human readable string representation to the output stream.

The level argument controls the printed level of detail. The flags argument allows formatted and multiline output.

Reimplemented from inet::IPrintableObject.

310 {
311  std::string className = getClassName();
312  auto index = className.rfind("::");
313  if (index != std::string::npos)
314  className = className.substr(index + 2);
315  if (level <= PRINT_LEVEL_DETAIL)
316  stream << EV_FAINT << "(" << className << ")" << EV_NORMAL;
317  stream << EV_ITALIC << getName() << EV_NORMAL << " (" << getDataLength() << ") ";
318  content->printToStream(stream, level + 1, evFlags);
319  return stream;
320 }

◆ removeAll() [1/2]

const Ptr<Chunk> inet::Packet::removeAll ( int  flags = 0)
inline

Removes all content from the packet and returns it as a mutable chunk in the current representation.

Resets both front and back offsets to zero. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

683  {
684  return removeAll<Chunk>(flags);
685  }

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

◆ removeAll() [2/2]

template<typename T >
const Ptr<T> inet::Packet::removeAll ( int  flags = 0)
inline

Removes all content from the packet and returns it as a mutable chunk in the requested representation.

Resets both front and back offsets to zero. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

756  {
758  const auto& chunk = peekAll<T>(flags);
759  eraseAll();
760  return makeExclusivelyOwnedMutableChunk(chunk);
761  }

◆ removeAt() [1/2]

const Ptr<Chunk> inet::Packet::removeAt ( b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Removes the designated part of the packet and returns it as a mutable chunk in the current representation.

The front and back offsets are updated according to the offset and length parameters. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

703  {
704  return removeAt<Chunk>(offset, length, flags);
705  }

◆ removeAt() [2/2]

template<typename T >
const Ptr<T> inet::Packet::removeAt ( b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Removes the designated part of the packet and returns it as a mutable chunk in the requested representation.

The front and back offsets are updated according to the offset and length parameters. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

784  {
786  const auto& chunk = peekAt<T>(offset, length, flags);
787  eraseAt(offset, chunk->getChunkLength());
788  return makeExclusivelyOwnedMutableChunk(chunk);
789  }

◆ removeAtBack() [1/2]

template<typename T >
const Ptr<T> inet::Packet::removeAtBack ( b  length,
int  flags = 0 
)
inline

Removes the designated part from the end of the data part of the packet and returns it as a mutable chunk in the requested representation.

The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

730  {
732  const auto& chunk = peekAtBack<T>(length, flags);
733  eraseAtBack(chunk->getChunkLength());
734  return makeExclusivelyOwnedMutableChunk(chunk);
735  }

◆ removeAtBack() [2/2]

const Ptr<Chunk> inet::Packet::removeAtBack ( b  length = b(-1),
int  flags = 0 
)
inline

Removes the designated part from the end of the data part of the packet and returns it as a mutable chunk in the current representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

665  {
666  return removeAtBack<Chunk>(length, flags);
667  }

Referenced by inet::EthernetMacBase::addPaddingAndSetFcs(), inet::Ppp::refreshOutGateConnection(), and inet::ieee80211::Tx::transmitFrame().

◆ removeAtFront() [1/2]

const Ptr<Chunk> inet::Packet::removeAtFront ( b  length = b(-1),
int  flags = 0 
)
inline

Removes the designated part from the beginning of the data part of the packet and returns it as a mutable chunk in the current representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

653  {
654  return removeAtFront<Chunk>(length, flags);
655  }

Referenced by inet::sctp::SctpNatHook::datagramForwardHook(), inet::PimCrcInsertionHook::datagramPostRoutingHook(), inet::tcp::TcpCrcInsertionHook::datagramPostRoutingHook(), inet::sctp::SctpCrcInsertion::datagramPostRoutingHook(), inet::UdpCrcInsertionHook::datagramPostRoutingHook(), inet::sctp::SctpUdpHook::datagramPreRoutingHook(), inet::sctp::SctpNatHook::datagramPreRoutingHook(), inet::ieee80211::OriginatorMacDataService::extractFramesToTransmit(), inet::ieee80211::OriginatorQosMacDataService::extractFramesToTransmit(), inet::tcp::TcpLwip::handleLowerPacket(), inet::Flooding::handleLowerPacket(), inet::EthernetMac::handleUpperPacket(), inet::EthernetCsmaMac::handleUpperPacket(), inet::ProbabilisticBroadcast::insertMessage(), inet::tcp::TcpLwip::ip_output(), inet::ieee80211::Dcf::originatorProcessFailedFrame(), inet::ieee80211::Hcf::originatorProcessFailedFrame(), inet::xMIPv6::processHoAOpt(), inet::RsvpTe::processResvMsg(), inet::xMIPv6::processType2RH(), inet::removeProtocolHeader(), inet::Icmpv6::sendErrorMessage(), inet::Mpls::swapLabel(), inet::ieee80211::Tx::transmitFrame(), inet::ieee80211::Dcf::transmitFrame(), and inet::ieee80211::Hcf::transmitFrame().

◆ removeAtFront() [2/2]

template<typename T >
const Ptr<T> inet::Packet::removeAtFront ( b  length = b(-1),
int  flags = 0 
)
inline

Removes the designated part from the beginning of the data part of the packet and returns it as a mutable chunk in the requested representation.

If the length is unspecified, then the length of the result is chosen according to the current representation. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

716  {
718  const auto& chunk = peekAtFront<T>(length, flags);
719  eraseAtFront(chunk->getChunkLength());
720  return makeExclusivelyOwnedMutableChunk(chunk);
721  }

◆ removeData() [1/2]

const Ptr<Chunk> inet::Packet::removeData ( int  flags = 0)
inline

Removes the data part of the packet and returns it as a mutable chunk in the current representation.

The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

674  {
675  return removeData<Chunk>(flags);
676  }

Referenced by inet::Ieee8021aeTagEpdHeaderInserter::processPacket().

◆ removeData() [2/2]

template<typename T >
const Ptr<T> inet::Packet::removeData ( int  flags = 0)
inline

Removes the data part of the packet and returns it as a mutable chunk in the requested representation.

The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

743  {
745  const auto& chunk = peekData<T>(flags);
746  eraseData();
747  return makeExclusivelyOwnedMutableChunk(chunk);
748  }

◆ removeDataAt() [1/2]

const Ptr<Chunk> inet::Packet::removeDataAt ( b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Removes the designated part of the data part of the packet and returns it as a mutable chunk in the current representation.

The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

693  {
694  return removeDataAt<Chunk>(offset, length, flags);
695  }

Referenced by inet::DscpMarker::markPacket(), and inet::queueing::EcnMarker::setEcn().

◆ removeDataAt() [2/2]

template<typename T >
const Ptr<T> inet::Packet::removeDataAt ( b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Removes the designated part of the data part of the packet and returns it as a mutable chunk in the requested representation.

The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

770  {
772  const auto& chunk = peekDataAt<T>(offset, length, flags);
773  eraseDataAt(offset, chunk->getChunkLength());
774  return makeExclusivelyOwnedMutableChunk(chunk);
775  }

◆ removeRegionTag()

template<typename T >
const Ptr<T> inet::Packet::removeRegionTag ( b  offset,
b  length 
)
inline

Removes the region tag for the provided type and range, or throws an exception if no such region tag is found.

1438  {
1439  return regionTags.removeTag<T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1440  }

◆ removeRegionTagIfPresent()

template<typename T >
const Ptr<T> inet::Packet::removeRegionTagIfPresent ( b  offset,
b  length 
)
inline

Removes the region tag for the provided type and range if present, or returns nullptr if no such region tag is found.

1445  {
1446  return regionTags.removeTagIfPresent<T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1447  }

◆ removeRegionTagsWherePresent()

template<typename T >
std::vector<SharingRegionTagSet::RegionTag<T> > inet::Packet::removeRegionTagsWherePresent ( b  offset,
b  length 
)
inline

Removes and returns all region tags for the provided type and range.

1452  {
1453  return regionTags.removeTagsWherePresent<T>(offset, length == b(-1) ? getTotalLength() - offset : length);
1454  }

◆ removeTag()

◆ removeTagIfPresent()

template<typename T >
const Ptr<T> inet::Packet::removeTagIfPresent ( )
inline

Removes the packet tag for the provided type if present, or returns nullptr if no such packet tag is found.

1331  {
1332  return tags.removeTagIfPresent<T>();
1333  }

Referenced by inet::Ieee8022Llc::decapsulate(), inet::Ipv4Encap::encapsulate(), inet::Ipv6::encapsulate(), inet::NextHopForwarding::encapsulate(), inet::Flooding::encapsulate(), inet::Ipv4::encapsulate(), inet::EthernetCutthroughSource::handleMessage(), inet::Udp::handleUpperPacket(), inet::DscpMarker::markPacket(), inet::Arp::processArpPacket(), inet::Mpls::processMplsPacketFromL2(), inet::EthernetTypeOrLengthInserter::processPacket(), inet::SendWithHopLimit::processPacket(), inet::Ieee8021rTagEpdHeaderInserter::processPacket(), inet::EthernetMacHeaderInserter::processPacket(), inet::VlanReqMapper::processPacket(), inet::Ieee8021qTagEpdHeaderInserter::processPacket(), inet::Ieee8021qTagTpidHeaderInserter::processPacket(), inet::EthernetEncapsulation::processPacketFromHigherLayer(), inet::EthernetEncapsulation::processPacketFromMac(), inet::Forwarding::pushPacket(), inet::EthernetCutthroughSource::pushPacketEnd(), inet::removeNetworkProtocolHeader(), inet::removeProtocolHeader(), inet::removeTransportProtocolHeader(), inet::Arp::sendArpGratuitous(), inet::Arp::sendArpProbe(), inet::Arp::sendArpRequest(), inet::NextHopForwarding::sendDatagramToOutput(), inet::Ipv6::sendDatagramToOutput(), inet::xMIPv6::sendMobilityMessageToIPv6Module(), inet::MacRelayUnitBase::sendPacket(), inet::Ipv6NeighbourDiscovery::sendPacketToIpv6Module(), inet::Gptp::sendPacketToNIC(), inet::Ipv4::sendPacketToNIC(), inet::Udp::sendUp(), inet::queueing::EcnMarker::setEcn(), and inet::Mpls::tryLabelAndForwardIpv4Datagram().

◆ replaceAll() [1/2]

const Ptr<Chunk> inet::Packet::replaceAll ( const Ptr< const Chunk > &  chunk,
int  flags = 0 
)
inline

Replaces all content in the packet with the provided chunk and returns the old part as a mutable chunk in the current representation.

Resets both front and back offsets to zero. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

836  {
837  return replaceAll<Chunk>(chunk, flags);
838  }

◆ replaceAll() [2/2]

template<typename T >
const Ptr<T> inet::Packet::replaceAll ( const Ptr< const Chunk > &  chunk,
int  flags = 0 
)
inline

Replaces all content in the packet with the provided chunk and returns the old content as a mutable chunk in the requested representation.

The inserted part is automatically marked immutable. Resets both front and back offsets to zero. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

912  {
914  return replaceAt(chunk, b(0), getTotalLength(), flags);
915  }

◆ replaceAt() [1/2]

const Ptr<Chunk> inet::Packet::replaceAt ( const Ptr< const Chunk > &  chunk,
b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Replaces the designated part of the packet with the provided chunk and returns the old content as a mutable chunk in the current representation.

The front and back offsets are updated according to the offset and length parameters. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

857  {
858  return replaceAt<Chunk>(chunk, offset, length, flags);
859  }

◆ replaceAt() [2/2]

template<typename T >
const Ptr<T> inet::Packet::replaceAt ( const Ptr< const Chunk > &  chunk,
b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Replaces the designated part of the packet with the provided chunk and returns the old content as a mutable chunk in the requested representation.

The front and back offsets are updated accordign to the length and offset parameters. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

TODO current limitation: the new chunk must be the same size as the old one

941  {
943  auto totalLength = getTotalLength();
944  CHUNK_CHECK_USAGE(chunk != nullptr, "chunk is nullptr");
945  CHUNK_CHECK_USAGE(chunk->getChunkLength() > b(0), "chunk is empty");
946  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= totalLength, "offset is out of range");
947  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= totalLength, "length is invalid");
948  constPtrCast<Chunk>(chunk)->markImmutable();
949  const auto& oldChunk = peekAt<T>(offset, length, flags);
950  b chunkLength = oldChunk->getChunkLength();
951  b frontLength = offset;
952  const auto& frontPart = frontLength > b(0) ? peekAt(b(0), frontLength) : nullptr;
953  b backLength = totalLength - offset - chunkLength;
954  const auto& backPart = backLength > b(0) ? peekAt(totalLength - backLength, backLength) : nullptr;
956  const auto& result = makeExclusivelyOwnedMutableChunk(oldChunk);
957  CHUNK_CHECK_USAGE(chunkLength == chunk->getChunkLength(), "length is different");
958  if (frontLength == b(0) && backLength == b(0))
959  content = chunk;
960  else {
961  const auto& sequenceChunk = makeShared<SequenceChunk>();
962  if (frontLength > b(0))
963  sequenceChunk->insertAtBack(frontPart);
964  sequenceChunk->insertAtBack(chunk);
965  if (backLength > b(0))
966  sequenceChunk->insertAtBack(backPart);
967  sequenceChunk->markImmutable();
968  content = sequenceChunk;
969  }
971  return result;
972  }

◆ replaceAtBack() [1/2]

template<typename T >
const Ptr<T> inet::Packet::replaceAtBack ( const Ptr< const Chunk > &  chunk,
b  length,
int  flags = 0 
)
inline

Replaces the designated part at the end of the data part of the packet with the provided chunk and returns the old part as a mutable chunk in the requested representation.

The inserted part is automatically marked immutable. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

885  {
887  CHUNK_CHECK_USAGE(b(0) <= length && length <= getDataLength(), "length is invalid");
888  return replaceAt<T>(chunk, getBackOffset() - length, length, flags);
889  }

◆ replaceAtBack() [2/2]

const Ptr<Chunk> inet::Packet::replaceAtBack ( const Ptr< const Chunk > &  chunk,
b  length = b(-1),
int  flags = 0 
)
inline

Replaces the designated part at the end of the data part of the packet with the provided chunk and returns the old part as a mutable chunk in the current representation.

If the length is unspecified, then the length of the replaced part is chosen according to the current representation. The inserted part is automatically marked immutable. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

816  {
817  return replaceAtBack<Chunk>(chunk, length, flags);
818  }

◆ replaceAtFront() [1/2]

const Ptr<Chunk> inet::Packet::replaceAtFront ( const Ptr< const Chunk > &  chunk,
b  length = b(-1),
int  flags = 0 
)
inline

Replaces the designated part at the beginning of the data part of the packet with the provided chunk and returns the old part as a mutable chunk in the current representation.

If the length is unspecified, then the length of the replaced part is chosen according to the current representation. The inserted part is automatically marked immutable. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

803  {
804  return replaceAtFront<Chunk>(chunk, length, flags);
805  }

◆ replaceAtFront() [2/2]

template<typename T >
const Ptr<T> inet::Packet::replaceAtFront ( const Ptr< const Chunk > &  chunk,
b  length = b(-1),
int  flags = 0 
)
inline

Replaces the designated part at the beginning of the data part of the packet with the provided chunk and returns the old part as a mutable chunk in the requested representation.

If the length is unspecified, then the length of the replaced part is chosen according to the current representation. The inserted part is automatically marked immutable. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

871  {
873  CHUNK_CHECK_USAGE(b(-1) <= length && length <= getDataLength(), "length is invalid");
874  return replaceAt<T>(chunk, getFrontOffset(), length, flags);
875  }

◆ replaceData() [1/2]

const Ptr<Chunk> inet::Packet::replaceData ( const Ptr< const Chunk > &  chunk,
int  flags = 0 
)
inline

Replaces the data part of the packet with the provided chunk and returns the old content as a mutable chunk in the current representation.

The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

826  {
827  return replaceData<Chunk>(chunk, flags);
828  }

◆ replaceData() [2/2]

template<typename T >
const Ptr<T> inet::Packet::replaceData ( const Ptr< const Chunk > &  chunk,
int  flags = 0 
)
inline

Replaces the data part of the packet with the provided chunk and returns the old content as a mutable chunk in the requested representation.

The inserted part is automatically marked immutable. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

899  {
901  return replaceAt<T>(chunk, getFrontOffset(), getDataLength(), flags);
902  }

◆ replaceDataAt() [1/2]

const Ptr<Chunk> inet::Packet::replaceDataAt ( const Ptr< const Chunk > &  chunk,
b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Replaces the designated part of the data part of the packet with the provided chunk and returns the old content as a mutable chunk in the current representation.

The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

846  {
847  return replaceDataAt<Chunk>(chunk, offset, length, flags);
848  }

◆ replaceDataAt() [2/2]

template<typename T >
const Ptr<T> inet::Packet::replaceDataAt ( const Ptr< const Chunk > &  chunk,
b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Replaces the designated part of the data part of the packet with the provided chunk and returns the old content as a mutable chunk in the requested representation.

The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

924  {
926  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= getDataLength(), "offset is out of range");
927  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= getDataLength(), "length is invalid");
928  return replaceAt<T>(chunk, getFrontOffset() + offset, length, flags);
929  }

◆ setBackOffset()

◆ setBitLength()

virtual void inet::Packet::setBitLength ( int64_t  value)
inlineoverridevirtual
184 { throw cRuntimeError("Invalid operation"); }

◆ setControlInfo()

virtual void inet::Packet::setControlInfo ( cObject *  p)
inlineoverridevirtual
183 { throw cRuntimeError("Invalid operation"); }

Referenced by inet::SctpNatPeer::handleMessage().

◆ setFrontOffset()

◆ str()

std::string inet::Packet::str ( ) const
overridevirtual

Returns a human readable string representation.

323 {
324  std::stringstream stream;
325  stream << "(" << getDataLength() << ") " << content;
326  return stream.str();
327 }

Referenced by inet::CloudDelayerBase::datagramForwardHook(), and inet::EtherAppServer::socketDataArrived().

◆ trim()

◆ trimBack()

void inet::Packet::trimBack ( )

Erases the back popped part of the packet and sets the back offset to zero.

The front popped part and the data part of the packet isn't affected.

274 {
276  b length = backIterator.getPosition();
278  eraseAtBack(length);
279 }

Referenced by trim().

◆ trimFront()

void inet::Packet::trimFront ( )

◆ updateAll() [1/2]

void inet::Packet::updateAll ( std::function< void(const Ptr< Chunk > &)>  f,
int  flags = 0 
)
inline

Updates the designated part by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

1020  {
1022  updateAll<Chunk>(f, flags);
1023  }

◆ updateAll() [2/2]

template<typename T >
void inet::Packet::updateAll ( std::function< void(const Ptr< T > &)>  f,
int  flags = 0 
)
inline

Updates the designated part by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

1100  {
1102  updateAt<T>(f, b(0), totalLength, flags);
1103  }

◆ updateAt() [1/2]

void inet::Packet::updateAt ( std::function< void(const Ptr< Chunk > &)>  f,
b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Updates the designated part by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. If the length is unspecified, then the length of the part is chosen according to the current representation. The front and back offsets are updated according to the offset and length parameters. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

1046  {
1048  updateAt<Chunk>(f, offset, length, flags);
1049  }

◆ updateAt() [2/2]

template<typename T >
void inet::Packet::updateAt ( std::function< void(const Ptr< T > &)>  f,
b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Updates the designated part by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. If the length is unspecified, then the length of the part is chosen according to the current representation. The front and back offsets are updated according to the offset and length parameters. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

TODO current limitation: the chunk size cannot be changed

1132  {
1134  auto totalLength = getTotalLength();
1135  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= totalLength, "offset is out of range");
1136  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= totalLength, "length is invalid");
1137  const auto& chunk = peekAt<T>(offset, length, flags);
1138  b chunkLength = chunk->getChunkLength();
1139  b frontLength = offset;
1140  b backLength = totalLength - offset - chunkLength;
1141  const auto& mutableChunk = makeExclusivelyOwnedMutableChunk(chunk);
1142  f(mutableChunk);
1143  CHUNK_CHECK_USAGE(chunkLength == mutableChunk->getChunkLength(), "length is different");
1144  if (mutableChunk != chunk) {
1145  const auto& sequenceChunk = makeShared<SequenceChunk>();
1146  if (frontLength > b(0)) {
1147  const auto& frontPart = peekAt(b(0), frontLength);
1148  sequenceChunk->insertAtBack(frontPart);
1149  }
1150  mutableChunk->markImmutable();
1151  sequenceChunk->insertAtBack(mutableChunk);
1152  if (backLength > b(0)) {
1153  const auto& backPart = peekAt(totalLength - backLength, backLength);
1154  sequenceChunk->insertAtBack(backPart);
1155  }
1156  sequenceChunk->markImmutable();
1157  content = sequenceChunk;
1158  }
1159  }

◆ updateAtBack() [1/2]

void inet::Packet::updateAtBack ( std::function< void(const Ptr< Chunk > &)>  f,
b  length = b(-1),
int  flags = 0 
)
inline

Updates the designated part at the end of the data part of the packet by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. If the length is unspecified, then the length of the part is chosen according to the current representation. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

998  {
1000  updateAtBack<Chunk>(f, length, flags);
1001  }

◆ updateAtBack() [2/2]

template<typename T >
void inet::Packet::updateAtBack ( std::function< void(const Ptr< T > &)>  f,
b  length,
int  flags = 0 
)
inline

Updates the designated part at the end of the data part of the packet by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

1075  {
1077  CHUNK_CHECK_USAGE(b(0) <= length && length <= getDataLength(), "length is invalid");
1078  updateAt<T>(f, getBackOffset() - length, length, flags);
1079  }

◆ updateAtFront() [1/2]

void inet::Packet::updateAtFront ( std::function< void(const Ptr< Chunk > &)>  f,
b  length = b(-1),
int  flags = 0 
)
inline

Updates the designated part at the beginning of the data part of the packet by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. If the length is unspecified, then the length of the part is chosen according to the current representation. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

985  {
987  updateAtFront<Chunk>(f, length, flags);
988  }

◆ updateAtFront() [2/2]

template<typename T >
void inet::Packet::updateAtFront ( std::function< void(const Ptr< T > &)>  f,
b  length = b(-1),
int  flags = 0 
)
inline

Updates the designated part at the beginning of the data part of the packet by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. If the length is unspecified, then the length of the part is chosen according to the current representation. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

1061  {
1063  CHUNK_CHECK_USAGE(b(-1) <= length && length <= getDataLength(), "length is invalid");
1064  updateAt<T>(f, getFrontOffset(), length, flags);
1065  }

◆ updateData() [1/2]

void inet::Packet::updateData ( std::function< void(const Ptr< Chunk > &)>  f,
int  flags = 0 
)
inline

Updates the data part of the packet by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

1009  {
1011  updateData<Chunk>(f, flags);
1012  }

◆ updateData() [2/2]

template<typename T >
void inet::Packet::updateData ( std::function< void(const Ptr< T > &)>  f,
int  flags = 0 
)
inline

Updates the designated part by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

1088  {
1090  updateAt<T>(f, getFrontOffset(), getDataLength(), flags);
1091  }

◆ updateDataAt() [1/2]

void inet::Packet::updateDataAt ( std::function< void(const Ptr< Chunk > &)>  f,
b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Updates the designated part by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. If the length is unspecified, then the length of the part is chosen according to the current representation. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

1033  {
1035  updateDataAt<Chunk>(f, offset, length, flags);
1036  }

◆ updateDataAt() [2/2]

template<typename T >
void inet::Packet::updateDataAt ( std::function< void(const Ptr< T > &)>  f,
b  offset,
b  length = b(-1),
int  flags = 0 
)
inline

Updates the designated part by applying the provided function on the requested mutable representation.

The changes are reflected in the packet. If the length is unspecified, then the length of the part is chosen according to the current representation. The front and back offsets are not affected. The flags parameter is a combination of Chunk::PeekFlag enumeration members.

1114  {
1116  CHUNK_CHECK_USAGE(b(0) <= offset && offset <= getDataLength(), "offset is out of range");
1117  CHUNK_CHECK_USAGE(b(-1) <= length && offset + length <= getDataLength(), "length is invalid");
1118  updateAt<T>(f, getFrontOffset() + offset, length, flags);
1119  }

Friends And Related Function Documentation

◆ PacketDescriptor

friend class PacketDescriptor
friend

Member Data Documentation

◆ backIterator

Chunk::BackwardIterator inet::Packet::backIterator
protected

Position of the back separator measured from the back of the packet.

Referenced by eraseAt(), getBack(), insertAt(), parsimPack(), parsimUnpack(), setBackOffset(), setFrontOffset(), and trimBack().

◆ content

Ptr<const Chunk> inet::Packet::content
protected

This chunk is always immutable to allow arbitrary peeking.

Nevertheless it's reused if possible to allow efficient merging with newly added chunks.

Referenced by eraseAt(), forEachChild(), insertAt(), Packet(), parsimPack(), parsimUnpack(), printToStream(), setBackOffset(), setFrontOffset(), and str().

◆ frontIterator

Chunk::ForwardIterator inet::Packet::frontIterator
protected

Position of the front separator measured from the front of the packet.

Referenced by eraseAt(), insertAt(), parsimPack(), parsimUnpack(), setBackOffset(), setFrontOffset(), and trimFront().

◆ regionTags

SharingRegionTagSet inet::Packet::regionTags
protected

The set of tags attached to regions of the content of the packet.

Referenced by copyRegionTags(), forEachChild(), parsimPack(), and parsimUnpack().

◆ tags

SharingTagSet inet::Packet::tags
protected

The set of tags attached to the packet as whole.

Referenced by copyTags(), forEachChild(), parsimPack(), and parsimUnpack().

◆ totalLength

b inet::Packet::totalLength
protected

Cached total length of the packet including the popped frond and back parts.

Referenced by eraseAt(), insertAt(), and parsimUnpack().


The documentation for this class was generated from the following files:
inet::SharingTagSet::parsimUnpack
virtual void parsimUnpack(cCommBuffer *buffer) override
Definition: SharingTagSet.cc:86
inet::Packet::peekAt
const Ptr< const Chunk > peekAt(b offset, b length=b(-1), int flags=0) const
Returns the designated part of the packet as an immutable chunk in the current representation.
Definition: Packet.h:343
inet::units::units::T
compose< Wb, pow< m, -2 > > T
Definition: Units.h:951
inet::Packet::eraseDataAt
void eraseDataAt(b offset, b length)
Erases the designated part of the data part of the packet.
Definition: Packet.h:1209
inet::SharingRegionTagSet::mapAllTags
void mapAllTags(b offset, b length, std::function< void(b, b, const Ptr< const TagBase > &)> f) const
Definition: SharingRegionTagSet.cc:110
inet::SharingRegionTagSet::addTagsWhereAbsent
std::vector< SharingRegionTagSet::RegionTag< TagBase > > addTagsWhereAbsent(const std::type_info &typeInfo, b offset, b length, const Ptr< const TagBase > &tag)
Definition: SharingRegionTagSet.cc:63
CHUNK_CHECK_IMPLEMENTATION
#define CHUNK_CHECK_IMPLEMENTATION(condition)
Definition: Chunk.h:29
inet::SharingTagSet::copyTags
void copyTags(const SharingTagSet &other)
Copies the set of tags from the other set.
Definition: SharingTagSet.h:191
inet::SharingRegionTagSet::getAllTags
std::vector< RegionTag< T > > getAllTags(b offset, b length) const
Returns all the shared tags of the provided type and range.
Definition: SharingRegionTagSet.h:470
inet::ChunkTemporarySharedPtr
TemporarySharedPtr< Chunk > ChunkTemporarySharedPtr
Definition: Chunk.h:870
inet::Packet::getDataLength
b getDataLength() const
Returns the current length of the data part of the packet.
Definition: Packet.h:206
inet::Packet::regionTags
SharingRegionTagSet regionTags
The set of tags attached to regions of the content of the packet.
Definition: Packet.h:123
inet::IPrintableObject::PRINT_LEVEL_DETAIL
@ PRINT_LEVEL_DETAIL
Definition: IPrintableObject.h:24
inet::Chunk::Iterator::setIndex
void setIndex(int index)
Definition: Chunk.h:310
inet::SharingRegionTagSet::copyTags
void copyTags(const SharingRegionTagSet &source, b sourceOffset, b offset, b length)
Copies the set of tags from the source region to the provided region.
Definition: SharingRegionTagSet.cc:219
inet::SharingTagSet::findTag
const Ptr< const T > findTag() const
Returns the shared tag of the provided type, or returns nullptr if no such tag is present.
Definition: SharingTagSet.h:203
inet::SharingRegionTagSet::getNumTags
int getNumTags() const
Returns the number of tags.
Definition: SharingRegionTagSet.h:300
EV_FAINT
#define EV_FAINT
Definition: INETDefs.h:104
inet::makeExclusivelyOwnedMutableChunk
const Ptr< T > makeExclusivelyOwnedMutableChunk(const Ptr< const T > &chunk)
Definition: Chunk.h:860
inet::SharingRegionTagSet::removeTag
const Ptr< TagBase > removeTag(int index)
Definition: SharingRegionTagSet.cc:100
SELFDOC_FUNCTION_T
#define SELFDOC_FUNCTION_T
Definition: Packet.h:37
inet::Packet::content
Ptr< const Chunk > content
This chunk is always immutable to allow arbitrary peeking.
Definition: Packet.h:102
inet::Packet::frontIterator
Chunk::ForwardIterator frontIterator
Position of the front separator measured from the front of the packet.
Definition: Packet.h:106
SELFDOC_FUNCTION
#define SELFDOC_FUNCTION
Definition: Packet.h:35
SELFDOC_FUNCTION
#define SELFDOC_FUNCTION
Definition: Packet.cc:43
inet::Packet::insertAt
void insertAt(const Ptr< const Chunk > &chunk, b offset)
Inserts the provided chunk at the given offset of the packet.
Definition: Packet.cc:171
inet::Packet::isConsistent
bool isConsistent()
Definition: Packet.h:139
inet::Packet::tags
SharingTagSet tags
The set of tags attached to the packet as whole.
Definition: Packet.h:119
inet::Packet::eraseAt
void eraseAt(b offset, b length)
Erases the designated content of the packet.
Definition: Packet.cc:220
inet::SharingRegionTagSet::findTag
const Ptr< const T > findTag(b offset, b length) const
Returns the shared tag of the provided type and range, or returns nullptr if no such tag is found.
Definition: SharingRegionTagSet.h:354
inet::Packet::setFrontOffset
void setFrontOffset(b offset)
Changes the front offset measured from the beginning of the packet.
Definition: Packet.cc:153
inet::SharingRegionTagSet::addTagIfAbsent
const Ptr< T > addTagIfAbsent(b offset, b length)
Returns a newly added exclusively owned tag of the provided type and range if absent,...
Definition: SharingRegionTagSet.h:402
inet::Packet::peekDataAt
const Ptr< const Chunk > peekDataAt(b offset, b length=b(-1), int flags=0) const
Returns the designated data part as an immutable chunk in the current representation.
Definition: Packet.h:332
inet::SharingTagSet::parsimPack
virtual void parsimPack(cCommBuffer *buffer) const override
Definition: SharingTagSet.cc:78
inet::SharingTagSet::removeTag
const Ptr< TagBase > removeTag(int index)
Definition: SharingTagSet.cc:35
inet::Packet::isIteratorConsistent
bool isIteratorConsistent(const Chunk::Iterator &iterator)
Definition: Packet.h:150
inet::Packet::eraseData
void eraseData()
Erases the whole data part of the packet.
Definition: Packet.h:1190
inet::SharingTagSet::getTag
const Ptr< const TagBase > & getTag(int index) const
Returns the shared tag at the given index.
Definition: SharingTagSet.h:169
inet::SharingRegionTagSet::mapAllTagsForUpdate
void mapAllTagsForUpdate(b offset, b length, std::function< void(b, b, const Ptr< TagBase > &)> f)
Definition: SharingRegionTagSet.cc:137
inet::SharingRegionTagSet::getTag
const Ptr< const TagBase > & getTag(int index) const
Returns the shared tag at the given index.
Definition: SharingRegionTagSet.h:310
SELFDOC_FUNCTION_CHUNK
#define SELFDOC_FUNCTION_CHUNK(chunk)
Definition: Packet.h:36
inet::Packet::setBackOffset
void setBackOffset(b offset)
Changes the back offset measured from the beginning of the packet.
Definition: Packet.cc:161
inet::EmptyChunk::singleton
static const Ptr< EmptyChunk > singleton
Definition: EmptyChunk.h:23
CHUNK_CHECK_USAGE
#define CHUNK_CHECK_USAGE(condition, format,...)
Definition: Chunk.h:42
inet::Packet::getFrontOffset
b getFrontOffset() const
Returns the front offset measured from the beginning of the packet.
Definition: Packet.h:215
inet::Chunk::Iterator::getPosition
b getPosition() const
Definition: Chunk.h:306
inet::Packet::eraseAll
void eraseAll()
Erases all content from the packet and sets both front and back offsets to zero.
Definition: Packet.h:1199
inet::Packet::getBackOffset
b getBackOffset() const
Returns the back offset measured from the beginning of the packet.
Definition: Packet.h:227
inet::SharingTagSet::removeTagIfPresent
const Ptr< T > removeTagIfPresent()
Removes the tag of the provided type if present and returns it for update, or returns nullptr if no s...
Definition: SharingTagSet.h:275
inet::Packet::trimFront
void trimFront()
Erases the front popped part of the packet and sets the front offset to zero.
Definition: Packet.cc:265
inet::Packet::getTotalLength
b getTotalLength() const
Returns the total packet length ignoring front and back offsets.
Definition: Packet.h:193
kind
removed DscpReq kind
Definition: IUdp-gates.txt:12
inet::units::values::b
value< int64_t, units::b > b
Definition: Units.h:1241
inet::SharingTagSet::getTagForUpdate
const Ptr< TagBase > getTagForUpdate(int index)
Returns the exclusively owned tag at the given index for update.
Definition: SharingTagSet.h:174
inet::Chunk::Iterator::setPosition
void setPosition(b position)
Definition: Chunk.h:307
inet::Packet::peekData
const Ptr< const Chunk > peekData(int flags=0) const
Returns the whole data part (excluding front and back popped parts) in the current representation.
Definition: Packet.h:266
EV_ITALIC
#define EV_ITALIC
Definition: INETDefs.h:105
inet::SharingRegionTagSet::addTag
void addTag(b offset, b length, const Ptr< const TagBase > &tag)
Definition: SharingRegionTagSet.cc:56
EV_NORMAL
#define EV_NORMAL
Definition: INETDefs.h:102
inet::evFlags
int evFlags
Definition: INETDefs.cc:12
inet::SharingRegionTagSet::parsimUnpack
virtual void parsimUnpack(cCommBuffer *buffer) override
Definition: SharingRegionTagSet.cc:40
inet::SharingTagSet::addTag
void addTag(const Ptr< const TagBase > &tag)
Definition: SharingTagSet.cc:28
inet::Packet::totalLength
b totalLength
Cached total length of the packet including the popped frond and back parts.
Definition: Packet.h:114
inet::SharingRegionTagSet::getRegionTag
const RegionTag< TagBase > & getRegionTag(int index) const
Returns the shared region tag at the given index.
Definition: SharingRegionTagSet.h:320
inet::SharingRegionTagSet::clearTags
void clearTags(b offset, b length)
Clears the set of tags in the given region.
Definition: SharingRegionTagSet.cc:166
inet::SharingRegionTagSet::removeTagsWherePresent
std::vector< RegionTag< T > > removeTagsWherePresent(b offset, b length)
Removes and returns all tags of the provided type and range and returns them for update.
Definition: SharingRegionTagSet.h:492
inet::SharingTagSet::addTagIfAbsent
const Ptr< T > addTagIfAbsent()
Returns a newly added exclusively owned tag of the provided type if absent, or returns the exclusivel...
Definition: SharingTagSet.h:251
SELFDOC_FUNCTION_CHUNK
#define SELFDOC_FUNCTION_CHUNK(chunk)
Definition: Packet.cc:44
inet::units::value::get
const value_type & get() const
Definition: Units.h:108
inet::Chunk::PF_ALLOW_ALL
@ PF_ALLOW_ALL
Definition: Chunk.h:284
inet::SharingRegionTagSet::removeTagIfPresent
const Ptr< T > removeTagIfPresent(b offset, b length)
Removes the tag of the provided type and range if present and returns it for update,...
Definition: SharingRegionTagSet.h:438
inet::Chunk::Iterator::getIndex
int getIndex() const
Definition: Chunk.h:309
inet::Packet::Packet
Packet(const char *name=nullptr, short kind=0)
Definition: Packet.cc:47
inet::Packet::backIterator
Chunk::BackwardIterator backIterator
Position of the back separator measured from the back of the packet.
Definition: Packet.h:110
inet::ProtocolDissectorRegistry::globalRegistry
static ProtocolDissectorRegistry globalRegistry
Definition: ProtocolDissectorRegistry.h:21
inet::SharingRegionTagSet::getAllTagsForUpdate
std::vector< RegionTag< T > > getAllTagsForUpdate(b offset, b length)
Returns all the exclusively owned tags of the provided type and range for update.
Definition: SharingRegionTagSet.h:481
inet::Packet::eraseAtFront
void eraseAtFront(b length)
Erases the requested amount of data from the beginning of the data part of the packet.
Definition: Packet.h:1169
inet::Packet::eraseAtBack
void eraseAtBack(b length)
Erases the requested amount of data from the end of the data part of the packet.
Definition: Packet.h:1180
inet::SharingTagSet::clearTags
void clearTags()
Clears the set of tags.
Definition: SharingTagSet.h:183
copy
MIT License free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to copy
Definition: LICENSE.txt:8
inet::SharingRegionTagSet::parsimPack
virtual void parsimPack(cCommBuffer *buffer) const override
Definition: SharingRegionTagSet.cc:28
inet::SharingTagSet::getNumTags
int getNumTags() const
Returns the number of tags.
Definition: SharingTagSet.h:159
inet::Packet::trimBack
void trimBack()
Erases the back popped part of the packet and sets the back offset to zero.
Definition: Packet.cc:273
inet::SharingTagSet::findTagForUpdate
const Ptr< T > findTagForUpdate()
Returns the exclusively owned tag of the provided type for update, or returns nullptr if no such tag ...
Definition: SharingTagSet.h:211
inet::Packet::replaceAt
const Ptr< Chunk > replaceAt(const Ptr< const Chunk > &chunk, b offset, b length=b(-1), int flags=0)
Replaces the designated part of the packet with the provided chunk and returns the old content as a m...
Definition: Packet.h:857