network packets More...
#include "packet.h"
Public Types | |
typedef void(* | AddressTracedCallback) (Ptr< const Packet > packet, const Address &address) |
TracedCallback signature for packet and Address. More... | |
typedef void(* | Mac48AddressTracedCallback) (Ptr< const Packet > packet, Mac48Address mac) |
TracedCallback signature for packet and Mac48Address. More... | |
typedef void(* | SinrTracedCallback) (Ptr< const Packet > packet, double sinr) |
TracedCallback signature for packet and SINR. More... | |
typedef void(* | SizeTracedCallback) (uint32_t oldSize, uint32_t newSize) |
TracedCallback signature for changes in packet size. More... | |
typedef void(* | TracedCallback) (Ptr< const Packet > packet) |
TracedCallback signature for Ptr<Packet> More... | |
Public Member Functions | |
Packet () | |
Create an empty packet with a new uid (as returned by getUid). More... | |
Packet (const Packet &o) | |
Copy constructor. More... | |
Packet (uint32_t size) | |
Create a packet with a zero-filled payload. More... | |
Packet (uint8_t const *buffer, uint32_t size, bool magic) | |
Create a new packet from the serialized buffer. More... | |
Packet (uint8_t const *buffer, uint32_t size) | |
Create a packet with payload filled with the content of this buffer. More... | |
void | AddAtEnd (Ptr< const Packet > packet) |
Concatenate the input packet at the end of the current packet. More... | |
void | AddByteTag (const Tag &tag) const |
Tag each byte included in this packet with a new byte tag. More... | |
void | AddHeader (const Header &header) |
Add header to this packet. More... | |
void | AddPacketTag (const Tag &tag) const |
Add a packet tag. More... | |
void | AddPaddingAtEnd (uint32_t size) |
Add a zero-filled padding to the packet. More... | |
void | AddTrailer (const Trailer &trailer) |
Add trailer to this packet. More... | |
PacketMetadata::ItemIterator | BeginItem (void) const |
Returns an iterator which points to the first 'item' stored in this buffer. More... | |
Ptr< Packet > | Copy (void) const |
performs a COW copy of the packet. More... | |
uint32_t | CopyData (uint8_t *buffer, uint32_t size) const |
Copy the packet contents to a byte buffer. More... | |
void | CopyData (std::ostream *os, uint32_t size) const |
Copy the packet contents to an output stream. More... | |
Ptr< Packet > | CreateFragment (uint32_t start, uint32_t length) const |
Create a new packet which contains a fragment of the original packet. More... | |
bool | FindFirstMatchingByteTag (Tag &tag) const |
Finds the first tag matching the parameter Tag type. More... | |
ByteTagIterator | GetByteTagIterator (void) const |
Retiurns an iterator over the set of byte tags included in this packet. More... | |
Ptr< NixVector > | GetNixVector (void) const |
Get the packet nix-vector. More... | |
PacketTagIterator | GetPacketTagIterator (void) const |
Returns an object which can be used to iterate over the list of packet tags. More... | |
uint32_t | GetSerializedSize (void) const |
Returns number of bytes required for packet serialization. More... | |
uint32_t | GetSize (void) const |
Returns the the size in bytes of the packet (including the zero-filled initial payload). More... | |
uint64_t | GetUid (void) const |
Returns the packet's Uid. More... | |
Packet & | operator= (const Packet &o) |
Basic assignment. More... | |
uint32_t | PeekHeader (Header &header) const |
Deserialize but does not remove the header from the internal buffer. More... | |
bool | PeekPacketTag (Tag &tag) const |
Search a matching tag and call Tag::Deserialize if it is found. More... | |
uint32_t | PeekTrailer (Trailer &trailer) |
Deserialize but does not remove a trailer from the internal buffer. More... | |
void | Print (std::ostream &os) const |
Print the packet contents. More... | |
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 the packet. More... | |
void | PrintPacketTags (std::ostream &os) const |
Print the list of packet tags. More... | |
void | RemoveAllByteTags (void) |
Remove all byte tags stored in this packet. More... | |
void | RemoveAllPacketTags (void) |
Remove all packet tags. More... | |
void | RemoveAtEnd (uint32_t size) |
Remove size bytes from the end of the current packet. More... | |
void | RemoveAtStart (uint32_t size) |
Remove size bytes from the start of the current packet. More... | |
uint32_t | RemoveHeader (Header &header) |
Deserialize and remove the header from the internal buffer. More... | |
bool | RemovePacketTag (Tag &tag) |
Remove a packet tag. More... | |
uint32_t | RemoveTrailer (Trailer &trailer) |
Remove a deserialized trailer from the internal buffer. More... | |
bool | ReplacePacketTag (Tag &tag) |
Replace the value of a packet tag. More... | |
uint32_t | Serialize (uint8_t *buffer, uint32_t maxSize) const |
Serialize a packet, tags, and metadata into a byte buffer. More... | |
void | SetNixVector (Ptr< NixVector > nixVector) |
Set the packet nix-vector. More... | |
std::string | ToString (void) const |
Return a string representation of the packet. More... | |
![]() | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Static Public Member Functions | |
static void | EnableChecking (void) |
Enable packets metadata checking. More... | |
static void | EnablePrinting (void) |
Enable printing packets metadata. More... | |
![]() | |
static void | Cleanup (void) |
Noop. More... | |
Private Member Functions | |
Packet (const Buffer &buffer, const ByteTagList &byteTagList, const PacketTagList &packetTagList, const PacketMetadata &metadata) | |
Constructor. More... | |
uint32_t | Deserialize (uint8_t const *buffer, uint32_t size) |
Private Attributes | |
Buffer | m_buffer |
the packet buffer (it's actual contents) More... | |
ByteTagList | m_byteTagList |
the ByteTag list More... | |
PacketMetadata | m_metadata |
the packet's metadata More... | |
Ptr< NixVector > | m_nixVector |
the packet's Nix vector More... | |
PacketTagList | m_packetTagList |
the packet's Tag list More... | |
Static Private Attributes | |
static uint32_t | m_globalUid = 0 |
Global counter of packets Uid. More... | |
network packets
Each network packet contains a byte buffer, a set of byte tags, a set of packet tags, and metadata.
Implementing a new type of Header or Trailer for a new protocol is pretty easy and is a matter of creating a subclass of the ns3::Header or of the ns3::Trailer base class, and implementing the methods described in their respective API documentation.
Implementing a new type of Tag requires roughly the same amount of work and this work is described in the ns3::Tag API documentation.
The performance aspects copy-on-write semantics of the Packet API are discussed in Packet Performance
typedef void(* ns3::Packet::AddressTracedCallback) (Ptr< const Packet > packet, const Address &address) |
TracedCallback signature for packet and Address.
[in] | packet | The packet. |
[in] | address | The address. |
typedef void(* ns3::Packet::Mac48AddressTracedCallback) (Ptr< const Packet > packet, Mac48Address mac) |
TracedCallback signature for packet and Mac48Address.
[in] | packet | The packet. |
[in] | mac | The Mac48Address. |
TracedCallback signature for packet and SINR.
[in] | packet | The packet. |
[in] | sinr | The received SINR. |
typedef void(* ns3::Packet::SizeTracedCallback) (uint32_t oldSize, uint32_t newSize) |
TracedCallback signature for changes in packet size.
[in] | oldSize | The previous packet's size. |
[in] | newSize | The actual packet's size. |
TracedCallback signature for Ptr<Packet>
[in] | packet | The packet. |
ns3::Packet::Packet | ( | ) |
Create an empty packet with a new uid (as returned by getUid).
Definition at line 130 of file packet.cc.
References m_globalUid.
Referenced by CreateFragment().
ns3::Packet::Packet | ( | const Packet & | o | ) |
Copy constructor.
o | object to copy |
Definition at line 146 of file packet.cc.
References ns3::NixVector::Copy(), and m_nixVector.
ns3::Packet::Packet | ( | uint32_t | size | ) |
Create a packet with a zero-filled payload.
The memory necessary for the payload is not allocated: it will be allocated at any later point if you attempt to fragment this packet or to access the zero-filled bytes. The packet is allocated with a new uid (as returned by getUid).
size | the size of the zero-filled payload |
Definition at line 172 of file packet.cc.
References m_globalUid.
ns3::Packet::Packet | ( | uint8_t const * | buffer, |
uint32_t | size, | ||
bool | magic | ||
) |
Create a new packet from the serialized buffer.
This new packet is identical to the serialized packet contained in the buffer and is magically deserialized for you
buffer | the serialized packet to be created |
size | the size of the packet for deserialization |
magic | allows packet deserialization; asserts when set to false |
Definition at line 187 of file packet.cc.
References Deserialize(), and NS_ASSERT.
ns3::Packet::Packet | ( | uint8_t const * | buffer, |
uint32_t | size | ||
) |
Create a packet with payload filled with the content of this buffer.
The input data is copied: the input buffer is untouched.
buffer | the data to store in the packet. |
size | the size of the input buffer. |
Definition at line 198 of file packet.cc.
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), m_buffer, m_globalUid, and ns3::Buffer::Iterator::Write().
|
private |
Concatenate the input packet at the end of the current packet.
This does not alter the uid of either packet.
packet | packet to concatenate |
Definition at line 311 of file packet.cc.
References ns3::ByteTagList::Add(), ns3::ByteTagList::AddAtEnd(), ns3::PacketMetadata::AddAtEnd(), ns3::Buffer::AddAtEnd(), ns3::ByteTagList::AddAtStart(), ns3::ByteTagList::Adjust(), GetSize(), m_buffer, m_byteTagList, m_metadata, and NS_LOG_FUNCTION.
Referenced by ns3::OriginatorRxStatus::AccumulateLastFragment(), ns3::CsmaNetDevice::AddHeader(), ns3::MpduStandardAggregator::AddHeaderAndPad(), ns3::MpduStandardAggregator::Aggregate(), ns3::MsduStandardAggregator::Aggregate(), ns3::MpduStandardAggregator::AggregateVhtSingleMpdu(), benchByteTags(), benchFragment(), ns3::PendingData::CopyFromOffset(), ns3::TcpTxBuffer::CopyFromSequence(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::BaseStationNetDevice::DoReceive(), ns3::SubscriberStationNetDevice::DoReceive(), Ns3WimaxFragmentationTestCase::DoRun(), PacketMetadataTest::DoRun(), PacketTest::DoRun(), ns3::Ipv6ExtensionFragment::Fragments::GetPacket(), ns3::SixLowPanNetDevice::Fragments::GetPacket(), ns3::Ipv4L3Protocol::Fragments::GetPacket(), ns3::Ipv6ExtensionFragment::Fragments::GetPartialPacket(), ns3::Ipv4L3Protocol::Fragments::GetPartialPacket(), ns3::LteRlcUm::ReassembleAndDeliver(), ns3::LteRlcAm::ReassembleAndDeliver(), ns3::olsr::RoutingProtocol::SendQueuedMessages(), and ns3::Icmpv6L4Protocol::SendRedirection().
void ns3::Packet::AddByteTag | ( | const Tag & | tag | ) | const |
Tag each byte included in this packet with a new byte tag.
tag | the new tag to add to this packet |
Note that adding a tag is a const operation which is pretty un-intuitive. The rationale is that the content and behavior of a packet is not changed when a tag is added to a packet: any code which was not aware of the new tag is going to work just the same if the new tag is added. The real reason why adding a tag was made a const operation is to allow a trace sink which gets a packet to tag the packet, even if the packet is const (and most trace sources should use const packets because it would be totally evil to allow a trace sink to modify the content of a packet).
Definition at line 789 of file packet.cc.
References ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Tag::GetSerializedSize(), GetSize(), list, m_byteTagList, NS_LOG_FUNCTION, and ns3::Tag::Serialize().
Referenced by ns3::AnimationInterface::AddByteTag(), benchByteTags(), ns3::LteRlcTm::DoNotifyTxOpportunity(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::LteRlcSm::DoNotifyTxOpportunity(), PacketTest::DoRun(), ns3::LtePdcp::DoTransmitPdcpSdu(), ns3::DelayJitterEstimation::PrepareTx(), CollisionExperiment::SendA(), CollisionExperiment::SendB(), Ipv4FragmentationTest::SendClient(), Ipv6FragmentationTest::SendClient(), ns3::Ipv4FlowProbe::SendOutgoingLogger(), ns3::Ipv6FlowProbe::SendOutgoingLogger(), Sender::SendPacket(), and ns3::PyViz::TraceNetDevTxCommon().
void ns3::Packet::AddHeader | ( | const Header & | header | ) |
Add header to this packet.
This method invokes the Header::GetSerializedSize and Header::Serialize methods to reserve space in the buffer and request the header to serialize itself in the packet buffer.
header | a reference to the header to add to this packet. |
Definition at line 255 of file packet.cc.
References ns3::ByteTagList::AddAtStart(), ns3::Buffer::AddAtStart(), ns3::PacketMetadata::AddHeader(), ns3::ByteTagList::Adjust(), ns3::Buffer::Begin(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Header::GetSerializedSize(), m_buffer, m_byteTagList, m_metadata, NS_LOG_FUNCTION, and ns3::Header::Serialize().
Referenced by ns3::dsr::DsrRouting::AddAckReqHeader(), ns3::PointToPointNetDevice::AddHeader(), ns3::CsmaNetDevice::AddHeader(), ns3::MpduStandardAggregator::AddHeaderAndPad(), ns3::MpduStandardAggregator::Aggregate(), ns3::MsduStandardAggregator::Aggregate(), ns3::MacLow::AggregateToAmpdu(), ns3::MpduStandardAggregator::AggregateVhtSingleMpdu(), ns3::UanMacRc::Associate(), ns3::UanMacRc::AssociateTimeout(), benchA(), benchB(), benchC(), benchD(), benchFragment(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::SixLowPanNetDevice::CompressLowPanNhc(), ns3::SixLowPanNetDevice::CompressLowPanUdpNhc(), ns3::BaseStationNetDevice::CreateDcd(), ns3::BaseStationNetDevice::CreateDlMap(), ns3::SsServiceFlowManager::CreateDsaAck(), ns3::MeshWifiBeacon::CreatePacket(), ns3::BaseStationNetDevice::CreateUcd(), ns3::BaseStationNetDevice::CreateUlMap(), ns3::SixLowPanNetDevice::DecompressLowPanHc1(), ns3::SixLowPanNetDevice::DecompressLowPanIphc(), ns3::SixLowPanNetDevice::DecompressLowPanNhc(), ns3::SixLowPanNetDevice::DecompressLowPanUdpNhc(), ns3::WimaxMacQueue::Dequeue(), ns3::TcpGeneralErrorModel::DoCorrupt(), ns3::LteEnbRrcProtocolIdeal::DoEncodeHandoverCommand(), ns3::LteEnbRrcProtocolReal::DoEncodeHandoverCommand(), ns3::LteEnbRrcProtocolIdeal::DoEncodeHandoverPreparationInformation(), ns3::LteEnbRrcProtocolReal::DoEncodeHandoverPreparationInformation(), ns3::Ipv4L3Protocol::DoFragmentation(), ns3::SixLowPanNetDevice::DoFragmentation(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::BaseStationNetDevice::DoReceive(), DsaRequestTestCase::DoRun(), FlameHeaderTest::DoRun(), MeshHeaderTest::DoRun(), LrWpanPacketTestCase::DoRun(), Ns3WimaxCsParamTlvTestCase::DoRun(), MeshInformationElementVectorBist::DoRun(), EpsGtpuHeaderTestCase::DoRun(), OlsrMidTestCase::DoRun(), DsdvHeaderTestCase::DoRun(), EpcTftClassifierTestCase::DoRun(), ns3::RlcAmStatusPduTestCase::DoRun(), ns3::aodv::TypeHeaderTest::DoRun(), ns3::aodv::RreqHeaderTest::DoRun(), Ns3WimaxSfTlvTestCase::DoRun(), OlsrHelloTestCase::DoRun(), ns3::aodv::RrepHeaderTest::DoRun(), PeerLinkFrameStartTest::DoRun(), ns3::aodv::RrepAckHeaderTest::DoRun(), OlsrTcTestCase::DoRun(), ns3::aodv::RerrHeaderTest::DoRun(), OlsrHnaTestCase::DoRun(), RrcConnectionRequestTestCase::DoRun(), PacketTest::DoRun(), RrcConnectionSetupTestCase::DoRun(), RrcConnectionSetupCompleteTestCase::DoRun(), RrcConnectionReconfigurationCompleteTestCase::DoRun(), RrcConnectionReconfigurationTestCase::DoRun(), HandoverPreparationInfoTestCase::DoRun(), RrcConnectionReestablishmentRequestTestCase::DoRun(), RrcConnectionReestablishmentTestCase::DoRun(), RrcConnectionReestablishmentCompleteTestCase::DoRun(), RrcConnectionRejectTestCase::DoRun(), MeasurementReportTestCase::DoRun(), ns3::SixLowPanNetDevice::DoSend(), Ipv4RawSocketImplTest::DoSendData_IpHdr(), Ipv4HeaderTest::DoSendData_IpHdr_Dscp(), ns3::EpcX2::DoSendHandoverPreparationFailure(), ns3::EpcX2::DoSendHandoverRequest(), ns3::EpcX2::DoSendHandoverRequestAck(), ns3::EpcX2::DoSendLoadInformation(), ns3::LteUeRrcProtocolReal::DoSendMeasurementReport(), ns3::EpcX2::DoSendResourceStatusUpdate(), ns3::RipNg::DoSendRouteUpdate(), ns3::LteEnbRrcProtocolReal::DoSendRrcConnectionReconfiguration(), ns3::LteUeRrcProtocolReal::DoSendRrcConnectionReconfigurationCompleted(), ns3::LteEnbRrcProtocolReal::DoSendRrcConnectionReestablishment(), ns3::LteUeRrcProtocolReal::DoSendRrcConnectionReestablishmentComplete(), ns3::LteEnbRrcProtocolReal::DoSendRrcConnectionReestablishmentReject(), ns3::LteUeRrcProtocolReal::DoSendRrcConnectionReestablishmentRequest(), ns3::LteEnbRrcProtocolReal::DoSendRrcConnectionReject(), ns3::LteEnbRrcProtocolReal::DoSendRrcConnectionRelease(), ns3::LteUeRrcProtocolReal::DoSendRrcConnectionRequest(), ns3::LteEnbRrcProtocolReal::DoSendRrcConnectionSetup(), ns3::LteUeRrcProtocolReal::DoSendRrcConnectionSetupCompleted(), ns3::EpcX2::DoSendSnStatusTransfer(), ns3::EpcX2::DoSendUeContextRelease(), ns3::EpcX2::DoSendUeData(), ns3::LtePdcp::DoTransmitPdcpSdu(), ns3::UanMacRcGw::EndCycle(), ns3::UanMacAloha::Enqueue(), ns3::UanMacCw::Enqueue(), ns3::SubscriberStationNetDevice::Enqueue(), ns3::Icmpv6L4Protocol::ForgeEchoRequest(), ns3::Icmpv6L4Protocol::ForgeNA(), ns3::Icmpv6L4Protocol::ForgeNS(), ns3::Icmpv6L4Protocol::ForgeRS(), ns3::MacLow::ForwardDown(), ns3::dsr::DsrRouting::ForwardErrPacket(), ns3::dsr::DsrRouting::ForwardPacket(), ns3::dot11s::HwmpProtocolMac::ForwardPerr(), ns3::Ipv4RawSocketImpl::ForwardUp(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::Icmpv4L4Protocol::HandleEcho(), ns3::Ipv6ExtensionFragment::HandleFragmentsTimeout(), ns3::RipNg::HandleRequests(), ns3::Ipv6L3Protocol::IpForward(), ns3::Ipv4L3ProtocolDropSinkWithContext(), ns3::Ipv4L3ProtocolDropSinkWithoutContext(), ns3::Ipv6L3ProtocolDropSinkWithContext(), ns3::Ipv6L3ProtocolDropSinkWithoutContext(), ns3::Ipv6L3Protocol::LocalDeliver(), ns3::LrWpanMac::McpsDataRequest(), ns3::EdcaTxopN::MissedAck(), ns3::EdcaTxopN::MissedBlockAck(), ns3::EdcaTxopN::MissedCts(), ns3::dsr::DsrRouting::PacketNewRoute(), ns3::PcapSniffRxEvent(), ns3::PcapSniffTxEvent(), ns3::PcapSniffTxRxEvent(), ns3::WimaxMacQueue::Peek(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::NscTcpL4Protocol::Receive(), ns3::TapBridge::ReceiveFromBridgedDevice(), ns3::aodv::RoutingProtocol::RecvError(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::flame::FlameProtocol::RequestRoute(), ns3::UanMacRc::RtsTimeout(), ns3::dsr::DsrRouting::SalvagePacket(), ns3::BlockAckManager::ScheduleBlockAckReqIfNeeded(), ns3::UanMacRc::ScheduleData(), ns3::SsServiceFlowManager::ScheduleDsaReq(), ns3::BsServiceFlowManager::ScheduleDsaRsp(), ns3::BSLinkManager::ScheduleRngRspMessage(), ns3::UdpClient::Send(), EpsBearerTagUdpClient::Send(), ns3::V4Ping::Send(), ns3::WifiNetDevice::Send(), ns3::Radvd::Send(), ns3::UdpL4Protocol::Send(), ns3::WimaxNetDevice::Send(), ns3::Ipv4L3Protocol::Send(), ns3::dsr::DsrRouting::Send(), ns3::WaveNetDevice::Send(), ns3::dsr::DsrRouting::SendAck(), ns3::LrWpanMac::SendAck(), ns3::MacLow::SendAckAfterData(), ns3::EdcaTxopN::SendAddBaRequest(), ns3::RegularWifiMac::SendAddBaResponse(), ns3::ArpL3Protocol::SendArpReply(), ns3::ArpL3Protocol::SendArpRequest(), ns3::StaWifiMac::SendAssociationRequest(), ns3::ApWifiMac::SendAssocResp(), ns3::BandwidthManager::SendBandwidthRequest(), ns3::MacLow::SendBlockAckResponse(), ns3::MacLow::SendCtsAfterRts(), ns3::MacLow::SendCtsToSelf(), ns3::MacLow::SendDataAfterCts(), ns3::MacLow::SendDataPacket(), ns3::EdcaTxopN::SendDelbaFrame(), ns3::Icmpv4L4Protocol::SendDestUnreach(), ns3::Icmpv6L4Protocol::SendEchoReply(), ns3::dsr::DsrRouting::SendErrorRequest(), ns3::WifiNetDevice::SendFrom(), ns3::AlohaNoackNetDevice::SendFrom(), ns3::FdNetDevice::SendFrom(), ns3::WimaxNetDevice::SendFrom(), ns3::dsr::DsrRouting::SendGratuitousReply(), ns3::aodv::RoutingProtocol::SendHello(), WaveNetDeviceExample::SendIpPacket(), ns3::Icmpv4L4Protocol::SendMessage(), ns3::Icmpv6L4Protocol::SendMessage(), ns3::Icmpv6L4Protocol::SendNA(), ns3::Icmpv6L4Protocol::SendNS(), ns3::ApWifiMac::SendOneBeacon(), WaveNetDeviceExample::SendOneWsmpPacket(), ns3::UdpTraceClient::SendPacket(), ns3::olsr::RoutingProtocol::SendPacket(), ns3::dsr::DsrRouting::SendPacketFromBuffer(), ns3::TcpL4Protocol::SendPacketV4(), ns3::TcpL4Protocol::SendPacketV6(), ns3::dot11s::PeerManagementProtocolMac::SendPeerLinkManagementFrame(), ns3::dsdv::RoutingProtocol::SendPeriodicUpdate(), ns3::olsr::Bug780Test::SendPing(), ChainRegressionTest::SendPing(), ns3::dot11s::HwmpProtocolMac::SendPrep(), ns3::dot11s::HwmpProtocolMac::SendPreq(), ns3::StaWifiMac::SendProbeRequest(), ns3::ApWifiMac::SendProbeResp(), ns3::olsr::RoutingProtocol::SendQueuedMessages(), ns3::SSLinkManager::SendRangingRequest(), ns3::Ipv4L3Protocol::SendRealOut(), ns3::Ipv6L3Protocol::SendRealOut(), ns3::Icmpv6L4Protocol::SendRedirection(), ns3::aodv::RoutingProtocol::SendReply(), ns3::aodv::RoutingProtocol::SendReplyAck(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), ns3::aodv::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::SendRerrWhenBreaksLinkToNextHop(), ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::RipNg::SendRouteRequest(), ns3::Icmpv6L4Protocol::SendRS(), ns3::UanMacRc::SendRts(), ns3::MacLow::SendRtsForPacket(), ns3::Icmpv4L4Protocol::SendTimeExceededTtl(), ns3::Ipv6RawSocketImpl::SendTo(), ns3::EpcSgwPgwApplication::SendToS1uSocket(), ns3::EpcEnbApplication::SendToS1uSocket(), ns3::dsdv::RoutingProtocol::SendTriggeredUpdate(), ns3::dsr::DsrRouting::SendUnreachError(), ns3::OcbWifiMac::SendVsc(), ns3::WaveNetDevice::SendX(), ns3::UanMacRcGw::StartCycle(), ns3::PyViz::TraceIpv4Drop(), and ns3::dot11s::HwmpProtocolMac::UpdateOutcomingFrame().
void ns3::Packet::AddPacketTag | ( | const Tag & | tag | ) | const |
Add a packet tag.
tag | the packet tag type to add. |
Note that this method is const, that is, it does not modify the state of this packet, which is fairly un-intuitive. See AddByteTag"()" discussion.
Definition at line 822 of file packet.cc.
References ns3::PacketTagList::Add(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Tag::GetSerializedSize(), m_packetTagList, and NS_LOG_FUNCTION.
Referenced by ns3::MacLow::AggregateToAmpdu(), benchD(), ns3::CoDelQueue::DoEnqueue(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::UeManager::DoReceivePdcpSdu(), PacketTest::DoRun(), ns3::RipNg::DoSendRouteUpdate(), ns3::UdpSocketImpl::DoSendTo(), ns3::VsaManager::DoSendVsa(), ns3::LteRlcUm::DoTransmitPdcpPdu(), ns3::LteRlcTm::DoTransmitPdcpPdu(), ns3::LteRlcAm::DoTransmitPdcpPdu(), ns3::LteUeMac::DoTransmitPdu(), ns3::LteEnbMac::DoTransmitPdu(), ns3::MacLow::ForwardDown(), ns3::dot11s::HwmpProtocol::ForwardUnicast(), ns3::Ipv4RawSocketImpl::ForwardUp(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::UdpSocketImpl::ForwardUp(), ns3::PacketSocket::ForwardUp(), ns3::UdpSocketImpl::ForwardUp6(), ns3::RipNg::HandleRequests(), ns3::WifiRemoteStationManager::PrepareForQueue(), ns3::dot11s::HwmpProtocol::ProactivePathResolved(), ns3::dsr::DsrOptionRreq::Process(), ns3::dot11s::HwmpProtocol::ReactivePathResolved(), ns3::NscTcpSocketImpl::ReadPendingData(), ns3::flame::FlameProtocolMac::Receive(), ns3::MeshWifiInterfaceMac::Receive(), ns3::dot11s::HwmpProtocolMac::ReceiveData(), ns3::TcpSocketBase::Recv(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::aodv::RoutingProtocol::RouteOutput(), ns3::dsdv::RoutingProtocol::RouteOutput(), ns3::dsr::DsrRouting::RouteRequestTimerExpire(), EpsBearerTagUdpClient::Send(), ns3::Radvd::Send(), ns3::WaveNetDevice::Send(), ns3::MacLow::SendAckAfterData(), Ipv4FragmentationTest::SendClient(), Ipv6FragmentationTest::SendClient(), ns3::MacLow::SendCtsAfterRts(), ns3::TcpSocketBase::SendDataPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), ns3::TcpSocketBase::SendEmptyPacket(), ns3::dsr::DsrRouting::SendErrorRequest(), ns3::SimpleNetDevice::SendFrom(), ns3::dsr::DsrRouting::SendInitialRequest(), ns3::Icmpv6L4Protocol::SendMessage(), ns3::RipNg::SendRouteRequest(), ns3::UdpSocketImpl::SendTo(), ns3::EpcEnbApplication::SendToLteSocket(), and ns3::WaveNetDevice::SendX().
void ns3::Packet::AddPaddingAtEnd | ( | uint32_t | size | ) |
Add a zero-filled padding to the packet.
size | number of padding bytes to add. |
Definition at line 323 of file packet.cc.
References ns3::ByteTagList::AddAtEnd(), ns3::Buffer::AddAtEnd(), ns3::PacketMetadata::AddPaddingAtEnd(), GetSize(), m_buffer, m_byteTagList, m_metadata, and NS_LOG_FUNCTION.
Referenced by PacketTest::DoRun(), and SendStuff().
void ns3::Packet::AddTrailer | ( | const Trailer & | trailer | ) |
Add trailer to this packet.
This method invokes the Trailer::GetSerializedSize and Trailer::Serialize methods to reserve space in the buffer and request the trailer to serialize itself in the packet buffer.
trailer | a reference to the trailer to add to this packet. |
Definition at line 283 of file packet.cc.
References ns3::ByteTagList::AddAtEnd(), ns3::Buffer::AddAtEnd(), ns3::PacketMetadata::AddTrailer(), ns3::Buffer::End(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Trailer::GetSerializedSize(), GetSize(), m_buffer, m_byteTagList, m_metadata, NS_LOG_FUNCTION, and ns3::Trailer::Serialize().
Referenced by ns3::CsmaNetDevice::AddHeader(), ns3::MacLow::AggregateToAmpdu(), LrWpanPacketTestCase::DoRun(), PacketTest::DoRun(), ns3::MacLow::ForwardDown(), ns3::LrWpanMac::McpsDataRequest(), ns3::LrWpanMac::SendAck(), ns3::MacLow::SendAckAfterData(), ns3::MacLow::SendBlockAckResponse(), ns3::MacLow::SendCtsAfterRts(), ns3::MacLow::SendCtsToSelf(), ns3::MacLow::SendDataAfterCts(), ns3::MacLow::SendDataPacket(), and ns3::MacLow::SendRtsForPacket().
PacketMetadata::ItemIterator ns3::Packet::BeginItem | ( | void | ) | const |
Returns an iterator which points to the first 'item' stored in this buffer.
Note that this iterator will point to an empty array of items if you don't call EnablePrinting or EnableChecking before.
Definition at line 527 of file packet.cc.
References ns3::PacketMetadata::BeginItem(), m_buffer, and m_metadata.
Referenced by PacketMetadataTest::CheckHistory(), and ns3::PyViz::FilterPacket().
performs a COW copy of the packet.
The returns packet will behave like an independent copy of the original packet, even though they both share the same datasets internally.
Definition at line 122 of file packet.cc.
References ns3::PacketTagIterator::Packet.
Referenced by ns3::dsr::DsrRouting::AddAckReqHeader(), ns3::MpduStandardAggregator::Aggregate(), ns3::MsduStandardAggregator::Aggregate(), ns3::MacLow::AggregateToAmpdu(), ns3::MpduStandardAggregator::AggregateVhtSingleMpdu(), benchA(), benchD(), ns3::dsr::DsrRouting::CancelPacketTimerNextHop(), ns3::dsr::DsrRouting::CancelPassiveTimer(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::IpcsClassifier::Classify(), ns3::EpcTftClassifier::Classify(), ns3::PacketBurst::Copy(), ns3::WimaxMacQueue::Dequeue(), ns3::Ipv4L3Protocol::DoFragmentation(), ns3::SixLowPanNetDevice::DoFragmentation(), ns3::LteRlcTm::DoNotifyTxOpportunity(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::BaseStationNetDevice::DoReceive(), ns3::LteUeMac::DoReceiveLteControlMessage(), ns3::VsaManager::DoRepeat(), TwoLevelAggregationTest::DoRun(), PacketTest::DoRun(), ns3::LteEnbMac::DoSchedDlConfigInd(), ns3::MeshPointDevice::DoSend(), ns3::SixLowPanNetDevice::DoSend(), ns3::UdpSocketImpl::DoSendTo(), ns3::Icmpv6L4Protocol::ForgeEchoRequest(), ns3::BridgeNetDevice::ForwardBroadcast(), ns3::MeshWifiInterfaceMac::ForwardDown(), ns3::MacLow::ForwardDown(), ns3::dsr::DsrRouting::ForwardPacket(), ns3::BridgeNetDevice::ForwardUnicast(), ns3::Ipv4RawSocketImpl::ForwardUp(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::PacketSocket::ForwardUp(), ns3::FdNetDevice::ForwardUp(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::BlockAckManager::GetNextPacket(), ns3::Ipv6ExtensionFragment::Fragments::GetPacket(), ns3::Ipv6ExtensionFragment::Fragments::GetPartialPacket(), ns3::EdcaTxopN::GotAck(), ns3::HalfDuplexIdealPhySignalParameters::HalfDuplexIdealPhySignalParameters(), ns3::Icmpv6L4Protocol::HandleDestinationUnreachable(), ns3::Ipv6ExtensionFragment::HandleFragmentsTimeout(), ns3::Icmpv6L4Protocol::HandlePacketTooBig(), ns3::Icmpv6L4Protocol::HandleParameterError(), ns3::Icmpv6L4Protocol::HandleRA(), Ipv4FragmentationTest::HandleReadClient(), SixlowpanFragmentationTest::HandleReadClient(), Ipv6FragmentationTest::HandleReadClient(), Ipv4FragmentationTest::HandleReadServer(), SixlowpanFragmentationTest::HandleReadServer(), Ipv6FragmentationTest::HandleReadServer(), ns3::Icmpv6L4Protocol::HandleRedirection(), ns3::Icmpv6L4Protocol::HandleTimeExceeded(), ns3::Ipv4L3Protocol::IpForward(), ns3::Ipv6L3Protocol::IpForward(), ns3::Ipv4L3Protocol::IpMulticastForward(), ns3::Ipv6L3Protocol::IpMulticastForward(), ns3::Ipv4L3ProtocolDropSinkWithContext(), ns3::Ipv4L3ProtocolDropSinkWithoutContext(), Ns3TcpStateTestCase::Ipv4L3Tx(), Ns3TcpLossTestCase::Ipv4L3Tx(), Ns3TcpInteroperabilityTestCase::Ipv4L3Tx(), ns3::Ipv6L3ProtocolDropSinkWithContext(), ns3::Ipv6L3ProtocolDropSinkWithoutContext(), ns3::dsr::DsrRouting::LinkScheduleTimerExpire(), ns3::Ipv4L3Protocol::LocalDeliver(), ns3::Ipv6L3Protocol::LocalDeliver(), ns3::dsr::DsrRouting::NetworkScheduleTimerExpire(), ns3::dsr::DsrRouting::NotifyDataReceipt(), ns3::AlohaNoackNetDevice::NotifyReceptionEndOk(), ns3::dsr::DsrRouting::PacketNewRoute(), ns3::dsr::DsrRouting::PassiveEntryCheck(), ns3::dsr::DsrRouting::PassiveScheduleTimerExpire(), ns3::PcapSniffRxEvent(), ns3::PcapSniffTxEvent(), ns3::PcapSniffTxRxEvent(), ns3::LrWpanMac::PdDataIndication(), ns3::WimaxMacQueue::Peek(), ns3::BlockAckManager::PeekNextPacket(), ns3::Ipv6OptionPad1::Process(), ns3::Ipv6OptionPadn::Process(), ns3::Ipv6ExtensionHopByHop::Process(), ns3::Ipv6OptionJumbogram::Process(), ns3::Ipv6ExtensionDestination::Process(), ns3::Ipv6OptionRouterAlert::Process(), ns3::Ipv6ExtensionFragment::Process(), ns3::dsr::DsrOptionPad1::Process(), ns3::dsr::DsrOptionPadn::Process(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::dsr::DsrOptionAckReq::Process(), ns3::dsr::DsrOptionAck::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::Ipv4L3Protocol::ProcessFragment(), ns3::SixLowPanNetDevice::ProcessFragment(), ns3::Ipv6Extension::ProcessOptions(), ns3::dsr::DsrRouting::PromiscReceive(), ns3::dot11s::PeerManagementProtocolMac::Receive(), ns3::ArpL3Protocol::Receive(), ns3::ApWifiMac::Receive(), ns3::PointToPointNetDevice::Receive(), ns3::CsmaNetDevice::Receive(), ns3::LteTestMac::Receive(), ns3::Ipv6L3Protocol::Receive(), ns3::UdpL4Protocol::Receive(), ns3::Ipv4L3Protocol::Receive(), ns3::Icmpv6L4Protocol::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::TapBridge::ReceiveFromBridgedDevice(), ns3::MeshPointDevice::ReceiveFromDevice(), ns3::SixLowPanNetDevice::ReceiveFromDevice(), ns3::EpcSgwPgwApplication::RecvFromTunDevice(), ns3::LrWpanMac::RemoveFirstTxQElement(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::dsdv::RoutingProtocol::RouteInput(), ns3::Ipv4ListRouting::RouteInput(), ns3::Ipv6ListRouting::RouteInput(), ns3::dsr::DsrRouting::RouteRequestTimerExpire(), ns3::dsr::DsrRouting::SalvagePacket(), ns3::UanMacRc::ScheduleData(), ns3::dsr::DsrRouting::ScheduleLinkPacketRetry(), ns3::dsr::DsrRouting::ScheduleNetworkPacketRetry(), ns3::dsr::DsrRouting::SchedulePassivePacketRetry(), ns3::ErrorChannel::Send(), ns3::ErrorChannelSixlow::Send(), ns3::SimpleChannel::Send(), ns3::YansWifiChannel::Send(), ns3::dsdv::RoutingProtocol::Send(), ns3::Ipv4L3Protocol::Send(), ns3::dsr::DsrRouting::Send(), ns3::Icmpv6L4Protocol::SendEchoReply(), ns3::dsr::DsrRouting::SendErrorRequest(), ns3::BridgeNetDevice::SendFrom(), ns3::SimpleNetDevice::SendFrom(), ns3::dsr::DsrRouting::SendInitialRequest(), ns3::dsr::DsrRouting::SendPacketFromBuffer(), ns3::dsr::DsrRouting::SendRealDown(), ns3::aodv::RoutingProtocol::SendRerrMessage(), ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::dsr::DsrRouting::SendUnreachError(), ns3::VsaManager::SendVsa(), ns3::MacLow::StartTransmission(), ns3::PyViz::TraceDevQueueDrop(), ns3::PyViz::TraceIpv4Drop(), ns3::PyViz::TraceNetDevRxCommon(), ns3::PyViz::TraceNetDevTxCommon(), ns3::CsmaChannel::TransmitEnd(), and ns3::UanChannel::TxPacket().
uint32_t ns3::Packet::CopyData | ( | uint8_t * | buffer, |
uint32_t | size | ||
) | const |
Copy the packet contents to a byte buffer.
buffer | a pointer to a byte buffer where the packet data should be copied. |
size | the size of the byte buffer. |
No more than size bytes will be copied by this function.
Definition at line 354 of file packet.cc.
References ns3::Buffer::CopyData(), and m_buffer.
Referenced by ns3::dsr::DsrRouting::AddAckReqHeader(), ns3::EthernetTrailer::CalcFcs(), ns3::dsr::DsrRouting::CancelPacketTimerNextHop(), ns3::EthernetTrailer::CheckFcs(), ns3::LrWpanMacTrailer::CheckFcs(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::Ipv4FlowClassifier::Classify(), ns3::Ipv6FlowClassifier::Classify(), ns3::SimpleOfdmWimaxPhy::ConvertBurstToBits(), ns3::SixLowPanNetDevice::DecompressLowPanIphc(), ns3::SixLowPanNetDevice::DecompressLowPanNhc(), ns3::LteTestPdcp::DoReceivePdcpPdu(), SixlowpanHc1ImplTest::DoRun(), SixlowpanIphcImplTest::DoRun(), Ipv4FragmentationTest::DoRun(), SixlowpanFragmentationTest::DoRun(), Ipv6FragmentationTest::DoRun(), PacketTest::DoRun(), ns3::dsr::DsrOptionRerr::DoSendError(), ns3::LteTestMac::DoTransmitPdu(), ns3::Ipv6ExtensionFragment::GetFragments(), GetString(), ns3::Icmpv6L4Protocol::HandleDestinationUnreachable(), ns3::Icmpv6L4Protocol::HandleEchoRequest(), ns3::Icmpv6L4Protocol::HandleNA(), ns3::Icmpv6L4Protocol::HandleNS(), ns3::Icmpv6L4Protocol::HandlePacketTooBig(), ns3::Icmpv6L4Protocol::HandleParameterError(), ns3::Icmpv6L4Protocol::HandleRA(), ns3::Ping6::HandleRead(), ns3::Radvd::HandleRead(), ns3::Icmpv6L4Protocol::HandleRedirection(), ns3::Icmpv6L4Protocol::HandleRS(), ns3::Icmpv6L4Protocol::HandleTimeExceeded(), Ns3TcpLossTestCase::Ipv4L3Tx(), Ns3TcpStateTestCase::Ipv4L3Tx(), Ns3TcpInteroperabilityTestCase::Ipv4L3Tx(), ns3::Ipv6L3Protocol::LocalDeliver(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::dsr::DsrRouting::PromiscReceive(), ns3::NscTcpL4Protocol::Receive(), ChannelAccessTestCase::Receive(), ns3::dsr::DsrRouting::Receive(), AnnexC_TestCase::Receive(), ns3::TapBridge::ReceiveFromBridgedDevice(), ns3::SixLowPanNetDevice::ReceiveFromDevice(), ns3::Socket::Recv(), ns3::Socket::RecvFrom(), ns3::dsr::DsrRouting::SalvagePacket(), ns3::FdNetDevice::SendFrom(), ns3::dsr::DsrRouting::SendPacketFromBuffer(), ns3::Ipv6RawSocketImpl::SendTo(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6TooBig::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), ns3::Icmpv6ParameterError::Serialize(), ns3::Icmpv6OptionRedirected::Serialize(), ns3::Icmpv4Echo::SetData(), ns3::Icmpv4DestinationUnreachable::SetData(), ns3::Icmpv4TimeExceeded::SetData(), ns3::LrWpanMacTrailer::SetFcs(), TestUtils::sprintPacketContentsBin(), ns3::TestUtils::sprintPacketContentsBin(), TestUtils::sprintPacketContentsHex(), ns3::TestUtils::sprintPacketContentsHex(), and ns3::PcapFile::Write().
void ns3::Packet::CopyData | ( | std::ostream * | os, |
uint32_t | size | ||
) | const |
Copy the packet contents to an output stream.
os | pointer to output stream in which we want to write the packet data. |
size | the maximum number of bytes we want to write in the output stream. |
Definition at line 360 of file packet.cc.
References ns3::Buffer::CopyData(), and m_buffer.
Create a new packet which contains a fragment of the original packet.
The returned packet shares the same uid as this packet.
start | offset from start of packet to start of fragment to create |
length | length of fragment to create |
Definition at line 228 of file packet.cc.
References ns3::ByteTagList::Adjust(), ns3::PacketMetadata::CreateFragment(), ns3::Buffer::CreateFragment(), ns3::Buffer::GetSize(), m_buffer, m_byteTagList, m_metadata, m_packetTagList, NS_ASSERT, NS_LOG_FUNCTION, and Packet().
Referenced by ns3::TcpRxBuffer::Add(), benchFragment(), ns3::PendingData::CopyFromOffset(), ns3::TcpTxBuffer::CopyFromSequence(), ns3::MsduAggregator::Deaggregate(), ns3::MpduAggregator::Deaggregate(), ns3::WimaxMacQueue::Dequeue(), ns3::Ipv4L3Protocol::DoFragmentation(), ns3::SixLowPanNetDevice::DoFragmentation(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), PacketMetadataTest::DoRun(), PacketTest::DoRun(), ns3::DcaTxop::GetFragmentPacket(), ns3::EdcaTxopN::GetFragmentPacket(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::PcapSniffRxEvent(), ns3::PcapSniffTxEvent(), ns3::LteRlcUm::ReassembleAndDeliver(), ns3::LteRlcAm::ReassembleAndDeliver(), ns3::Ipv4RawSocketImpl::RecvFrom(), ns3::Ipv6RawSocketImpl::RecvFrom(), ns3::Icmpv6L4Protocol::SendErrorDestinationUnreachable(), ns3::Icmpv6L4Protocol::SendErrorParameterError(), ns3::Icmpv6L4Protocol::SendErrorTimeExceeded(), ns3::Icmpv6L4Protocol::SendErrorTooBig(), and ns3::Icmpv6L4Protocol::SendRedirection().
|
private |
Definition at line 707 of file packet.cc.
References ns3::NixVector::Deserialize(), ns3::PacketMetadata::Deserialize(), ns3::Buffer::Deserialize(), m_buffer, m_metadata, m_nixVector, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by Packet().
|
static |
Enable packets metadata checking.
The packet metadata is also used to perform extensive sanity checks at runtime when performing operations on a Packet. For example, this metadata is used to verify that when you remove a header from a packet, this same header was actually present at the front of the packet. These errors will be detected and will abort the program.
Definition at line 540 of file packet.cc.
References ns3::PacketMetadata::EnableChecking(), and NS_LOG_FUNCTION_NOARGS.
|
static |
Enable printing packets metadata.
By default, packets do not keep around enough metadata to perform the operations requested by the Print methods. If you want to be able the Packet::Print method, you need to invoke this method at least once during the simulation setup and before any packet is created.
Definition at line 533 of file packet.cc.
References ns3::PacketMetadata::Enable(), and NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::TcpGeneralTest::DoRun(), ns3::UanHelper::EnableAscii(), ns3::YansWavePhyHelper::EnableAsciiInternal(), ns3::FdNetDeviceHelper::EnableAsciiInternal(), ns3::PointToPointHelper::EnableAsciiInternal(), ns3::LrWpanHelper::EnableAsciiInternal(), ns3::CsmaHelper::EnableAsciiInternal(), ns3::YansWifiPhyHelper::EnableAsciiInternal(), ns3::WimaxHelper::EnableAsciiInternal(), ns3::InternetStackHelper::EnableAsciiIpv4Internal(), ns3::InternetStackHelper::EnableAsciiIpv6Internal(), and ns3::AnimationInterface::EnablePacketMetadata().
bool ns3::Packet::FindFirstMatchingByteTag | ( | Tag & | tag | ) | const |
Finds the first tag matching the parameter Tag type.
tag | the byte tag type to search in this packet |
If the requested tag type is found, it is copied in the user's provided tag instance.
Definition at line 805 of file packet.cc.
References GetByteTagIterator(), ns3::ObjectBase::GetInstanceTypeId(), ns3::ByteTagIterator::Item::GetTag(), ns3::ByteTagIterator::Item::GetTypeId(), ns3::ByteTagIterator::HasNext(), and ns3::ByteTagIterator::Next().
Referenced by ns3::LteRlcTm::DoReceivePdu(), ns3::LteRlcUm::DoReceivePdu(), ns3::LteRlcAm::DoReceivePdu(), ns3::LtePdcp::DoReceivePdu(), ns3::LteRlcSm::DoReceivePdu(), ns3::Ipv4FlowProbe::DropLogger(), ns3::Ipv6FlowProbe::DropLogger(), ns3::Ipv4FlowProbe::ForwardLogger(), ns3::Ipv6FlowProbe::ForwardLogger(), ns3::Ipv4FlowProbe::ForwardUpLogger(), ns3::Ipv6FlowProbe::ForwardUpLogger(), ns3::Ipv4FlowProbe::QueueDropLogger(), ns3::Ipv6FlowProbe::QueueDropLogger(), Receiver::Receive(), CollisionExperiment::Receive(), ns3::DelayJitterEstimation::RecordRx(), and ns3::PyViz::TraceNetDevRxCommon().
ByteTagIterator ns3::Packet::GetByteTagIterator | ( | void | ) | const |
Retiurns an iterator over the set of byte tags included in this packet.
Definition at line 799 of file packet.cc.
References ns3::ByteTagList::Begin(), GetSize(), and m_byteTagList.
Referenced by PacketTest::DoCheck(), Ipv4FragmentationTest::DoRun(), Ipv6FragmentationTest::DoRun(), FindFirstMatchingByteTag(), ns3::AnimationInterface::GetAnimUidFromPacket(), and PrintByteTags().
Get the packet nix-vector.
See the comment on SetNixVector
Definition at line 249 of file packet.cc.
References m_nixVector.
Referenced by ns3::Ipv4NixVectorRouting::RouteInput().
PacketTagIterator ns3::Packet::GetPacketTagIterator | ( | void | ) | const |
Returns an object which can be used to iterate over the list of packet tags.
Definition at line 880 of file packet.cc.
References ns3::PacketTagList::Head(), and m_packetTagList.
Referenced by PrintPacketTags().
uint32_t ns3::Packet::GetSerializedSize | ( | void | ) | const |
Returns number of bytes required for packet serialization.
For packet serialization, the total size is checked in order to determine the size of the buffer required for serialization
Definition at line 546 of file packet.cc.
References ns3::NixVector::GetSerializedSize(), ns3::PacketMetadata::GetSerializedSize(), ns3::Buffer::GetSerializedSize(), m_buffer, m_metadata, and m_nixVector.
Referenced by LrWpanPacketTestCase::DoRun(), ns3::GrantedTimeWindowMpiInterface::SendPacket(), and ns3::NullMessageMpiInterface::SendPacket().
|
inline |
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition at line 786 of file packet.h.
References ns3::Buffer::GetSize(), and m_buffer.
Referenced by ns3::PendingData::Add(), ns3::TcpTxBuffer::Add(), ns3::TcpRxBuffer::Add(), AddAtEnd(), AddByteTag(), ns3::SixLowPanNetDevice::Fragments::AddFragment(), ns3::CsmaNetDevice::AddHeader(), ns3::MpduStandardAggregator::AddHeaderAndPad(), AddPaddingAtEnd(), AddTrailer(), ns3::MpduStandardAggregator::Aggregate(), ns3::MsduStandardAggregator::Aggregate(), ns3::MacLow::AggregateToAmpdu(), ns3::MpduStandardAggregator::AggregateVhtSingleMpdu(), ns3::BSSchedulerRtps::BSSchedulerBasicConnection(), ns3::BSSchedulerRtps::BSSchedulerBEConnection(), ns3::BSSchedulerRtps::BSSchedulerBroadcastConnection(), ns3::BSSchedulerRtps::BSSchedulerInitialRangingConnection(), ns3::BSSchedulerRtps::BSSchedulerNRTPSConnection(), ns3::BSSchedulerRtps::BSSchedulerPrimaryConnection(), ns3::EthernetTrailer::CalcFcs(), ns3::UanPhyPerUmodem::CalcPer(), ns3::dot11s::AirtimeLinkMetricCalculator::CalculateMetric(), ns3::MsduStandardAggregator::CalculatePadding(), ns3::MpduStandardAggregator::CalculatePadding(), ns3::LrWpanPhy::CalculateTxTime(), ns3::MpduStandardAggregator::CanBeAggregated(), ns3::EthernetTrailer::CheckFcs(), ns3::LrWpanMacTrailer::CheckFcs(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::Ipv4FlowClassifier::Classify(), ns3::Ipv6FlowClassifier::Classify(), ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::SixLowPanNetDevice::CompressLowPanNhc(), ns3::SixLowPanNetDevice::CompressLowPanUdpNhc(), ns3::SimpleOfdmWimaxPhy::ConvertBurstToBits(), ns3::PendingData::CopyFromOffset(), ns3::TcpTxBuffer::CopyFromSequence(), DataIndication(), ns3::MsduAggregator::Deaggregate(), ns3::MpduAggregator::Deaggregate(), ns3::SixLowPanNetDevice::DecompressLowPanHc1(), ns3::SixLowPanNetDevice::DecompressLowPanIphc(), ns3::SixLowPanNetDevice::DecompressLowPanNhc(), ns3::SixLowPanNetDevice::DecompressLowPanUdpNhc(), ns3::WimaxMacQueue::Dequeue(), ns3::Queue::Dequeue(), ns3::dsr::SendBuffer::Dequeue(), ns3::dsr::ErrorBuffer::Dequeue(), ns3::dsr::PassiveBuffer::Dequeue(), ns3::dsr::MaintainBuffer::Dequeue(), ns3::TcpGeneralErrorModel::DoCorrupt(), ns3::RateErrorModel::DoCorruptBit(), ns3::RateErrorModel::DoCorruptByte(), ns3::DropTailQueue::DoDequeue(), ns3::CoDelQueue::DoDequeue(), ns3::RedQueue::DoDequeue(), ns3::DropTailQueue::DoEnqueue(), ns3::CoDelQueue::DoEnqueue(), ns3::RedQueue::DoEnqueue(), ns3::TcpSocketBase::DoForwardUp(), ns3::Ipv4L3Protocol::DoFragmentation(), ns3::SixLowPanNetDevice::DoFragmentation(), ns3::LteRlcTm::DoNotifyTxOpportunity(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::BaseStationNetDevice::DoReceive(), ns3::SubscriberStationNetDevice::DoReceive(), ns3::LteTestPdcp::DoReceivePdcpPdu(), ns3::LteTestRrc::DoReceivePdcpSdu(), ns3::LteRlcTm::DoReceivePdu(), ns3::LteRlcUm::DoReceivePdu(), ns3::LteRlcAm::DoReceivePdu(), ns3::LtePdcp::DoReceivePdu(), ns3::LteRlcSm::DoReceivePdu(), ns3::LteEnbRrc::DoRecvUeData(), LrWpanPlmeAndPdInterfaceTestCase::DoRun(), TwoLevelAggregationTest::DoRun(), LrWpanPacketTestCase::DoRun(), Ns3WimaxFragmentationTestCase::DoRun(), Ipv4StaticRoutingSlash32TestCase::DoRun(), Ipv6ForwardingTest::DoRun(), DsdvHeaderTestCase::DoRun(), Ipv6RipngTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), UdpSocketLoopbackTest::DoRun(), Ipv4ForwardingTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), SixlowpanIphcImplTest::DoRun(), Ipv4HeaderTest::DoRun(), Ipv4FragmentationTest::DoRun(), SixlowpanFragmentationTest::DoRun(), Udp6SocketLoopbackTest::DoRun(), Ipv6FragmentationTest::DoRun(), UdpSocketImplTest::DoRun(), OlsrHelloTestCase::DoRun(), OlsrTcTestCase::DoRun(), OlsrHnaTestCase::DoRun(), Ipv6RipngCountToInfinityTest::DoRun(), PacketTest::DoRun(), Ipv4GlobalRoutingSlash32TestCase::DoRun(), Udp6SocketImplTest::DoRun(), ns3::MeshPointDevice::DoSend(), ns3::SixLowPanNetDevice::DoSend(), ns3::BaseStationNetDevice::DoSend(), ns3::SubscriberStationNetDevice::DoSend(), ns3::LteUeRrc::DoSendData(), Ipv4RawSocketImplTest::DoSendData_IpHdr(), Ipv4HeaderTest::DoSendData_IpHdr_Dscp(), ns3::dsr::DsrOptionRerr::DoSendError(), ns3::EpcX2::DoSendHandoverPreparationFailure(), ns3::EpcX2::DoSendHandoverRequest(), ns3::EpcX2::DoSendHandoverRequestAck(), ns3::EpcX2::DoSendLoadInformation(), ns3::EpcX2::DoSendResourceStatusUpdate(), ns3::EpcX2::DoSendSnStatusTransfer(), ns3::UdpSocketImpl::DoSendTo(), ns3::EpcX2::DoSendUeContextRelease(), ns3::EpcX2::DoSendUeData(), ns3::LteRlcTm::DoTransmitPdcpPdu(), ns3::LteRlcUm::DoTransmitPdcpPdu(), ns3::LteRlcAm::DoTransmitPdcpPdu(), ns3::LtePdcp::DoTransmitPdcpSdu(), ns3::LteTestMac::DoTransmitPdu(), ns3::Queue::Drop(), ns3::RedQueue::DropEarly(), ns3::Ipv4FlowProbe::DropLogger(), ns3::Ipv6FlowProbe::DropLogger(), dstSocketRecv(), ns3::YansWifiPhy::EndReceive(), ns3::LrWpanPhy::EndRx(), ns3::Queue::Enqueue(), ns3::UanMacCw::Enqueue(), ns3::BaseStationNetDevice::Enqueue(), ns3::SubscriberStationNetDevice::Enqueue(), ns3::TapBridge::Filter(), ns3::Icmpv6L4Protocol::ForgeEchoRequest(), ns3::Icmpv6L4Protocol::ForgeNA(), ns3::Icmpv6L4Protocol::ForgeNS(), ns3::Icmpv6L4Protocol::ForgeRS(), ns3::MeshWifiInterfaceMac::ForwardDown(), ns3::MacLow::ForwardDown(), ns3::Ipv4FlowProbe::ForwardLogger(), ns3::Ipv6FlowProbe::ForwardLogger(), ns3::dot11s::HwmpProtocolMac::ForwardPerr(), ns3::dot11s::HwmpProtocol::ForwardUnicast(), ns3::UdpSocketImpl::ForwardUp(), ns3::PacketSocket::ForwardUp(), ns3::FdNetDevice::ForwardUp(), ns3::UdpSocketImpl::ForwardUp6(), ns3::Ipv4FlowProbe::ForwardUpLogger(), ns3::Ipv6FlowProbe::ForwardUpLogger(), ns3::PacketSizeMinMaxAvgTotalCalculator::FrameUpdate(), GetByteTagIterator(), ns3::MacLow::GetDataTxVector(), ns3::WimaxMacQueue::GetFirstPacketPayloadSize(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::WifiRemoteStationManager::GetFragmentSize(), ns3::BlockAckManager::GetNextPacketSize(), ns3::WifiRemoteStationManager::GetNFragments(), ns3::Ipv4L3Protocol::Fragments::GetPacket(), ns3::Ipv4L3Protocol::Fragments::GetPartialPacket(), ns3::Icmpv6DestinationUnreachable::GetSerializedSize(), ns3::Icmpv6TooBig::GetSerializedSize(), ns3::Icmpv6TimeExceeded::GetSerializedSize(), ns3::Icmpv6ParameterError::GetSerializedSize(), ns3::Icmpv6OptionRedirected::GetSerializedSize(), ns3::PacketBurst::GetSize(), ns3::MacLow::GetSize(), GetString(), ns3::DcaTxop::GotAck(), ns3::EdcaTxopN::GotAck(), ns3::Icmpv6L4Protocol::HandleDestinationUnreachable(), ns3::Icmpv6L4Protocol::HandleEchoRequest(), ns3::MacRxMiddle::HandleFragments(), ns3::Ipv6ExtensionFragment::HandleFragmentsTimeout(), ns3::Ipv4L3Protocol::HandleFragmentsTimeout(), Ipv4DynamicGlobalRoutingTestCase::HandleRead(), ns3::UdpEchoServer::HandleRead(), ns3::PacketSocketServer::HandleRead(), ns3::UdpServer::HandleRead(), ns3::PacketSink::HandleRead(), ns3::Ping6::HandleRead(), ns3::UdpEchoClient::HandleRead(), ns3::MacLow::IsAmpdu(), ns3::Ipv4L3Protocol::LocalDeliver(), ns3::LrWpanMac::McpsDataRequest(), ns3::WifiRemoteStationManager::NeedFragmentation(), ns3::WifiRemoteStationManager::NeedRts(), ns3::DcaTxop::NotifyAccessGranted(), ns3::EdcaTxopN::NotifyAccessGranted(), ns3::dsr::DsrRouting::NotifyDataReceipt(), RoutingHelper::OnOffTrace(), ns3::TcpL4Protocol::PacketReceived(), ns3::PacketSizeMinMaxAvgTotalCalculator::PacketUpdate(), ns3::PcapSniffTxRxEvent(), ns3::TcpSocketBase::PeerClose(), ns3::MacLow::PerformMsduAggregation(), PhyRxEndOkTrace(), WifiPhyStats::PhyTxTrace(), ns3::LrWpanMac::PlmeSetTRXStateConfirm(), ns3::dot11s::HwmpProtocol::ProactivePathResolved(), ns3::Ipv6ExtensionFragment::Process(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::Ipv4L3Protocol::ProcessFragment(), ns3::SixLowPanNetDevice::ProcessFragment(), ns3::Ipv6Extension::ProcessOptions(), ns3::TcpSocketBase::ProcessWait(), ns3::dsr::DsrRouting::PromiscReceive(), ns3::EdcaTxopN::PushFront(), ns3::DcaTxop::Queue(), ns3::EdcaTxopN::Queue(), ns3::dot11s::HwmpProtocol::ReactivePathResolved(), ns3::NscTcpSocketImpl::ReadPendingData(), ns3::LteRlcUm::ReassembleAndDeliver(), ns3::LteRlcAm::ReassembleAndDeliver(), ns3::flame::FlameProtocolMac::Receive(), ns3::dot11s::PeerManagementProtocolMac::Receive(), ns3::UanTransducerHd::Receive(), ns3::ArpL3Protocol::Receive(), Receiver::Receive(), ns3::V4Ping::Receive(), ns3::ApWifiMac::Receive(), ns3::NscTcpL4Protocol::Receive(), ns3::MeshWifiInterfaceMac::Receive(), ns3::CsmaNetDevice::Receive(), ns3::LteTestMac::Receive(), ChannelAccessTestCase::Receive(), ns3::dsr::DsrRouting::Receive(), Bug730TestCase::Receive(), AnnexC_TestCase::Receive(), ns3::dot11s::HwmpProtocolMac::ReceiveAction(), ns3::TcpSocketBase::ReceivedAck(), ns3::dot11s::HwmpProtocolMac::ReceiveData(), ns3::TcpSocketBase::ReceivedData(), ns3::TapBridge::ReceiveFromBridgedDevice(), ns3::MeshPointDevice::ReceiveFromDevice(), ns3::SixLowPanNetDevice::ReceiveFromDevice(), ns3::UanMacRc::ReceiveOkFromPhy(), NetAnimExperiment::ReceivePacket(), ReceivePacket(), DsdvManetExample::ReceivePacket(), RoutingExperiment::ReceivePacket(), Experiment::ReceivePacket(), ns3::UanMacRcGw::ReceivePacket(), ns3::TcpGeneralTest::ReceivePacket(), PacketSocketAppsTest::ReceivePkt(), Ipv4StaticRoutingSlash32TestCase::ReceivePkt(), Ipv6ForwardingTest::ReceivePkt(), Ipv6RipngTest::ReceivePkt(), UdpSocketLoopbackTest::ReceivePkt(), Ipv6RawSocketImplTest::ReceivePkt(), Ipv4RawSocketImplTest::ReceivePkt(), Ipv4ForwardingTest::ReceivePkt(), SixlowpanHc1ImplTest::ReceivePkt(), SixlowpanIphcImplTest::ReceivePkt(), Ipv4HeaderTest::ReceivePkt(), Udp6SocketLoopbackTest::ReceivePkt(), UdpSocketImplTest::ReceivePkt(), Ipv6RipngCountToInfinityTest::ReceivePkt(), Ipv4GlobalRoutingSlash32TestCase::ReceivePkt(), Udp6SocketImplTest::ReceivePkt(), Ipv6RawSocketImplTest::ReceivePkt2(), Ipv4RawSocketImplTest::ReceivePkt2(), UdpSocketImplTest::ReceivePkt2(), Udp6SocketImplTest::ReceivePkt2(), Ipv6RipngSplitHorizonStrategyTest::ReceivePktProbe(), ns3::olsr::HelloRegressionTest::ReceivePktProbeA(), ns3::olsr::TcRegressionTest::ReceivePktProbeA(), ns3::olsr::HelloRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeC(), RoutingHelper::ReceiveRoutingPacket(), ns3::UdpSocketImpl::Recv(), ns3::NscTcpSocketImpl::Recv(), ns3::PacketSocket::Recv(), ns3::TcpSocketBase::Recv(), ns3::Socket::Recv(), ns3::Ipv4RawSocketImpl::RecvFrom(), ns3::Ipv6RawSocketImpl::RecvFrom(), ns3::TcpSocketBase::RecvFrom(), ns3::Socket::RecvFrom(), ns3::EpcSgwPgwApplication::RecvFromTunDevice(), ns3::EpcX2::RecvFromX2cSocket(), ns3::EpcX2::RecvFromX2uSocket(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::dsdv::RoutingProtocol::RouteOutput(), ns3::TcpZeroWindowTest::Rx(), NodeStatistics::RxCallback(), Ipv6PacketInfoTagTest::RxCb(), Ipv4PacketInfoTagTest::RxCb(), UanTest::RxPacket(), AcousticModemEnergyTestCase::RxPacket(), ns3::SSScheduler::Schedule(), ns3::UanMacRc::ScheduleData(), ns3::NscTcpSocketImpl::Send(), ns3::LrWpanNetDevice::Send(), ns3::Radvd::Send(), ns3::Ipv6L3Protocol::Send(), ns3::Ipv4L3Protocol::Send(), ns3::dsr::DsrRouting::Send(), ns3::TcpSocketBase::Send(), ns3::LteTestRrc::SendData(), ns3::TcpSocketBase::SendDataPacket(), ns3::Icmpv6L4Protocol::SendEchoReply(), ns3::Icmpv6L4Protocol::SendErrorDestinationUnreachable(), ns3::Icmpv6L4Protocol::SendErrorParameterError(), ns3::Icmpv6L4Protocol::SendErrorTimeExceeded(), ns3::Icmpv6L4Protocol::SendErrorTooBig(), ns3::SimpleNetDevice::SendFrom(), ns3::FdNetDevice::SendFrom(), ns3::MeshWifiInterfaceMac::SendManagementFrame(), ns3::Icmpv6L4Protocol::SendMessage(), ns3::Icmpv6L4Protocol::SendNA(), ns3::Icmpv6L4Protocol::SendNS(), SendOnePacket(), ns3::Ipv4FlowProbe::SendOutgoingLogger(), ns3::Ipv6FlowProbe::SendOutgoingLogger(), ns3::UanMacRcGw::SendPacket(), ns3::olsr::RoutingProtocol::SendPacket(), ns3::UanPhyGen::SendPacket(), ns3::YansWifiPhy::SendPacket(), ns3::UanMacRc::SendPacket(), ns3::dsr::DsrRouting::SendPacketFromBuffer(), ns3::TcpL4Protocol::SendPacketV4(), ns3::TcpL4Protocol::SendPacketV6(), ns3::dot11s::PeerManagementProtocolMac::SendPeerLinkManagementFrame(), ns3::dot11s::HwmpProtocolMac::SendPrep(), ns3::dot11s::HwmpProtocolMac::SendPreq(), ns3::olsr::RoutingProtocol::SendQueuedMessages(), ns3::Ipv4L3Protocol::SendRealOut(), ns3::Ipv6L3Protocol::SendRealOut(), ns3::Icmpv6L4Protocol::SendRedirection(), ns3::Icmpv6L4Protocol::SendRS(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::Ipv6RawSocketImpl::SendTo(), ns3::PacketSocket::SendTo(), ns3::EpcEnbApplication::SendToLteSocket(), ns3::EpcSgwPgwApplication::SendToS1uSocket(), ns3::EpcEnbApplication::SendToS1uSocket(), ns3::EpcSgwPgwApplication::SendToTunDevice(), ns3::dsdv::RoutingProtocol::SendTriggeredUpdate(), ns3::dsr::DsrRouting::SendUnreachError(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6TooBig::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), ns3::Icmpv6ParameterError::Serialize(), ns3::Icmpv6OptionRedirected::Serialize(), ns3::Icmpv4Echo::SetData(), ns3::LrWpanMacTrailer::SetFcs(), ns3::Icmpv6DestinationUnreachable::SetPacket(), ns3::Icmpv6TooBig::SetPacket(), ns3::Icmpv6TimeExceeded::SetPacket(), ns3::Icmpv6ParameterError::SetPacket(), ns3::Icmpv6OptionRedirected::SetPacket(), ns3::PacketProbe::SetValue(), ns3::Ipv4PacketProbe::SetValue(), ns3::Ipv6PacketProbe::SetValue(), ns3::ApplicationPacketProbe::SetValue(), SinkRx(), Ns3TcpNoDelayTestCase::SinkRx(), Ns3TcpSocketTestCase1::SinkRx(), NscTcpLossTestCase1::SinkRx(), Ns3TcpSocketTestCase2::SinkRx(), NscTcpLossTestCase2::SinkRx(), SocketPrinter(), TestUtils::sprintPacketContentsBin(), ns3::TestUtils::sprintPacketContentsBin(), TestUtils::sprintPacketContentsHex(), ns3::TestUtils::sprintPacketContentsHex(), srcSocketRecv(), ns3::YansWifiPhy::StartReceivePreambleAndHeader(), ns3::ShannonSpectrumErrorModel::StartRx(), ns3::UanPhyGen::StartRxPacket(), ns3::HalfDuplexIdealPhy::StartTx(), ns3::MacLow::StopMpduAggregation(), PowerRateAdaptationTest::TestAparf(), PowerRateAdaptationTest::TestParf(), ns3::PyViz::TraceDevQueueDrop(), ns3::PyViz::TraceNetDevRxCommon(), ns3::PyViz::TraceNetDevTxCommon(), ns3::PacketProbe::TraceSink(), ns3::Ipv4PacketProbe::TraceSink(), ns3::ApplicationPacketProbe::TraceSink(), ns3::Ipv6PacketProbe::TraceSink(), ns3::UanTransducerHd::Transmit(), ns3::SimpleNetDevice::TransmitComplete(), ns3::PointToPointNetDevice::TransmitStart(), ns3::CsmaNetDevice::TransmitStart(), ns3::TcpZeroWindowTest::Tx(), ns3::TcpFastRetrTest::Tx(), ns3::flame::FlameProtocolMac::UpdateOutcomingFrame(), ns3::dot11s::HwmpProtocolMac::UpdateOutcomingFrame(), and ns3::PcapFile::Write().
uint64_t ns3::Packet::GetUid | ( | void | ) | const |
Returns the packet's Uid.
A packet is allocated a new uid when it is created empty or with zero-filled payload.
Note: This uid is an internal uid and cannot be counted on to provide an accurate counter of how many "simulated packets" of a particular protocol are in the system. It is not trivial to make this uid into such a counter, because of questions such as what should the uid be when the packet is sent over broadcast media, or when fragmentation occurs. If a user wants to trace actual packet counts, he or she should look at e.g. the IP ID field or transport sequence numbers, or other packet or frame counters at other protocol layers.
Definition at line 366 of file packet.cc.
References ns3::PacketMetadata::GetUid(), and m_metadata.
Referenced by ns3::dsr::PassiveBuffer::AllEqual(), ns3::dsdv::RoutingProtocol::DeferredRouteOutput(), ns3::aodv::RoutingProtocol::DeferredRouteOutput(), ns3::ListErrorModel::DoCorrupt(), ns3::Icmpv6L4Protocol::DoDAD(), CoDelQueueBasicEnqueueDequeue::DoRun(), ns3::aodv::RequestQueue::Drop(), ns3::dsdv::PacketQueue::Drop(), ns3::dsdv::RoutingProtocol::Drop(), ns3::dsr::ErrorBuffer::Drop(), ns3::dsr::SendBuffer::Drop(), ns3::dsr::PassiveBuffer::Drop(), ns3::dsr::ErrorBuffer::DropLink(), ns3::dsr::PassiveBuffer::DropLink(), ns3::aodv::RequestQueue::Enqueue(), ns3::dsr::SendBuffer::Enqueue(), ns3::dsdv::PacketQueue::Enqueue(), ns3::dsr::ErrorBuffer::Enqueue(), ns3::dsr::PassiveBuffer::Enqueue(), ns3::BridgeNetDevice::ForwardBroadcast(), ns3::aodv::RoutingProtocol::Forwarding(), ns3::BridgeNetDevice::ForwardUnicast(), ns3::PacketSocket::ForwardUp(), ns3::Icmpv6L4Protocol::HandleNS(), ns3::UdpServer::HandleRead(), ns3::aodv::DuplicatePacketDetection::IsDuplicate(), ns3::dsr::DsrRouting::NotifyDataReceipt(), ns3::dsr::DsrRouting::PacketNewRoute(), ns3::dsr::DsrRouting::PromiscReceive(), ns3::CsmaChannel::PropagationCompleteEvent(), ns3::CsmaNetDevice::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::TapBridge::ReceiveFromBridgedDevice(), ns3::MeshPointDevice::ReceiveFromDevice(), ns3::BridgeNetDevice::ReceiveFromDevice(), ns3::SixLowPanNetDevice::ReceiveFromDevice(), ns3::Node::ReceiveFromDevice(), ns3::aodv::RoutingProtocol::RecvAodv(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::dsdv::RoutingProtocol::RouteInput(), ns3::dsdv::RoutingProtocol::RouteOutput(), RedQueueTestCase::RunRedTest(), ns3::UdpClient::Send(), EpsBearerTagUdpClient::Send(), ns3::PointToPointNetDevice::Send(), ns3::dsr::DsrRouting::Send(), ns3::FdNetDevice::SendFrom(), ns3::CsmaNetDevice::SendFrom(), ns3::dsdv::RoutingProtocol::SendPeriodicUpdate(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), ns3::dsdv::RoutingProtocol::SendTriggeredUpdate(), ns3::dsr::DsrRouting::SendUnreachError(), ns3::PyViz::TraceDevQueueDrop(), ns3::PyViz::TraceNetDevRxCommon(), ns3::PyViz::TraceNetDevRxWifi(), ns3::PyViz::TraceNetDevTxCommon(), ns3::PyViz::TraceNetDevTxWifi(), ns3::CsmaNetDevice::TransmitAbort(), ns3::CsmaNetDevice::TransmitCompleteEvent(), ns3::CsmaChannel::TransmitEnd(), ns3::PointToPointRemoteChannel::TransmitStart(), ns3::PointToPointChannel::TransmitStart(), ns3::CsmaChannel::TransmitStart(), ns3::PointToPointNetDevice::TransmitStart(), and ns3::CsmaNetDevice::TransmitStart().
Basic assignment.
o | object to copy |
Definition at line 157 of file packet.cc.
References ns3::NixVector::Copy(), m_buffer, m_byteTagList, m_metadata, m_nixVector, and m_packetTagList.
uint32_t ns3::Packet::PeekHeader | ( | Header & | header | ) | const |
Deserialize but does not remove the header from the internal buffer.
s This method invokes Header::Deserialize.
header | a reference to the header to read from the internal buffer. |
Definition at line 276 of file packet.cc.
References ns3::Buffer::Begin(), ns3::Header::Deserialize(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), m_buffer, and NS_LOG_FUNCTION.
Referenced by ns3::MacLow::AggregateToAmpdu(), ns3::UanPhyCalcSinrDual::CalcSinrDb(), ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::SixLowPanNetDevice::CompressLowPanNhc(), ns3::SixLowPanNetDevice::CompressLowPanUdpNhc(), ns3::LteUeRrcProtocolReal::DoReceivePdcpPdu(), ns3::LteEnbRrcProtocolReal::DoReceivePdcpPdu(), ns3::LteUeRrcProtocolReal::DoReceivePdcpSdu(), ns3::LteEnbRrcProtocolReal::DoReceivePdcpSdu(), ns3::LteRlcUm::DoReceivePdu(), ns3::LteRlcAm::DoReceivePdu(), ns3::TapBridge::Filter(), ns3::Ipv4RawSocketImpl::ForwardUp(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::MacLow::GetTid(), ns3::EdcaTxopN::GotAck(), ns3::Icmpv4L4Protocol::HandleDestUnreach(), ns3::Icmpv4L4Protocol::HandleTimeExceeded(), Ns3TcpStateTestCase::Ipv4L3Tx(), ns3::UanMacRc::IsPhy1Ok(), ns3::EdcaTxopN::MissedBlockAck(), ns3::EdcaTxopN::NeedBarRetransmission(), ns3::dsr::DsrRouting::NotifyDataReceipt(), ns3::TcpL4Protocol::PacketReceived(), ns3::LrWpanMac::PdDataConfirm(), ns3::LrWpanMac::PdDataIndication(), NodeStatistics::PhyCallback(), OcbWifiMacTestCase::PhyTxTrace(), WaveNetDeviceExample::Receive(), ns3::MeshWifiInterfaceMac::Receive(), ns3::OcbWifiMac::Receive(), ns3::UdpL4Protocol::Receive(), ns3::UanMacRcGw::ReceivePacket(), ns3::UanMacRcGw::SendPacket(), ns3::UanMacRc::SendPacket(), SinkRx(), ns3::PyViz::TraceNetDevPromiscRxCsma(), ns3::PyViz::TraceNetDevRxCsma(), ns3::PyViz::TraceNetDevRxWifi(), ns3::PyViz::TraceNetDevTxCsma(), ns3::PyViz::TraceNetDevTxWifi(), ns3::dot11s::PeerManagementProtocolMac::UpdateOutcomingFrame(), and ns3::AnimationInterface::WifiPhyRxBeginTrace().
bool ns3::Packet::PeekPacketTag | ( | Tag & | tag | ) | const |
Search a matching tag and call Tag::Deserialize if it is found.
tag | the tag to search in this packet |
Definition at line 844 of file packet.cc.
References m_packetTagList, and ns3::PacketTagList::Peek().
Referenced by ns3::LrWpanPhy::CheckInterference(), Ipv4FragmentationTest::DoRun(), Ipv6FragmentationTest::DoRun(), PacketTest::DoRun(), ns3::LrWpanPhy::EndRx(), Ipv4DynamicGlobalRoutingTestCase::HandleRead(), PrintReceivedPacket(), PrintReceivedRoutingPacket(), ns3::QosUtilsGetTidForPacket(), ns3::flame::FlameProtocolMac::Receive(), ns3::dot11s::HwmpProtocolMac::ReceiveData(), ns3::BsmApplication::ReceiveWavePacket(), ns3::UdpSocketImpl::RecvFrom(), ns3::NscTcpSocketImpl::RecvFrom(), ns3::PacketSocket::RecvFrom(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::dsdv::RoutingProtocol::RouteInput(), ns3::aodv::RoutingProtocol::RouteOutput(), ns3::dsdv::RoutingProtocol::RouteOutput(), ns3::YansWifiPhy::StartReceivePreambleAndHeader(), and ns3::MacLow::StartTransmission().
uint32_t ns3::Packet::PeekTrailer | ( | Trailer & | trailer | ) |
Deserialize but does not remove a trailer from the internal buffer.
This method invokes the Trailer::Deserialize method.
trailer | a reference to the trailer to read from the internal buffer. |
Definition at line 303 of file packet.cc.
References ns3::Trailer::Deserialize(), ns3::Buffer::End(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), m_buffer, and NS_LOG_FUNCTION.
void ns3::Packet::Print | ( | std::ostream & | os | ) | const |
Print the packet contents.
os | output stream in which the data should be printed. |
Iterate over the headers and trailers present in this packet, from the first header to the last trailer and invoke, for each of them, the user-provided method Header::DoPrint or Trailer::DoPrint methods.
Definition at line 410 of file packet.cc.
References ns3::PacketMetadata::BeginItem(), ns3::PacketMetadata::Item::current, ns3::PacketMetadata::Item::currentSize, ns3::PacketMetadata::Item::currentTrimedFromStart, ns3::Chunk::Deserialize(), ns3::ObjectBase::GetAttribute(), ns3::TypeId::GetAttributeN(), ns3::TypeId::GetConstructor(), ns3::TypeId::GetName(), ns3::TypeId::HasConstructor(), ns3::PacketMetadata::ItemIterator::HasNext(), ns3::PacketMetadata::Item::HEADER, ns3::PacketMetadata::Item::isFragment, m_buffer, m_metadata, ns3::PacketMetadata::ItemIterator::Next(), NS_ASSERT, ns3::PacketMetadata::Item::PAYLOAD, ns3::Chunk::Print(), ns3::PacketMetadata::Item::tid, ns3::PacketMetadata::Item::TRAILER, and ns3::PacketMetadata::Item::type.
Referenced by ns3::Ipv4L3Protocol::DoFragmentation(), LrWpanPacketTestCase::DoRun(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::AnimationInterface::GetPacketMetadata(), ns3::operator<<(), LrWpanCcaTestCase::PhyRxBegin(), LrWpanCcaTestCase::PhyRxDrop(), LrWpanCcaTestCase::PhyRxEnd(), LrWpanCcaTestCase::PhyTxBegin(), LrWpanCcaTestCase::PhyTxEnd(), and ToString().
void ns3::Packet::PrintByteTags | ( | std::ostream & | os | ) | const |
Iterate over the byte tags present in this packet, and invoke the Print method of each tag stored in the packet.
os | output stream in which the data should be printed. |
Definition at line 372 of file packet.cc.
References GetByteTagIterator(), ns3::TypeId::GetConstructor(), ns3::ByteTagIterator::Item::GetEnd(), ns3::TypeId::GetName(), ns3::ByteTagIterator::Item::GetStart(), ns3::ByteTagIterator::Item::GetTag(), ns3::ByteTagIterator::Item::GetTypeId(), ns3::ByteTagIterator::HasNext(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), ns3::ByteTagIterator::Next(), NS_ASSERT, and ns3::Tag::Print().
void ns3::Packet::PrintPacketTags | ( | std::ostream & | os | ) | const |
Print the list of packet tags.
os | the stream on which to print the tags. |
Definition at line 857 of file packet.cc.
References ns3::TypeId::GetConstructor(), GetPacketTagIterator(), ns3::PacketTagIterator::Item::GetTag(), ns3::PacketTagIterator::Item::GetTypeId(), ns3::TypeId::HasConstructor(), ns3::PacketTagIterator::HasNext(), ns3::PacketTagIterator::Next(), NS_ASSERT, and ns3::Tag::Print().
void ns3::Packet::RemoveAllByteTags | ( | void | ) |
Remove all byte tags stored in this packet.
Definition at line 347 of file packet.cc.
References m_byteTagList, NS_LOG_FUNCTION, and ns3::ByteTagList::RemoveAll().
Referenced by Ipv6ForwardingTest::DoRun(), Ipv6RipngTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), Ipv4ForwardingTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), SixlowpanIphcImplTest::DoRun(), Ipv4HeaderTest::DoRun(), UdpSocketImplTest::DoRun(), Udp6SocketImplTest::DoRun(), dstSocketRecv(), ns3::aodv::LoopbackTestCase::EchoData(), ns3::UdpEchoServer::HandleRead(), FlameRegressionTest::HandleReadServer(), HwmpProactiveRegressionTest::HandleReadServer(), SixlowpanFragmentationTest::HandleReadServer(), HwmpSimplestRegressionTest::HandleReadServer(), HwmpReactiveRegressionTest::HandleReadServer(), HwmpDoRfRegressionTest::HandleReadServer(), and srcSocketRecv().
void ns3::Packet::RemoveAllPacketTags | ( | void | ) |
Remove all packet tags.
Definition at line 850 of file packet.cc.
References m_packetTagList, NS_LOG_FUNCTION, and ns3::PacketTagList::RemoveAll().
Referenced by PacketTest::DoRun(), dstSocketRecv(), ns3::aodv::LoopbackTestCase::EchoData(), ns3::UdpEchoServer::HandleRead(), FlameRegressionTest::HandleReadServer(), HwmpProactiveRegressionTest::HandleReadServer(), SixlowpanFragmentationTest::HandleReadServer(), HwmpSimplestRegressionTest::HandleReadServer(), HwmpReactiveRegressionTest::HandleReadServer(), HwmpDoRfRegressionTest::HandleReadServer(), and srcSocketRecv().
void ns3::Packet::RemoveAtEnd | ( | uint32_t | size | ) |
Remove size bytes from the end of the current packet.
It is safe to remove more bytes than are present in the packet.
size | number of bytes from remove |
Definition at line 331 of file packet.cc.
References m_buffer, m_metadata, NS_LOG_FUNCTION, ns3::PacketMetadata::RemoveAtEnd(), and ns3::Buffer::RemoveAtEnd().
Referenced by PacketTest::DoRun(), ns3::Ipv6ExtensionFragment::Process(), and ns3::CsmaNetDevice::Receive().
void ns3::Packet::RemoveAtStart | ( | uint32_t | size | ) |
Remove size bytes from the start of the current packet.
It is safe to remove more bytes than are present in the packet.
size | number of bytes from remove |
Definition at line 338 of file packet.cc.
References ns3::ByteTagList::Adjust(), m_buffer, m_byteTagList, m_metadata, NS_LOG_FUNCTION, ns3::PacketMetadata::RemoveAtStart(), and ns3::Buffer::RemoveAtStart().
Referenced by ns3::dsr::DsrRouting::AddAckReqHeader(), ns3::dsr::DsrRouting::CancelPacketTimerNextHop(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::MsduAggregator::Deaggregate(), ns3::MpduAggregator::Deaggregate(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), PacketTest::DoRun(), ns3::TapBridge::Filter(), ns3::Ipv6L3Protocol::LocalDeliver(), ns3::Ipv6OptionPad1::Process(), ns3::Ipv6OptionPadn::Process(), ns3::Ipv6ExtensionHopByHop::Process(), ns3::Ipv6OptionJumbogram::Process(), ns3::Ipv6ExtensionDestination::Process(), ns3::Ipv6OptionRouterAlert::Process(), ns3::Ipv6ExtensionFragment::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::dsr::DsrRouting::PromiscReceive(), ns3::LteRlcUm::ReassembleAndDeliver(), ns3::LteRlcAm::ReassembleAndDeliver(), ns3::dsr::DsrRouting::Receive(), ns3::Ipv4RawSocketImpl::RecvFrom(), ns3::Ipv6RawSocketImpl::RecvFrom(), ns3::dsr::DsrRouting::SalvagePacket(), and ns3::dsr::DsrRouting::SendPacketFromBuffer().
uint32_t ns3::Packet::RemoveHeader | ( | Header & | header | ) |
Deserialize and remove the header from the internal buffer.
This method invokes Header::Deserialize.
header | a reference to the header to remove from the internal buffer. |
Definition at line 266 of file packet.cc.
References ns3::ByteTagList::Adjust(), ns3::Buffer::Begin(), ns3::Header::Deserialize(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), m_buffer, m_byteTagList, m_metadata, NS_LOG_FUNCTION, ns3::Buffer::RemoveAtStart(), and ns3::PacketMetadata::RemoveHeader().
Referenced by ns3::dsr::DsrRouting::AddAckReqHeader(), benchA(), benchD(), benchFragment(), C1(), C2(), ns3::dsr::DsrRouting::CancelPacketTimerNextHop(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::IpcsClassifier::Classify(), ns3::EpcTftClassifier::Classify(), ns3::SixLowPanNetDevice::CompressLowPanHc1(), ns3::SixLowPanNetDevice::CompressLowPanIphc(), ns3::SixLowPanNetDevice::CompressLowPanNhc(), ns3::SixLowPanNetDevice::CompressLowPanUdpNhc(), ns3::MsduAggregator::Deaggregate(), ns3::MpduAggregator::Deaggregate(), ns3::SixLowPanNetDevice::DecompressLowPanHc1(), ns3::SixLowPanNetDevice::DecompressLowPanIphc(), ns3::SixLowPanNetDevice::DecompressLowPanNhc(), ns3::SixLowPanNetDevice::DecompressLowPanUdpNhc(), ns3::TcpGeneralErrorModel::DoCorrupt(), ns3::LteEnbRrcProtocolIdeal::DoDecodeHandoverCommand(), ns3::LteEnbRrcProtocolReal::DoDecodeHandoverCommand(), ns3::LteEnbRrcProtocolIdeal::DoDecodeHandoverPreparationInformation(), ns3::LteEnbRrcProtocolReal::DoDecodeHandoverPreparationInformation(), ns3::TcpSocketBase::DoForwardUp(), ns3::Ipv4L3Protocol::DoFragmentation(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::BaseStationNetDevice::DoReceive(), ns3::SubscriberStationNetDevice::DoReceive(), ns3::LteUeRrcProtocolReal::DoReceivePdcpPdu(), ns3::LteEnbRrcProtocolReal::DoReceivePdcpPdu(), ns3::LteUeRrcProtocolReal::DoReceivePdcpSdu(), ns3::LteEnbRrcProtocolReal::DoReceivePdcpSdu(), ns3::LtePdcp::DoReceivePdu(), DsaRequestTestCase::DoRun(), FlameHeaderTest::DoRun(), MeshHeaderTest::DoRun(), LrWpanPacketTestCase::DoRun(), Ns3WimaxFragmentationTestCase::DoRun(), MeshInformationElementVectorBist::DoRun(), EpsGtpuHeaderTestCase::DoRun(), OlsrMidTestCase::DoRun(), DsdvHeaderTestCase::DoRun(), ns3::RlcAmStatusPduTestCase::DoRun(), Ns3WimaxSfTlvTestCase::DoRun(), OlsrHelloTestCase::DoRun(), PeerLinkFrameStartTest::DoRun(), ns3::aodv::RrepAckHeaderTest::DoRun(), OlsrTcTestCase::DoRun(), OlsrHnaTestCase::DoRun(), RrcConnectionRequestTestCase::DoRun(), PacketTest::DoRun(), RrcConnectionSetupTestCase::DoRun(), RrcConnectionSetupCompleteTestCase::DoRun(), RrcConnectionReconfigurationCompleteTestCase::DoRun(), RrcConnectionReconfigurationTestCase::DoRun(), HandoverPreparationInfoTestCase::DoRun(), RrcConnectionReestablishmentRequestTestCase::DoRun(), RrcConnectionReestablishmentTestCase::DoRun(), RrcConnectionReestablishmentCompleteTestCase::DoRun(), RrcConnectionRejectTestCase::DoRun(), MeasurementReportTestCase::DoRun(), ns3::dsr::DsrOptionRerr::DoSendError(), ns3::RipNg::DoSendRouteUpdate(), ns3::LteTestMac::DoTransmitPdu(), ns3::TapBridge::Filter(), ns3::WifiNetDevice::ForwardUp(), ns3::WimaxNetDevice::ForwardUp(), ns3::FdNetDevice::ForwardUp(), ns3::WaveNetDevice::ForwardUp(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::EdcaTxopN::GotAck(), ns3::Icmpv6L4Protocol::HandleDestinationUnreachable(), ns3::Icmpv4L4Protocol::HandleEcho(), ns3::Icmpv6L4Protocol::HandleEchoRequest(), ns3::Icmpv6L4Protocol::HandleNA(), ns3::Icmpv6L4Protocol::HandleNS(), ns3::Icmpv6L4Protocol::HandlePacketTooBig(), ns3::Icmpv6L4Protocol::HandleParameterError(), ns3::Icmpv6L4Protocol::HandleRA(), ns3::UdpServer::HandleRead(), ns3::Ping6::HandleRead(), ns3::Radvd::HandleRead(), ns3::Icmpv6L4Protocol::HandleRedirection(), ns3::RipNg::HandleRequests(), ns3::Icmpv6L4Protocol::HandleRS(), ns3::Icmpv6L4Protocol::HandleTimeExceeded(), Ns3TcpLossTestCase::Ipv4L3Tx(), Ns3TcpStateTestCase::Ipv4L3Tx(), Ns3TcpInteroperabilityTestCase::Ipv4L3Tx(), ns3::dsr::DsrRouting::NotifyDataReceipt(), ns3::AlohaNoackNetDevice::NotifyReceptionEndOk(), ns3::PcapSniffRxEvent(), ns3::PcapSniffTxEvent(), ns3::LrWpanMac::PdDataIndication(), ns3::UanMacCw::PhyRxPacketGood(), ns3::Ipv6OptionPad1::Process(), ns3::Ipv6OptionPadn::Process(), ns3::Ipv6ExtensionHopByHop::Process(), ns3::Ipv6OptionJumbogram::Process(), ns3::Ipv6ExtensionDestination::Process(), ns3::Ipv6OptionRouterAlert::Process(), ns3::Ipv6ExtensionFragment::Process(), ns3::dsr::DsrOptionPad1::Process(), ns3::dsr::DsrOptionPadn::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::dsr::DsrOptionAckReq::Process(), ns3::dsr::DsrOptionAck::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::UanMacRc::ProcessAck(), ns3::SixLowPanNetDevice::ProcessFragment(), ns3::PointToPointNetDevice::ProcessHeader(), ns3::dsr::DsrRouting::PromiscReceive(), ns3::LteRlcUm::ReassembleAndDeliver(), ns3::LteRlcAm::ReassembleAndDeliver(), ns3::olsr::Bug780Test::Receive(), ns3::dot11s::PeerManagementProtocolMac::Receive(), ns3::Icmpv4L4Protocol::Receive(), ns3::V4Ping::Receive(), ns3::StaWifiMac::Receive(), ns3::ApWifiMac::Receive(), ns3::CsmaNetDevice::Receive(), ns3::OcbWifiMac::Receive(), ns3::UdpL4Protocol::Receive(), ns3::RipNg::Receive(), ns3::RegularWifiMac::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::dot11s::HwmpProtocolMac::ReceiveAction(), ns3::dot11s::HwmpProtocolMac::ReceiveData(), ns3::SixLowPanNetDevice::ReceiveFromDevice(), ns3::MacLow::ReceiveOk(), ns3::UanMacRc::ReceiveOkFromPhy(), ns3::UanMacRcGw::ReceivePacket(), Ipv6RipngSplitHorizonStrategyTest::ReceivePktProbe(), ns3::olsr::HelloRegressionTest::ReceivePktProbeA(), ns3::olsr::TcRegressionTest::ReceivePktProbeA(), ns3::olsr::HelloRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeB(), ns3::olsr::TcRegressionTest::ReceivePktProbeC(), ns3::aodv::RoutingProtocol::RecvAodv(), ns3::aodv::RoutingProtocol::RecvError(), ns3::EpcSgwPgwApplication::RecvFromS1uSocket(), ns3::EpcEnbApplication::RecvFromS1uSocket(), ns3::EpcX2::RecvFromX2cSocket(), ns3::EpcX2::RecvFromX2uSocket(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::LrWpanMac::RemoveFirstTxQElement(), ns3::flame::FlameProtocol::RemoveRoutingStuff(), ns3::flame::FlameProtocol::RequestRoute(), ns3::dsr::DsrRouting::RouteRequestTimerExpire(), ns3::UanMacAloha::RxPacketGood(), ns3::dsr::DsrRouting::SalvagePacket(), ns3::dsr::DsrRouting::SendPacketFromBuffer(), ns3::Ipv4L3Protocol::SendRealOut(), ns3::Ipv4RawSocketImpl::SendTo(), and ns3::Ipv6RawSocketImpl::SendTo().
bool ns3::Packet::RemovePacketTag | ( | Tag & | tag | ) |
Remove a packet tag.
tag | the packet tag type to remove from this packet. The tag parameter is set to the value of the tag found. |
Definition at line 829 of file packet.cc.
References ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Tag::GetSerializedSize(), m_packetTagList, NS_LOG_FUNCTION, and ns3::PacketTagList::Remove().
Referenced by benchD(), ns3::MacLow::DeaggregateAmpduAndReceive(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::LteUeMac::DoReceivePhyPdu(), ns3::LteEnbMac::DoReceivePhyPdu(), PacketTest::DoRun(), ns3::UdpSocketImpl::DoSendTo(), ns3::MeshWifiInterfaceMac::ForwardDown(), ns3::Ipv4RawSocketImpl::ForwardUp(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::UdpSocketImpl::ForwardUp(), ns3::UdpSocketImpl::ForwardUp6(), ns3::Radvd::HandleRead(), ns3::RipNg::HandleRequests(), Tunnel::N0SocketRecv(), Tunnel::N1SocketRecv(), Tunnel::N3SocketRecv(), ns3::CoDelQueue::OkToDrop(), ns3::LrWpanPhy::PdDataRequest(), ns3::dot11s::HwmpProtocol::ProactivePathResolved(), ns3::dot11s::HwmpProtocol::ReactivePathResolved(), ns3::RipNg::Receive(), ns3::MacLow::ReceiveOk(), ReceivePacket(), Ipv6RipngSplitHorizonStrategyTest::ReceivePktProbe(), ns3::EpcEnbApplication::RecvFromLteSocket(), ns3::EpcSgwPgwApplication::RecvFromS1uSocket(), ns3::EpcEnbApplication::RecvFromS1uSocket(), ns3::dot11s::HwmpProtocol::RemoveRoutingStuff(), ns3::flame::FlameProtocol::RemoveRoutingStuff(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), Ipv6PacketInfoTagTest::RxCb(), Ipv4PacketInfoTagTest::RxCb(), ns3::Ipv6L3Protocol::Send(), ns3::Ipv4L3Protocol::Send(), ns3::LteEnbRrc::SendData(), ns3::SimpleNetDevice::SendFrom(), ns3::dsdv::RoutingProtocol::SendPacketFromQueue(), ns3::aodv::RoutingProtocol::SendPacketFromQueue(), ns3::RipNg::SendRouteRequest(), ns3::SimpleNetDevice::TransmitComplete(), ns3::flame::FlameProtocolMac::UpdateOutcomingFrame(), and ns3::dot11s::HwmpProtocolMac::UpdateOutcomingFrame().
uint32_t ns3::Packet::RemoveTrailer | ( | Trailer & | trailer | ) |
Remove a deserialized trailer from the internal buffer.
This method invokes the Deserialize method.
trailer | a reference to the trailer to remove from the internal buffer. |
Definition at line 294 of file packet.cc.
References ns3::Trailer::Deserialize(), ns3::Buffer::End(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), m_buffer, m_metadata, NS_LOG_FUNCTION, ns3::Buffer::RemoveAtEnd(), and ns3::PacketMetadata::RemoveTrailer().
Referenced by LrWpanPacketTestCase::DoRun(), PacketTest::DoRun(), ns3::LrWpanMac::PdDataIndication(), ns3::CsmaNetDevice::Receive(), ns3::MacLow::ReceiveOk(), and ns3::MacLow::StoreMpduIfNeeded().
bool ns3::Packet::ReplacePacketTag | ( | Tag & | tag | ) |
Replace the value of a packet tag.
tag | the packet tag type to replace. To get the old value of the tag, use PeekPacketTag first. |
Definition at line 836 of file packet.cc.
References ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Tag::GetSerializedSize(), m_packetTagList, NS_LOG_FUNCTION, and ns3::PacketTagList::Replace().
Referenced by ns3::LrWpanPhy::CheckInterference().
uint32_t ns3::Packet::Serialize | ( | uint8_t * | buffer, |
uint32_t | maxSize | ||
) | const |
Serialize a packet, tags, and metadata into a byte buffer.
buffer | a raw byte buffer to which the packet will be serialized |
maxSize | the max size of the buffer for bounds checking |
Definition at line 589 of file packet.cc.
References ns3::NixVector::GetSerializedSize(), ns3::PacketMetadata::GetSerializedSize(), ns3::Buffer::GetSerializedSize(), m_buffer, m_metadata, m_nixVector, ns3::NixVector::Serialize(), ns3::PacketMetadata::Serialize(), and ns3::Buffer::Serialize().
Referenced by LrWpanPacketTestCase::DoRun(), ns3::GrantedTimeWindowMpiInterface::SendPacket(), and ns3::NullMessageMpiInterface::SendPacket().
Set the packet nix-vector.
Note: This function supports a temporary solution to a specific problem in this generic class, i.e. how to associate something specific like nix-vector with a packet. This design methodology should not be followed, and is only here as an impetus to fix this general issue.
nixVector | the nix vector |
Definition at line 243 of file packet.cc.
References m_nixVector.
Referenced by ns3::Ipv4NixVectorRouting::RouteOutput().
std::string ns3::Packet::ToString | ( | void | ) | const |
|
private |
the packet buffer (it's actual contents)
Definition at line 716 of file packet.h.
Referenced by AddAtEnd(), AddHeader(), AddPaddingAtEnd(), AddTrailer(), BeginItem(), CopyData(), CreateFragment(), Deserialize(), GetSerializedSize(), GetSize(), operator=(), Packet(), PeekHeader(), PeekTrailer(), Print(), RemoveAtEnd(), RemoveAtStart(), RemoveHeader(), RemoveTrailer(), and Serialize().
|
private |
the ByteTag list
Definition at line 717 of file packet.h.
Referenced by AddAtEnd(), AddByteTag(), AddHeader(), AddPaddingAtEnd(), AddTrailer(), CreateFragment(), GetByteTagIterator(), operator=(), RemoveAllByteTags(), RemoveAtStart(), and RemoveHeader().
|
staticprivate |
|
private |
the packet's metadata
Definition at line 719 of file packet.h.
Referenced by AddAtEnd(), AddHeader(), AddPaddingAtEnd(), AddTrailer(), BeginItem(), CreateFragment(), Deserialize(), GetSerializedSize(), GetUid(), operator=(), Print(), RemoveAtEnd(), RemoveAtStart(), RemoveHeader(), RemoveTrailer(), and Serialize().
the packet's Nix vector
Definition at line 722 of file packet.h.
Referenced by Deserialize(), GetNixVector(), GetSerializedSize(), operator=(), Packet(), Serialize(), and SetNixVector().
|
private |
the packet's Tag list
Definition at line 718 of file packet.h.
Referenced by AddPacketTag(), CreateFragment(), GetPacketTagIterator(), operator=(), PeekPacketTag(), RemoveAllPacketTags(), RemovePacketTag(), and ReplacePacketTag().