21 #include "hwmp-protocol.h"
22 #include "hwmp-protocol-mac.h"
24 #include "hwmp-rtable.h"
26 #include "ns3/simulator.h"
27 #include "ns3/packet.h"
28 #include "ns3/mesh-point-device.h"
29 #include "ns3/wifi-net-device.h"
30 #include "ns3/mesh-point-device.h"
31 #include "ns3/mesh-wifi-interface-mac.h"
32 #include "ns3/random-variable-stream.h"
33 #include "airtime-metric.h"
34 #include "ie-dot11s-preq.h"
35 #include "ie-dot11s-prep.h"
36 #include "ns3/trace-source-accessor.h"
37 #include "ie-dot11s-perr.h"
44 NS_OBJECT_ENSURE_REGISTERED (HwmpProtocol);
46 HwmpProtocol::GetTypeId ()
48 static TypeId tid = TypeId (
"ns3::dot11s::HwmpProtocol")
49 .SetParent<MeshL2RoutingProtocol> ()
50 .AddConstructor<HwmpProtocol> ()
51 .AddAttribute (
"RandomStart",
52 "Random delay at first proactive PREQ",
58 .AddAttribute (
"MaxQueueSize",
59 "Maximum number of packets we can store when resolving route",
61 MakeUintegerAccessor (
62 &HwmpProtocol::m_maxQueueSize),
63 MakeUintegerChecker<uint16_t> (1)
65 .AddAttribute (
"Dot11MeshHWMPmaxPREQretries",
66 "Maximum number of retries before we suppose the destination to be unreachable",
68 MakeUintegerAccessor (
69 &HwmpProtocol::m_dot11MeshHWMPmaxPREQretries),
70 MakeUintegerChecker<uint8_t> (1)
72 .AddAttribute (
"Dot11MeshHWMPnetDiameterTraversalTime",
73 "Time we suppose the packet to go from one edge of the network to another",
76 &HwmpProtocol::m_dot11MeshHWMPnetDiameterTraversalTime),
79 .AddAttribute (
"Dot11MeshHWMPpreqMinInterval",
80 "Minimal interval between to successive PREQs",
83 &HwmpProtocol::m_dot11MeshHWMPpreqMinInterval),
86 .AddAttribute (
"Dot11MeshHWMPperrMinInterval",
87 "Minimal interval between to successive PREQs",
89 MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPperrMinInterval),
92 .AddAttribute (
"Dot11MeshHWMPactiveRootTimeout",
93 "Lifetime of poractive routing information",
96 &HwmpProtocol::m_dot11MeshHWMPactiveRootTimeout),
99 .AddAttribute (
"Dot11MeshHWMPactivePathTimeout",
100 "Lifetime of reactive routing information",
103 &HwmpProtocol::m_dot11MeshHWMPactivePathTimeout),
106 .AddAttribute (
"Dot11MeshHWMPpathToRootInterval",
107 "Interval between two successive proactive PREQs",
110 &HwmpProtocol::m_dot11MeshHWMPpathToRootInterval),
113 .AddAttribute (
"Dot11MeshHWMPrannInterval",
114 "Lifetime of poractive routing information",
117 &HwmpProtocol::m_dot11MeshHWMPrannInterval),
120 .AddAttribute (
"MaxTtl",
121 "Initial value of Time To Live field",
123 MakeUintegerAccessor (
124 &HwmpProtocol::m_maxTtl),
125 MakeUintegerChecker<uint8_t> (2)
127 .AddAttribute (
"UnicastPerrThreshold",
128 "Maximum number of PERR receivers, when we send a PERR as a chain of unicasts",
130 MakeUintegerAccessor (
131 &HwmpProtocol::m_unicastPerrThreshold),
132 MakeUintegerChecker<uint8_t> (1)
134 .AddAttribute (
"UnicastPreqThreshold",
135 "Maximum number of PREQ receivers, when we send a PREQ as a chain of unicasts",
137 MakeUintegerAccessor (
138 &HwmpProtocol::m_unicastPreqThreshold),
139 MakeUintegerChecker<uint8_t> (1)
141 .AddAttribute (
"UnicastDataThreshold",
142 "Maximum number ofbroadcast receivers, when we send a broadcast as a chain of unicasts",
144 MakeUintegerAccessor (
145 &HwmpProtocol::m_unicastDataThreshold),
146 MakeUintegerChecker<uint8_t> (1)
148 .AddAttribute (
"DoFlag",
149 "Destination only HWMP flag",
150 BooleanValue (
false),
151 MakeBooleanAccessor (
152 &HwmpProtocol::m_doFlag),
153 MakeBooleanChecker ()
155 .AddAttribute (
"RfFlag",
156 "Reply and forward flag",
158 MakeBooleanAccessor (
159 &HwmpProtocol::m_rfFlag),
160 MakeBooleanChecker ()
162 .AddTraceSource (
"RouteDiscoveryTime",
163 "The time of route discovery procedure",
171 HwmpProtocol::HwmpProtocol () :
175 m_rtable (CreateObject<HwmpRtable> ()),
177 m_maxQueueSize (255),
178 m_dot11MeshHWMPmaxPREQretries (3),
179 m_dot11MeshHWMPnetDiameterTraversalTime (
MicroSeconds (1024*100)),
180 m_dot11MeshHWMPpreqMinInterval (
MicroSeconds (1024*100)),
181 m_dot11MeshHWMPperrMinInterval (
MicroSeconds (1024*100)),
182 m_dot11MeshHWMPactiveRootTimeout (
MicroSeconds (1024*5000)),
183 m_dot11MeshHWMPactivePathTimeout (
MicroSeconds (1024*5000)),
184 m_dot11MeshHWMPpathToRootInterval (
MicroSeconds (1024*2000)),
188 m_unicastPerrThreshold (32),
189 m_unicastPreqThreshold (1),
190 m_unicastDataThreshold (1),
195 m_coefficient = CreateObject<UniformRandomVariable> ();
198 HwmpProtocol::~HwmpProtocol ()
206 m_coefficient->SetAttribute (
"Max",
DoubleValue (m_randomStart.GetSeconds ()));
217 for (std::map<Mac48Address, PreqEvent>::iterator i = m_preqTimeouts.begin (); i != m_preqTimeouts.end (); i++)
219 i->second.preqTimeout.Cancel ();
221 m_proactivePreqTimer.Cancel ();
222 m_preqTimeouts.clear ();
223 m_lastDataSeqno.clear ();
224 m_hwmpSeqnoMetricDatabase.clear ();
225 m_interfaces.clear ();
233 uint32_t sourceIface,
237 uint16_t protocolType,
243 if (sourceIface == GetMeshPoint ()->GetIfIndex ())
248 NS_FATAL_ERROR (
"HWMP tag has come with a packet from upper layer. This must not occur...");
253 tag.SetSeqno (m_dataSeqno++);
255 tag.SetTtl (m_maxTtl);
261 NS_FATAL_ERROR (
"HWMP tag is supposed to be here at this point.");
264 if (tag.GetTtl () == 0)
266 m_stats.droppedTtl++;
272 m_stats.txBroadcast++;
273 m_stats.txBytes += packet->
GetSize ();
275 std::vector<uint16_t> channels;
276 for (HwmpProtocolMacMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin++)
278 bool shouldSend =
true;
279 for (std::vector<uint16_t>::const_iterator chan = channels.begin (); chan != channels.end (); chan++)
281 if ((*chan) == plugin->second->GetChannelId ())
290 channels.push_back (plugin->second->GetChannelId ());
291 std::vector<Mac48Address> receivers = GetBroadcastReceivers (plugin->first);
292 for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i++)
300 tag.SetAddress (address);
302 routeReply (
true, packetCopy, source, destination, protocolType, plugin->first);
308 return ForwardUnicast (sourceIface, source, destination, packet, protocolType, routeReply, tag.GetTtl ());
319 NS_FATAL_ERROR (
"HWMP tag must exist when packet received from the network");
329 NS_LOG_DEBUG (
"Requested src = "<<source<<
", dst = "<<destination<<
", I am "<<GetAddress ()<<
", RA = "<<result.retransmitter);
332 result = m_rtable->LookupProactive ();
335 tag.SetAddress (result.retransmitter);
342 routeReply (
true, packet, source, destination, protocolType, result.ifIndex);
344 m_stats.txBytes += packet->
GetSize ();
347 if (sourceIface != GetMeshPoint ()->GetIfIndex ())
351 result = m_rtable->LookupReactiveExpired (destination);
359 result = m_rtable->LookupProactiveExpired ();
363 std::vector<FailedDestination> destinations = m_rtable->GetUnreachableDestinations (result.retransmitter);
364 InitiatePathError (MakePathError (destinations));
366 m_stats.totalDropped++;
370 result = m_rtable->LookupReactiveExpired (destination);
371 if (ShouldSendPreq (destination))
373 uint32_t originator_seqno = GetNextHwmpSeqno ();
374 uint32_t dst_seqno = 0;
377 dst_seqno = result.seqnum;
379 m_stats.initiatedPreq++;
380 for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
382 i->second->RequestDestination (destination, originator_seqno, dst_seqno);
387 pkt.
dst = destination;
390 pkt.
reply = routeReply;
392 if (QueuePacket (pkt))
394 m_stats.totalQueued++;
399 m_stats.totalDropped++;
406 preq.IncrementMetric (metric);
408 std::map<Mac48Address, std::pair<uint32_t, uint32_t> >::const_iterator i = m_hwmpSeqnoMetricDatabase.find (
409 preq.GetOriginatorAddress ());
410 bool freshInfo (
true);
411 if (i != m_hwmpSeqnoMetricDatabase.end ())
413 if ((int32_t)(i->second.first - preq.GetOriginatorSeqNumber ()) > 0)
417 if (i->second.first == preq.GetOriginatorSeqNumber ())
420 if (i->second.second <= preq.GetMetric ())
426 m_hwmpSeqnoMetricDatabase[preq.GetOriginatorAddress ()] =
427 std::make_pair (preq.GetOriginatorSeqNumber (), preq.GetMetric ());
428 NS_LOG_DEBUG (
"I am " << GetAddress () <<
"Accepted preq from address" << from <<
", preq:" << preq);
435 (m_rtable->LookupReactive (preq.GetOriginatorAddress ()).metric > preq.GetMetric ())
439 m_rtable->AddReactivePath (
440 preq.GetOriginatorAddress (),
445 preq.GetOriginatorSeqNumber ()
447 ReactivePathResolved (preq.GetOriginatorAddress ());
451 (m_rtable->LookupReactive (fromMp).metric > metric)
454 m_rtable->AddReactivePath (
460 preq.GetOriginatorSeqNumber ()
462 ReactivePathResolved (fromMp);
464 for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator i = destinations.begin (); i != destinations.end (); i++)
473 NS_ASSERT (((*i)->IsDo ()) && ((*i)->IsRf ()));
478 ((m_rtable->LookupProactive ()).metric > preq.GetMetric ())
481 m_rtable->AddProactivePath (
483 preq.GetOriginatorAddress (),
487 preq.GetOriginatorSeqNumber ()
489 ProactivePathResolved ();
491 if (!preq.IsNeedNotPrep ())
495 preq.GetOriginatorAddress (),
498 preq.GetOriginatorSeqNumber (),
506 if ((*i)->GetDestinationAddress () == GetAddress ())
510 preq.GetOriginatorAddress (),
513 preq.GetOriginatorSeqNumber (),
523 HwmpRtable::LookupResult result = m_rtable->LookupReactive ((*i)->GetDestinationAddress ());
527 uint32_t lifetime = result.lifetime.GetMicroSeconds () / 1024;
528 if ((lifetime > 0) && ((int32_t)(result.seqnum - (*i)->GetDestSeqNumber ()) >= 0))
531 (*i)->GetDestinationAddress (),
532 preq.GetOriginatorAddress (),
535 preq.GetOriginatorSeqNumber (),
540 m_rtable->AddPrecursor ((*i)->GetDestinationAddress (), interface, from,
544 (*i)->SetFlags (
true,
false, (*i)->IsUsn ());
555 if (preq.GetDestCount () == 0)
560 NS_LOG_DEBUG (
"I am " << GetAddress () <<
"retransmitting PREQ:" << preq);
561 for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
563 i->second->SendPreq (preq);
567 HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface, Mac48Address fromMp, uint32_t metric)
569 prep.IncrementMetric (metric);
571 std::map<Mac48Address, std::pair<uint32_t, uint32_t> >::const_iterator i = m_hwmpSeqnoMetricDatabase.find (
572 prep.GetOriginatorAddress ());
573 bool freshInfo (
true);
574 uint32_t sequence = prep.GetDestinationSeqNumber ();
575 if (i != m_hwmpSeqnoMetricDatabase.end ())
577 if ((int32_t)(i->second.first - sequence) > 0)
581 if (i->second.first == sequence)
586 m_hwmpSeqnoMetricDatabase[prep.GetOriginatorAddress ()] = std::make_pair (sequence, prep.GetMetric ());
589 NS_LOG_DEBUG (
"I am " << GetAddress () <<
", received prep from " << prep.GetOriginatorAddress () <<
", receiver was:" << from);
590 HwmpRtable::LookupResult result = m_rtable->LookupReactive (prep.GetDestinationAddress ());
597 ((m_rtable->LookupReactive (prep.GetOriginatorAddress ())).metric > prep.GetMetric ())
601 m_rtable->AddReactivePath (
602 prep.GetOriginatorAddress (),
608 m_rtable->AddPrecursor (prep.GetDestinationAddress (), interface, from,
612 m_rtable->AddPrecursor (prep.GetOriginatorAddress (), interface, result.retransmitter,
615 ReactivePathResolved (prep.GetOriginatorAddress ());
619 ((m_rtable->LookupReactive (fromMp)).metric > metric)
622 m_rtable->AddReactivePath (
629 ReactivePathResolved (fromMp);
631 if (prep.GetDestinationAddress () == GetAddress ())
633 NS_LOG_DEBUG (
"I am "<<GetAddress ()<<
", resolved "<<prep.GetOriginatorAddress ());
641 HwmpProtocolMacMap::const_iterator prep_sender = m_interfaces.find (result.ifIndex);
642 NS_ASSERT (prep_sender != m_interfaces.end ());
643 prep_sender->second->SendPrep (prep, result.retransmitter);
646 HwmpProtocol::ReceivePerr (std::vector<FailedDestination> destinations, Mac48Address from, uint32_t interface, Mac48Address fromMp)
649 NS_LOG_DEBUG (
"I am "<<GetAddress ()<<
", received PERR from "<<from);
650 std::vector<FailedDestination> retval;
651 HwmpRtable::LookupResult result;
652 for (
unsigned int i = 0; i < destinations.size (); i++)
654 result = m_rtable->LookupReactiveExpired (destinations[i].destination);
656 (result.retransmitter != from) ||
657 (result.ifIndex != interface) ||
658 ((int32_t)(result.seqnum - destinations[i].seqnum) > 0)
661 retval.push_back (destinations[i]);
664 if (retval.size () == 0)
668 ForwardPathError (MakePathError (retval));
671 HwmpProtocol::SendPrep (
674 Mac48Address retransmitter,
676 uint32_t originatorDsn,
677 uint32_t destinationSN,
682 prep.SetHopcount (0);
683 prep.SetTtl (m_maxTtl);
684 prep.SetDestinationAddress (dst);
685 prep.SetDestinationSeqNumber (destinationSN);
686 prep.SetLifetime (lifetime);
687 prep.SetMetric (initMetric);
688 prep.SetOriginatorAddress (src);
689 prep.SetOriginatorSeqNumber (originatorDsn);
690 HwmpProtocolMacMap::const_iterator prep_sender = m_interfaces.find (interface);
691 NS_ASSERT (prep_sender != m_interfaces.end ());
692 prep_sender->second->SendPrep (prep, retransmitter);
693 m_stats.initiatedPrep++;
699 std::vector<Ptr<NetDevice> > interfaces = mp->GetInterfaces ();
700 for (std::vector<
Ptr<NetDevice> >::const_iterator i = interfaces.begin (); i != interfaces.end (); i++)
715 m_interfaces[wifiNetDev->GetIfIndex ()] = hwmpMac;
716 mac->InstallPlugin (hwmpMac);
719 mac->SetLinkMetricCallback (
MakeCallback (&AirtimeLinkMetricCalculator::CalculateMetric, metric));
721 mp->SetRoutingProtocol (
this);
723 mp->AggregateObject (
this);
728 HwmpProtocol::PeerLinkStatus (
Mac48Address meshPointAddress,
Mac48Address peerAddress, uint32_t interface,
bool status)
734 std::vector<FailedDestination> destinations = m_rtable->GetUnreachableDestinations (peerAddress);
735 InitiatePathError (MakePathError (destinations));
740 m_neighboursCallback = cb;
745 if (source == GetAddress ())
749 std::map<Mac48Address, uint32_t,std::less<Mac48Address> >::const_iterator i = m_lastDataSeqno.find (source);
750 if (i == m_lastDataSeqno.end ())
752 m_lastDataSeqno[source] = seqno;
756 if ((int32_t)(i->second - seqno) >= 0)
760 m_lastDataSeqno[source] = seqno;
769 retval.
receivers = GetPerrReceivers (destinations);
774 m_stats.initiatedPerr++;
775 for (
unsigned int i = 0; i < destinations.size (); i++)
778 m_rtable->DeleteReactivePath (destinations[i].destination);
785 for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
787 std::vector<Mac48Address> receivers_for_interface;
788 for (
unsigned int j = 0; j < perr.
receivers.size (); j++)
792 receivers_for_interface.push_back (perr.
receivers[j].second);
795 i->second->InitiatePerr (perr.
destinations, receivers_for_interface);
801 for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
803 std::vector<Mac48Address> receivers_for_interface;
804 for (
unsigned int j = 0; j < perr.
receivers.size (); j++)
808 receivers_for_interface.push_back (perr.
receivers[j].second);
811 i->second->ForwardPerr (perr.
destinations, receivers_for_interface);
815 std::vector<std::pair<uint32_t, Mac48Address> >
819 for (
unsigned int i = 0; i < failedDest.size (); i++)
822 m_rtable->DeleteReactivePath (failedDest[i].destination);
823 m_rtable->DeleteProactivePath (failedDest[i].destination);
824 for (
unsigned int j = 0; j < precursors.size (); j++)
826 retval.push_back (precursors[j]);
830 for (
unsigned int i = 0; i < retval.size (); i++)
832 for (
unsigned int j = i+1; j < retval.size (); j++)
834 if (retval[i].second == retval[j].second)
836 retval.erase (retval.begin () + j);
842 std::vector<Mac48Address>
845 std::vector<Mac48Address> retval;
846 if (!m_neighboursCallback.IsNull ())
848 retval = m_neighboursCallback (interface);
850 if ((retval.size () >= m_unicastPreqThreshold) || (retval.size () == 0))
857 std::vector<Mac48Address>
860 std::vector<Mac48Address> retval;
861 if (!m_neighboursCallback.IsNull ())
863 retval = m_neighboursCallback (interface);
865 if ((retval.size () >= m_unicastDataThreshold) || (retval.size () == 0))
874 HwmpProtocol::QueuePacket (QueuedPacket packet)
876 if (m_rqueue.size () > m_maxQueueSize)
880 m_rqueue.push_back (packet);
884 HwmpProtocol::QueuedPacket
885 HwmpProtocol::DequeueFirstPacketByDst (Mac48Address dst)
889 for (std::vector<QueuedPacket>::iterator i = m_rqueue.begin (); i != m_rqueue.end (); i++)
901 HwmpProtocol::QueuedPacket
902 HwmpProtocol::DequeueFirstPacket ()
906 if (m_rqueue.size () != 0)
908 retval = m_rqueue[0];
909 m_rqueue.erase (m_rqueue.begin ());
915 HwmpProtocol::ReactivePathResolved (Mac48Address dst)
917 std::map<Mac48Address, PreqEvent>::iterator i = m_preqTimeouts.find (dst);
918 if (i != m_preqTimeouts.end ())
920 m_routeDiscoveryTimeCallback (
Simulator::Now () - i->second.whenScheduled);
923 HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
926 QueuedPacket packet = DequeueFirstPacketByDst (dst);
927 while (packet.pkt != 0)
931 packet.pkt->RemovePacketTag (tag);
932 tag.SetAddress (result.retransmitter);
933 packet.pkt->AddPacketTag (tag);
935 m_stats.txBytes += packet.pkt->GetSize ();
936 packet.reply (
true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
938 packet = DequeueFirstPacketByDst (dst);
942 HwmpProtocol::ProactivePathResolved ()
945 HwmpRtable::LookupResult result = m_rtable->LookupProactive ();
947 QueuedPacket packet = DequeueFirstPacket ();
948 while (packet.pkt != 0)
952 if (!packet.pkt->RemovePacketTag (tag))
956 tag.SetAddress (result.retransmitter);
957 packet.pkt->AddPacketTag (tag);
959 m_stats.txBytes += packet.pkt->GetSize ();
960 packet.reply (
true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
962 packet = DequeueFirstPacket ();
969 std::map<Mac48Address, PreqEvent>::const_iterator i = m_preqTimeouts.find (dst);
970 if (i == m_preqTimeouts.end ())
973 Time (m_dot11MeshHWMPnetDiameterTraversalTime * 2),
986 result = m_rtable->LookupProactive ();
990 std::map<Mac48Address, PreqEvent>::iterator i = m_preqTimeouts.find (dst);
992 m_preqTimeouts.erase (i);
995 if (numOfRetry > m_dot11MeshHWMPmaxPREQretries)
999 while (packet.
pkt != 0)
1001 m_stats.totalDropped++;
1003 packet = DequeueFirstPacketByDst (dst);
1005 std::map<Mac48Address, PreqEvent>::iterator i = m_preqTimeouts.find (dst);
1007 m_routeDiscoveryTimeCallback (
Simulator::Now () - i->second.whenScheduled);
1008 m_preqTimeouts.erase (i);
1012 uint32_t originator_seqno = GetNextHwmpSeqno ();
1013 uint32_t dst_seqno = m_rtable->LookupReactiveExpired (dst).seqnum;
1014 for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
1016 i->second->RequestDestination (dst, originator_seqno, dst_seqno);
1019 Time ((2 * (numOfRetry + 1)) * m_dot11MeshHWMPnetDiameterTraversalTime),
1024 HwmpProtocol::SetRoot ()
1026 Time randomStart =
Seconds (m_coefficient->GetValue ());
1032 HwmpProtocol::UnsetRoot ()
1034 m_proactivePreqTimer.Cancel ();
1041 preq.SetHopcount (0);
1042 preq.SetTTL (m_maxTtl);
1043 preq.SetLifetime (m_dot11MeshHWMPactiveRootTimeout.GetMicroSeconds () /1024);
1047 preq.SetOriginatorAddress (GetAddress ());
1048 preq.SetPreqID (GetNextPreqId ());
1049 preq.SetOriginatorSeqNumber (GetNextHwmpSeqno ());
1050 for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
1052 i->second->SendPreq (preq);
1057 HwmpProtocol::GetDoFlag ()
1062 HwmpProtocol::GetRfFlag ()
1067 HwmpProtocol::GetPreqMinInterval ()
1069 return m_dot11MeshHWMPpreqMinInterval;
1072 HwmpProtocol::GetPerrMinInterval ()
1074 return m_dot11MeshHWMPperrMinInterval;
1077 HwmpProtocol::GetMaxTtl ()
1082 HwmpProtocol::GetNextPreqId ()
1088 HwmpProtocol::GetNextHwmpSeqno ()
1094 HwmpProtocol::GetActivePathLifetime ()
1096 return m_dot11MeshHWMPactivePathTimeout.GetMicroSeconds () / 1024;
1099 HwmpProtocol::GetUnicastPerrThreshold ()
1101 return m_unicastPerrThreshold;
1109 HwmpProtocol::Statistics::Statistics () :
1121 void HwmpProtocol::Statistics::Print (std::ostream & os)
const
1123 os <<
"<Statistics "
1124 "txUnicast=\"" << txUnicast <<
"\" "
1125 "txBroadcast=\"" << txBroadcast <<
"\" "
1126 "txBytes=\"" << txBytes <<
"\" "
1127 "droppedTtl=\"" << droppedTtl <<
"\" "
1128 "totalQueued=\"" << totalQueued <<
"\" "
1129 "totalDropped=\"" << totalDropped <<
"\" "
1130 "initiatedPreq=\"" << initiatedPreq <<
"\" "
1131 "initiatedPrep=\"" << initiatedPrep <<
"\" "
1132 "initiatedPerr=\"" << initiatedPerr <<
"\"/>" << std::endl;
1138 "address=\"" << m_address <<
"\"" << std::endl <<
1139 "maxQueueSize=\"" << m_maxQueueSize <<
"\"" << std::endl <<
1140 "Dot11MeshHWMPmaxPREQretries=\"" << (uint16_t)m_dot11MeshHWMPmaxPREQretries <<
"\"" << std::endl <<
1141 "Dot11MeshHWMPnetDiameterTraversalTime=\"" << m_dot11MeshHWMPnetDiameterTraversalTime.
GetSeconds () <<
"\"" << std::endl <<
1142 "Dot11MeshHWMPpreqMinInterval=\"" << m_dot11MeshHWMPpreqMinInterval.
GetSeconds () <<
"\"" << std::endl <<
1143 "Dot11MeshHWMPperrMinInterval=\"" << m_dot11MeshHWMPperrMinInterval.
GetSeconds () <<
"\"" << std::endl <<
1144 "Dot11MeshHWMPactiveRootTimeout=\"" << m_dot11MeshHWMPactiveRootTimeout.
GetSeconds () <<
"\"" << std::endl <<
1145 "Dot11MeshHWMPactivePathTimeout=\"" << m_dot11MeshHWMPactivePathTimeout.
GetSeconds () <<
"\"" << std::endl <<
1146 "Dot11MeshHWMPpathToRootInterval=\"" << m_dot11MeshHWMPpathToRootInterval.
GetSeconds () <<
"\"" << std::endl <<
1147 "Dot11MeshHWMPrannInterval=\"" << m_dot11MeshHWMPrannInterval.
GetSeconds () <<
"\"" << std::endl <<
1148 "isRoot=\"" << m_isRoot <<
"\"" << std::endl <<
1149 "maxTtl=\"" << (uint16_t)m_maxTtl <<
"\"" << std::endl <<
1150 "unicastPerrThreshold=\"" << (uint16_t)m_unicastPerrThreshold <<
"\"" << std::endl <<
1151 "unicastPreqThreshold=\"" << (uint16_t)m_unicastPreqThreshold <<
"\"" << std::endl <<
1152 "unicastDataThreshold=\"" << (uint16_t)m_unicastDataThreshold <<
"\"" << std::endl <<
1153 "doFlag=\"" << m_doFlag <<
"\"" << std::endl <<
1154 "rfFlag=\"" << m_rfFlag <<
"\">" << std::endl;
1156 for (HwmpProtocolMacMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin++)
1158 plugin->second->Report (os);
1160 os <<
"</Hwmp>" << std::endl;
1163 HwmpProtocol::ResetStats ()
1165 m_stats = Statistics ();
1166 for (HwmpProtocolMacMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin++)
1168 plugin->second->ResetStats ();
1180 HwmpProtocol::QueuedPacket::QueuedPacket () :
Structure of path error: IePerr and list of receivers: interfaces and MAC address.
bool RequestRoute(uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, Ptr< const Packet > packet, uint16_t protocolType, RouteReplyCallback routeReply)
Route request, inherited from MeshL2RoutingProtocol.
#define NS_LOG_FUNCTION(parameters)
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
Hwmp tag implements interaction between HWMP protocol and MeshWifiMac.
static const uint32_t MAX_METRIC
Maximum (the best?) path metric.
Route lookup result, return type of LookupXXX methods.
void AddPacketTag(const Tag &tag) const
#define NS_ASSERT(condition)
void ForwardPathError(PathError perr)
Forwards a received path error.
#define NS_LOG_COMPONENT_DEFINE(name)
uint32_t GetSize(void) const
Mac48Address src
src address
bool Install(Ptr< MeshPointDevice >)
Install HWMP on given mesh point.
void InitiatePathError(PathError perr)
Passes a self-generated PERR to interface-plugin.
#define NS_LOG_FUNCTION_NOARGS()
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
#define NS_FATAL_ERROR(msg)
fatal error handling
TracedCallback< Time > m_routeDiscoveryTimeCallback
Route discovery time:
void SendProactivePreq()
Proactive Preq routines:
bool DropDataFrame(uint32_t seqno, Mac48Address source)
MAC-plugin asks whether the frame can be dropped. Protocol automatically updates seqno.
std::vector< std::pair< uint32_t, Mac48Address > > PrecursorList
Path precursor = {MAC, interface ID}.
Ptr< Packet > pkt
the packet
std::vector< Mac48Address > GetPreqReceivers(uint32_t interface)
double GetSeconds(void) const
bool RemoveRoutingStuff(uint32_t fromIface, const Mac48Address source, const Mac48Address destination, Ptr< Packet > packet, uint16_t &protocolType)
Cleanup packet from all tags.
bool PeekPacketTag(Tag &tag) const
std::vector< std::pair< uint32_t, Mac48Address > > GetPerrReceivers(std::vector< FailedDestination > failedDest)
void RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry)
Generates PREQ retry when retry timeout has expired and route is still unresolved.
See 7.3.2.96 of 802.11s draft 2.07.
bool ForwardUnicast(uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, Ptr< Packet > packet, uint16_t protocolType, RouteReplyCallback routeReply, uint32_t ttl)
Like RequestRoute, but for unicast packets.
Packet waiting its routing information.
Hold together all Wifi-related objects.This class holds together ns3::WifiChannel, ns3::WifiPhy, ns3::WifiMac, and, ns3::WifiRemoteStationManager.
static Mac48Address GetBroadcast(void)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Time m_randomStart
Random start in Proactive PREQ propagation.
Mac48Address GetAddress()
static Mac48Address ConvertFrom(const Address &address)
Ptr< Packet > Copy(void) const
uint16_t protocol
protocol number
void AddDestinationAddressElement(bool doFlag, bool rfFlag, Mac48Address dest_address, uint32_t dest_seq_number)
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
void DelDestinationAddressElement(Mac48Address dest_address)
Delete a destination address unit by destination.
PathError MakePathError(std::vector< FailedDestination > destinations)
forms a path error information element when list of destination fails on a given interface ...
std::vector< std::pair< uint32_t, Mac48Address > > receivers
list of PathError receivers (in case of unicast PERR)
std::vector< Ptr< DestinationAddressUnit > > GetDestinationList()
Get all destinations, which are stored in PREQ:
RouteReplyCallback reply
how to reply
void Report(std::ostream &) const
Statistics:
Mac48Address dst
dst address
Ptr< UniformRandomVariable > m_coefficient
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
std::vector< Mac48Address > GetBroadcastReceivers(uint32_t interface)
std::vector< FailedDestination > destinations
destination list: Mac48Address and sequence number
bool RemovePacketTag(Tag &tag)
#define NS_LOG_DEBUG(msg)
uint32_t inInterface
incoming device interface ID. (if packet has come from upper layers, this is Mesh point ID) ...
bool ShouldSendPreq(Mac48Address dst)
checks when the last path discovery procedure was started for a given destination.
Hold an floating point type.
Basic MAC of mesh point Wi-Fi interface. Its function is extendable through plugins mechanism...
Time MicroSeconds(uint64_t us)
create ns3::Time instances in units of microseconds.
int64_t AssignStreams(int64_t stream)
void SetNeighboursCallback(Callback< std::vector< Mac48Address >, uint32_t > cb)
This callback is used to obtain active neighbours on a given interface.
virtual void DoInitialize()