Implementing face clean up callback in forwarding strategy
Necessary for FwStats strategy that uses CcnxFace object as a key to
several statistics parameters.
diff --git a/utils/load-stats-node.cc b/utils/load-stats-node.cc
index e64bb9d..04ac660 100644
--- a/utils/load-stats-node.cc
+++ b/utils/load-stats-node.cc
@@ -170,6 +170,15 @@
return zero;
}
+
+void
+LoadStatsNode::RemoveFace (ns3::Ptr<ns3::CcnxFace> face)
+{
+ NS_LOG_FUNCTION (this);
+ m_incoming.erase (face);
+ m_outgoing.erase (face);
+}
+
bool
LoadStatsNode::operator == (const LoadStatsNode &other) const
{
diff --git a/utils/load-stats-node.h b/utils/load-stats-node.h
index 9bdf5be..a4d6d87 100644
--- a/utils/load-stats-node.h
+++ b/utils/load-stats-node.h
@@ -118,6 +118,9 @@
// don't do any copying at all
return *this;
}
+
+ void
+ RemoveFace (ns3::Ptr<ns3::CcnxFace> face);
private:
LoadStatsFace m_pit;
diff --git a/utils/stats-tree.cc b/utils/stats-tree.cc
index e987043..d83b881 100644
--- a/utils/stats-tree.cc
+++ b/utils/stats-tree.cc
@@ -137,6 +137,16 @@
return node->payload ();
}
+void
+StatsTree::RemoveFace (ns3::Ptr<ns3::CcnxFace> face)
+{
+ tree_type::recursive_iterator item (&m_tree), end;
+ for (; item != end; item ++)
+ {
+ item->payload ().RemoveFace (face);
+ }
+}
+
std::ostream &
operator << (std::ostream &os, const StatsTree &tree)
{
diff --git a/utils/stats-tree.h b/utils/stats-tree.h
index 9702675..1bb128b 100644
--- a/utils/stats-tree.h
+++ b/utils/stats-tree.h
@@ -65,10 +65,14 @@
// Get (const ns3::CcnxNameComponents &key) const;
const LoadStatsNode &
operator [] (const ns3::CcnxNameComponents &key) const;
+
+ void
+ RemoveFace (ns3::Ptr<ns3::CcnxFace> face);
private:
const LoadStatsNode &
WalkLeftRightRoot (tree_type *node);
+
private:
tree_type m_tree;