21 #ifndef _NDN_FIB_ENTRY_H_
22 #define _NDN_FIB_ENTRY_H_
25 #include "ns3/nstime.h"
26 #include "ns3/ndn-face.h"
27 #include "ns3/ndn-name.h"
28 #include "ns3/ndn-limits.h"
29 #include "ns3/traced-value.h"
31 #include <boost/multi_index_container.hpp>
32 #include <boost/multi_index/tag.hpp>
33 #include <boost/multi_index/ordered_index.hpp>
34 #include <boost/multi_index/composite_key.hpp>
35 #include <boost/multi_index/hashed_index.hpp>
36 #include <boost/multi_index/random_access_index.hpp>
37 #include <boost/multi_index/member.hpp>
38 #include <boost/multi_index/mem_fun.hpp>
44 typedef Name NameComponents;
76 , m_status (NDN_FIB_YELLOW)
77 , m_routingCost (cost)
78 , m_sRtt (Seconds (0))
79 , m_rttVar (Seconds (0))
80 , m_realDelay (Seconds (0))
93 operator< (const Ptr<Face> &face)
const {
return *m_face < *face; }
123 m_status.Set (status);
132 return m_routingCost;
141 m_routingCost = routingCost;
177 m_realDelay = realDelay;
183 TracedValue<Status> &
190 friend std::ostream& operator<< (std::ostream& os,
const FaceMetric &metric);
195 TracedValue<Status> m_status;
200 int32_t m_routingCost;
228 typedef boost::multi_index::multi_index_container<
230 boost::multi_index::indexed_by<
232 boost::multi_index::ordered_unique<
233 boost::multi_index::tag<i_face>,
238 boost::multi_index::ordered_non_unique<
239 boost::multi_index::tag<i_metric>,
240 boost::multi_index::composite_key<
242 boost::multi_index::const_mem_fun<FaceMetric,FaceMetric::Status,&FaceMetric::GetStatus>,
243 boost::multi_index::const_mem_fun<FaceMetric,int32_t,&FaceMetric::GetRoutingCost>
248 boost::multi_index::random_access<
249 boost::multi_index::tag<i_nth>
273 Entry (Ptr<Fib> fib,
const Ptr<const Name> &prefix)
343 friend std::ostream& operator<< (std::ostream& os,
const Entry &entry);
354 std::ostream& operator<< (std::ostream& os,
const Entry &entry);
355 std::ostream& operator<< (std::ostream& os,
const FaceMetric &metric);
361 #endif // _NDN_FIB_ENTRY_H_
Entry(Ptr< Fib > fib, const Ptr< const Name > &prefix)
Constructor.
Exception class for the case when FIB entry is not found.
TracedValue< Status > & GetStatusTrace()
Get direct access to status trace.
bool m_needsProbing
flag indicating that probing should be performed
Status
Color codes for FIB face status.
Structure for FIB table entry, holding indexed list of available faces and their respective metrics...
void UpdateStatus(Ptr< Face > face, FaceMetric::Status status)
Update status of FIB next hop.
Typedef for indexed face container of Entry.
void SetStatus(Status status)
Set current status of FIB entry.
Ptr< Face > GetFace() const
Return Face associated with FaceMetric.
bool operator<(const FaceMetric &fm) const
Comparison operator used by boost::multi_index::identity<>
void AddOrUpdateRoutingMetric(Ptr< Face > face, int32_t metric)
Add or update routing metric of FIB next hop.
void Invalidate()
Invalidate face.
FaceMetricContainer::type m_faces
Indexed list of faces.
Time GetSRtt() const
Get current estimate for smoothed RTT value.
int32_t GetRoutingCost() const
Get current routing cost.
const Name & GetPrefix() const
Get prefix for the FIB entry.
void UpdateRtt(const Time &rttSample)
Recalculate smoothed RTT and RTT variation.
Structure holding various parameters associated with a (FibEntry, Face) tuple.
Ptr< Fib > GetFib()
Get pointer to access FIB, to which this entry is added.
void SetRealDelay(Time realDelay)
Set real propagation delay to the producer, calculated based on NS-3 p2p link delays.
void SetRealDelayToProducer(Ptr< Face > face, Time delay)
Set real delay to the producer.
Status GetStatus() const
Get current status of FIB entry.
Time GetRttVar() const
Get current estimate for the RTT variation.
FaceMetric(Ptr< Face > face, int32_t cost)
Metric constructor.
void SetRoutingCost(int32_t routingCost)
Set routing cost.
Ptr< Fib > m_fib
FIB to which entry is added.
const FaceMetric & FindBestCandidate(uint32_t skip=0) const
Find "best route" candidate, skipping `skip' first candidates (modulo # of faces) ...
void UpdateFaceRtt(Ptr< Face > face, const Time &sample)
Update RTT averages for the face.
Ptr< const Name > m_prefix
Prefix of the FIB entry.
Time GetRealDelay() const
Get real propagation delay to the producer, calculated based on NS-3 p2p link delays.
void RemoveFace(const Ptr< Face > &face)
Remove record associated with face