21 #include "ns3/ipv4-flow-probe.h"
22 #include "ns3/ipv4-flow-classifier.h"
24 #include "ns3/packet.h"
25 #include "ns3/flow-monitor.h"
27 #include "ns3/pointer.h"
28 #include "ns3/config.h"
29 #include "ns3/flow-id-tag.h"
61 virtual void Print (std::ostream &os)
const;
112 .AddConstructor<Ipv4FlowProbeTag> ()
153 :
Tag (), m_flowId (flowId), m_packetId (packetId), m_packetSize (packetSize)
196 m_classifier (classifier)
202 if (!ipv4->TraceConnectWithoutContext (
"SendOutgoing",
207 if (!ipv4->TraceConnectWithoutContext (
"UnicastForward",
212 if (!ipv4->TraceConnectWithoutContext (
"LocalDeliver",
218 if (!ipv4->TraceConnectWithoutContext (
"Drop",
225 std::ostringstream oss;
226 oss <<
"/NodeList/" << node->
GetId () <<
"/DeviceList/*/TxQueue/Drop";
246 if (
m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
249 NS_LOG_DEBUG (
"ReportFirstTx ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
"); "
250 << ipHeader << *ipPayload);
266 if (
m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
269 NS_LOG_DEBUG (
"ReportForwarding ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
");");
270 m_flowMonitor->ReportForwarding (
this, flowId, packetId, size);
281 if (
m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
287 ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
290 NS_LOG_DEBUG (
"ReportLastRx ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
");");
308 Ipv4Mask maski = m_ipv4->GetNetworkMask (ifIndex);
320 if (
m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
326 ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
329 NS_LOG_DEBUG (
"Drop ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
", " << reason
331 <<
"HDR: " << ipHeader <<
" PKT: " << *ipPayload);
368 m_flowMonitor->ReportDrop (
this, flowId, packetId, size, myReason);
380 tagFound = ConstCast<Packet> (ipPayload)->RemovePacketTag (fTag);
uint32_t FlowPacketId
Abstract identifier of a packet within a flow.
Tag used to allow a fast identification of the packet.
void ForwardUpLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being received by the destination.
uint32_t m_flowId
flow identifier
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
void SetPacketSize(uint32_t packetSize)
Set the packet size.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
a class to represent an Ipv4 address mask
Ipv4FlowProbe(Ptr< FlowMonitor > monitor, Ptr< Ipv4FlowClassifier > classifier, Ptr< Node > node)
Constructor.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Fallback reason (no known reason)
uint32_t GetSize(void) const
Fragment timeout exceeded.
TAG_BUFFER_INLINE uint32_t ReadU32(void)
void SendOutgoingLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being sent.
Ptr< FlowMonitor > m_flowMonitor
the FlowMonitor instance
#define NS_FATAL_ERROR(msg)
fatal error handling
Ipv4Address GetSubnetDirectedBroadcast(Ipv4Mask const &mask) const
Generate subnet-directed broadcast address corresponding to mask.
virtual uint32_t GetSerializedSize(void) const
DropReason
Reason why a packet has been dropped.
void ForwardLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being forwarded.
void SetFlowId(uint32_t flowId)
Set the flow identifier.
uint32_t m_packetSize
packet size
virtual void Serialize(TagBuffer buf) const
void QueueDropLogger(Ptr< const Packet > ipPayload)
Log a packet being dropped by a queue.
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
void SetPacketId(uint32_t packetId)
Set the packet identifier.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
uint32_t GetPacketId(void) const
Set the packet identifier.
Packet dropped due to invalid checksum in the IPv4 header.
tag a set of bytes in a packet
uint32_t m_packetId
packet identifier
Implement the Ipv4 layer.
virtual void Print(std::ostream &os) const
Ptr< Ipv4FlowClassifier > m_classifier
the Ipv4FlowClassifier this probe is associated with
virtual TypeId GetInstanceTypeId(void) const
virtual void Deserialize(TagBuffer buf)
uint32_t GetFlowId(void) const
Set the flow identifier.
The FlowProbe class is responsible for listening for packet events in a specific point of the simulat...
Packet dropped due to TTL decremented to zero during IPv4 forwarding.
uint32_t GetPacketSize(void) const
Get the packet size.
Ipv4 addresses are stored in host order in this class.
uint32_t GetId(void) const
Packet dropped due to queue overflow.
Interface is down so can not send packet.
#define NS_LOG_DEBUG(msg)
Fragment timeout exceeded.
Packet dropped due to missing route to the destination.
Interface is down so can not send packet.
DropReason
enumeration of possible reasons why a packet may be dropped
Ptr< T > GetObject(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
static TypeId GetTypeId(void)
Get the type ID.
uint32_t FlowId
Abstract identifier of a packet flow.
void DropLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, Ipv4L3Protocol::DropReason reason, Ptr< Ipv4 > ipv4, uint32_t ifIndex)
Log a packet being dropped.