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;
125 .SetGroupName (
"FlowMonitor")
138 return 4 + 4 + 4 + 8;
179 :
Tag (), m_flowId (flowId), m_packetId (packetId), m_packetSize (
packetSize), m_src (src), m_dst (dst)
227 m_classifier (classifier)
233 if (!
m_ipv4->TraceConnectWithoutContext (
"SendOutgoing",
238 if (!
m_ipv4->TraceConnectWithoutContext (
"UnicastForward",
243 if (!
m_ipv4->TraceConnectWithoutContext (
"LocalDeliver",
249 if (!
m_ipv4->TraceConnectWithoutContext (
"Drop",
255 std::ostringstream qd;
256 qd <<
"/NodeList/" << node->
GetId () <<
"/$ns3::TrafficControlLayer/RootQueueDiscList/*/Drop";
260 std::ostringstream oss;
261 oss <<
"/NodeList/" << node->
GetId () <<
"/DeviceList/*/TxQueue/Drop";
275 .SetGroupName (
"FlowMonitor")
309 if (
m_classifier->Classify (ipHeader, ipPayload, &flowId, &packetId))
312 NS_LOG_DEBUG (
"ReportFirstTx ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
"); " 313 << ipHeader << *ipPayload);
346 NS_LOG_DEBUG (
"ReportForwarding ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
");");
347 m_flowMonitor->ReportForwarding (
this, flowId, packetId, size);
369 NS_LOG_DEBUG (
"ReportLastRx ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
"); " 370 << ipHeader << *ipPayload);
406 NS_LOG_DEBUG (
"Drop ("<<
this<<
", "<<flowId<<
", "<<packetId<<
", "<<size<<
", " << reason
408 <<
"HDR: " << ipHeader <<
" PKT: " << *ipPayload);
445 m_flowMonitor->ReportDrop (
this, flowId, packetId, size, myReason);
474 bool tagFound = item->GetPacket ()->FindFirstMatchingByteTag (fTag);
uint32_t FlowPacketId
Abstract identifier of a packet within a flow.
bool FindFirstMatchingByteTag(Tag &tag) const
Finds the first tag matching the parameter Tag type.
Tag used to allow a fast identification of the packet.
static Ipv4Address Deserialize(const uint8_t buf[4])
void ForwardUpLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being received by the destination.
void Write(const uint8_t *buffer, uint32_t size)
virtual void Serialize(TagBuffer buf) const
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.
uint32_t GetId(void) const
void SetPacketSize(uint32_t packetSize)
Set the packet size.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
a class to represent an Ipv4 address mask
Ipv4FlowProbe(Ptr< FlowMonitor > monitor, Ptr< Ipv4FlowClassifier > classifier, Ptr< Node > node)
Constructor.
Ipv4Address m_src
IP source.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Fallback reason (no known reason)
Fragment timeout exceeded.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
TAG_BUFFER_INLINE uint32_t ReadU32(void)
void SendOutgoingLogger(const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being sent.
bool IsSrcDstValid(Ipv4Address src, Ipv4Address dst) const
Checks if the addresses stored in tag are matching the arguments.
Ipv4Address m_dst
IP destination.
Ptr< FlowMonitor > m_flowMonitor
the FlowMonitor instance
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint32_t GetPacketId(void) const
Set the packet identifier.
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
void QueueDropLogger(Ptr< const Packet > ipPayload)
Log a packet being dropped by a queue.
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
void QueueDiscDropLogger(Ptr< const QueueDiscItem > item)
Log a packet being dropped by a queue disc.
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)
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
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.
uint32_t GetFlowId(void) const
Set the flow identifier.
Ptr< Ipv4FlowClassifier > m_classifier
the Ipv4FlowClassifier this probe is associated with
Packet dropped by the queue disc.
virtual void Deserialize(TagBuffer buf)
Ipv4Address GetSubnetDirectedBroadcast(Ipv4Mask const &mask) const
Generate subnet-directed broadcast address corresponding to mask.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
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.
Ipv4 addresses are stored in host order in this class.
uint32_t GetPacketSize(void) const
Get the packet size.
virtual void Print(std::ostream &os) const
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Packet dropped due to queue overflow.
Interface is down so can not send packet.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Fragment timeout exceeded.
virtual uint32_t GetSerializedSize(void) const
Packet dropped due to missing route to the destination.
void Read(uint8_t *buffer, uint32_t size)
static TypeId GetTypeId(void)
Register this type.
Interface is down so can not send packet.
DropReason
enumeration of possible reasons why a packet may be dropped
static const uint32_t packetSize
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
Ptr< Ipv4L3Protocol > m_ipv4
the Ipv4L3Protocol this probe is bound to
void Serialize(uint8_t buf[4]) const
Serialize this address to a 4-byte buffer.
virtual void DoDispose(void)
Destructor implementation.
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.