ns-3
|
network packets More...
#include <packet.h>
Public Member Functions | |
Packet () | |
Packet (const Packet &o) | |
Packet & | operator= (const Packet &o) |
Packet (uint32_t size) | |
Packet (uint8_t const *buffer, uint32_t size, bool magic) | |
Packet (uint8_t const *buffer, uint32_t size) | |
Ptr< Packet > | CreateFragment (uint32_t start, uint32_t length) const |
uint32_t | GetSize (void) const |
void | AddHeader (const Header &header) |
uint32_t | RemoveHeader (Header &header) |
uint32_t | PeekHeader (Header &header) const |
void | AddTrailer (const Trailer &trailer) |
uint32_t | RemoveTrailer (Trailer &trailer) |
uint32_t | PeekTrailer (Trailer &trailer) |
void | AddAtEnd (Ptr< const Packet > packet) |
void | AddPaddingAtEnd (uint32_t size) |
void | RemoveAtEnd (uint32_t size) |
void | RemoveAtStart (uint32_t size) |
uint8_t const * | PeekData (void) const NS_DEPRECATED |
uint32_t | CopyData (uint8_t *buffer, uint32_t size) const |
void | CopyData (std::ostream *os, uint32_t size) const |
Ptr< Packet > | Copy (void) const |
uint64_t | GetUid (void) const |
void | Print (std::ostream &os) const |
PacketMetadata::ItemIterator | BeginItem (void) const |
uint32_t | GetSerializedSize (void) const |
uint32_t | Serialize (uint8_t *buffer, uint32_t maxSize) const |
void | AddByteTag (const Tag &tag) const |
ByteTagIterator | GetByteTagIterator (void) const |
bool | FindFirstMatchingByteTag (Tag &tag) const |
void | RemoveAllByteTags (void) |
void | PrintByteTags (std::ostream &os) const |
void | AddPacketTag (const Tag &tag) const |
bool | RemovePacketTag (Tag &tag) |
bool | PeekPacketTag (Tag &tag) const |
void | RemoveAllPacketTags (void) |
void | PrintPacketTags (std::ostream &os) const |
PacketTagIterator | GetPacketTagIterator (void) const |
void | SetNixVector (Ptr< NixVector >) |
Ptr< NixVector > | GetNixVector (void) const |
![]() | |
SimpleRefCount (const SimpleRefCount &o) | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
uint32_t | GetReferenceCount (void) const |
Static Public Member Functions | |
static void | EnablePrinting (void) |
static void | EnableChecking (void) |
![]() | |
static void | Cleanup (void) |
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 of the Packet API are discussed in Packet Performance
ns3::Packet::Packet | ( | ) |
Create an empty packet with a new uid (as returned by getUid).
Referenced by CreateFragment().
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 |
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 |
References 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. |
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), and ns3::Buffer::Iterator::Write().
Concatenate the input packet at the end of the current packet. This does not alter the uid of either packet.
packet | packet to concatenate |
References ns3::ByteTagList::Add(), ns3::ByteTagList::AddAtEnd(), ns3::Buffer::AddAtEnd(), ns3::ByteTagList::AddAtStart(), GetSize(), ns3::Buffer::GetSize(), and NS_LOG_FUNCTION.
Referenced by ns3::CsmaNetDevice::AddHeader(), ns3::MsduStandardAggregator::Aggregate(), ns3::TcpTxBuffer::CopyFromSequence(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), and ns3::Icmpv6L4Protocol::SendRedirection().
void ns3::Packet::AddByteTag | ( | const Tag & | tag | ) | const |
tag | the new tag to add to this packet |
Tag each byte included in this packet with the new tag.
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).
References ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Tag::GetSerializedSize(), NS_LOG_FUNCTION, and ns3::Tag::Serialize().
Referenced by ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), and ns3::DelayJitterEstimation::PrepareTx().
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. |
References ns3::ByteTagList::AddAtStart(), ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Header::GetSerializedSize(), NS_LOG_FUNCTION, and ns3::Header::Serialize().
Referenced by ns3::CsmaNetDevice::AddHeader(), ns3::MsduStandardAggregator::Aggregate(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::MeshWifiBeacon::CreatePacket(), ns3::WimaxMacQueue::Dequeue(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::UanMacAloha::Enqueue(), ns3::UanMacCw::Enqueue(), ns3::SubscriberStationNetDevice::Enqueue(), ns3::Icmpv6L4Protocol::ForgeEchoRequest(), ns3::Icmpv6L4Protocol::ForgeNA(), ns3::Icmpv6L4Protocol::ForgeNS(), ns3::Icmpv6L4Protocol::ForgeRS(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::dsr::DsrRouting::PacketNewRoute(), ns3::WimaxMacQueue::Peek(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::NscTcpL4Protocol::Receive(), ns3::flame::FlameProtocol::RequestRoute(), ns3::UdpL4Protocol::Send(), ns3::WifiNetDevice::Send(), ns3::TcpL4Protocol::Send(), ns3::Ipv4L3Protocol::Send(), ns3::WimaxNetDevice::Send(), ns3::RegularWifiMac::SendAddBaResponse(), ns3::Icmpv6L4Protocol::SendEchoReply(), ns3::WifiNetDevice::SendFrom(), ns3::AlohaNoackNetDevice::SendFrom(), ns3::EmuNetDevice::SendFrom(), ns3::WimaxNetDevice::SendFrom(), ns3::dsr::DsrRouting::SendGratuitousReply(), ns3::Icmpv6L4Protocol::SendMessage(), ns3::Icmpv6L4Protocol::SendNA(), ns3::Icmpv6L4Protocol::SendNS(), ns3::Icmpv6L4Protocol::SendRedirection(), ns3::Icmpv6L4Protocol::SendRS(), ns3::Ipv6RawSocketImpl::SendTo(), ns3::EpcEnbApplication::SendToS1uSocket(), ns3::EpcSgwPgwApplication::SendToS1uSocket(), and ns3::dot11s::HwmpProtocolMac::UpdateOutcomingFrame().
void ns3::Packet::AddPacketTag | ( | const Tag & | tag | ) | const |
tag | the tag to store in this packet |
Add a tag to this packet. This method calls the Tag::GetSerializedSize and, then, Tag::Serialize.
Note that this method is const, that is, it does not modify the state of this packet, which is fairly un-intuitive.
References ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Tag::GetSerializedSize(), and NS_LOG_FUNCTION.
Referenced by ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::LteRlcUm::DoTransmitPdcpPdu(), ns3::LteRlcAm::DoTransmitPdcpPdu(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::WifiRemoteStationManager::PrepareForQueue(), ns3::dsr::DsrOptionRreq::Process(), ns3::flame::FlameProtocolMac::Receive(), ns3::TcpSocketBase::Recv(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::aodv::RoutingProtocol::RouteOutput(), ns3::dsdv::RoutingProtocol::RouteOutput(), ns3::Icmpv6L4Protocol::SendMessage(), ns3::EpcEnbApplication::SendToLteSocket(), and ns3::LteSpectrumPhy::StartTx().
void ns3::Packet::AddPaddingAtEnd | ( | uint32_t | size | ) |
size | number of padding bytes to add. |
References ns3::ByteTagList::AddAtEnd(), ns3::Buffer::AddAtEnd(), and NS_LOG_FUNCTION.
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. |
References ns3::ByteTagList::AddAtEnd(), ns3::Buffer::AddAtEnd(), ns3::Buffer::End(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Trailer::GetSerializedSize(), NS_LOG_FUNCTION, and ns3::Trailer::Serialize().
Referenced by ns3::CsmaNetDevice::AddHeader().
PacketMetadata::ItemIterator ns3::Packet::BeginItem | ( | void | ) | const |
The returns packet will behave like an independent copy of the original packet, even though they both share the same datasets internally.
Referenced by ns3::MsduStandardAggregator::Aggregate(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::IpcsClassifier::Classify(), ns3::EpcTftClassifier::Classify(), ns3::PacketBurst::Copy(), ns3::WimaxMacQueue::Dequeue(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::Icmpv6L4Protocol::ForgeEchoRequest(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::HalfDuplexIdealPhySignalParameters::HalfDuplexIdealPhySignalParameters(), ns3::AlohaNoackNetDevice::NotifyReceptionEndOk(), ns3::dsr::DsrRouting::PacketNewRoute(), ns3::WimaxMacQueue::Peek(), ns3::Ipv6OptionPad1::Process(), ns3::Ipv6ExtensionHopByHop::Process(), ns3::Ipv6OptionPadn::Process(), ns3::Ipv6ExtensionDestination::Process(), ns3::Ipv6OptionJumbogram::Process(), ns3::Ipv6ExtensionFragment::Process(), ns3::dsr::DsrOptionPad1::Process(), ns3::Ipv6OptionRouterAlert::Process(), ns3::dsr::DsrOptionPadn::Process(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::dsr::DsrOptionAckReq::Process(), ns3::dsr::DsrOptionAck::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::dot11s::PeerManagementProtocolMac::Receive(), ns3::ArpL3Protocol::Receive(), ns3::UdpL4Protocol::Receive(), ns3::Ipv6L3Protocol::Receive(), ns3::Ipv4L3Protocol::Receive(), ns3::CsmaNetDevice::Receive(), ns3::Icmpv6L4Protocol::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::EpcSgwPgwApplication::RecvFromTunDevice(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::Ipv4ListRouting::RouteInput(), ns3::Ipv6ListRouting::RouteInput(), ns3::YansWifiChannel::Send(), ns3::Ipv4L3Protocol::Send(), ns3::Icmpv6L4Protocol::SendEchoReply(), ns3::MacLow::StartTransmission(), ns3::CsmaChannel::TransmitEnd(), and ns3::UanChannel::TxPacket().
uint32_t ns3::Packet::CopyData | ( | uint8_t * | buffer, |
uint32_t | size | ||
) | const |
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.
References ns3::Buffer::CopyData().
Referenced by ns3::EthernetTrailer::CalcFcs(), ns3::EthernetTrailer::CheckFcs(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::dsr::DsrOptionRerr::DoSendError(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::NscTcpL4Protocol::Receive(), ns3::Icmpv6L4Protocol::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::Socket::Recv(), ns3::Socket::RecvFrom(), ns3::EmuNetDevice::SendFrom(), ns3::Ipv6RawSocketImpl::SendTo(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6TooBig::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), ns3::Icmpv6ParameterError::Serialize(), ns3::Icmpv6OptionRedirected::Serialize(), and ns3::PcapFile::Write().
void ns3::Packet::CopyData | ( | std::ostream * | os, |
uint32_t | size | ||
) | const |
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. |
References ns3::Buffer::CopyData().
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 |
References ns3::PacketMetadata::CreateFragment(), ns3::Buffer::CreateFragment(), ns3::Buffer::GetSize(), NS_ASSERT, NS_LOG_FUNCTION, and Packet().
Referenced by ns3::TcpRxBuffer::Add(), ns3::TcpTxBuffer::CopyFromSequence(), ns3::WimaxMacQueue::Dequeue(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::Ipv4RawSocketImpl::RecvFrom(), ns3::Ipv6RawSocketImpl::RecvFrom(), ns3::Icmpv6L4Protocol::SendErrorDestinationUnreachable(), ns3::Icmpv6L4Protocol::SendErrorParameterError(), ns3::Icmpv6L4Protocol::SendErrorTimeExceeded(), ns3::Icmpv6L4Protocol::SendErrorTooBig(), and ns3::Icmpv6L4Protocol::SendRedirection().
|
static |
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.
References NS_LOG_FUNCTION_NOARGS.
|
static |
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.
References NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::UanHelper::EnableAscii(), and ns3::AnimationInterface::EnablePacketMetadata().
bool ns3::Packet::FindFirstMatchingByteTag | ( | Tag & | tag | ) | const |
tag | the tag to search in this packet |
If the requested tag type is found, it is copied in the user's provided tag instance.
References GetByteTagIterator(), ns3::ObjectBase::GetInstanceTypeId(), ns3::ByteTagIterator::Item::GetTag(), ns3::ByteTagIterator::Item::GetTypeId(), ns3::ByteTagIterator::HasNext(), and ns3::ByteTagIterator::Next().
Referenced by ns3::DelayJitterEstimation::RecordRx().
ByteTagIterator ns3::Packet::GetByteTagIterator | ( | void | ) | const |
References ns3::ByteTagList::Begin().
Referenced by FindFirstMatchingByteTag(), and PrintByteTags().
PacketTagIterator ns3::Packet::GetPacketTagIterator | ( | void | ) | const |
Referenced by PrintPacketTags().
uint32_t ns3::Packet::GetSerializedSize | ( | void | ) | const |
For packet serializtion, the total size is checked in order to determine the size of the buffer required for serialization
References ns3::NixVector::GetSerializedSize(), and ns3::Buffer::GetSerializedSize().
Referenced by ns3::MpiInterface::SendPacket().
|
inline |
References ns3::Buffer::GetSize().
Referenced by ns3::TcpRxBuffer::Add(), ns3::TcpTxBuffer::Add(), AddAtEnd(), ns3::CsmaNetDevice::AddHeader(), ns3::MsduStandardAggregator::Aggregate(), ns3::EthernetTrailer::CalcFcs(), ns3::UanPhyPerUmodem::CalcPer(), ns3::EthernetTrailer::CheckFcs(), ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::TcpTxBuffer::CopyFromSequence(), ns3::WimaxMacQueue::Dequeue(), ns3::Queue::Dequeue(), ns3::TcpSocketBase::DoForwardUp(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::LteEnbMac::DoReceivePhyPdu(), ns3::dsr::DsrOptionRerr::DoSendError(), ns3::LteRlcUm::DoTransmitPdcpPdu(), ns3::LteRlcAm::DoTransmitPdcpPdu(), ns3::Queue::Enqueue(), ns3::UanMacCw::Enqueue(), ns3::BaseStationNetDevice::Enqueue(), ns3::SubscriberStationNetDevice::Enqueue(), ns3::Icmpv6L4Protocol::ForgeNA(), ns3::Icmpv6L4Protocol::ForgeNS(), ns3::Icmpv6L4Protocol::ForgeRS(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::WifiRemoteStationManager::GetFragmentSize(), ns3::Icmpv6DestinationUnreachable::GetSerializedSize(), ns3::Icmpv6TooBig::GetSerializedSize(), ns3::Icmpv6TimeExceeded::GetSerializedSize(), ns3::Icmpv6ParameterError::GetSerializedSize(), ns3::Icmpv6OptionRedirected::GetSerializedSize(), ns3::PacketBurst::GetSize(), ns3::WifiRemoteStationManager::NeedFragmentation(), ns3::WifiRemoteStationManager::NeedRts(), ns3::TcpSocketBase::PeerClose(), ns3::Ipv6ExtensionFragment::Process(), ns3::dsr::DsrOptionRreq::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::TcpSocketBase::ProcessWait(), ns3::DcaTxop::Queue(), ns3::flame::FlameProtocolMac::Receive(), ns3::UanTransducerHd::Receive(), ns3::dot11s::PeerManagementProtocolMac::Receive(), ns3::ArpL3Protocol::Receive(), ns3::NscTcpL4Protocol::Receive(), ns3::TcpL4Protocol::Receive(), ns3::CsmaNetDevice::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::TcpSocketBase::ReceivedAck(), ns3::UdpSocketImpl::Recv(), ns3::NscTcpSocketImpl::Recv(), ns3::TcpSocketBase::Recv(), ns3::PacketSocket::Recv(), ns3::Socket::Recv(), ns3::TcpSocketBase::RecvFrom(), ns3::Socket::RecvFrom(), ns3::EpcSgwPgwApplication::RecvFromTunDevice(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::dsdv::RoutingProtocol::RouteOutput(), ns3::SSScheduler::Schedule(), ns3::NscTcpSocketImpl::Send(), ns3::TcpSocketBase::Send(), ns3::LteUeRrc::Send(), ns3::Ipv6L3Protocol::Send(), ns3::Ipv4L3Protocol::Send(), ns3::TcpSocketBase::SendDataPacket(), ns3::Icmpv6L4Protocol::SendEchoReply(), ns3::Icmpv6L4Protocol::SendErrorDestinationUnreachable(), ns3::Icmpv6L4Protocol::SendErrorParameterError(), ns3::Icmpv6L4Protocol::SendErrorTimeExceeded(), ns3::Icmpv6L4Protocol::SendErrorTooBig(), ns3::EmuNetDevice::SendFrom(), ns3::MeshWifiInterfaceMac::SendManagementFrame(), ns3::Icmpv6L4Protocol::SendMessage(), ns3::Icmpv6L4Protocol::SendNA(), ns3::Icmpv6L4Protocol::SendNS(), ns3::YansWifiPhy::SendPacket(), ns3::UanPhyGen::SendPacket(), ns3::Icmpv6L4Protocol::SendRedirection(), ns3::Icmpv6L4Protocol::SendRS(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::PacketSocket::SendTo(), ns3::Ipv6RawSocketImpl::SendTo(), ns3::EpcEnbApplication::SendToS1uSocket(), ns3::EpcSgwPgwApplication::SendToS1uSocket(), ns3::EpcSgwPgwApplication::SendToTunDevice(), ns3::Icmpv6DestinationUnreachable::Serialize(), ns3::Icmpv6TooBig::Serialize(), ns3::Icmpv6TimeExceeded::Serialize(), ns3::Icmpv6ParameterError::Serialize(), ns3::Icmpv6OptionRedirected::Serialize(), ns3::Icmpv6DestinationUnreachable::SetPacket(), ns3::Icmpv6TooBig::SetPacket(), ns3::Icmpv6TimeExceeded::SetPacket(), ns3::Icmpv6ParameterError::SetPacket(), ns3::Icmpv6OptionRedirected::SetPacket(), ns3::UanPhyGen::StartRxPacket(), ns3::HalfDuplexIdealPhy::StartTx(), ns3::UanTransducerHd::Transmit(), ns3::flame::FlameProtocolMac::UpdateOutcomingFrame(), ns3::dot11s::HwmpProtocolMac::UpdateOutcomingFrame(), and ns3::PcapFile::Write().
uint64_t ns3::Packet::GetUid | ( | void | ) | const |
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.
Referenced by ns3::Icmpv6L4Protocol::DoDAD(), ns3::aodv::RequestQueue::Enqueue(), ns3::dsdv::PacketQueue::Enqueue(), ns3::aodv::DuplicatePacketDetection::IsDuplicate(), ns3::dsr::DsrRouting::PacketNewRoute(), ns3::CsmaChannel::PropagationCompleteEvent(), ns3::CsmaNetDevice::Receive(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::dsdv::RoutingProtocol::RouteOutput(), ns3::PointToPointNetDevice::Send(), ns3::EmuNetDevice::SendFrom(), ns3::CsmaNetDevice::SendFrom(), ns3::CsmaChannel::TransmitEnd(), ns3::PointToPointRemoteChannel::TransmitStart(), ns3::PointToPointChannel::TransmitStart(), and ns3::CsmaChannel::TransmitStart().
uint8_t const * ns3::Packet::PeekData | ( | void | ) | const |
If you try to change the content of the buffer returned by this method, you will die. Note that this method is now deprecated and will be removed in the next version of ns-3. If you need to get access to the content of the byte buffer of a packet, you need to call ns3::Packet::CopyData to perform an explicit copy.
References NS_LOG_FUNCTION, and ns3::Buffer::PeekData().
uint32_t ns3::Packet::PeekHeader | ( | Header & | header | ) | const |
Deserialize but does not remove the header from the internal buffer. This method invokes Header::Deserialize.
header | a reference to the header to read from the internal buffer. |
References ns3::Buffer::Begin(), ns3::Header::Deserialize(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), and NS_LOG_FUNCTION.
Referenced by ns3::UanPhyCalcSinrDual::CalcSinrDb(), ns3::Ipv4FlowClassifier::Classify(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::UdpL4Protocol::Receive(), ns3::TcpL4Protocol::Receive(), and ns3::dot11s::PeerManagementProtocolMac::UpdateOutcomingFrame().
bool ns3::Packet::PeekPacketTag | ( | Tag & | tag | ) | const |
tag | the tag to search in this packet |
Search a matching tag and call Tag::Deserialize if it is found.
Referenced by ns3::QosUtilsGetTidForPacket(), ns3::flame::FlameProtocolMac::Receive(), ns3::UdpSocketImpl::RecvFrom(), ns3::NscTcpSocketImpl::RecvFrom(), ns3::PacketSocket::RecvFrom(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::aodv::RoutingProtocol::RouteOutput(), and ns3::dsdv::RoutingProtocol::RouteOutput().
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. |
References ns3::Trailer::Deserialize(), ns3::Buffer::End(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), and NS_LOG_FUNCTION.
void ns3::Packet::Print | ( | std::ostream & | os | ) | const |
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.
References ns3::ObjectBase::GetAttribute(), ns3::TypeId::GetAttributeN(), ns3::TypeId::GetConstructor(), ns3::TypeId::GetName(), ns3::TypeId::HasConstructor(), and NS_ASSERT.
Referenced by ns3::Ipv6ExtensionFragment::GetFragments().
void ns3::Packet::PrintByteTags | ( | std::ostream & | os | ) | const |
os | output stream in which the data should be printed. |
Iterate over the tags present in this packet, and invoke the Print method of each tag stored in the packet.
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::ByteTagIterator::Next(), NS_ASSERT, and ns3::Tag::Print().
void ns3::Packet::PrintPacketTags | ( | std::ostream & | os | ) | const |
os | the stream in which we want to print data. |
Print the list of 'packet' tags.
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 the tags stored in this packet.
References NS_LOG_FUNCTION.
void ns3::Packet::RemoveAllPacketTags | ( | void | ) |
Remove all packet tags.
References NS_LOG_FUNCTION.
void ns3::Packet::RemoveAtEnd | ( | uint32_t | size | ) |
Remove size bytes from the end of the current packet It is safe to remove more bytes that what is present in the packet.
size | number of bytes from remove |
References NS_LOG_FUNCTION, and ns3::Buffer::RemoveAtEnd().
Referenced by 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 that what is present in the packet.
size | number of bytes from remove |
References NS_LOG_FUNCTION, and ns3::Buffer::RemoveAtStart().
Referenced by ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::Ipv6OptionPad1::Process(), ns3::Ipv6ExtensionHopByHop::Process(), ns3::Ipv6OptionPadn::Process(), ns3::Ipv6ExtensionDestination::Process(), ns3::Ipv6OptionJumbogram::Process(), ns3::Ipv6ExtensionFragment::Process(), ns3::Ipv6OptionRouterAlert::Process(), ns3::Ipv6ExtensionRouting::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::Ipv6Extension::ProcessOptions(), ns3::dsr::DsrRouting::Receive(), ns3::Ipv4RawSocketImpl::RecvFrom(), and ns3::Ipv6RawSocketImpl::RecvFrom().
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. |
References ns3::Buffer::Begin(), ns3::Header::Deserialize(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), NS_LOG_FUNCTION, and ns3::Buffer::RemoveAtStart().
Referenced by ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::IpcsClassifier::Classify(), ns3::EpcTftClassifier::Classify(), ns3::TcpSocketBase::DoForwardUp(), ns3::dsr::DsrOptionRerr::DoSendError(), ns3::Ipv6ExtensionFragment::GetFragments(), ns3::AlohaNoackNetDevice::NotifyReceptionEndOk(), ns3::Ipv6OptionPad1::Process(), ns3::Ipv6ExtensionHopByHop::Process(), ns3::Ipv6OptionPadn::Process(), ns3::Ipv6ExtensionDestination::Process(), ns3::Ipv6OptionJumbogram::Process(), ns3::Ipv6ExtensionFragment::Process(), ns3::dsr::DsrOptionPad1::Process(), ns3::Ipv6OptionRouterAlert::Process(), ns3::dsr::DsrOptionPadn::Process(), ns3::dsr::DsrOptionRrep::Process(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrOptionRerr::Process(), ns3::Ipv6ExtensionLooseRouting::Process(), ns3::dsr::DsrOptionAckReq::Process(), ns3::dsr::DsrOptionAck::Process(), ns3::Icmpv4L4Protocol::Receive(), ns3::dot11s::PeerManagementProtocolMac::Receive(), ns3::UdpL4Protocol::Receive(), ns3::CsmaNetDevice::Receive(), ns3::RegularWifiMac::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::MacLow::ReceiveOk(), ns3::EpcEnbApplication::RecvFromS1uSocket(), ns3::EpcSgwPgwApplication::RecvFromS1uSocket(), ns3::flame::FlameProtocol::RemoveRoutingStuff(), ns3::flame::FlameProtocol::RequestRoute(), ns3::Ipv4RawSocketImpl::SendTo(), and ns3::Ipv6RawSocketImpl::SendTo().
bool ns3::Packet::RemovePacketTag | ( | Tag & | tag | ) |
tag | the tag to remove from this packet |
Remove a tag from this packet. This method calls Tag::Deserialize if the tag is found.
References ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), ns3::Tag::GetSerializedSize(), NS_LOG_FUNCTION, and ns3::PacketTagList::Remove().
Referenced by ns3::LteRlcUm::DoNotifyTxOpportunity(), ns3::LteRlcAm::DoNotifyTxOpportunity(), ns3::LteEnbMac::DoReceivePhyPdu(), ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::MacLow::ReceiveOk(), ns3::EpcEnbApplication::RecvFromLteSocket(), ns3::EpcEnbApplication::RecvFromS1uSocket(), ns3::EpcSgwPgwApplication::RecvFromS1uSocket(), ns3::dot11s::HwmpProtocol::RemoveRoutingStuff(), ns3::flame::FlameProtocol::RemoveRoutingStuff(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::Ipv6L3Protocol::Send(), ns3::Ipv4L3Protocol::Send(), ns3::LteEnbRrc::Send(), ns3::LteSpectrumPhy::StartRx(), 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. |
References ns3::Trailer::Deserialize(), ns3::Buffer::End(), ns3::ObjectBase::GetInstanceTypeId(), ns3::TypeId::GetName(), NS_LOG_FUNCTION, and ns3::Buffer::RemoveAtEnd().
Referenced by ns3::CsmaNetDevice::Receive(), and ns3::MacLow::ReceiveOk().