20 #include "ns3/assert.h"
21 #include "ns3/simulator.h"
25 #include "flame-rtable.h"
31 NS_OBJECT_ENSURE_REGISTERED (FlameRtable);
34 FlameRtable::GetTypeId ()
37 TypeId (
"ns3::flame::FlameRtable")
38 .SetParent<Object> ().AddConstructor<FlameRtable> ()
39 .AddAttribute (
"Lifetime",
40 "The lifetime of the routing enrty",
41 TimeValue (
Seconds (120)), MakeTimeAccessor (
48 FlameRtable::FlameRtable () :
52 FlameRtable::~FlameRtable ()
62 const uint32_t interface,
const uint8_t cost,
const uint16_t seqnum)
64 std::map<Mac48Address, Route>::iterator i = m_routes.find (destination);
65 if (i == m_routes.end ())
69 newroute.retransmitter = retransmitter;
70 newroute.interface = interface;
72 newroute.seqnum = seqnum;
73 m_routes[destination] = newroute;
76 i->second.seqnum = seqnum;
78 i->second.retransmitter = retransmitter;
79 i->second.interface = interface;
80 i->second.cost = cost;
86 std::map<Mac48Address, Route>::iterator i = m_routes.find (destination);
87 if (i == m_routes.end ())
97 return LookupResult (i->second.retransmitter, i->second.interface, i->second.cost, i->second.seqnum);
102 return (retransmitter == o.retransmitter && ifIndex == o.ifIndex && cost == o.cost && seqnum == o.seqnum);
void AddPath(const Mac48Address destination, const Mac48Address retransmitter, const uint32_t interface, const uint8_t cost, const uint16_t seqnum)
Add path.
#define NS_ASSERT(condition)
#define NS_LOG_COMPONENT_DEFINE(name)
static Mac48Address GetBroadcast(void)
Time m_lifetime
Lifetime parameter.
Route lookup result, return type of LookupXXX methods.
bool operator==(const LookupResult &o) const
Compare route lookup results, used by tests.
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
bool IsValid() const
True for valid route.
#define NS_LOG_DEBUG(msg)
LookupResult Lookup(Mac48Address destination)
Lookup path to destination.