71 "Lifetime of poractive routing information", |
71 "Lifetime of poractive routing information", |
72 TimeValue (MicroSeconds (1024*5000)), |
72 TimeValue (MicroSeconds (1024*5000)), |
73 MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactiveRootTimeout), |
73 MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactiveRootTimeout), |
74 MakeTimeChecker () |
74 MakeTimeChecker () |
75 ) |
75 ) |
76 .AddAttribute ("dot11MeshHWMPactiveRootTimeout", |
|
77 "Lifetime of poractive routing information", |
|
78 TimeValue (MicroSeconds (1024*5000)), |
|
79 MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactiveRootTimeout), |
|
80 MakeTimeChecker () |
|
81 ) |
|
82 .AddAttribute ("dot11MeshHWMPactivePathTimeout", |
76 .AddAttribute ("dot11MeshHWMPactivePathTimeout", |
83 "Lifetime of reactive routing information", |
77 "Lifetime of reactive routing information", |
84 TimeValue (MicroSeconds (1024*5000)), |
78 TimeValue (MicroSeconds (1024*5000)), |
85 MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactivePathTimeout), |
79 MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactivePathTimeout), |
86 MakeTimeChecker () |
80 MakeTimeChecker () |
94 .AddAttribute ("dot11MeshHWMPrannInterval", |
88 .AddAttribute ("dot11MeshHWMPrannInterval", |
95 "Lifetime of poractive routing information", |
89 "Lifetime of poractive routing information", |
96 TimeValue (MicroSeconds (1024*5000)), |
90 TimeValue (MicroSeconds (1024*5000)), |
97 MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPrannInterval), |
91 MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPrannInterval), |
98 MakeTimeChecker () |
92 MakeTimeChecker () |
|
93 ) |
|
94 .AddAttribute ("maxQueueSize", |
|
95 "Maximum number of packets we can store when resolving route", |
|
96 UintegerValue (255), |
|
97 MakeUintegerAccessor (&HwmpProtocol::m_maxQueueSize), |
|
98 MakeUintegerChecker<uint16_t> (1) |
|
99 ) |
|
100 .AddAttribute ("maxTtl", |
|
101 "Initial value of Time To Live field", |
|
102 UintegerValue (32), |
|
103 MakeUintegerAccessor (&HwmpProtocol::m_maxTtl), |
|
104 MakeUintegerChecker<uint8_t> (1) |
99 ); |
105 ); |
100 return tid; |
106 return tid; |
101 } |
107 } |
102 HwmpProtocol::HwmpProtocol (): |
108 HwmpProtocol::HwmpProtocol (): |
103 m_dataSeqno(0), |
109 m_dataSeqno(0), |
104 m_hwmpSeqno(0), |
110 m_hwmpSeqno(0), |
105 m_maxTtl (32), |
|
106 m_rtable (CreateObject<HwmpRtable> ()) |
111 m_rtable (CreateObject<HwmpRtable> ()) |
107 { |
112 { |
108 } |
113 } |
109 |
114 |
110 HwmpProtocol::~HwmpProtocol () |
115 HwmpProtocol::~HwmpProtocol () |
523 m_rtable->DeleteProactivePath (failedDest[i].destination, port); |
528 m_rtable->DeleteProactivePath (failedDest[i].destination, port); |
524 } |
529 } |
525 return retransmitters; |
530 return retransmitters; |
526 } |
531 } |
527 #endif |
532 #endif |
528 void |
|
529 HwmpProtocol::SetMaxQueueSize (int maxPacketsPerDestination) |
|
530 { |
|
531 } |
|
532 bool |
533 bool |
533 HwmpProtocol::QueuePacket (MeshL2RoutingProtocol::QueuedPacket packet) |
534 HwmpProtocol::QueuePacket (MeshL2RoutingProtocol::QueuedPacket packet) |
534 { |
535 { |
535 #if 0 |
536 if (m_rqueue.size () > m_maxQueueSize) |
536 if ((int)m_rqueue[packet.dst].size () > m_maxQueueSize) |
|
537 return false; |
537 return false; |
538 m_rqueue[packet.dst].push (packet); |
538 m_rqueue.push_back (packet); |
539 #endif |
|
540 return true; |
539 return true; |
541 } |
540 } |
542 |
541 |
543 MeshL2RoutingProtocol::QueuedPacket |
542 MeshL2RoutingProtocol::QueuedPacket |
544 HwmpProtocol::DequeuePacket (Mac48Address dst) |
543 HwmpProtocol::DequeueFirstPacketByDst (Mac48Address dst) |
545 { |
544 { |
546 MeshL2RoutingProtocol::QueuedPacket retval; |
545 MeshL2RoutingProtocol::QueuedPacket retval; |
547 #if 0 |
|
548 retval.pkt = NULL; |
546 retval.pkt = NULL; |
549 //Ptr<Packet> in this structure is NULL when queue is empty |
547 for(std::vector<QueuedPacket>::iterator i = m_rqueue.begin (); i != m_rqueue.end (); i++) |
550 std::map<Mac48Address, std::queue<QueuedPacket> >:: iterator i = m_rqueue.find (dst); |
548 if((*i).dst == dst) |
551 if (i == m_rqueue.end ()) |
549 { |
552 return retval; |
550 retval = (*i); |
553 if ((int)m_rqueue[dst].size () == 0) |
|
554 return retval; |
|
555 if ((int)i->second.size () == 0) |
|
556 { |
|
557 m_rqueue.erase (i); |
551 m_rqueue.erase (i); |
558 return retval; |
552 break; |
559 } |
553 } |
560 retval = m_rqueue[dst].front (); |
|
561 m_rqueue[dst].pop (); |
|
562 #endif |
|
563 return retval; |
554 return retval; |
564 } |
555 } |
565 void |
556 MeshL2RoutingProtocol::QueuedPacket |
566 HwmpProtocol::SendAllPossiblePackets (Mac48Address dst) |
557 HwmpProtocol::DequeueFirstPacket () |
567 { |
558 { |
568 #if 0 |
559 MeshL2RoutingProtocol::QueuedPacket retval; |
|
560 retval.pkt = NULL; |
|
561 if(m_rqueue.size () != 0) |
|
562 retval = m_rqueue[0]; |
|
563 m_rqueue.erase (m_rqueue.begin ()); |
|
564 return retval; |
|
565 } |
|
566 void |
|
567 HwmpProtocol::ReactivePathResolved (Mac48Address dst) |
|
568 { |
569 HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst); |
569 HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst); |
|
570 NS_ASSERT(result.retransmitter != Mac48Address::GetBroadcast ()); |
|
571 //Send all packets stored for this destination |
570 MeshL2RoutingProtocol::QueuedPacket packet; |
572 MeshL2RoutingProtocol::QueuedPacket packet; |
571 while (1) |
573 while (1) |
572 |
574 { |
573 { |
575 packet = DequeueFirstPacketByDst (dst); |
574 packet = DequeuePacket (dst); |
576 if (packet.pkt == NULL) |
575 if (packet.pkt == NULL) |
577 return; |
576 return; |
578 //set RA tag for retransmitter: |
577 //set RA tag for retransmitter: |
579 HwmpTag tag; |
578 HwmpProtocolTag tag; |
580 NS_ASSERT (packet.pkt->FindFirstMatchingTag(tag)); |
579 NS_ASSERT (packet.pkt->FindFirstMatchingTag(tag)); |
581 tag.SetAddress (result.retransmitter); |
580 tag.SetAddress (result.retransmitter); |
582 packet.pkt->RemoveAllTags (); |
581 NS_ASSERT (result.retransmitter != Mac48Address::GetBroadcast()); |
583 packet.pkt->AddTag (tag); |
582 packet.pkt->RemoveAllTags (); |
584 packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex); |
583 packet.pkt->AddTag (tag); |
585 } |
584 packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex); |
586 } |
585 } |
587 void |
586 #endif |
588 HwmpProtocol::ProactivePathResolved () |
587 } |
589 { |
|
590 //send all packets to root |
|
591 HwmpRtable::LookupResult result = m_rtable->LookupProactive (); |
|
592 NS_ASSERT(result.retransmitter != Mac48Address::GetBroadcast ()); |
|
593 NS_ASSERT(false); |
|
594 } |
|
595 |
588 bool |
596 bool |
589 HwmpProtocol::ShouldSendPreq (Mac48Address dst) |
597 HwmpProtocol::ShouldSendPreq (Mac48Address dst) |
590 { |
598 { |
591 std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst); |
599 std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst); |
592 if (i == m_preqTimeouts.end ()) |
600 if (i == m_preqTimeouts.end ()) |
599 return false; |
607 return false; |
600 } |
608 } |
601 void |
609 void |
602 HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry) |
610 HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry) |
603 { |
611 { |
604 #if 0 |
|
605 HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst); |
612 HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst); |
|
613 if(result.retransmitter == Mac48Address::GetBroadcast ()) |
|
614 result = m_rtable->LookupProactive (); |
606 if (result.retransmitter != Mac48Address::GetBroadcast ()) |
615 if (result.retransmitter != Mac48Address::GetBroadcast ()) |
607 { |
616 { |
608 std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst); |
617 std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst); |
609 NS_ASSERT (i != m_preqTimeouts.end()); |
618 NS_ASSERT (i != m_preqTimeouts.end()); |
610 m_preqTimeouts.erase (i); |
619 m_preqTimeouts.erase (i); |
611 return; |
620 return; |
612 } |
621 } |
613 numOfRetry++; |
622 numOfRetry++; |
614 if (numOfRetry > dot11sParameters::dot11MeshHWMPmaxPREQretries) |
623 if (numOfRetry > m_dot11MeshHWMPmaxPREQretries) |
615 { |
624 { |
616 MeshL2RoutingProtocol::QueuedPacket packet; |
625 MeshL2RoutingProtocol::QueuedPacket packet; |
617 //purge queue and delete entry from retryDatabase |
626 //purge queue and delete entry from retryDatabase |
618 while (1) |
627 while (1) |
619 { |
628 { |
620 packet = DequeuePacket (dst); |
629 packet = DequeueFirstPacketByDst (dst); |
621 if (packet.pkt == NULL) |
630 if (packet.pkt == NULL) |
622 break; |
631 break; |
623 packet.reply (false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC); |
632 packet.reply (false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC); |
624 } |
633 } |
625 std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst); |
634 std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst); |
626 NS_ASSERT (i != m_preqTimeouts.end()); |
635 NS_ASSERT (i != m_preqTimeouts.end()); |
627 m_preqTimeouts.erase (i); |
636 m_preqTimeouts.erase (i); |
628 return; |
637 return; |
629 } |
638 } |
630 #if 0 |
639 //TODO: Request a destination again |
631 for (unsigned int i = 0; i < m_requestCallback.size (); i++) |
640 NS_ASSERT(false); |
632 if ((m_modes[i] == REACTIVE) || (m_modes[i] == ROOT)) |
|
633 m_requestCallback[i] (dst); |
|
634 #endif |
|
635 m_preqTimeouts[dst] = Simulator::Schedule ( |
641 m_preqTimeouts[dst] = Simulator::Schedule ( |
636 MilliSeconds (2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())), |
642 MilliSeconds (2*(m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())), |
637 &HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry); |
643 &HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry); |
638 #endif |
|
639 } |
644 } |
640 } //namespace dot11s |
645 } //namespace dot11s |
641 } //namespace ns3 |
646 } //namespace ns3 |