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