22 #include "ns3/assert.h"
24 #include "ns3/object.h"
25 #include "ns3/simulator.h"
71 NS_LOG_FUNCTION(
this << destination << retransmitter << interface << metric
81 i->second.retransmitter = retransmitter;
82 i->second.interface = interface;
83 i->second.metric = metric;
85 i->second.seqnum = seqnum;
96 NS_LOG_FUNCTION(
this << metric << root << retransmitter << interface << lifetime << seqnum);
107 uint32_t precursorInterface,
111 NS_LOG_FUNCTION(
this << destination << precursorInterface << precursorAddress << lifetime);
113 precursor.
interface = precursorInterface;
114 precursor.
address = precursorAddress;
116 auto i =
m_routes.find(destination);
119 bool should_add =
true;
120 for (
unsigned int j = 0; j < i->second.precursors.size(); j++)
124 if (i->second.precursors[j].address == precursorAddress)
127 i->second.precursors[j].whenExpire = precursor.
whenExpire;
133 i->second.precursors.push_back(precursor);
164 auto i =
m_routes.find(destination);
175 auto i =
m_routes.find(destination);
192 auto i =
m_routes.find(destination);
197 NS_LOG_DEBUG(
"Returning reactive route to " << destination);
211 NS_LOG_DEBUG(
"Proactive route has expired and will be deleted, sorry.");
229 std::vector<HwmpProtocol::FailedDestination>
234 std::vector<HwmpProtocol::FailedDestination> retval;
237 if (i->second.retransmitter == peerAddress)
241 dst.
seqnum = i->second.seqnum;
242 retval.push_back(dst);
250 retval.push_back(dst);
261 auto route =
m_routes.find(destination);
264 for (
auto i = route->second.precursors.begin(); i != route->second.precursors.end(); i++)
268 retval.emplace_back(i->interface, i->address);
static Mac48Address GetBroadcast()
A base class which provides memory management and object aggregation.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Routing table for HWMP – 802.11s routing protocol.
void DeleteReactivePath(Mac48Address destination)
Delete the reactive paths toward a destination.
void DoDispose() override
Destructor implementation.
static const uint32_t INTERFACE_ANY
Means all interfaces.
static const uint32_t MAX_METRIC
Maximum (the best?) path metric.
LookupResult LookupReactive(Mac48Address destination)
Lookup path to destination.
LookupResult LookupReactiveExpired(Mac48Address destination)
Return all reactive paths, including expired.
static TypeId GetTypeId()
Get the type ID.
std::map< Mac48Address, ReactiveRoute > m_routes
List of routes.
PrecursorList GetPrecursors(Mac48Address destination)
Get the precursors list.
void DeleteProactivePath()
Delete all the proactive paths.
LookupResult LookupProactiveExpired()
Return all proactive paths, including expired.
std::vector< std::pair< uint32_t, Mac48Address > > PrecursorList
Path precursor = {MAC, interface ID}.
std::vector< HwmpProtocol::FailedDestination > GetUnreachableDestinations(Mac48Address peerAddress)
When peer link with a given MAC-address fails - it returns list of unreachable destination addresses.
ProactiveRoute m_root
Path to proactive tree root MP.
LookupResult LookupProactive()
Find proactive path to tree root.
void AddPrecursor(Mac48Address destination, uint32_t precursorInterface, Mac48Address precursorAddress, Time lifetime)
Add a precursor.
void AddProactivePath(uint32_t metric, Mac48Address root, Mac48Address retransmitter, uint32_t interface, Time lifetime, uint32_t seqnum)
Add a proactive path.
void AddReactivePath(Mac48Address destination, Mac48Address retransmitter, uint32_t interface, uint32_t metric, Time lifetime, uint32_t seqnum)
Add a reactive path.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
structure of unreachable destination - address and sequence number
Mac48Address destination
destination address
uint32_t seqnum
sequence number
Route lookup result, return type of LookupXXX methods.
LookupResult(Mac48Address r=Mac48Address::GetBroadcast(), uint32_t i=INTERFACE_ANY, uint32_t m=MAX_METRIC, uint32_t s=0, Time l=Seconds(0.0))
Lookup result function.
bool operator==(const LookupResult &o) const
Compare route lookup results, used by tests.
uint32_t seqnum
sequence number
uint32_t ifIndex
IF index.
Mac48Address retransmitter
retransmitter
Route found in reactive mode.
Mac48Address address
address
uint32_t interface
interface
Time whenExpire
expire time
std::vector< Precursor > precursors
precursors
uint32_t interface
interface
Time whenExpire
expire time
Mac48Address retransmitter
retransmitter
uint32_t seqnum
sequence number
Route found in reactive mode.