32 #include "ns3/mac48-address.h"
33 #include "ns3/callback.h"
34 #include "ns3/assert.h"
36 #include "ns3/deprecated.h"
79 uint32_t
GetEnd (
void)
const;
275 Packet (uint8_t
const*buffer, uint32_t size,
bool magic);
286 Packet (uint8_t
const*buffer, uint32_t size);
304 inline uint32_t
GetSize (
void)
const;
433 uint32_t
CopyData (uint8_t *buffer, uint32_t size)
const;
443 void CopyData (std::ostream *os, uint32_t size)
const;
475 uint64_t
GetUid (
void)
const;
487 void Print (std::ostream &os)
const;
555 uint32_t
Serialize (uint8_t* buffer, uint32_t maxSize)
const;
755 (uint32_t oldSize, uint32_t newSize);
784 uint32_t
Deserialize (uint8_t
const*buffer, uint32_t size);
a polymophic address class
automatically resized byte buffer
uint32_t GetSize(void) const
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(void) const
The index is an offset from the start of the packet.
TagBuffer m_buffer
the buffer associated with this tag.
TypeId GetTypeId(void) const
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(void) 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.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
void RemoveAllByteTags(void)
Remove all byte tags stored in this packet.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Buffer m_buffer
the packet buffer (it's actual contents)
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 Deserialize(uint8_t const *buffer, uint32_t size)
Deserializes a packet.
uint32_t RemoveTrailer(Trailer &trailer)
Remove a deserialized trailer from the internal 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.
Ptr< NixVector > GetNixVector(void) const
Get the packet nix-vector.
void(* TwoAddressTracedCallback)(const Ptr< const Packet > packet, const Address &srcAddress, const Address &destAddress)
TracedCallback signature for packet and source/destination addresses.
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.
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.
std::string ToString(void) const
Return a string representation of the packet.
void RemoveAllPacketTags(void)
Remove all packet tags.
PacketTagIterator GetPacketTagIterator(void) const
Returns an object which can be used to iterate over the list of packet tags.
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
PacketTagList m_packetTagList
the packet's Tag list
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.
ByteTagIterator GetByteTagIterator(void) const
Returns an iterator over the set of byte tags included in this packet.
uint64_t GetUid(void) const
Returns the packet's Uid.
static void EnableChecking(void)
Enable packets metadata checking.
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.
PacketMetadata::ItemIterator BeginItem(void) const
Returns an iterator which points to the first 'item' stored in this buffer.
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.
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
static void EnablePrinting(void)
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.
uint32_t GetSerializedSize(void) const
Returns number of bytes required for packet serialization.
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
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.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Identifies a packet tag within a packet.
const struct PacketTagList::TagData * m_data
the tag data
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
Item(const struct PacketTagList::TagData *data)
Constructor.
TypeId GetTypeId(void) const
Iterator over the set of packet tags in a packet.
const struct PacketTagList::TagData * m_current
actual position over the set of tags in a packet
PacketTagIterator(const struct PacketTagList::TagData *head)
Constructor.
List of the packet tags stored in a packet.
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.