|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #include "ns3/object.h"
22 #include "ns3/assert.h"
23 #include "ns3/simulator.h"
42 .SetGroupName (
"Mesh")
60 uint32_t metric,
Time lifetime, uint32_t seqnum)
63 std::map<Mac48Address, ReactiveRoute>::iterator i =
m_routes.find (destination);
71 i->second.retransmitter = retransmitter;
72 i->second.interface = interface;
73 i->second.metric = metric;
75 i->second.seqnum = seqnum;
79 uint32_t interface,
Time lifetime, uint32_t seqnum)
81 NS_LOG_FUNCTION (
this << metric << root << retransmitter << interface << lifetime << seqnum);
93 NS_LOG_FUNCTION (
this << destination << precursorInterface << precursorAddress << lifetime);
96 precursor.
address = precursorAddress;
98 std::map<Mac48Address, ReactiveRoute>::iterator i =
m_routes.find (destination);
101 bool should_add =
true;
102 for (
unsigned int j = 0; j < i->second.precursors.size (); j++)
106 if (i->second.precursors[j].address == precursorAddress)
109 i->second.precursors[j].whenExpire = precursor.
whenExpire;
115 i->second.precursors.push_back (precursor);
143 std::map<Mac48Address, ReactiveRoute>::iterator i =
m_routes.find (destination);
153 std::map<Mac48Address, ReactiveRoute>::iterator i =
m_routes.find (destination);
169 std::map<Mac48Address, ReactiveRoute>::iterator i =
m_routes.find (destination);
174 NS_LOG_DEBUG (
"Returning reactive route to " << destination);
175 return LookupResult (i->second.retransmitter, i->second.interface, i->second.metric, i->second.seqnum,
184 NS_LOG_DEBUG (
"Proactive route has expired and will be deleted, sorry.");
197 std::vector<HwmpProtocol::FailedDestination>
202 std::vector<HwmpProtocol::FailedDestination> retval;
203 for (std::map<Mac48Address, ReactiveRoute>::iterator i =
m_routes.begin (); i !=
m_routes.end (); i++)
205 if (i->second.retransmitter == peerAddress)
209 dst.
seqnum = i->second.seqnum;
210 retval.push_back (dst);
218 retval.push_back (dst);
228 std::map<Mac48Address, ReactiveRoute>::iterator route =
m_routes.find (destination);
231 for (std::vector<Precursor>::const_iterator i = route->second.precursors.begin ();
232 i != route->second.precursors.end (); i++)
236 retval.push_back (std::make_pair (i->interface, i->address));
249 retransmitter (r), ifIndex (i), metric (m), seqnum (s), lifetime (l)
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void DeleteReactivePath(Mac48Address destination)
Delete the reactive paths toward a destination.
Mac48Address retransmitter
retransmitter
static const uint32_t INTERFACE_ANY
Means all interfaces.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void AddReactivePath(Mac48Address destination, Mac48Address retransmitter, uint32_t interface, uint32_t metric, Time lifetime, uint32_t seqnum)
Add a reactive path.
static Time Now(void)
Return the current simulation virtual time.
Mac48Address retransmitter
retransmitter
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
Route found in reactive mode.
ProactiveRoute m_root
Path to proactive tree root MP.
Route lookup result, return type of LookupXXX methods.
uint32_t interface
interface
void AddProactivePath(uint32_t metric, Mac48Address root, Mac48Address retransmitter, uint32_t interface, Time lifetime, uint32_t seqnum)
Add a proactive path.
void DeleteProactivePath()
Delete all the proactive paths.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
uint32_t interface
interface
void DoDispose()
Destructor implementation.
std::map< Mac48Address, ReactiveRoute > m_routes
List of routes.
bool operator==(const LookupResult &o) const
Compare route lookup results, used by tests.
static Mac48Address GetBroadcast(void)
uint32_t seqnum
sequence number
Time whenExpire
expire time
LookupResult LookupReactiveExpired(Mac48Address destination)
Return all reactive paths, including expired.
A base class which provides memory management and object aggregation.
Time whenExpire
expire time
std::vector< HwmpProtocol::FailedDestination > GetUnreachableDestinations(Mac48Address peerAddress)
When peer link with a given MAC-address fails - it returns list of unreachable destination addresses.
Simulation virtual time values and global simulation resolution.
static TypeId GetTypeId()
Get the type ID.
PrecursorList GetPrecursors(Mac48Address destination)
Get the precursors list.
uint32_t ifIndex
IF index.
LookupResult LookupReactive(Mac48Address destination)
Lookup path to destination.
void AddPrecursor(Mac48Address destination, uint32_t precursorInterface, Mac48Address precursorAddress, Time lifetime)
Add a precursor.
uint32_t seqnum
sequence number
static const uint32_t MAX_METRIC
Maximum (the best?) path metric.
LookupResult LookupProactiveExpired()
Return all proactive paths, including expired.
Mac48Address destination
destination address
std::vector< Precursor > precursors
precursors
uint32_t seqnum
sequence number
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Route found in reactive mode.
LookupResult LookupProactive()
Find proactive path to tree root.
Time Seconds(double value)
Construct a Time in the indicated unit.
std::vector< std::pair< uint32_t, Mac48Address > > PrecursorList
Path precursor = {MAC, interface ID}.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
structure of unreachable destination - address and sequence number
Mac48Address address
address
Routing table for HWMP – 802.11s routing protocol.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.