Removed commented code, removed unneded debg messages
This commit is contained in:
@@ -142,17 +142,6 @@ HwmpMacPlugin::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header,
|
||||
header.SetAddr1(tag.GetAddress());
|
||||
return true;
|
||||
}
|
||||
#if 0
|
||||
HwmpMacPlugin::HwmpMacPlugin ():
|
||||
{
|
||||
}
|
||||
|
||||
HwmpMacPlugin::~HwmpMacPlugin ()
|
||||
{
|
||||
m_preqQueue.clear ();
|
||||
}
|
||||
//Interaction with HWMP:
|
||||
#endif
|
||||
void
|
||||
HwmpMacPlugin::SendPreq(IePreq preq)
|
||||
{
|
||||
@@ -205,73 +194,14 @@ HwmpMacPlugin::RequestDestination (Mac48Address dst)
|
||||
m_preqQueue.push_back (preq);
|
||||
//set iterator position to my preq:
|
||||
m_myPreq = m_preqQueue.end () -1;
|
||||
NS_LOG_UNCOND("no preq");
|
||||
SendOnePreq ();
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ASSERT (m_myPreq->GetOriginatorAddress() == m_parent->GetAddress());
|
||||
NS_LOG_UNCOND ("add a destination "<<dst);
|
||||
m_myPreq->AddDestinationAddressElement (false, false, dst, 0); //DO = 0, RF = 0
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
void
|
||||
HwmpMacPlugin::SendPathError (std::vector<HwmpRtable::FailedDestination> destinations)
|
||||
{
|
||||
std::vector<Mac48Address> receivers = m_retransmittersOfPerrCallback (destinations, m_ifIndex);
|
||||
NS_LOG_DEBUG ("SendPathError started");
|
||||
if (receivers.size () == 0)
|
||||
return;
|
||||
NS_LOG_DEBUG (m_address<<" Should Send PERR to");
|
||||
for (unsigned int i = 0; i < receivers.size (); i ++)
|
||||
{
|
||||
AddPerrReceiver (receivers[i]);
|
||||
NS_LOG_DEBUG (receivers[i]);
|
||||
}
|
||||
NS_LOG_DEBUG ("To tel about failure with");
|
||||
for (unsigned int i = 0; i < destinations.size (); i ++)
|
||||
{
|
||||
m_myPerr.AddAddressUnit (destinations[i]);
|
||||
NS_LOG_DEBUG (destinations[i].destination);
|
||||
}
|
||||
if (!m_perrTimer.IsRunning ())
|
||||
{
|
||||
m_perrCallback (m_myPerr,m_myPerrReceivers);
|
||||
m_myPerr.ResetPerr ();
|
||||
m_perrTimer = Simulator::Schedule (dot11sParameters::dot11MeshHWMPperrMinInterval,&HwmpMacPlugin::SendOnePerr,this);
|
||||
}
|
||||
}
|
||||
void
|
||||
HwmpMacPlugin::ReceivePerr (IeDot11sPerr& perr, const Mac48Address& from)
|
||||
{
|
||||
if (m_disabled)
|
||||
return;
|
||||
NS_LOG_DEBUG (m_address<<" RECEIVED PERR from "<<from);
|
||||
/**
|
||||
* Check forwarding conditions:
|
||||
*/
|
||||
std::vector<HwmpRtable::FailedDestination> destinations = perr.GetAddressUnitVector ();
|
||||
for (unsigned int i = 0; i < destinations.size (); i ++)
|
||||
{
|
||||
/**
|
||||
* Lookup for a valid routing information
|
||||
*/
|
||||
HwmpRtable::LookupResult result = m_requestRouteCallback (destinations[i].destination);
|
||||
if (
|
||||
(result.retransmitter != from)
|
||||
|| (result.seqnum >= destinations[i].seqnum)
|
||||
)
|
||||
|
||||
perr.DeleteAddressUnit (destinations[i].destination);
|
||||
}
|
||||
NS_LOG_DEBUG ("Retransmit "<<(int)perr.GetNumOfDest());
|
||||
if (perr.GetNumOfDest () == 0)
|
||||
return;
|
||||
destinations = perr.GetAddressUnitVector ();
|
||||
SendPathError (destinations);
|
||||
}
|
||||
#endif
|
||||
void
|
||||
HwmpMacPlugin::SendOnePreq ()
|
||||
{
|
||||
@@ -281,7 +211,6 @@ HwmpMacPlugin::SendOnePreq ()
|
||||
return;
|
||||
if (m_myPreq == m_preqQueue.begin ())
|
||||
m_myPreq == m_preqQueue.end ();
|
||||
NS_LOG_UNCOND ("I am "<<m_parent->GetAddress ()<<"sending PREQ:"<<m_preqQueue[0]);
|
||||
SendPreq(m_preqQueue[0]);
|
||||
//erase first!
|
||||
m_preqQueue.erase (m_preqQueue.begin());
|
||||
@@ -362,7 +291,6 @@ HwmpMacPlugin::SendPrep (IePrep prep, Mac48Address receiver)
|
||||
hdr.SetAddr2 (m_parent->GetAddress ());
|
||||
hdr.SetAddr3 (prep.GetDestinationAddress ());
|
||||
//Send Management frame
|
||||
NS_LOG_UNCOND("Sending PREP");
|
||||
m_parent->SendManagementFrame(packet, hdr);
|
||||
}
|
||||
void
|
||||
|
||||
@@ -89,48 +89,6 @@ private:
|
||||
};
|
||||
MyPerr m_myPerr;
|
||||
};
|
||||
|
||||
#if 0
|
||||
class HwmpMacPlugin : public MeshWifiInterfaceMacPlugin {
|
||||
public:
|
||||
private:
|
||||
//true means that we can add a destination to
|
||||
//existing PREQ element
|
||||
//False means that we must send
|
||||
void SendPrep (
|
||||
Mac48Address dst, //dst is PREQ's originator address
|
||||
Mac48Address src, //src is PREQ's destination address
|
||||
Mac48Address retransmitter,
|
||||
uint32_t initMetric,
|
||||
uint32_t dsn,/* taken form PREQ*/
|
||||
uint32_t originatorDsn, //taken from rtable or as m_myDsn ++;
|
||||
uint32_t lifetime //taken from PREQ
|
||||
);
|
||||
//HWMP interaction callbacks:
|
||||
Callback<void, INFO> m_routingInfoCallback;
|
||||
Callback<std::vector<Mac48Address>, std::vector<HwmpRtable::FailedDestination>, uint32_t> m_retransmittersOfPerrCallback;
|
||||
Callback<HwmpRtable::LookupResult, const Mac48Address&> m_requestRouteCallback;
|
||||
Callback<HwmpRtable::LookupResult, uint32_t> m_requestRootPathCallback;
|
||||
//Mac interaction callbacks:
|
||||
Callback<void, const IeDot11sPreq&> m_preqCallback;
|
||||
Callback<void, const IeDot11sPrep&, const Mac48Address&> m_prepCallback;
|
||||
Callback<void, const IeDot11sPerr&, std::vector<Mac48Address> > m_perrCallback;
|
||||
//HwmpCounters:
|
||||
uint32_t m_preqId;
|
||||
uint32_t m_myDsn;
|
||||
//Seqno and metric database
|
||||
std::map<Mac48Address, uint32_t> m_dsnDatabase;
|
||||
std::map<Mac48Address, uint32_t> m_preqMetricDatabase;
|
||||
//Disable/enable functionality
|
||||
bool m_disabled;
|
||||
//Proactive PREQ mechanism:
|
||||
EventId m_proactivePreqTimer;
|
||||
void SendProactivePreq ();
|
||||
IeDot11sPerr m_myPerr;
|
||||
EventId m_perrTimer;
|
||||
void SendOnePerr ();
|
||||
};
|
||||
#endif
|
||||
} //namespace dot11s
|
||||
} //namespace ns3
|
||||
#endif
|
||||
|
||||
@@ -172,7 +172,6 @@ HwmpProtocol::RequestRoute (
|
||||
tag.SetTtl (m_maxTtl+1);
|
||||
if (m_dataSeqno == 0xffffffff)
|
||||
m_dataSeqno = 0;
|
||||
NS_LOG_UNCOND("add a tag"<<packet->GetUid());
|
||||
packet->AddPacketTag(tag);
|
||||
}
|
||||
}
|
||||
@@ -320,7 +319,6 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface)
|
||||
}
|
||||
if ((*i)->GetDestinationAddress () == m_address)
|
||||
{
|
||||
NS_LOG_UNCOND("PREQ has reached destination:"<<m_address);
|
||||
preq.DelDestinationAddressElement ((*i)->GetDestinationAddress());
|
||||
SendPrep (
|
||||
m_address,
|
||||
@@ -373,7 +371,7 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface)
|
||||
if (preq.GetDestCount () == 0)
|
||||
return;
|
||||
//Forward PREQ to all interfaces:
|
||||
NS_LOG_UNCOND("I am "<<m_address<<"retransmitting PREQ:"<<preq);
|
||||
NS_LOG_DEBUG("I am "<<m_address<<"retransmitting PREQ:"<<preq);
|
||||
for(HwmpPluginMap::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i ++)
|
||||
i->second->SendPreq (preq);
|
||||
}
|
||||
@@ -382,7 +380,7 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface)
|
||||
{
|
||||
prep.IncrementMetric (1);
|
||||
//acceptance cretirea:
|
||||
NS_LOG_UNCOND("I am "<<m_address<<", received prep");
|
||||
NS_LOG_DEBUG("I am "<<m_address<<", received prep");
|
||||
std::map<Mac48Address, uint32_t>::iterator i = m_lastHwmpSeqno.find (prep.GetOriginatorAddress());
|
||||
if (i == m_lastHwmpSeqno.end ())
|
||||
{
|
||||
@@ -408,10 +406,7 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface)
|
||||
//try to look for default route
|
||||
result = m_rtable->LookupProactive ();
|
||||
if (result.retransmitter == Mac48Address::GetBroadcast ())
|
||||
{
|
||||
NS_LOG_UNCOND("I am "<<m_address<<", can not forward prep");
|
||||
return;
|
||||
}
|
||||
m_rtable->AddPrecursor (prep.GetOriginatorAddress (), interface, result.retransmitter);
|
||||
//Forward PREP
|
||||
HwmpPluginMap::iterator prep_sender = m_interfaces.find (result.ifIndex);
|
||||
@@ -423,13 +418,13 @@ void
|
||||
HwmpProtocol::ReceivePerr (IePerr perr, Mac48Address from, uint32_t interface)
|
||||
{
|
||||
//Acceptance cretirea:
|
||||
NS_LOG_UNCOND("I am "<<m_address<<", received PERR from "<<from);
|
||||
NS_LOG_DEBUG("I am "<<m_address<<", received PERR from "<<from);
|
||||
std::vector<IePerr::FailedDestination> destinations = perr.GetAddressUnitVector ();
|
||||
HwmpRtable::LookupResult result;
|
||||
for(unsigned int i = 0; i < destinations.size (); i ++)
|
||||
{
|
||||
result = m_rtable->LookupReactive (destinations[i].destination);
|
||||
NS_LOG_UNCOND("Destination = "<<destinations[i].destination<<", RA = "<<result.retransmitter);
|
||||
NS_LOG_DEBUG("Destination = "<<destinations[i].destination<<", RA = "<<result.retransmitter);
|
||||
if (
|
||||
(result.retransmitter != from) ||
|
||||
(result.ifIndex != interface) ||
|
||||
@@ -443,6 +438,7 @@ HwmpProtocol::ReceivePerr (IePerr perr, Mac48Address from, uint32_t interface)
|
||||
}
|
||||
if(perr.GetNumOfDest () == 0)
|
||||
return;
|
||||
NS_LOG_UNCOND("Forward PERR");
|
||||
MakePathError (destinations);
|
||||
}
|
||||
void
|
||||
@@ -456,7 +452,6 @@ HwmpProtocol::SendPrep (
|
||||
uint32_t lifetime,
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_UNCOND("sending prep to "<<dst<<" through "<<retransmitter);
|
||||
IePrep prep;
|
||||
prep.SetHopcount (0);
|
||||
prep.SetTtl (m_maxTtl);
|
||||
@@ -494,10 +489,6 @@ HwmpProtocol::Install (Ptr<MeshPointDevice> mp)
|
||||
mp->SetRoutingProtocol (this);
|
||||
// Mesh point aggregates all installed protocols
|
||||
mp->AggregateObject (this);
|
||||
//Address tmp_addr = mp->GetAddress ();
|
||||
//Mac48Address * address = dynamic_cast<Mac48Address *> (&tmp_addr);
|
||||
//if (address == NULL)
|
||||
// return false;
|
||||
m_address = Mac48Address::ConvertFrom (mp->GetAddress ());//* address;
|
||||
return true;
|
||||
}
|
||||
@@ -505,9 +496,7 @@ void
|
||||
HwmpProtocol::PeerLinkStatus(Mac48Address peerAddress, uint32_t interface, bool status)
|
||||
{
|
||||
if(status)
|
||||
{
|
||||
// m_rtable->AddReactivePath(peerAddress, peerAddress, interface, 1, Seconds (0), 0);
|
||||
}
|
||||
m_rtable->AddReactivePath(peerAddress, peerAddress, interface, 1, Seconds (0), 0);
|
||||
else
|
||||
{
|
||||
std::vector<IePerr::FailedDestination> destinations = m_rtable->GetUnreachableDestinations (peerAddress);
|
||||
@@ -533,101 +522,13 @@ HwmpProtocol::DropDataFrame(uint32_t seqno, Mac48Address source)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
HwmpProtocol::ObtainRoutingInformation (
|
||||
HwmpProtocolState::INFO info
|
||||
)
|
||||
{
|
||||
switch (info.type)
|
||||
{
|
||||
case HwmpProtocolState::INFO_PREP:
|
||||
if (info.me != info.source)
|
||||
{
|
||||
m_rtable->AddPrecursor (info.source, info.outPort, info.nextHop);
|
||||
m_rtable->AddPrecursor (info.destination, info.outPort, info.prevHop);
|
||||
NS_LOG_DEBUG ("path to "<<info.source<<" precursor is "<<info.nextHop);
|
||||
NS_LOG_DEBUG ("path to "<<info.destination<<" precursor is "<<info.prevHop);
|
||||
}
|
||||
case HwmpProtocolState::INFO_PREQ:
|
||||
m_rtable->AddReactivePath (
|
||||
info.destination,
|
||||
info.nextHop,
|
||||
info.outPort,
|
||||
info.metric,
|
||||
info.lifetime,
|
||||
info.dsn);
|
||||
SendAllPossiblePackets (info.destination);
|
||||
break;
|
||||
case HwmpProtocolState::INFO_PERR:
|
||||
//delete first subentry
|
||||
case HwmpProtocolState::INFO_PROACTIVE:
|
||||
//add information to the root MP.
|
||||
m_rtable->AddProactivePath (
|
||||
info.metric,
|
||||
info.destination,
|
||||
info.nextHop,
|
||||
info.outPort,
|
||||
info.lifetime,
|
||||
info.dsn);
|
||||
//Set mode as PROACTIVE:
|
||||
SetProactive (info.outPort);
|
||||
break;
|
||||
case HwmpProtocolState::INFO_NEW_PEER:
|
||||
#if 0
|
||||
m_rtable->AddReactivePath (
|
||||
info.destination,
|
||||
info.nextHop,
|
||||
info.outPort,
|
||||
info.metric,
|
||||
Seconds (0),
|
||||
0);
|
||||
#endif
|
||||
break;
|
||||
case HwmpProtocolState::INFO_FAILED_PEER:
|
||||
/**
|
||||
* Conditions for generating PERR
|
||||
*/
|
||||
{
|
||||
NS_LOG_DEBUG ("Failed peer"<<info.destination);
|
||||
std::vector<HwmpRtable::FailedDestination> failedDestinations =
|
||||
m_rtable->GetUnreachableDestinations (info.destination, info.outPort);
|
||||
/**
|
||||
* Entry about peer does not contain seqnum
|
||||
*/
|
||||
HwmpRtable::FailedDestination peer;
|
||||
peer.destination = info.destination;
|
||||
peer.seqnum = 0;
|
||||
failedDestinations.push_back (peer);
|
||||
MakePathError (failedDestinations, info.outPort);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void
|
||||
HwmpProtocol::MakePathError (std::vector<IePerr::FailedDestination> destinations)
|
||||
{
|
||||
NS_LOG_UNCOND ("START PERR, I am "<<m_address);
|
||||
//TODO:
|
||||
//make a perr IE and send
|
||||
//HwmpRtable increments a sequence number as written in 11B.9.7.2
|
||||
NS_LOG_UNCOND("Number of unreachable destinations:"<<destinations.size ());
|
||||
for(std::vector<IePerr::FailedDestination>::iterator i = destinations.begin (); i != destinations.end (); i ++)
|
||||
{
|
||||
HwmpRtable::LookupResult result = m_rtable->LookupReactiveExpired (i->destination);
|
||||
NS_LOG_UNCOND("Address::"<<i->destination<<", next hop is "<<result.retransmitter);
|
||||
}
|
||||
std::vector<std::pair<uint32_t, Mac48Address> > receivers = GetPerrReceivers (destinations);
|
||||
NS_LOG_UNCOND("Number of perr receivers:"<<receivers.size ());
|
||||
if(receivers.size () == 0)
|
||||
return;
|
||||
for(std::vector<std::pair<uint32_t, Mac48Address> >::iterator i = receivers.begin (); i != receivers.end (); i ++)
|
||||
NS_LOG_UNCOND("Address:"<<i->second<<", interface:"<<i->first);
|
||||
//form a path error and send it to proper ports
|
||||
IePerr perr;
|
||||
for(unsigned int i = 0; i < destinations.size (); i ++)
|
||||
{
|
||||
@@ -642,7 +543,6 @@ HwmpProtocol::MakePathError (std::vector<IePerr::FailedDestination> destinations
|
||||
receivers_for_interface.push_back(receivers[j].second);
|
||||
i->second->SendOnePerr (perr, receivers_for_interface);
|
||||
}
|
||||
|
||||
}
|
||||
std::vector<std::pair<uint32_t, Mac48Address> >
|
||||
HwmpProtocol::GetPerrReceivers (std::vector<IePerr::FailedDestination> failedDest)
|
||||
@@ -657,16 +557,10 @@ HwmpProtocol::GetPerrReceivers (std::vector<IePerr::FailedDestination> failedDes
|
||||
retval.push_back(precursors[j]);
|
||||
}
|
||||
//Check if we have dublicates in retval and precursors:
|
||||
unsigned int size = retval.size();
|
||||
for (unsigned int i = 0; i < size; i ++)
|
||||
for (unsigned int j = i; j < size; j ++)
|
||||
for (unsigned int i = 0; i < retval.size(); i ++)
|
||||
for (unsigned int j = i; j < retval.size(); j ++)
|
||||
if(retval[i].second == retval[j].second)
|
||||
{
|
||||
//erase and check size
|
||||
NS_LOG_UNCOND("deleting dublicate");
|
||||
retval.erase(retval.begin() + j);
|
||||
size --;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
std::vector<Mac48Address>
|
||||
@@ -762,7 +656,6 @@ HwmpProtocol::ShouldSendPreq (Mac48Address dst)
|
||||
std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst);
|
||||
if (i == m_preqTimeouts.end ())
|
||||
{
|
||||
NS_LOG_UNCOND("Timeout is:" <<2*(m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds()));
|
||||
m_preqTimeouts[dst] = Simulator::Schedule (
|
||||
MilliSeconds (2*(m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
|
||||
&HwmpProtocol::RetryPathDiscovery, this, dst, 0);
|
||||
@@ -801,11 +694,7 @@ HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry)
|
||||
return;
|
||||
}
|
||||
for(HwmpPluginMap::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i ++)
|
||||
{
|
||||
i->second->RequestDestination(dst);
|
||||
i->second->RequestDestination(Mac48Address("00:00:00:00:00:10"));
|
||||
i->second->RequestDestination(Mac48Address("00:00:00:00:00:24"));
|
||||
}
|
||||
m_preqTimeouts[dst] = Simulator::Schedule (
|
||||
MilliSeconds (2*(m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
|
||||
&HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);
|
||||
|
||||
Reference in New Issue
Block a user