Fixed ticket #27
This commit is contained in:
@@ -70,7 +70,7 @@ HwmpRtable::AddReactivePath(
|
||||
uint32_t seqnum
|
||||
)
|
||||
{
|
||||
std::map<Mac48Address, ReactiveRoute, mac48addrComparator>::iterator i = m_routes.find(destination);
|
||||
std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find(destination);
|
||||
if (i == m_routes.end())
|
||||
{
|
||||
ReactiveRoute newroute;
|
||||
@@ -135,7 +135,7 @@ void
|
||||
HwmpRtable::AddPrecursor(Mac48Address destination, uint32_t port, Mac48Address precursor)
|
||||
{
|
||||
bool should_add = true;
|
||||
std::map<Mac48Address, ReactiveRoute, mac48addrComparator>::iterator i = m_routes.find(destination);
|
||||
std::map<Mac48Address, ReactiveRoute>::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 ++)
|
||||
@@ -178,7 +178,7 @@ HwmpRtable::DeleteProactivePath(Mac48Address root, uint32_t port)
|
||||
void
|
||||
HwmpRtable::DeleteReactivePath(Mac48Address destination, uint32_t port)
|
||||
{
|
||||
std::map<Mac48Address, ReactiveRoute, mac48addrComparator>::iterator i = m_routes.find(destination);
|
||||
std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find(destination);
|
||||
if (i != m_routes.end())
|
||||
if (i->second.port == port)
|
||||
m_routes.erase(i);
|
||||
@@ -192,7 +192,7 @@ HwmpRtable::LookupReactive(Mac48Address destination)
|
||||
result.metric = MAX_METRIC;
|
||||
result.ifIndex = PORT_ANY;
|
||||
|
||||
std::map<Mac48Address, ReactiveRoute, mac48addrComparator>::iterator i = m_routes.find(destination);
|
||||
std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find(destination);
|
||||
if (i == m_routes.end())
|
||||
return result;
|
||||
result.ifIndex = i->second.port;
|
||||
@@ -213,7 +213,7 @@ HwmpRtable::LookupProactive(uint32_t port)
|
||||
result.retransmitter = Mac48Address::GetBroadcast();
|
||||
result.metric = MAX_METRIC;
|
||||
result.ifIndex = PORT_ANY;
|
||||
std::map<uint32_t, ProactiveRoute, mac48addrComparator>::iterator i = m_roots.find(port);
|
||||
std::map<uint32_t, ProactiveRoute>::iterator i = m_roots.find(port);
|
||||
if (i == m_roots.end())
|
||||
return result;
|
||||
result.ifIndex = i->first;
|
||||
@@ -229,7 +229,7 @@ std::vector<HwmpRtable::FailedDestination>
|
||||
HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port)
|
||||
{
|
||||
std::vector<FailedDestination> retval;
|
||||
for (std::map<Mac48Address, ReactiveRoute, mac48addrComparator>::iterator i = m_routes.begin(); i!= m_routes.end(); i++)
|
||||
for (std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.begin(); i!= m_routes.end(); i++)
|
||||
if ((i->second.retransmitter == peerAddress)&&(i->second.port == port))
|
||||
{
|
||||
FailedDestination dst;
|
||||
@@ -241,7 +241,7 @@ HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port)
|
||||
/**
|
||||
* Lookup a path to root
|
||||
*/
|
||||
std::map<uint32_t, ProactiveRoute, mac48addrComparator>::iterator i = m_roots.find(port);
|
||||
std::map<uint32_t, ProactiveRoute>::iterator i = m_roots.find(port);
|
||||
if ((i != m_roots.end())&&(i->second.retransmitter == peerAddress))
|
||||
{
|
||||
FailedDestination dst;
|
||||
@@ -254,7 +254,7 @@ HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port)
|
||||
uint32_t
|
||||
HwmpRtable::RequestSeqnum(Mac48Address destination)
|
||||
{
|
||||
std::map<Mac48Address, ReactiveRoute, mac48addrComparator>::iterator i = m_routes.find(destination);
|
||||
std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find(destination);
|
||||
if (i == m_routes.end())
|
||||
return 0;
|
||||
return i->second.seqnum;
|
||||
@@ -264,13 +264,13 @@ std::vector<Mac48Address>
|
||||
HwmpRtable::GetPrecursors(Mac48Address destination, uint32_t port)
|
||||
{
|
||||
std::vector<Mac48Address> retval;
|
||||
std::map<uint32_t, ProactiveRoute, mac48addrComparator>::iterator root = m_roots.find(port);
|
||||
std::map<uint32_t, ProactiveRoute>::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<Mac48Address, ReactiveRoute, mac48addrComparator>::iterator route = m_routes.find(destination);
|
||||
std::map<Mac48Address, ReactiveRoute>::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 ++)
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <map>
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/mac48-address.h"
|
||||
#include "ns3/mac48-address-comparator.h"
|
||||
#include "ns3/net-device.h"
|
||||
#include "ns3/event-id.h"
|
||||
#include "ns3/packet.h"
|
||||
@@ -101,7 +100,7 @@ private:
|
||||
uint32_t seqnum;
|
||||
std::vector<Mac48Address> precursors;
|
||||
};
|
||||
std::map<Mac48Address, ReactiveRoute, mac48addrComparator> m_routes;
|
||||
std::map<Mac48Address, ReactiveRoute> m_routes;
|
||||
std::map<uint32_t, ProactiveRoute> m_roots;
|
||||
};
|
||||
} //namespace ns3
|
||||
|
||||
@@ -184,7 +184,7 @@ HwmpState::ReceivePreq(IeDot11sPreq& preq, const Mac48Address& from, const uint
|
||||
if (preq.GetTtl() == 0)
|
||||
return;
|
||||
//acceptance cretirea:
|
||||
std::map<Mac48Address, uint32_t, mac48addrComparator>::iterator i = m_dsnDatabase.find(preq.GetOriginatorAddress());
|
||||
std::map<Mac48Address, uint32_t>::iterator i = m_dsnDatabase.find(preq.GetOriginatorAddress());
|
||||
if (i == m_dsnDatabase.end())
|
||||
{
|
||||
m_dsnDatabase[preq.GetOriginatorAddress()] = preq.GetOriginatorSeqNumber();
|
||||
@@ -197,7 +197,7 @@ HwmpState::ReceivePreq(IeDot11sPreq& preq, const Mac48Address& from, const uint
|
||||
if (i->second == preq.GetOriginatorSeqNumber())
|
||||
{
|
||||
//find metric
|
||||
std::map<Mac48Address, uint32_t, mac48addrComparator>::iterator j =
|
||||
std::map<Mac48Address, uint32_t>::iterator j =
|
||||
m_preqMetricDatabase.find(preq.GetOriginatorAddress());
|
||||
NS_ASSERT(j != m_dsnDatabase.end());
|
||||
if (j->second <= preq.GetMetric())
|
||||
@@ -319,7 +319,7 @@ HwmpState::ReceivePrep(IeDot11sPrep& prep, const Mac48Address& from, const uint3
|
||||
prep.DecrementTtl();
|
||||
prep.IncrementMetric(metric);
|
||||
//acceptance cretirea:
|
||||
std::map<Mac48Address, uint32_t, mac48addrComparator>::iterator i = m_dsnDatabase.find(prep.GetDestinationAddress());
|
||||
std::map<Mac48Address, uint32_t>::iterator i = m_dsnDatabase.find(prep.GetDestinationAddress());
|
||||
if (i == m_dsnDatabase.end())
|
||||
{
|
||||
m_dsnDatabase[prep.GetDestinationAddress()] = prep.GetDestinationSeqNumber();
|
||||
|
||||
@@ -161,8 +161,8 @@ private:
|
||||
uint32_t m_preqId;
|
||||
uint32_t m_myDsn;
|
||||
//Seqno and metric database
|
||||
std::map<Mac48Address, uint32_t, mac48addrComparator> m_dsnDatabase;
|
||||
std::map<Mac48Address, uint32_t, mac48addrComparator> m_preqMetricDatabase;
|
||||
std::map<Mac48Address, uint32_t> m_dsnDatabase;
|
||||
std::map<Mac48Address, uint32_t> m_preqMetricDatabase;
|
||||
//Disable/enable functionality
|
||||
bool m_disabled;
|
||||
//Proactive PREQ mechanism:
|
||||
|
||||
@@ -172,7 +172,7 @@ Hwmp::~Hwmp()
|
||||
void
|
||||
Hwmp::DoDispose()
|
||||
{
|
||||
for (std::map<Mac48Address, EventId, mac48addrComparator>::iterator i = m_timeoutDatabase.begin(); i != m_timeoutDatabase.end(); i ++)
|
||||
for (std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.begin(); i != m_timeoutDatabase.end(); i ++)
|
||||
i->second.Cancel();
|
||||
m_timeoutDatabase.clear();
|
||||
m_seqnoDatabase.clear();
|
||||
@@ -234,7 +234,7 @@ Hwmp::RequestRoute(
|
||||
//check seqno!
|
||||
if (destination == Mac48Address::GetBroadcast())
|
||||
{
|
||||
std::map<Mac48Address, uint32_t, mac48addrComparator>::iterator i = m_seqnoDatabase.find(source);
|
||||
std::map<Mac48Address, uint32_t>::iterator i = m_seqnoDatabase.find(source);
|
||||
if (i == m_seqnoDatabase.end())
|
||||
m_seqnoDatabase[source] = tag.GetSeqno();
|
||||
else
|
||||
@@ -608,7 +608,7 @@ Hwmp::DequeuePacket(Mac48Address dst)
|
||||
MeshL2RoutingProtocol::QueuedPacket retval;
|
||||
retval.pkt = NULL;
|
||||
//Ptr<Packet> in this structure is NULL when queue is empty
|
||||
std::map<Mac48Address, std::queue<QueuedPacket>, mac48addrComparator>:: iterator i = m_rqueue.find(dst);
|
||||
std::map<Mac48Address, std::queue<QueuedPacket> >:: iterator i = m_rqueue.find(dst);
|
||||
if (i == m_rqueue.end())
|
||||
return retval;
|
||||
if ((int)m_rqueue[dst].size() == 0)
|
||||
@@ -648,7 +648,7 @@ Hwmp::SendAllPossiblePackets(Mac48Address dst)
|
||||
bool
|
||||
Hwmp::ShouldSendPreq(Mac48Address dst)
|
||||
{
|
||||
std::map<Mac48Address, EventId, mac48addrComparator>::iterator i = m_timeoutDatabase.find(dst);
|
||||
std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find(dst);
|
||||
if (i == m_timeoutDatabase.end())
|
||||
{
|
||||
m_timeoutDatabase[dst] = Simulator::Schedule(
|
||||
@@ -664,7 +664,7 @@ Hwmp::RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry)
|
||||
HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst);
|
||||
if (result.retransmitter != Mac48Address::GetBroadcast())
|
||||
{
|
||||
std::map<Mac48Address, EventId, mac48addrComparator>::iterator i = m_timeoutDatabase.find(dst);
|
||||
std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find(dst);
|
||||
NS_ASSERT(i != m_timeoutDatabase.end());
|
||||
m_timeoutDatabase.erase(i);
|
||||
return;
|
||||
@@ -681,7 +681,7 @@ Hwmp::RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry)
|
||||
break;
|
||||
packet.reply(false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC);
|
||||
}
|
||||
std::map<Mac48Address, EventId, mac48addrComparator>::iterator i = m_timeoutDatabase.find(dst);
|
||||
std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find(dst);
|
||||
NS_ASSERT(i != m_timeoutDatabase.end());
|
||||
m_timeoutDatabase.erase(i);
|
||||
return;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "ns3/tag.h"
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/mac48-address.h"
|
||||
#include "ns3/mac48-address-comparator.h"
|
||||
#include "ns3/mesh-l2-routing-protocol.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/ptr.h"
|
||||
@@ -249,7 +248,7 @@ private:
|
||||
* \attention mesh seqno is processed at HWMP
|
||||
*/
|
||||
uint32_t m_seqno;
|
||||
std::map<Mac48Address, uint32_t/*, mac48addrComparator*/>
|
||||
std::map<Mac48Address, uint32_t/**/>
|
||||
m_seqnoDatabase;
|
||||
//Timers:
|
||||
/**
|
||||
@@ -269,7 +268,7 @@ private:
|
||||
* Keeps PREQ retry timers for every
|
||||
* destination
|
||||
*/
|
||||
std::map<Mac48Address, EventId, mac48addrComparator>
|
||||
std::map<Mac48Address, EventId>
|
||||
m_timeoutDatabase;
|
||||
/**
|
||||
* Configurable parameters:
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2008,2009 IITP RAS
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Kirill Andreev <andreev@iitp.ru>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MAC48ADDRESS_COMPARATOR
|
||||
#define MAC48ADDRESS_COMPARATOR
|
||||
#include "ns3/mac48-address.h"
|
||||
namespace ns3 {
|
||||
struct mac48addrComparator
|
||||
{
|
||||
bool operator()(const Mac48Address addr1, Mac48Address addr2) const
|
||||
{
|
||||
uint8_t s1[6], s2[6];
|
||||
addr1.CopyTo(s1);
|
||||
addr2.CopyTo(s2);
|
||||
for (int i = 0; i < 6; i ++)
|
||||
if (s1[i] > s2[i])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}//namespace ns3
|
||||
#endif
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <stdint.h>
|
||||
#include <map>
|
||||
#include "ns3/mac48-address.h"
|
||||
#include "ns3/mac48-address-comparator.h"
|
||||
#include "ns3/mgt-headers.h"
|
||||
#include "ns3/mesh-mgt-headers.h"
|
||||
#include "ns3/callback.h"
|
||||
@@ -370,7 +369,7 @@ private:
|
||||
* \brief metric calculation parameters
|
||||
*/
|
||||
uint32_t CalculateMetric(Mac48Address peerAddress);
|
||||
std::map<Mac48Address, uint32_t, mac48addrComparator>
|
||||
std::map<Mac48Address, uint32_t>
|
||||
m_metricDatabase;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ def build(bld):
|
||||
'hwmp.h',
|
||||
'tx-statistics.h',
|
||||
'dot11s-peer-management-element.h',
|
||||
'mac48-address-comparator.h',
|
||||
'hwmp-rtable.h',
|
||||
'mesh-wifi-peer-manager.h',
|
||||
'mesh-wifi-mac-header.h',
|
||||
|
||||
Reference in New Issue
Block a user