model: Major API changes
Interest and ContentObject are no longer derived from Header class.
Instead, they are encapsulating payload and, optionally, wire-formatted
Packet object.
Refs #1005 (http://redmine.named-data.net/)
diff --git a/model/fw/best-route.cc b/model/fw/best-route.cc
index 21a6b57..f5ab205 100644
--- a/model/fw/best-route.cc
+++ b/model/fw/best-route.cc
@@ -65,17 +65,16 @@
bool
BestRoute::DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
- NS_LOG_FUNCTION (this << header->GetName ());
+ NS_LOG_FUNCTION (this << interest->GetName ());
// No real need to call parent's (green-yellow-red's strategy) method, since it is incorporated
// in the logic of the BestRoute strategy
//
// // Try to work out with just green faces
- // bool greenOk = super::DoPropagateInterest (inFace, header, origPacket, pitEntry);
+ // bool greenOk = super::DoPropagateInterest (inFace, interest, origPacket, pitEntry);
// if (greenOk)
// return true;
@@ -87,7 +86,7 @@
if (metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in front
break;
- if (!TrySendOutInterest (inFace, metricFace.GetFace (), header, origPacket, pitEntry))
+ if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))
{
continue;
}
diff --git a/model/fw/best-route.h b/model/fw/best-route.h
index f7caa19..6648acb 100644
--- a/model/fw/best-route.h
+++ b/model/fw/best-route.h
@@ -58,8 +58,7 @@
// from super
virtual bool
DoPropagateInterest (Ptr<Face> incomingFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
protected:
static LogComponent g_log;
diff --git a/model/fw/flooding.cc b/model/fw/flooding.cc
index 3672b24..3d93248 100644
--- a/model/fw/flooding.cc
+++ b/model/fw/flooding.cc
@@ -66,8 +66,7 @@
bool
Flooding::DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
@@ -80,7 +79,7 @@
if (metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
break;
- if (!TrySendOutInterest (inFace, metricFace.GetFace (), header, origPacket, pitEntry))
+ if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))
{
continue;
}
diff --git a/model/fw/flooding.h b/model/fw/flooding.h
index 5eadabb..f7ce55a 100644
--- a/model/fw/flooding.h
+++ b/model/fw/flooding.h
@@ -60,8 +60,7 @@
// inherited from Nacks/ForwardingStrategy
virtual bool
DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
protected:
diff --git a/model/fw/green-yellow-red.cc b/model/fw/green-yellow-red.cc
index 5d6a001..cb7fd89 100644
--- a/model/fw/green-yellow-red.cc
+++ b/model/fw/green-yellow-red.cc
@@ -64,8 +64,7 @@
bool
GreenYellowRed::DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
@@ -79,7 +78,7 @@
metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_YELLOW)
break; //propagate only to green faces
- if (!TrySendOutInterest (inFace, metricFace.GetFace (), header, origPacket, pitEntry))
+ if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))
{
continue;
}
@@ -123,11 +122,10 @@
void
GreenYellowRed::DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> nack,
Ptr<pit::Entry> pitEntry)
{
- super::DidReceiveValidNack (inFace, nackCode, header, origPacket, pitEntry);
+ super::DidReceiveValidNack (inFace, nackCode, nack, pitEntry);
if (inFace != 0 &&
(nackCode == Interest::NACK_CONGESTION ||
diff --git a/model/fw/green-yellow-red.h b/model/fw/green-yellow-red.h
index 1c4dcde..11817bf 100644
--- a/model/fw/green-yellow-red.h
+++ b/model/fw/green-yellow-red.h
@@ -44,8 +44,7 @@
virtual bool
DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
virtual void
@@ -54,8 +53,7 @@
virtual void
DidReceiveValidNack (Ptr<Face> incomingFace,
uint32_t nackCode,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> nack,
Ptr<pit::Entry> pitEntry);
private:
typedef Nacks super;
diff --git a/model/fw/nacks.cc b/model/fw/nacks.cc
index 6bafefb..357427c 100644
--- a/model/fw/nacks.cc
+++ b/model/fw/nacks.cc
@@ -75,82 +75,74 @@
void
Nacks::OnInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket)
+ Ptr<Interest> interest)
{
- if (header->GetNack () > 0)
- OnNack (inFace, header, origPacket/*original packet*/);
+ if (interest->GetNack () > 0)
+ OnNack (inFace, header);
else
- super::OnInterest (inFace, header, origPacket/*original packet*/);
+ super::OnInterest (inFace, interest);
}
void
Nacks::OnNack (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket)
+ Ptr<Interest> nack)
{
// NS_LOG_FUNCTION (inFace << header->GetName ());
- m_inNacks (header, inFace);
+ m_inNacks (nack, inFace);
Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
if (pitEntry == 0)
{
// somebody is doing something bad
- m_dropNacks (header, inFace);
+ m_dropNacks (nack, inFace);
return;
}
- DidReceiveValidNack (inFace, header->GetNack (), header, origPacket, pitEntry);
+ DidReceiveValidNack (inFace, header->GetNack (), nack, pitEntry);
}
void
Nacks::DidReceiveDuplicateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
- super::DidReceiveDuplicateInterest (inFace, header, origPacket, pitEntry);
+ super::DidReceiveDuplicateInterest (inFace, interest, pitEntry);
if (m_nacksEnabled)
{
NS_LOG_DEBUG ("Sending NACK_LOOP");
- Ptr<Interest> nackHeader = Create<Interest> (*header);
- nackHeader->SetNack (Interest::NACK_LOOP);
- Ptr<Packet> nack = Create<Packet> ();
- nack->AddHeader (*nackHeader);
+ Ptr<Interest> nack = Create<Interest> (*interest);
+ nack->SetNack (Interest::NACK_LOOP);
FwHopCountTag hopCountTag;
- if (origPacket->PeekPacketTag (hopCountTag))
+ if (interest->GetPayload ()->PeekPacketTag (hopCountTag))
{
- nack->AddPacketTag (hopCountTag);
+ nack->GetPayload ()->AddPacketTag (hopCountTag);
}
else
{
NS_LOG_DEBUG ("No FwHopCountTag tag associated with received duplicated Interest");
}
- inFace->Send (nack);
- m_outNacks (nackHeader, inFace);
+ inFace->SendInterest (nack);
+ m_outNacks (nack, inFace);
}
}
void
Nacks::DidExhaustForwardingOptions (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
if (m_nacksEnabled)
{
- Ptr<Packet> packet = Create<Packet> ();
- Ptr<Interest> nackHeader = Create<Interest> (*header);
- nackHeader->SetNack (Interest::NACK_GIVEUP_PIT);
- packet->AddHeader (*nackHeader);
+ Ptr<Interest> nack = Create<Interest> (*header);
+ nack->SetNack (Interest::NACK_GIVEUP_PIT);
FwHopCountTag hopCountTag;
- if (origPacket->PeekPacketTag (hopCountTag))
+ if (interest->GetPayload ()->PeekPacketTag (hopCountTag))
{
- packet->AddPacketTag (hopCountTag);
+ nack->GetPayload ()->AddPacketTag (hopCountTag);
}
else
{
@@ -159,10 +151,9 @@
BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
{
- NS_LOG_DEBUG ("Send NACK for " << boost::cref (nackHeader->GetName ()) << " to " << boost::cref (*incoming.m_face));
- incoming.m_face->Send (packet->Copy ());
-
- m_outNacks (nackHeader, incoming.m_face);
+ NS_LOG_DEBUG ("Send NACK for " << boost::cref (nack->GetName ()) << " to " << boost::cref (*incoming.m_face));
+ incoming.m_face->SendInterest (nack);
+ m_outNacks (nack, incoming.m_face);
}
pitEntry->ClearOutgoing (); // to force erasure of the record
@@ -174,11 +165,10 @@
void
Nacks::DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> nack,
Ptr<pit::Entry> pitEntry)
{
- NS_LOG_DEBUG ("nackCode: " << nackCode << " for [" << header->GetName () << "]");
+ NS_LOG_DEBUG ("nackCode: " << nackCode << " for [" << nack->GetName () << "]");
// If NACK is NACK_GIVEUP_PIT, then neighbor gave up trying to and removed it's PIT entry.
// So, if we had an incoming entry to this neighbor, then we can remove it now
@@ -198,29 +188,27 @@
NS_LOG_DEBUG ("Not all outgoing are in vain");
// suppress
// Don't do anything, we are still expecting data from some other face
- m_dropNacks (header, inFace);
+ m_dropNacks (nack, inFace);
return;
}
- Ptr<Packet> nonNackInterest = Create<Packet> ();
- Ptr<Interest> nonNackHeader = Create<Interest> (*header);
- nonNackHeader->SetNack (Interest::NORMAL_INTEREST);
- nonNackInterest->AddHeader (*nonNackHeader);
+ Ptr<Interest> interest = Create<Interest> (*nack);
+ interest->SetNack (Interest::NORMAL_INTEREST);
FwHopCountTag hopCountTag;
- if (origPacket->PeekPacketTag (hopCountTag))
+ if (nack->GetPayload ()->PeekPacketTag (hopCountTag))
{
- nonNackInterest->AddPacketTag (hopCountTag);
+ interest->GetPayload ()->AddPacketTag (hopCountTag);
}
else
{
NS_LOG_DEBUG ("No FwHopCountTag tag associated with received NACK");
}
- bool propagated = DoPropagateInterest (inFace, nonNackHeader, nonNackInterest, pitEntry);
+ bool propagated = DoPropagateInterest (inFace, interest, pitEntry);
if (!propagated)
{
- DidExhaustForwardingOptions (inFace, nonNackHeader, nonNackInterest, pitEntry);
+ DidExhaustForwardingOptions (inFace, interest, pitEntry);
}
}
}
diff --git a/model/fw/nacks.h b/model/fw/nacks.h
index 19a9ecb..7855e19 100644
--- a/model/fw/nacks.h
+++ b/model/fw/nacks.h
@@ -43,34 +43,29 @@
// from super
virtual void
OnInterest (Ptr<Face> face,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket);
+ Ptr<Interest> interest);
protected:
// from super
virtual void
DidReceiveDuplicateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> packet,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
// from super
virtual void
DidExhaustForwardingOptions (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> packet,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
virtual void
OnNack (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket);
+ Ptr<Interest> nack);
virtual void
DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> nack,
Ptr<pit::Entry> pitEntry);
protected:
diff --git a/model/fw/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
index 1d6bcda..ef61593 100644
--- a/model/fw/ndn-forwarding-strategy.cc
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -143,53 +143,48 @@
void
ForwardingStrategy::OnInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload)
+ Ptr<Interest> interest)
{
- m_inInterests (header, inFace);
+ m_inInterests (interest, inFace);
- Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
+ Ptr<pit::Entry> pitEntry = m_pit->Lookup (*interest);
bool similarInterest = true;
if (pitEntry == 0)
{
similarInterest = false;
- pitEntry = m_pit->Create (header);
+ pitEntry = m_pit->Create (interest);
if (pitEntry != 0)
{
- DidCreatePitEntry (inFace, header, origPacket, pitEntry);
+ DidCreatePitEntry (inFace, interest, pitEntry);
}
else
{
- FailedToCreatePitEntry (inFace, header, origPacket);
+ FailedToCreatePitEntry (inFace, interest);
return;
}
}
bool isDuplicated = true;
- if (!pitEntry->IsNonceSeen (header->GetNonce ()))
+ if (!pitEntry->IsNonceSeen (interest->GetNonce ()))
{
- pitEntry->AddSeenNonce (header->GetNonce ());
+ pitEntry->AddSeenNonce (interest->GetNonce ());
isDuplicated = false;
}
if (isDuplicated)
{
- DidReceiveDuplicateInterest (inFace, header, origPacket, pitEntry);
+ DidReceiveDuplicateInterest (inFace, interest, pitEntry);
return;
}
- Ptr<Packet> contentObject;
- Ptr<const ContentObject> contentObjectHeader; // used for tracing
- Ptr<const Packet> payload; // used for tracing
- boost::tie (contentObject, contentObjectHeader, payload) = m_contentStore->Lookup (header);
+ Ptr<ContentObject> contentObject;
+ contentObject = m_contentStore->Lookup (interest);
if (contentObject != 0)
{
- NS_ASSERT (contentObjectHeader != 0);
-
FwHopCountTag hopCountTag;
- if (origPacket->PeekPacketTag (hopCountTag))
+ if (interest->GetPayload ()->PeekPacketTag (hopCountTag))
{
- contentObject->AddPacketTag (hopCountTag);
+ contentObject->GetPayload ()->AddPacketTag (hopCountTag);
}
pitEntry->AddIncoming (inFace/*, Seconds (1.0)*/);
@@ -198,55 +193,49 @@
WillSatisfyPendingInterest (0, pitEntry);
// Actually satisfy pending interest
- SatisfyPendingInterest (0, contentObjectHeader, payload, contentObject, pitEntry);
+ SatisfyPendingInterest (0, contentObject, pitEntry);
return;
}
- if (similarInterest && ShouldSuppressIncomingInterest (inFace, header, origPacket, pitEntry))
+ if (similarInterest && ShouldSuppressIncomingInterest (inFace, interest, pitEntry))
{
- pitEntry->AddIncoming (inFace/*, header->GetInterestLifetime ()*/);
+ pitEntry->AddIncoming (inFace/*, interest->GetInterestLifetime ()*/);
// update PIT entry lifetime
- pitEntry->UpdateLifetime (header->GetInterestLifetime ());
+ pitEntry->UpdateLifetime (interest->GetInterestLifetime ());
// Suppress this interest if we're still expecting data from some other face
NS_LOG_DEBUG ("Suppress interests");
- m_dropInterests (header, inFace);
+ m_dropInterests (interest, inFace);
- DidSuppressSimilarInterest (inFace, header, origPacket, pitEntry);
+ DidSuppressSimilarInterest (inFace, interest, pitEntry);
return;
}
if (similarInterest)
{
- DidForwardSimilarInterest (inFace, header, origPacket, pitEntry);
+ DidForwardSimilarInterest (inFace, interest, pitEntry);
}
- PropagateInterest (inFace, header, origPacket, pitEntry);
+ PropagateInterest (inFace, interest, pitEntry);
}
void
ForwardingStrategy::OnData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<Packet> payload)
+ Ptr<ContentObject> data)
{
- NS_LOG_FUNCTION (inFace << header->GetName () << payload);
- m_inData (header, payload, inFace);
+ NS_LOG_FUNCTION (inFace << data->GetName ());
+ m_inData (data, inFace);
// Lookup PIT entry
- Ptr<pit::Entry> pitEntry = m_pit->Lookup (*header);
+ Ptr<pit::Entry> pitEntry = m_pit->Lookup (*data);
if (pitEntry == 0)
{
bool cached = false;
if (m_cacheUnsolicitedData || (m_cacheUnsolicitedDataFromApps && (inFace->GetFlags () | Face::APPLICATION)))
{
- FwHopCountTag hopCountTag;
-
- Ptr<Packet> payloadCopy = payload->Copy ();
- payloadCopy->RemovePacketTag (hopCountTag);
-
// Optimistically add or update entry in the content store
- cached = m_contentStore->Add (header, payloadCopy);
+ cached = m_contentStore->Add (data);
}
else
{
@@ -254,32 +243,16 @@
// (unsolicited data packets should not "poison" content store)
//drop dulicated or not requested data packet
- m_dropData (header, payload, inFace);
+ m_dropData (data, inFace);
}
- DidReceiveUnsolicitedData (inFace, header, payload, cached);
+ DidReceiveUnsolicitedData (inFace, data, cached);
return;
}
else
{
- bool cached = false;
-
- FwHopCountTag hopCountTag;
- if (payload->PeekPacketTag (hopCountTag))
- {
- Ptr<Packet> payloadCopy = payload->Copy ();
- payloadCopy->RemovePacketTag (hopCountTag);
-
- // Add or update entry in the content store
- cached = m_contentStore->Add (header, payloadCopy);
- }
- else
- {
- // Add or update entry in the content store
- cached = m_contentStore->Add (header, payload); // no need for extra copy
- }
-
- DidReceiveSolicitedData (inFace, header, payload, cached);
+ bool cached = m_contentStore->Add (data);
+ DidReceiveSolicitedData (inFace, data, cached);
}
while (pitEntry != 0)
@@ -297,24 +270,21 @@
void
ForwardingStrategy::DidCreatePitEntry (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntrypitEntry)
{
}
void
ForwardingStrategy::FailedToCreatePitEntry (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload)
+ Ptr<const Interest> interest)
{
- m_dropInterests (header, inFace);
+ m_dropInterests (interest, inFace);
}
void
ForwardingStrategy::DidReceiveDuplicateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
/////////////////////////////////////////////////////////////////////////////////////////
@@ -323,35 +293,32 @@
// //
/////////////////////////////////////////////////////////////////////////////////////////
pitEntry->AddIncoming (inFace);
- m_dropInterests (header, inFace);
+ m_dropInterests (interest, inFace);
}
void
ForwardingStrategy::DidSuppressSimilarInterest (Ptr<Face> face,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
}
void
ForwardingStrategy::DidForwardSimilarInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
}
void
ForwardingStrategy::DidExhaustForwardingOptions (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << boost::cref (*inFace));
if (pitEntry->AreAllOutgoingInVain ())
{
- m_dropInterests (header, inFace);
+ m_dropInterests (interest, inFace);
// All incoming interests cannot be satisfied. Remove them
pitEntry->ClearIncoming ();
@@ -368,8 +335,7 @@
bool
ForwardingStrategy::DetectRetransmittedInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
pit::Entry::in_iterator existingInFace = pitEntry->GetIncoming ().find (inFace);
@@ -387,8 +353,7 @@
void
ForwardingStrategy::SatisfyPendingInterest (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
+ Ptr<const ContentObject> data,
Ptr<pit::Entry> pitEntry)
{
if (inFace != 0)
@@ -397,14 +362,14 @@
//satisfy all pending incoming Interests
BOOST_FOREACH (const pit::IncomingFace &incoming, pitEntry->GetIncoming ())
{
- bool ok = incoming.m_face->SendData (header, payload);
+ bool ok = incoming.m_face->SendData (data);
- DidSendOutData (inFace, incoming.m_face, header, payload, origPacket, pitEntry);
+ DidSendOutData (inFace, incoming.m_face, data, pitEntry);
NS_LOG_DEBUG ("Satisfy " << *incoming.m_face);
if (!ok)
{
- m_dropData (header, payload, incoming.m_face);
+ m_dropData (data, incoming.m_face);
NS_LOG_DEBUG ("Cannot satisfy data to " << *incoming.m_face);
}
}
@@ -421,8 +386,7 @@
void
ForwardingStrategy::DidReceiveSolicitedData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
+ Ptr<const ContentObject> data,
bool didCreateCacheEntry)
{
// do nothing
@@ -430,8 +394,7 @@
void
ForwardingStrategy::DidReceiveUnsolicitedData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
+ Ptr<const ContentObject> data,
bool didCreateCacheEntry)
{
// do nothing
@@ -454,8 +417,7 @@
bool
ForwardingStrategy::ShouldSuppressIncomingInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
bool isNew = pitEntry->GetIncoming ().size () == 0 && pitEntry->GetOutgoing ().size () == 0;
@@ -463,7 +425,7 @@
if (isNew) return false; // never suppress new interests
bool isRetransmitted = m_detectRetransmissions && // a small guard
- DetectRetransmittedInterest (inFace, header, origPacket, pitEntry);
+ DetectRetransmittedInterest (inFace, interest, pitEntry);
if (pitEntry->GetOutgoing ().find (inFace) != pitEntry->GetOutgoing ().end ())
{
@@ -489,18 +451,17 @@
void
ForwardingStrategy::PropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
bool isRetransmitted = m_detectRetransmissions && // a small guard
- DetectRetransmittedInterest (inFace, header, origPacket, pitEntry);
+ DetectRetransmittedInterest (inFace, interest, pitEntry);
- pitEntry->AddIncoming (inFace/*, header->GetInterestLifetime ()*/);
+ pitEntry->AddIncoming (inFace/*, interest->GetInterestLifetime ()*/);
/// @todo Make lifetime per incoming interface
- pitEntry->UpdateLifetime (header->GetInterestLifetime ());
+ pitEntry->UpdateLifetime (interest->GetInterestLifetime ());
- bool propagated = DoPropagateInterest (inFace, header, payload, origPacket, pitEntry);
+ bool propagated = DoPropagateInterest (inFace, interest, pitEntry);
if (!propagated && isRetransmitted) //give another chance if retransmitted
{
@@ -508,13 +469,13 @@
pitEntry->IncreaseAllowedRetxCount ();
// try again
- propagated = DoPropagateInterest (inFace, header, payload, origPacket, pitEntry);
+ propagated = DoPropagateInterest (inFace, interest, pitEntry);
}
// if (!propagated)
// {
// NS_LOG_DEBUG ("++++++++++++++++++++++++++++++++++++++++++++++++++++++");
- // NS_LOG_DEBUG ("+++ Not propagated ["<< header->GetName () <<"], but number of outgoing faces: " << pitEntry->GetOutgoing ().size ());
+ // NS_LOG_DEBUG ("+++ Not propagated ["<< interest->GetName () <<"], but number of outgoing faces: " << pitEntry->GetOutgoing ().size ());
// NS_LOG_DEBUG ("++++++++++++++++++++++++++++++++++++++++++++++++++++++");
// }
@@ -523,15 +484,14 @@
// ForwardingStrategy failed to find it.
if (!propagated && pitEntry->AreAllOutgoingInVain ())
{
- DidExhaustForwardingOptions (inFace, header, payload, origPacket, pitEntry);
+ DidExhaustForwardingOptions (inFace, interest, pitEntry);
}
}
bool
ForwardingStrategy::CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
if (outFace == inFace)
@@ -561,11 +521,10 @@
bool
ForwardingStrategy::TrySendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
- if (!CanSendOutInterest (inFace, outFace, header, payload, pitEntry))
+ if (!CanSendOutInterest (inFace, outFace, interest, pitEntry))
{
return false;
}
@@ -573,13 +532,13 @@
pitEntry->AddOutgoing (outFace);
//transmission
- bool successSend = outFace->SendInterest (header, payload);
+ bool successSend = outFace->SendInterest (interest);
if (!successSend)
{
- m_dropInterests (header, outFace);
+ m_dropInterests (interest, outFace);
}
- DidSendOutInterest (inFace, outFace, header, payload, pitEntry);
+ DidSendOutInterest (inFace, outFace, interest, pitEntry);
return true;
}
@@ -587,21 +546,19 @@
void
ForwardingStrategy::DidSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
- m_outInterests (header, outFace);
+ m_outInterests (interest, outFace);
}
void
ForwardingStrategy::DidSendOutData (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
+ Ptr<const ContentObject> data,
Ptr<pit::Entry> pitEntry)
{
- m_outData (header, payload, inFace == 0, outFace);
+ m_outData (data, inFace == 0, outFace);
}
void
diff --git a/model/fw/ndn-forwarding-strategy.h b/model/fw/ndn-forwarding-strategy.h
index 45ccc55..49b034b 100644
--- a/model/fw/ndn-forwarding-strategy.h
+++ b/model/fw/ndn-forwarding-strategy.h
@@ -49,7 +49,7 @@
public Object
{
public:
- static TypeId GetTypeId (void);
+ static TypeId GetTypeId ();
/**
* @brief Helper function to retrieve logging name for the forwarding strategy
@@ -66,27 +66,23 @@
* \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
*
* Processing Interest packets
- * @param face incoming face
- * @param header deserialized Interest header
- * @param origPacket original packet
+ * @param face incoming face
+ * @param interest Interest packet
*/
virtual void
OnInterest (Ptr<Face> face,
- Ptr<const Interest> header,
- Ptr<const Packet> payload);
+ Ptr<Interest> interest);
/**
* \brief Actual processing of incoming Ndn content objects
*
* Processing ContentObject packets
* @param face incoming face
- * @param header deserialized ContentObject header
- * @param payload data packet payload
+ * @param data Data packet
*/
virtual void
OnData (Ptr<Face> face,
- Ptr<const ContentObject> header,
- Ptr<Packet> payload);
+ Ptr<ContentObject> data);
/**
* @brief Event fired just before PIT entry is removed by timeout
@@ -143,8 +139,7 @@
*/
virtual void
DidCreatePitEntry (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -153,13 +148,12 @@
* Note that this call can be called only for non-similar Interest (i.e., there is an attempt to create a new PIT entry).
* For any non-similar Interests, either FailedToCreatePitEntry or DidCreatePitEntry is called.
*
- * @param inFace incoming face
- * @param header deserialized Interest header
+ * @param inFace incoming face
+ * @param interest Interest packet
*/
virtual void
FailedToCreatePitEntry (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload);
+ Ptr<const Interest> interest);
/**
* @brief An event that is fired every time a duplicated Interest is received
@@ -167,15 +161,14 @@
* This even is the last action that is performed before the Interest processing is halted
*
* @param inFace incoming face
- * @param header deserialized Interest header
+ * @param interest Interest packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*
* @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
*/
virtual void
DidReceiveDuplicateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -184,15 +177,14 @@
* This even is the last action that is performed before the Interest processing is halted
*
* @param inFace incoming face
- * @param header deserialized Interest header
+ * @param interest Interest packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*
* @see DidReceiveDuplicateInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
*/
virtual void
DidSuppressSimilarInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -201,15 +193,14 @@
* This even is fired just before handling the Interest to PropagateInterest method
*
* @param inFace incoming face
- * @param header deserialized Interest header
+ * @param interest Interest packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*
* @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, ShouldSuppressIncomingInterest
*/
virtual void
DidForwardSimilarInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -219,15 +210,14 @@
* and retransmitted Interest cannot by forwarded. For more details, refer to the implementation.
*
* @param inFace incoming face
- * @param header deserialized Interest header
+ * @param interest Interest header
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*
* @see DetectRetransmittedInterest
*/
virtual void
DidExhaustForwardingOptions (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -239,14 +229,13 @@
* already has inFace (i.e., a similar interest is received on the same face more than once).
*
* @param inFace incoming face
- * @param header deserialized Interest header
+ * @param interest Interest header
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
* @return true if Interest should be considered as retransmitted
*/
virtual bool
DetectRetransmittedInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -267,44 +256,38 @@
* Note that when Interest is satisfied from the cache, incoming face will be 0
*
* @param inFace incoming face
- * @param header deserialized ContentObject header
- * @param payload ContentObject payload
+ * @param data Data packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*/
virtual void
SatisfyPendingInterest (Ptr<Face> inFace, // 0 allowed (from cache)
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
+ Ptr<const ContentObject> data,
Ptr<pit::Entry> pitEntry);
/**
* @brief Event which is fired just after data was send out on the face
*
- * @param inFace incoming face of the ContentObject
+ * @param inFace incoming face of the ContentObject
* @param outFace outgoing face
- * @param header deserialized ContentObject header
- * @param payload ContentObject payload
+ * @param data Data packet
* @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
*/
virtual void
DidSendOutData (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
+ Ptr<const ContentObject> data,
Ptr<pit::Entry> pitEntry);
/**
* @brief Event which is fired every time a requested (solicited) DATA packet (there is an active PIT entry) is received
*
* @param inFace incoming face
- * @param header deserialized ContentObject header
- * @param payload ContentObject payload
+ * @param data Data packet
* @param didCreateCacheEntry flag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)
*/
virtual void
DidReceiveSolicitedData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
+ Ptr<const ContentObject> data,
bool didCreateCacheEntry);
/**
@@ -314,14 +297,12 @@
* attribute CacheUnsolicitedData true
*
* @param inFace incoming face
- * @param header deserialized ContentObject header
- * @param payload ContentObject payload
+ * @param data Data packet
* @param didCreateCacheEntry flag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)
*/
virtual void
DidReceiveUnsolicitedData (Ptr<Face> inFace,
- Ptr<const ContentObject> header,
- Ptr<const Packet> payload,
+ Ptr<const ContentObject> data,
bool didCreateCacheEntry);
/**
@@ -333,13 +314,12 @@
* For more details, refer to the source code.
*
* @param inFace incoming face
- * @param header deserialized ContentObject header
+ * @param interest Interest packet
* @param payload ContentObject payload
*/
virtual bool
ShouldSuppressIncomingInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -352,7 +332,7 @@
*
* @param inFace incoming face of the Interest
* @param outFace proposed outgoing face of the Interest
- * @param header parsed Interest header
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*
* @see DetectRetransmittedInterest
@@ -360,8 +340,7 @@
virtual bool
CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -371,7 +350,7 @@
*
* @param inFace incoming face of the Interest
* @param outFace proposed outgoing face of the Interest
- * @param header parsed Interest header
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*
* @see CanSendOutInterest
@@ -379,8 +358,7 @@
virtual bool
TrySendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -388,13 +366,13 @@
*
* @param inFace incoming face of the Interest
* @param outFace outgoing face of the Interest
- * @param header parsed Interest header
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*/
virtual void
DidSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -404,15 +382,14 @@
* PIT entry lifetime, calling DoPropagateInterest, and retransmissions (enabled by default).
*
* @param inFace incoming face
- * @param header Interest header
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*
* @see DoPropagateInterest
*/
virtual void
PropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/**
@@ -426,7 +403,7 @@
* PIT entry lifetime, calling DoPropagateInterest, as well as perform retransmissions (enabled by default).
*
* @param inFace incoming face
- * @param header Interest header
+ * @param interest Interest packet
* @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
*
* @return true if interest was successfully propagated, false if all options have failed
@@ -435,8 +412,7 @@
*/
virtual bool
DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> payload,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry) = 0;
protected:
@@ -453,27 +429,27 @@
bool m_cacheUnsolicitedData;
bool m_detectRetransmissions;
- TracedCallback<Ptr<const Interest>, Ptr<const Packet>,
+ TracedCallback<Ptr<const Interest>,
Ptr<const Face> > m_outInterests; ///< @brief Transmitted interests trace
- TracedCallback<Ptr<const Interest>, Ptr<const Packet>,
+ TracedCallback<Ptr<const Interest>,
Ptr<const Face> > m_inInterests; ///< @brief trace of incoming Interests
- TracedCallback<Ptr<const Interest>, Ptr<const Packet>,
+ TracedCallback<Ptr<const Interest>,
Ptr<const Face> > m_dropInterests; ///< @brief trace of dropped Interests
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
- TracedCallback<Ptr<const ContentObject>, Ptr<const Packet>,
+ TracedCallback<Ptr<const ContentObject>,
bool /*from cache*/,
Ptr<const Face> > m_outData; ///< @brief trace of outgoing Data
- TracedCallback<Ptr<const ContentObject>, Ptr<const Packet>,
+ TracedCallback<Ptr<const ContentObject>,
Ptr<const Face> > m_inData; ///< @brief trace of incoming Data
- TracedCallback<Ptr<const ContentObject>, Ptr<const Packet>,
+ TracedCallback<Ptr<const ContentObject>,
Ptr<const Face> > m_dropData; ///< @brief trace of dropped Data
////////////////////////////////////////////////////////////////////
diff --git a/model/fw/per-fib-limits.h b/model/fw/per-fib-limits.h
index 633bd5e..560432a 100644
--- a/model/fw/per-fib-limits.h
+++ b/model/fw/per-fib-limits.h
@@ -99,8 +99,7 @@
virtual bool
CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/// \copydoc ForwardingStrategy::WillSatisfyPendingInterest
@@ -141,8 +140,7 @@
bool
PerFibLimits<Parent>::CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
@@ -152,7 +150,7 @@
if (fibLimits->IsBelowLimit ())
{
- if (super::CanSendOutInterest (inFace, outFace, header, origPacket, pitEntry))
+ if (super::CanSendOutInterest (inFace, outFace, interest, pitEntry))
{
fibLimits->BorrowLimit ();
return true;
@@ -185,7 +183,7 @@
template<class Parent>
void
PerFibLimits<Parent>::WillSatisfyPendingInterest (Ptr<Face> inFace,
- Ptr<pit::Entry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
diff --git a/model/fw/per-out-face-limits.h b/model/fw/per-out-face-limits.h
index 08e892b..fcdd43f 100644
--- a/model/fw/per-out-face-limits.h
+++ b/model/fw/per-out-face-limits.h
@@ -87,8 +87,7 @@
virtual bool
CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
/// \copydoc ForwardingStrategy::WillSatisfyPendingInterest
@@ -134,8 +133,7 @@
bool
PerOutFaceLimits<Parent>::CanSendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
@@ -143,7 +141,7 @@
Ptr<Limits> faceLimits = outFace->template GetObject<Limits> ();
if (faceLimits->IsBelowLimit ())
{
- if (super::CanSendOutInterest (inFace, outFace, header, origPacket, pitEntry))
+ if (super::CanSendOutInterest (inFace, outFace, interest, pitEntry))
{
faceLimits->BorrowLimit ();
return true;
@@ -175,7 +173,7 @@
template<class Parent>
void
PerOutFaceLimits<Parent>::WillSatisfyPendingInterest (Ptr<Face> inFace,
- Ptr<pit::Entry> pitEntry)
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
diff --git a/model/fw/smart-flooding.cc b/model/fw/smart-flooding.cc
index 97faaf7..86ec8ee 100644
--- a/model/fw/smart-flooding.cc
+++ b/model/fw/smart-flooding.cc
@@ -66,14 +66,13 @@
bool
SmartFlooding::DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this);
// Try to work out with just green faces
- bool greenOk = super::DoPropagateInterest (inFace, header, origPacket, pitEntry);
+ bool greenOk = super::DoPropagateInterest (inFace, interest, pitEntry);
if (greenOk)
return true;
@@ -85,7 +84,7 @@
if (metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
break;
- if (!TrySendOutInterest (inFace, metricFace.GetFace (), header, origPacket, pitEntry))
+ if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))
{
continue;
}
diff --git a/model/fw/smart-flooding.h b/model/fw/smart-flooding.h
index e1637aa..9263172 100644
--- a/model/fw/smart-flooding.h
+++ b/model/fw/smart-flooding.h
@@ -55,8 +55,7 @@
// inherited
virtual bool
DoPropagateInterest (Ptr<Face> inFace,
- Ptr<const Interest> header,
- Ptr<const Packet> origPacket,
+ Ptr<const Interest> interest,
Ptr<pit::Entry> pitEntry);
protected: