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"
60 virtual void Print (std::ostream &os)
const;
111 .SetGroupName (
"FlowMonitor")
153 :
Tag (), m_flowId (flowId), m_packetId (packetId), m_packetSize (packetSize)
196 m_classifier (classifier)
202 if (!m_ipv4->TraceConnectWithoutContext (
"SendOutgoing",
207 if (!m_ipv4->TraceConnectWithoutContext (
"UnicastForward",
212 if (!m_ipv4->TraceConnectWithoutContext (
"LocalDeliver",
218 if (!m_ipv4->TraceConnectWithoutContext (
"Drop",
225 std::ostringstream oss;
226 oss <<
"/NodeList/" << node->
GetId () <<
"/DeviceList/*/TxQueue/Drop";
254 if (
m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
257 NS_LOG_DEBUG (
"ReportFirstTx ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
"); "
258 << ipHeader << *ipPayload);
280 NS_LOG_DEBUG (
"ReportForwarding ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
");");
281 m_flowMonitor->ReportForwarding (
this, flowId, packetId, size);
297 NS_LOG_DEBUG (
"ReportLastRx ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
");");
333 NS_LOG_DEBUG (
"Drop ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
", " << reason
335 <<
"HDR: " << ipHeader <<
" PKT: " << *ipPayload);
372 m_flowMonitor->ReportDrop (
this, flowId, packetId, size, myReason);
uint32_t FlowPacketId
Abstract identifier of a packet within a flow.
Tag used to allow a fast identification of the packet.
bool FindFirstMatchingByteTag(Tag &tag) const
Finds the first tag matching the parameter Tag type.
void ForwardUpLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being received by the destination.
Interface is down so can not send packet.
uint32_t m_flowId
flow identifier
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual void DoDispose(void)
Destructor implementation.
void SetPacketSize(uint32_t packetSize)
Set the packet size.
DropReason
enumeration of possible reasons why a packet may be dropped
a class to represent an Ipv4 address mask
Packet dropped due to TTL decremented to zero during IPv4 forwarding.
Ipv4FlowProbe(Ptr< FlowMonitor > monitor, Ptr< Ipv4FlowClassifier > classifier, Ptr< Node > node)
Constructor.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Fragment timeout exceeded.
#define NS_FATAL_ERROR(msg)
Fatal error handling.
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
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.
Packet dropped due to queue overflow.
Fragment timeout exceeded.
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)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void Print(std::ostream &os) const
Ptr< Ipv4FlowClassifier > m_classifier
the Ipv4FlowClassifier this probe is associated with
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
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...
uint32_t GetPacketSize(void) const
Get the packet size.
Fallback reason (no known reason)
Ipv4 addresses are stored in host order in this class.
uint32_t GetId(void) const
Packet dropped due to missing route to the destination.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Interface is down so can not send packet.
static const uint32_t packetSize
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Ptr< Ipv4L3Protocol > m_ipv4
the Ipv4L3Protocol this probe is bound to
virtual void DoDispose(void)
Destructor implementation.
static TypeId GetTypeId(void)
Get the type ID.
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
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.