diff --git a/examples/mesh.cc b/examples/mesh.cc index 6f9db0efe..d3185d567 100644 --- a/examples/mesh.cc +++ b/examples/mesh.cc @@ -80,9 +80,10 @@ main(int argc, char *argv[]) "DeltaY", DoubleValue (step), "GridWidth", UintegerValue (xSize), "LayoutType", StringValue("RowFirst")); - mobility.SetMobilityModel ("ns3::StaticMobilityModel"); + NS_LOG_UNCOND("Mobility"); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (nodes); - + NS_LOG_UNCOND("Mobility installed"); // Setting Internet Stack: InternetStackHelper stack; stack.Install(nodes); diff --git a/src/devices/l2-routing/l2-routing-hwmp/hwmp-rtable.cc b/src/devices/l2-routing/l2-routing-hwmp/hwmp-rtable.cc index 6d3060c09..21b6c5733 100644 --- a/src/devices/l2-routing/l2-routing-hwmp/hwmp-rtable.cc +++ b/src/devices/l2-routing/l2-routing-hwmp/hwmp-rtable.cc @@ -70,10 +70,10 @@ HwmpRtable::AddReactivePath( uint32_t seqnum ) { - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if(i == m_routes.end()) { - struct ReactiveRoute newroute; + ReactiveRoute newroute; m_routes[destination] = newroute; } else @@ -119,9 +119,9 @@ HwmpRtable::AddProactivePath( uint32_t seqnum ) { - struct ProactiveRoute newroute; + ProactiveRoute newroute; m_roots[port] = newroute; - std::map::iterator i = m_roots.find(port); + std::map::iterator i = m_roots.find(port); NS_ASSERT(i != m_roots.end()); i->second.root = root; i->second.retransmitter = retransmitter; @@ -135,7 +135,7 @@ void HwmpRtable::AddPrecursor(Mac48Address destination, uint32_t port, Mac48Address precursor) { bool should_add = true; - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if((i != m_routes.end()) && (i->second.port == port)) { for(unsigned int j = 0 ; j < i->second.precursors.size(); j ++) @@ -147,7 +147,7 @@ HwmpRtable::AddPrecursor(Mac48Address destination, uint32_t port, Mac48Address p if(should_add) i->second.precursors.push_back(precursor); } - std::map::iterator k = m_roots.find(port); + std::map::iterator k = m_roots.find(port); if(k!= m_roots.end()) { for(unsigned int j = 0 ; j < k->second.precursors.size(); j ++) @@ -161,7 +161,7 @@ HwmpRtable::AddPrecursor(Mac48Address destination, uint32_t port, Mac48Address p void HwmpRtable::DeleteProactivePath(uint32_t port) { - std::map::iterator j = m_roots.find(port); + std::map::iterator j = m_roots.find(port); if(j != m_roots.end()) m_roots.erase(j); @@ -169,7 +169,7 @@ HwmpRtable::DeleteProactivePath(uint32_t port) void HwmpRtable::DeleteProactivePath(Mac48Address root, uint32_t port) { - std::map::iterator j = m_roots.find(port); + std::map::iterator j = m_roots.find(port); if((j != m_roots.end())&&(j->second.root == root)) m_roots.erase(j); @@ -178,21 +178,21 @@ HwmpRtable::DeleteProactivePath(Mac48Address root, uint32_t port) void HwmpRtable::DeleteReactivePath(Mac48Address destination, uint32_t port) { - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if(i != m_routes.end()) if(i->second.port == port) m_routes.erase(i); } -struct HwmpRtable::LookupResult +HwmpRtable::LookupResult HwmpRtable::LookupReactive(Mac48Address destination) { - struct LookupResult result; + LookupResult result; result.retransmitter = Mac48Address::GetBroadcast(); result.metric = MAX_METRIC; result.ifIndex = PORT_ANY; - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if(i == m_routes.end()) return result; result.ifIndex = i->second.port; @@ -206,14 +206,14 @@ HwmpRtable::LookupReactive(Mac48Address destination) return result; } -struct HwmpRtable::LookupResult +HwmpRtable::LookupResult HwmpRtable::LookupProactive(uint32_t port) { - struct LookupResult result; + LookupResult result; result.retransmitter = Mac48Address::GetBroadcast(); result.metric = MAX_METRIC; result.ifIndex = PORT_ANY; - std::map::iterator i = m_roots.find(port); + std::map::iterator i = m_roots.find(port); if(i == m_roots.end()) return result; result.ifIndex = i->first; @@ -225,14 +225,14 @@ HwmpRtable::LookupProactive(uint32_t port) return result; } -std::vector +std::vector HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port) { - std::vector retval; - for(std::map::iterator i = m_routes.begin(); i!= m_routes.end(); i++) + std::vector retval; + for(std::map::iterator i = m_routes.begin(); i!= m_routes.end(); i++) if((i->second.retransmitter == peerAddress)&&(i->second.port == port)) { - struct FailedDestination dst; + FailedDestination dst; dst.destination = i->first; i->second.seqnum ++; dst.seqnum = i->second.seqnum; @@ -241,10 +241,10 @@ HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port) /** * Lookup a path to root */ - std::map::iterator i = m_roots.find(port); + std::map::iterator i = m_roots.find(port); if((i != m_roots.end())&&(i->second.retransmitter == peerAddress)) { - struct FailedDestination dst; + FailedDestination dst; dst.destination = i->second.root; dst.seqnum = i->second.seqnum; retval.push_back(dst); @@ -254,7 +254,7 @@ HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port) uint32_t HwmpRtable::RequestSeqnum(Mac48Address destination) { - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if(i == m_routes.end()) return 0; return i->second.seqnum; @@ -264,13 +264,13 @@ std::vector HwmpRtable::GetPrecursors(Mac48Address destination, uint32_t port) { std::vector retval; - std::map::iterator root = m_roots.find(port); + std::map::iterator root = m_roots.find(port); if((root != m_roots.end()) &&(root->second.root == destination)) { for(unsigned int i = 0; i < root->second.precursors.size(); i ++) retval.push_back(root->second.precursors[i]); } - std::map::iterator route = m_routes.find(destination); + std::map::iterator route = m_routes.find(destination); if( (route != m_routes.end()) && (route->second.port == port) ) { for(unsigned int i = 0; i < route->second.precursors.size(); i ++) diff --git a/src/devices/l2-routing/l2-routing-hwmp/hwmp-state.cc b/src/devices/l2-routing/l2-routing-hwmp/hwmp-state.cc index 48fca22f0..56ae10c73 100644 --- a/src/devices/l2-routing/l2-routing-hwmp/hwmp-state.cc +++ b/src/devices/l2-routing/l2-routing-hwmp/hwmp-state.cc @@ -47,14 +47,14 @@ HwmpState::HwmpState() } void HwmpState::SetRequestRouteCallback( - Callback cb) + Callback cb) { m_requestRouteCallback = cb; } void HwmpState::SetRequestRootPathCallback( - Callback cb) + Callback cb) { m_requestRootPathCallback = cb; } @@ -87,7 +87,7 @@ HwmpState::SetRoutingInfoCallback( void HwmpState::SetRetransmittersOfPerrCallback( - Callback, std::vector, uint32_t> cb) + Callback, std::vector, uint32_t> cb) { m_retransmittersOfPerrCallback = cb; } @@ -133,7 +133,7 @@ HwmpState::RequestDestination(Mac48Address dst) } } void -HwmpState::SendPathError(std::vector destinations) +HwmpState::SendPathError(std::vector destinations) { std::vector receivers = m_retransmittersOfPerrCallback(destinations, m_ifIndex); NS_LOG_DEBUG("SendPathError started"); @@ -272,7 +272,7 @@ HwmpState::ReceivePreq(WifiPreqInformationElement& preq, const Mac48Address& fr continue; } //check if can answer: - struct HwmpRtable::LookupResult result = m_requestRouteCallback((*i)->GetDestinationAddress()); + HwmpRtable::LookupResult result = m_requestRouteCallback((*i)->GetDestinationAddress()); if((!((*i)->IsDo())) && (result.retransmitter!=Mac48Address::GetBroadcast())) { //have a valid information and acn answer @@ -328,7 +328,7 @@ HwmpState::ReceivePrep(WifiPrepInformationElement& prep, const Mac48Address& fro if(i->second > prep.GetDestinationSeqNumber()) return; //update routing info - struct HwmpRtable::LookupResult result = m_requestRouteCallback(prep.GetDestinationAddress()); + HwmpRtable::LookupResult result = m_requestRouteCallback(prep.GetDestinationAddress()); if(result.retransmitter == Mac48Address::GetBroadcast()) //try to look for default route result = m_requestRootPathCallback(m_ifIndex); @@ -371,7 +371,7 @@ HwmpState::ReceivePerr(WifiPerrInformationElement& perr, const Mac48Address& fro /** * Lookup for a valid routing information */ - struct HwmpRtable::LookupResult result = m_requestRouteCallback(destinations[i].destination); + HwmpRtable::LookupResult result = m_requestRouteCallback(destinations[i].destination); if( (result.retransmitter != from) ||(result.seqnum >= destinations[i].seqnum) diff --git a/src/devices/l2-routing/l2-routing-hwmp/hwmp.cc b/src/devices/l2-routing/l2-routing-hwmp/hwmp.cc index 2f0b777e7..df66f7856 100644 --- a/src/devices/l2-routing/l2-routing-hwmp/hwmp.cc +++ b/src/devices/l2-routing/l2-routing-hwmp/hwmp.cc @@ -180,7 +180,7 @@ Hwmp::DoDispose() * clear routing queue: */ for( - std::map >::iterator i = m_rqueue.begin(); + std::map >::iterator i = m_rqueue.begin(); i != m_rqueue.end(); i++ ) @@ -211,7 +211,7 @@ Hwmp::RequestRoute( L2RoutingProtocol::RouteReplyCallback routeReply ) { - struct HwmpRtable::LookupResult result; + HwmpRtable::LookupResult result; HwmpTag tag; if(sourceIface == m_interface) { @@ -269,14 +269,14 @@ Hwmp::RequestRoute( { //Start path error procedure: NS_LOG_DEBUG("Must Send PERR"); - std::vector destinations; - struct HwmpRtable::FailedDestination dst; + std::vector destinations; + HwmpRtable::FailedDestination dst; dst.seqnum = m_rtable->RequestSeqnum(destination); dst.destination = destination; destinations.push_back(dst); StartPathErrorProcedure(destinations, result.ifIndex); } - struct L2RoutingProtocol::QueuedPacket pkt; + L2RoutingProtocol::QueuedPacket pkt; packet->RemoveAllTags(); packet->AddTag(tag); pkt.pkt = packet; @@ -527,12 +527,12 @@ Hwmp::ObtainRoutingInformation( */ { NS_LOG_DEBUG("Failed peer"< failedDestinations = + std::vector failedDestinations = m_rtable->GetUnreachableDestinations(info.destination, info.outPort); /** * Entry about peer does not contain seqnum */ - struct HwmpRtable::FailedDestination peer; + HwmpRtable::FailedDestination peer; peer.destination = info.destination; peer.seqnum = 0; failedDestinations.push_back(peer); @@ -544,20 +544,20 @@ Hwmp::ObtainRoutingInformation( } } -struct HwmpRtable::LookupResult +HwmpRtable::LookupResult Hwmp::RequestRouteForAddress(const Mac48Address& dst) { return m_rtable->LookupReactive(dst); } -struct HwmpRtable::LookupResult +HwmpRtable::LookupResult Hwmp::RequestRootPathForPort(uint32_t port) { return m_rtable->LookupProactive(port); } void -Hwmp::StartPathErrorProcedure(std::vector destinations, uint32_t port) +Hwmp::StartPathErrorProcedure(std::vector destinations, uint32_t port) { NS_LOG_DEBUG("START PERR"); for(unsigned int i = 0; i < m_hwmpStates.size(); i++) @@ -565,7 +565,7 @@ Hwmp::StartPathErrorProcedure(std::vector m_pathErrorCallback[i](destinations); } std::vector -Hwmp::GetRetransmittersForFailedDestinations(std::vector failedDest, uint32_t port) +Hwmp::GetRetransmittersForFailedDestinations(std::vector failedDest, uint32_t port) { std::vector retransmitters; if(m_broadcastPerr) @@ -597,7 +597,7 @@ Hwmp::SetMaxQueueSize(int maxPacketsPerDestination) } bool -Hwmp::QueuePacket(struct L2RoutingProtocol::QueuedPacket packet) +Hwmp::QueuePacket(L2RoutingProtocol::QueuedPacket packet) { if((int)m_rqueue[packet.dst].size() > m_maxQueueSize) return false; @@ -605,13 +605,13 @@ Hwmp::QueuePacket(struct L2RoutingProtocol::QueuedPacket packet) return true; } -struct L2RoutingProtocol::QueuedPacket +L2RoutingProtocol::QueuedPacket Hwmp::DequeuePacket(Mac48Address dst) { - struct L2RoutingProtocol::QueuedPacket retval; + L2RoutingProtocol::QueuedPacket retval; retval.pkt = NULL; //Ptr in this structure is NULL when queue is empty - std::map, addrcmp>:: iterator i = m_rqueue.find(dst); + std::map, addrcmp>:: iterator i = m_rqueue.find(dst); if(i == m_rqueue.end()) return retval; if((int)m_rqueue[dst].size() == 0) @@ -629,8 +629,8 @@ Hwmp::DequeuePacket(Mac48Address dst) void Hwmp::SendAllPossiblePackets(Mac48Address dst) { - struct HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst); - struct L2RoutingProtocol::QueuedPacket packet; + HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst); + L2RoutingProtocol::QueuedPacket packet; while(1) { @@ -664,7 +664,7 @@ Hwmp::ShouldSendPreq(Mac48Address dst) void Hwmp::RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry) { - struct HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst); + HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst); if(result.retransmitter != Mac48Address::GetBroadcast()) { std::map::iterator i = m_timeoutDatabase.find(dst); @@ -675,7 +675,7 @@ Hwmp::RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry) numOfRetry++; if(numOfRetry > dot11sParameters::dot11MeshHWMPmaxPREQretries) { - struct L2RoutingProtocol::QueuedPacket packet; + L2RoutingProtocol::QueuedPacket packet; //purge queue and delete entry from retryDatabase while(1) { diff --git a/src/devices/wifi/mesh-wifi-peer-manager.cc b/src/devices/wifi/mesh-wifi-peer-manager.cc index 69d81f8c4..df359a144 100644 --- a/src/devices/wifi/mesh-wifi-peer-manager.cc +++ b/src/devices/wifi/mesh-wifi-peer-manager.cc @@ -967,7 +967,7 @@ WifiPeerManager::GetNextBeaconShift( coefficientSign = 1; UniformVariable randomShift(1, 15); //So, the shift is a random integer variable uniformly distributed in [-15;-1] U [1;15] - int beaconShift = randomShift.GetInteger() * coefficientSign; + int beaconShift = randomShift.GetInteger(1,15) * coefficientSign; NS_LOG_DEBUG("Shift value = " << beaconShift << " beacon TUs"); //We need the result not in Time Units, but in microseconds return MicroSeconds(beaconShift * 1024);