21#include "ns3/ipv6-flow-probe.h"
23#include "ns3/config.h"
24#include "ns3/flow-id-tag.h"
25#include "ns3/flow-monitor.h"
26#include "ns3/ipv6-flow-classifier.h"
29#include "ns3/packet.h"
30#include "ns3/pointer.h"
62 void Print(std::ostream& os)
const override;
113 .SetGroupName(
"FlowMonitor")
162 m_packetId(packetId),
211 m_classifier(classifier)
217 if (!ipv6->TraceConnectWithoutContext(
223 if (!ipv6->TraceConnectWithoutContext(
229 if (!ipv6->TraceConnectWithoutContext(
236 if (!ipv6->TraceConnectWithoutContext(
243 std::ostringstream qd;
244 qd <<
"/NodeList/" << node->GetId() <<
"/$ns3::TrafficControlLayer/RootQueueDiscList/*/Drop";
250 std::ostringstream oss;
251 oss <<
"/NodeList/" << node->GetId() <<
"/DeviceList/*/TxQueue/Drop";
287 if (
m_classifier->Classify(ipHeader, ipPayload, &flowId, &packetId))
290 NS_LOG_DEBUG(
"ReportFirstTx (" <<
this <<
", " << flowId <<
", " << packetId <<
", " << size
291 <<
"); " << ipHeader << *ipPayload);
297 ipPayload->AddByteTag(fTag);
307 bool found = ipPayload->FindFirstMatchingByteTag(fTag);
315 NS_LOG_DEBUG(
"ReportForwarding (" <<
this <<
", " << flowId <<
", " << packetId <<
", "
317 m_flowMonitor->ReportForwarding(
this, flowId, packetId, size);
327 bool found = ipPayload->FindFirstMatchingByteTag(fTag);
335 NS_LOG_DEBUG(
"ReportLastRx (" <<
this <<
", " << flowId <<
", " << packetId <<
", " << size
355 case Ipv6L3Protocol::DROP_BAD_CHECKSUM:
357 Ipv6Mask maski = m_ipv6->GetNetworkMask (ifIndex);
358 Ipv6Address bcast = addri.GetSubnetDirectedBroadcast (maski);
367 bool found = ipPayload->FindFirstMatchingByteTag(fTag);
375 NS_LOG_DEBUG(
"Drop (" <<
this <<
", " << flowId <<
", " << packetId <<
", " << size <<
", "
377 <<
"HDR: " << ipHeader <<
" PKT: " << *ipPayload);
420 m_flowMonitor->ReportDrop(
this, flowId, packetId, size, myReason);
428 bool tagFound = ipPayload->FindFirstMatchingByteTag(fTag);
439 NS_LOG_DEBUG(
"Drop (" <<
this <<
", " << flowId <<
", " << packetId <<
", " << size <<
", "
449 bool tagFound = item->GetPacket()->FindFirstMatchingByteTag(fTag);
460 NS_LOG_DEBUG(
"Drop (" <<
this <<
", " << flowId <<
", " << packetId <<
", " << size <<
", "
The FlowProbe class is responsible for listening for packet events in a specific point of the simulat...
void DoDispose() override
Destructor implementation.
Ptr< FlowMonitor > m_flowMonitor
the FlowMonitor instance
Describes an IPv6 address.
void DoDispose() override
Destructor implementation.
void QueueDiscDropLogger(Ptr< const QueueDiscItem > item)
Log a packet being dropped by a queue disc.
~Ipv6FlowProbe() override
void QueueDropLogger(Ptr< const Packet > ipPayload)
Log a packet being dropped by a queue.
static TypeId GetTypeId()
Register this type.
Ptr< Ipv6FlowClassifier > m_classifier
the Ipv6FlowClassifier this probe is associated with
void DropLogger(const Ipv6Header &ipHeader, Ptr< const Packet > ipPayload, Ipv6L3Protocol::DropReason reason, Ptr< Ipv6 > ipv6, uint32_t ifIndex)
Log a packet being dropped.
void ForwardLogger(const Ipv6Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being forwarded.
Ipv6FlowProbe(Ptr< FlowMonitor > monitor, Ptr< Ipv6FlowClassifier > classifier, Ptr< Node > node)
Constructor.
void ForwardUpLogger(const Ipv6Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being received by the destination.
DropReason
enumeration of possible reasons why a packet may be dropped
@ DROP_TTL_EXPIRE
Packet dropped due to TTL decremented to zero during IPv4 forwarding.
@ DROP_FRAGMENT_TIMEOUT
Fragment timeout exceeded.
@ DROP_NO_ROUTE
Packet dropped due to missing route to the destination.
@ DROP_UNKNOWN_OPTION
Unknown option.
@ DROP_QUEUE_DISC
Packet dropped by the queue disc.
@ DROP_INTERFACE_DOWN
Interface is down so can not send packet.
@ DROP_MALFORMED_HEADER
Malformed header.
@ DROP_ROUTE_ERROR
Route error.
@ DROP_UNKNOWN_PROTOCOL
Unknown L4 protocol.
@ DROP_INVALID_REASON
Fallback reason (no known reason)
@ DROP_QUEUE
Packet dropped due to queue overflow.
void SendOutgoingLogger(const Ipv6Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface)
Log a packet being sent.
Tag used to allow a fast identification of the packet.
uint32_t GetFlowId() const
Set the flow identifier.
uint32_t m_flowId
flow identifier
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetFlowId(uint32_t flowId)
Set the flow identifier.
void SetPacketId(uint32_t packetId)
Set the packet identifier.
void Deserialize(TagBuffer buf) override
void SetPacketSize(uint32_t packetSize)
Set the packet size.
uint32_t GetPacketSize() const
Get the packet size.
static TypeId GetTypeId()
Get the type ID.
uint32_t GetPacketId() const
Set the packet identifier.
uint32_t GetSerializedSize() const override
void Print(std::ostream &os) const override
void Serialize(TagBuffer buf) const override
uint32_t m_packetSize
packet size
uint32_t m_packetId
packet identifier
IPv6 layer implementation.
DropReason
Reason why a packet has been dropped.
@ DROP_FRAGMENT_TIMEOUT
Fragment timeout.
@ DROP_ROUTE_ERROR
Route error.
@ DROP_TTL_EXPIRED
Packet TTL has expired.
@ DROP_INTERFACE_DOWN
Interface is down so can not send packet.
@ DROP_UNKNOWN_OPTION
Unknown option.
@ DROP_NO_ROUTE
No route to host.
@ DROP_UNKNOWN_PROTOCOL
Unknown L4 protocol.
@ DROP_MALFORMED_HEADER
Malformed header.
Smart pointer class similar to boost::intrusive_ptr.
TAG_BUFFER_INLINE uint32_t ReadU32()
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
tag a set of bytes in a packet
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
bool ConnectWithoutContextFailSafe(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static const uint32_t packetSize
Packet size generated at the AP.