Class that monitors flows at the IPv4 layer of a Node. More...
#include "ipv4-flow-probe.h"
Public Types | |
enum | DropReason { DROP_NO_ROUTE = 0 , DROP_TTL_EXPIRE , DROP_BAD_CHECKSUM , DROP_QUEUE , DROP_QUEUE_DISC , DROP_INTERFACE_DOWN , DROP_ROUTE_ERROR , DROP_FRAGMENT_TIMEOUT , DROP_INVALID_REASON } |
enumeration of possible reasons why a packet may be dropped More... | |
Public Types inherited from ns3::FlowProbe | |
typedef std::map< FlowId, FlowStats > | Stats |
Container to map FlowId -> FlowStats. More... | |
Public Member Functions | |
Ipv4FlowProbe (Ptr< FlowMonitor > monitor, Ptr< Ipv4FlowClassifier > classifier, Ptr< Node > node) | |
Constructor. More... | |
virtual | ~Ipv4FlowProbe () |
Public Member Functions inherited from ns3::FlowProbe | |
FlowProbe (FlowProbe const &)=delete | |
virtual | ~FlowProbe () |
void | AddPacketDropStats (FlowId flowId, uint32_t packetSize, uint32_t reasonCode) |
Add a packet drop data to the flow stats. More... | |
void | AddPacketStats (FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe) |
Add a packet data to the flow stats. More... | |
Stats | GetStats () const |
Get the partial flow statistics stored in this probe. More... | |
FlowProbe & | operator= (FlowProbe const &)=delete |
void | SerializeToXmlStream (std::ostream &os, uint16_t indent, uint32_t index) const |
Serializes the results to an std::ostream in XML format. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose (void) |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator (void) const |
Get an iterator to the Objects aggregated to this one. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
Get the most derived TypeId for this Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (void) const |
Get a pointer to the requested aggregated Object. More... | |
void | Initialize (void) |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized (void) const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= ([[maybe_unused]] const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising erros. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::FlowProbe | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Protected Member Functions | |
virtual void | DoDispose (void) |
Destructor implementation. More... | |
Protected Member Functions inherited from ns3::FlowProbe | |
FlowProbe (Ptr< FlowMonitor > flowMonitor) | |
Constructor. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoInitialize (void) |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate (void) |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
Private Member Functions | |
void | DropLogger (const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, Ipv4L3Protocol::DropReason reason, Ptr< Ipv4 > ipv4, uint32_t ifIndex) |
Log a packet being dropped. More... | |
void | ForwardLogger (const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface) |
Log a packet being forwarded. More... | |
void | ForwardUpLogger (const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface) |
Log a packet being received by the destination. More... | |
void | QueueDiscDropLogger (Ptr< const QueueDiscItem > item) |
Log a packet being dropped by a queue disc. More... | |
void | QueueDropLogger (Ptr< const Packet > ipPayload) |
Log a packet being dropped by a queue. More... | |
void | SendOutgoingLogger (const Ipv4Header &ipHeader, Ptr< const Packet > ipPayload, uint32_t interface) |
Log a packet being sent. More... | |
Private Attributes | |
Ptr< Ipv4FlowClassifier > | m_classifier |
the Ipv4FlowClassifier this probe is associated with More... | |
Ptr< Ipv4L3Protocol > | m_ipv4 |
the Ipv4L3Protocol this probe is bound to More... | |
Additional Inherited Members | |
Protected Attributes inherited from ns3::FlowProbe | |
Ptr< FlowMonitor > | m_flowMonitor |
the FlowMonitor instance More... | |
Stats | m_stats |
The flow stats. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Class that monitors flows at the IPv4 layer of a Node.
For each node in the simulation, one instance of the class Ipv4FlowProbe is created to monitor that node. Ipv4FlowProbe accomplishes this by connecting callbacks to trace sources in the Ipv4L3Protocol interface of the node.
Definition at line 41 of file ipv4-flow-probe.h.
enumeration of possible reasons why a packet may be dropped
Enumerator | |
---|---|
DROP_NO_ROUTE | Packet dropped due to missing route to the destination. |
DROP_TTL_EXPIRE | Packet dropped due to TTL decremented to zero during IPv4 forwarding. |
DROP_BAD_CHECKSUM | Packet dropped due to invalid checksum in the IPv4 header. |
DROP_QUEUE | Packet dropped due to queue overflow. Note: only works for NetDevices that provide a TxQueue attribute of type Queue with a Drop trace source. It currently works with Csma and PointToPoint devices, but not with WiFi or WiMax. |
DROP_QUEUE_DISC | Packet dropped by the queue disc. |
DROP_INTERFACE_DOWN | Interface is down so can not send packet. |
DROP_ROUTE_ERROR | Route error. |
DROP_FRAGMENT_TIMEOUT | Fragment timeout exceeded. |
DROP_INVALID_REASON | Fallback reason (no known reason) |
Definition at line 57 of file ipv4-flow-probe.h.
ns3::Ipv4FlowProbe::Ipv4FlowProbe | ( | Ptr< FlowMonitor > | monitor, |
Ptr< Ipv4FlowClassifier > | classifier, | ||
Ptr< Node > | node | ||
) |
Constructor.
monitor | the FlowMonitor this probe is associated with |
classifier | the Ipv4FlowClassifier this probe is associated with |
node | the Node this probe is associated with |
Definition at line 223 of file ipv4-flow-probe.cc.
References ns3::Config::ConnectWithoutContextFailSafe(), DropLogger(), ForwardLogger(), ForwardUpLogger(), ns3::Node::GetId(), ns3::Object::GetObject(), m_ipv4, ns3::MakeCallback(), NS_FATAL_ERROR, NS_LOG_FUNCTION, QueueDiscDropLogger(), QueueDropLogger(), and SendOutgoingLogger().
|
virtual |
Definition at line 265 of file ipv4-flow-probe.cc.
|
protectedvirtual |
Destructor implementation.
This method is called by Dispose() or by the Object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.
It is safe to call GetObject() from within this method.
Reimplemented from ns3::FlowProbe.
Definition at line 283 of file ipv4-flow-probe.cc.
References ns3::FlowProbe::DoDispose(), m_classifier, and m_ipv4.
|
private |
Log a packet being dropped.
ipHeader | IP header |
ipPayload | IP payload |
reason | drop reason |
ipv4 | pointer to the IP object dropping the packet |
ifIndex | interface index |
Definition at line 376 of file ipv4-flow-probe.cc.
References DROP_BAD_CHECKSUM, ns3::Ipv4L3Protocol::DROP_BAD_CHECKSUM, DROP_FRAGMENT_TIMEOUT, ns3::Ipv4L3Protocol::DROP_FRAGMENT_TIMEOUT, DROP_INTERFACE_DOWN, ns3::Ipv4L3Protocol::DROP_INTERFACE_DOWN, DROP_INVALID_REASON, DROP_NO_ROUTE, ns3::Ipv4L3Protocol::DROP_NO_ROUTE, DROP_ROUTE_ERROR, ns3::Ipv4L3Protocol::DROP_ROUTE_ERROR, DROP_TTL_EXPIRE, ns3::Ipv4L3Protocol::DROP_TTL_EXPIRED, ns3::Packet::FindFirstMatchingByteTag(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4FlowProbeTag::GetFlowId(), ns3::Ipv4FlowProbeTag::GetPacketId(), ns3::Ipv4Header::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Ipv4Address::GetSubnetDirectedBroadcast(), ns3::FlowProbe::m_flowMonitor, m_ipv4, NS_FATAL_ERROR, and NS_LOG_DEBUG.
Referenced by Ipv4FlowProbe().
|
private |
Log a packet being forwarded.
ipHeader | IP header |
ipPayload | IP payload |
interface | incoming interface |
Definition at line 324 of file ipv4-flow-probe.cc.
References ns3::Packet::FindFirstMatchingByteTag(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4FlowProbeTag::GetFlowId(), ns3::Ipv4Header::GetFragmentOffset(), ns3::Ipv4FlowProbeTag::GetPacketId(), ns3::Ipv4Header::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Ipv4Header::GetSource(), ns3::Ipv4Header::IsLastFragment(), ns3::Ipv4FlowProbeTag::IsSrcDstValid(), ns3::FlowProbe::m_flowMonitor, NS_LOG_DEBUG, NS_LOG_LOGIC, and NS_LOG_WARN.
Referenced by Ipv4FlowProbe().
|
private |
Log a packet being received by the destination.
ipHeader | IP header |
ipPayload | IP payload |
interface | incoming interface |
Definition at line 352 of file ipv4-flow-probe.cc.
References ns3::Packet::FindFirstMatchingByteTag(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4FlowProbeTag::GetFlowId(), ns3::Ipv4FlowProbeTag::GetPacketId(), ns3::Ipv4Header::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Ipv4Header::GetSource(), ns3::Ipv4FlowProbeTag::IsSrcDstValid(), ns3::FlowProbe::m_flowMonitor, NS_LOG_DEBUG, and NS_LOG_LOGIC.
Referenced by Ipv4FlowProbe().
|
static |
Register this type.
Definition at line 271 of file ipv4-flow-probe.cc.
References ns3::TypeId::SetParent().
|
private |
Log a packet being dropped by a queue disc.
item | queue disc item |
Definition at line 471 of file ipv4-flow-probe.cc.
References DROP_QUEUE_DISC, ns3::Ipv4FlowProbeTag::GetFlowId(), ns3::Ipv4FlowProbeTag::GetPacketId(), ns3::Ipv4FlowProbeTag::GetPacketSize(), ns3::FlowProbe::m_flowMonitor, and NS_LOG_DEBUG.
Referenced by Ipv4FlowProbe().
Log a packet being dropped by a queue.
ipPayload | IP payload |
Definition at line 450 of file ipv4-flow-probe.cc.
References DROP_QUEUE, ns3::Packet::FindFirstMatchingByteTag(), ns3::Ipv4FlowProbeTag::GetFlowId(), ns3::Ipv4FlowProbeTag::GetPacketId(), ns3::Ipv4FlowProbeTag::GetPacketSize(), ns3::FlowProbe::m_flowMonitor, and NS_LOG_DEBUG.
Referenced by Ipv4FlowProbe().
|
private |
Log a packet being sent.
ipHeader | IP header |
ipPayload | IP payload |
interface | outgoing interface |
Definition at line 291 of file ipv4-flow-probe.cc.
References ns3::Packet::AddByteTag(), ns3::Packet::FindFirstMatchingByteTag(), ns3::Ipv4Header::GetDestination(), ns3::Ipv4Header::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Ipv4Header::GetSource(), m_classifier, ns3::FlowProbe::m_flowMonitor, m_ipv4, and NS_LOG_DEBUG.
Referenced by Ipv4FlowProbe().
|
private |
the Ipv4FlowClassifier this probe is associated with
Definition at line 119 of file ipv4-flow-probe.h.
Referenced by DoDispose(), and SendOutgoingLogger().
|
private |
the Ipv4L3Protocol this probe is bound to
Definition at line 120 of file ipv4-flow-probe.h.
Referenced by Ipv4FlowProbe(), DoDispose(), DropLogger(), and SendOutgoingLogger().