20#include "ns3/assert.h"
21#include "ns3/callback.h"
22#include "ns3/mac48-address.h"
482 void Print(std::ostream& os)
const;
a polymophic address class
automatically resized byte buffer
Identifies a byte tag and a set of bytes within a packet to which the tag applies.
TypeId m_tid
the ns3::TypeId associated to this tag.
uint32_t m_start
the index of the first byte tagged by this tag.
uint32_t GetEnd() const
The index is an offset from the start of the packet.
TagBuffer m_buffer
the buffer associated with this tag.
Item(TypeId tid, uint32_t start, uint32_t end, TagBuffer buffer)
Constructor.
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
uint32_t GetStart() const
The index is an offset from the start of the packet.
uint32_t m_end
the index of the last byte tagged by this tag.
Iterator over the set of byte tags in a packet.
ByteTagIterator(ByteTagList::Iterator i)
Copy Constructor.
ByteTagList::Iterator m_current
actual position over the set of byte tags in a packet
An iterator for iterating through a byte tag list.
keep track of the byte tags stored in a packet.
void(* SizeTracedCallback)(uint32_t oldSize, uint32_t newSize)
TracedCallback signature for changes in packet size.
PacketTagIterator GetPacketTagIterator() const
Returns an object which can be used to iterate over the list of packet tags.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Buffer m_buffer
the packet buffer (it's actual contents)
static void EnableChecking()
Enable packets metadata checking.
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
void(* Mac48AddressTracedCallback)(Ptr< const Packet > packet, Mac48Address mac)
TracedCallback signature for packet and Mac48Address.
uint32_t RemoveTrailer(Trailer &trailer)
Remove a deserialized trailer from the internal buffer.
PacketMetadata::ItemIterator BeginItem() const
Returns an iterator which points to the first 'item' stored in this buffer.
void SetNixVector(Ptr< NixVector > nixVector) const
Set the packet nix-vector.
ByteTagList m_byteTagList
the ByteTag list
void(* AddressTracedCallback)(Ptr< const Packet > packet, const Address &address)
TracedCallback signature for packet and Address.
void(* TwoAddressTracedCallback)(const Ptr< const Packet > packet, const Address &srcAddress, const Address &destAddress)
TracedCallback signature for packet and source/destination addresses.
Ptr< NixVector > GetNixVector() const
Get the packet nix-vector.
void PrintByteTags(std::ostream &os) const
Iterate over the byte tags present in this packet, and invoke the Print method of each tag stored in ...
void(* SinrTracedCallback)(Ptr< const Packet > packet, double sinr)
TracedCallback signature for packet and SINR.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
static uint32_t m_globalUid
Global counter of packets Uid.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
void RemoveAtEnd(uint32_t size)
Remove size bytes from the end of the current packet.
uint32_t Deserialize(const uint8_t *buffer, uint32_t size)
Deserializes a packet.
uint32_t GetSerializedSize() const
Returns number of bytes required for packet serialization.
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
PacketTagList m_packetTagList
the packet's Tag list
Ptr< Packet > Copy() const
performs a COW copy of the packet.
void PrintPacketTags(std::ostream &os) const
Print the list of packet tags.
Packet & operator=(const Packet &o)
Basic assignment.
bool FindFirstMatchingByteTag(Tag &tag) const
Finds the first tag matching the parameter Tag type.
uint32_t Serialize(uint8_t *buffer, uint32_t maxSize) const
Serialize a packet, tags, and metadata into a byte buffer.
void RemoveAllByteTags()
Remove all byte tags stored in this packet.
Packet()
Create an empty packet with a new uid (as returned by getUid).
void AddPacketTag(const Tag &tag) const
Add a packet tag.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
void RemoveAllPacketTags()
Remove all packet tags.
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
uint32_t PeekTrailer(Trailer &trailer)
Deserialize but does not remove a trailer from the internal buffer.
void Print(std::ostream &os) const
Print the packet contents.
uint64_t GetUid() const
Returns the packet's Uid.
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
std::string ToString() const
Return a string representation of the packet.
static void EnablePrinting()
Enable printing packets metadata.
void AddTrailer(const Trailer &trailer)
Add trailer to this packet.
void AddPaddingAtEnd(uint32_t size)
Add a zero-filled padding to the packet.
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
ByteTagIterator GetByteTagIterator() const
Returns an iterator over the set of byte tags included in this packet.
PacketMetadata m_metadata
the packet's metadata
Ptr< NixVector > m_nixVector
the packet's Nix vector
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Identifies a packet tag within a packet.
Item(const PacketTagList::TagData *data)
Constructor.
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
const PacketTagList::TagData * m_data
the tag data
Iterator over the set of packet tags in a packet.
const PacketTagList::TagData * m_current
actual position over the set of tags in a packet
PacketTagIterator(const PacketTagList::TagData *head)
Constructor.
List of the packet tags stored in a packet.
Smart pointer class similar to boost::intrusive_ptr.
A template-based reference counting class.
tag a set of bytes in a packet
Forward calls to a chain of Callback.
Protocol trailer serialization and deserialization.
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Defines a linked list of Packet tags, including copy-on-write semantics.
Tree node for sharing serialized tags.