21 #include "ndn-pit-entry.h"
23 #include "ns3/ndn-pit.h"
24 #include "ns3/ndn-fib.h"
25 #include "ns3/ndn-name.h"
26 #include "ns3/ndn-interest.h"
28 #include "ns3/packet.h"
29 #include "ns3/simulator.h"
32 #include <boost/lambda/lambda.hpp>
33 #include <boost/lambda/bind.hpp>
34 #include <boost/foreach.hpp>
35 namespace ll = boost::lambda;
37 NS_LOG_COMPONENT_DEFINE (
"ndn.pit.Entry");
44 Ptr<const Interest> header,
45 Ptr<fib::Entry> fibEntry)
46 : m_container (container)
48 , m_fibEntry (fibEntry)
51 NS_LOG_FUNCTION (
this);
56 header->GetInterestLifetime ():
68 NS_LOG_FUNCTION (
this);
76 NS_LOG_INFO (this->
GetPrefix () <<
", Updated lifetime to " <<
m_expireTime.ToDouble (Time::S) <<
"s, " << (
m_expireTime-Simulator::Now ()).ToDouble (Time::S) <<
"s left");
87 NS_LOG_INFO (this->
GetPrefix () <<
", Offsetting lifetime to " <<
m_expireTime.ToDouble (Time::S) <<
"s, " << (
m_expireTime-Simulator::Now ()).ToDouble (Time::S) <<
"s left");
119 std::pair<in_iterator,bool> ret =
142 std::pair<out_iterator,bool> ret =
147 const_cast<OutgoingFace&
>(*ret.first).UpdateOnRetransmit ();
209 NS_LOG_DEBUG (
"inVain " << inVain);
274 std::ostream& operator<< (std::ostream& os,
const Entry &entry)
276 os <<
"Prefix: " << entry.
GetPrefix () <<
"\n";
291 BOOST_FOREACH (
const OutgoingFace &face, entry.
m_outgoing)
bool AreTherePromisingOutgoingFacesExcept(Ptr< Face > face) const
Similar to AreAllOutgoingInVain, but ignores face
Ptr< fib::Entry > m_fibEntry
FIB entry related to this prefix.
Entry(Pit &container, Ptr< const Interest > header, Ptr< fib::Entry > fibEntry)
PIT entry constructor.
out_container m_outgoing
container for outgoing interests
Ptr< const Interest > m_interest
Interest of the PIT entry (if several interests are received, then nonce is from the first Interest) ...
PIT state component for each outgoing interest.
virtual in_iterator AddIncoming(Ptr< Face > face)
Add face to the list of incoming faces.
virtual void RemoveAllReferencesToFace(Ptr< Face > face)
Remove all references to face.
virtual ~Entry()
Virtual destructor.
std::set< OutgoingFace > out_container
outgoing faces container type
Class implementing Pending Interests Table.
Time m_lastRetransmission
Last time when number of retransmissions were increased.
Ptr< Face > m_face
face of the incoming Interest
const Time & GetMaxPitEntryLifetime() const
Get maximum PIT entry lifetime.
virtual out_iterator AddOutgoing(Ptr< Face > face)
Add face to the list of outgoing faces.
Ptr< fib::Entry > GetFibEntry()
Get associated FIB entry.
virtual void ClearIncoming()
Clear all incoming faces either after all of them were satisfied or NACKed.
bool AreAllOutgoingInVain() const
Check if all outgoing faces are NACKed.
in_container::iterator in_iterator
iterator to incoming faces
Ptr< Face > m_face
face of the outgoing Interest
virtual void RemoveIncoming(Ptr< Face > face)
Remove incoming entry for face face
in_container m_incoming
container for incoming interests
virtual void OffsetLifetime(const Time &offsetTime)
Offset the currently set PIT lifetime (allowed both negative and positive offsets) ...
bool m_waitingInVain
when flag is set, we do not expect data for this interest, only a small hope that it will happen ...
std::set< IncomingFace > in_container
incoming faces container type
Ptr< const Interest > GetInterest() const
Get Interest (if several interests are received, then nonce is from the first Interest) ...
Time m_expireTime
Time when PIT entry will be removed.
const in_container & GetIncoming() const
Get associated list (const reference) of incoming faces.
virtual void ClearOutgoing()
Clear all incoming faces either after all of them were satisfied or NACKed.
const out_container & GetOutgoing() const
Get associated list (const reference) of outgoing faces.
uint32_t m_maxRetxCount
Maximum allowed number of retransmissions via outgoing faces.
virtual void AddSeenNonce(uint32_t nonce)
Add nonce to the list of seen nonces.
virtual void UpdateLifetime(const Time &lifetime)
Update lifetime of PIT entry.
nonce_container m_seenNonces
map of nonces that were seen for this prefix
const Name & GetPrefix() const
Get prefix of the PIT entry.
virtual void SetWaitingInVain(Ptr< Face > face)
Flag outgoing face as hopeless.
uint32_t GetOutgoingCount() const
Get number of outgoing faces (needed for python bindings)
Pit & m_container
Reference to the container (to rearrange indexes, if necessary)
const Time & GetExpireTime() const
Get current expiration time of the record.
virtual void IncreaseAllowedRetxCount()
Increase maximum limit of allowed retransmission per outgoing face.
uint32_t GetMaxRetxCount() const
Get maximum allowed number of retransmissions via outgoing faces.
bool IsNonceSeen(uint32_t nonce) const
Check if nonce nonce for the same prefix has already been seen.
out_container::iterator out_iterator
iterator to outgoing faces
PIT state component for each incoming interest (not including duplicates)