Bugfixes with tag

This commit is contained in:
Kirill Andreev
2009-04-02 19:18:36 +04:00
parent adce54584f
commit 40d4dc921f
4 changed files with 12 additions and 21 deletions

View File

@@ -39,11 +39,11 @@ int
main (int argc, char *argv[])
{
// Creating square topology with nNodes x nNodes grid
int xSize = 2;
int ySize = 2;
int xSize = 4;
int ySize = 4;
double step = 100.0; // Grid with one-hop edge
double randomStart = 0.1; // One beacon interval
uint32_t nIfaces = 1;
uint32_t nIfaces = 2;
bool chan = false;
bool pcap = false;

View File

@@ -73,8 +73,7 @@ HwmpMacPlugin::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
if(meshHdr.GetMeshTtl () == 0)
return false;
tag.SetTtl (meshHdr.GetMeshTtl () - 1);
tag.SetAddress (header.GetAddr2 ());
if(!m_protocol->RemoveTags(destination))
if(m_protocol->GetAddress() != destination)
packet->AddPacketTag(tag);
if (destination == Mac48Address::GetBroadcast ())
if(m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (), header.GetAddr4 ()) )
@@ -135,13 +134,13 @@ HwmpMacPlugin::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header,
//TODO: add a mesh header and remove a TAG
NS_ASSERT(header.IsData ());
HwmpTag tag;
NS_ASSERT(packet->RemovePacketTag(tag));
bool tagExists = packet->RemovePacketTag(tag);
NS_ASSERT(tagExists);
WifiMeshHeader meshHdr;
meshHdr.SetMeshSeqno(tag.GetSeqno());
meshHdr.SetMeshTtl(tag.GetTtl());
packet->AddHeader(meshHdr);
header.SetAddr1(tag.GetAddress());
NS_LOG_UNCOND("Broadcast sent");
return true;
}
void

View File

@@ -160,6 +160,7 @@ HwmpProtocol::RequestRoute (
)
{
HwmpTag tag;
tag.SetAddress(Mac48Address::GetBroadcast());
if (sourceIface == GetMeshPoint ()->GetIfIndex())
// packet from level 3
{
@@ -168,7 +169,6 @@ HwmpProtocol::RequestRoute (
if(destination == Mac48Address::GetBroadcast ())
{
tag.SetSeqno (m_dataSeqno++);
tag.SetAddress (Mac48Address::GetBroadcast());
tag.SetTtl (m_maxTtl+1);
if (m_dataSeqno == 0xffffffff)
m_dataSeqno = 0;
@@ -184,7 +184,9 @@ HwmpProtocol::RequestRoute (
}
if (destination == Mac48Address::GetBroadcast ())
{
NS_LOG_UNCOND("BROADCAS");
packet->RemovePacketTag (tag);
tag.SetAddress (Mac48Address::GetBroadcast ());
packet->AddPacketTag(tag);
routeReply (true, packet, source, destination, protocolType, HwmpRtable::INTERFACE_ANY);
}
else
@@ -250,14 +252,6 @@ HwmpProtocol::ForwardUnicast(uint32_t sourceIface, const Mac48Address source, c
QueuePacket (pkt);
return true;
}
bool
HwmpProtocol::RemoveTags (Mac48Address dst)
{
//Check that dst is my address
if(dst == m_address)
return true;
return false;
}
void
HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface)
{
@@ -503,7 +497,7 @@ HwmpProtocol::PeerLinkStatus(Mac48Address meshPointAddress, Mac48Address peerAdd
if(result.retransmitter == Mac48Address::GetBroadcast ())
{
NS_LOG_UNCOND("I am"<<m_address<<" MP:"<<meshPointAddress<<"accessible through interface"<<interface<<", ra = "<<peerAddress);
m_rtable->AddReactivePath(meshPointAddress, peerAddress, interface, 1, Seconds (0), 0);
//m_rtable->AddReactivePath(meshPointAddress, peerAddress, interface, 1, Seconds (0), 0);
}
}
else
@@ -706,7 +700,7 @@ HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry)
}
for(HwmpPluginMap::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i ++)
{
//i->second->RequestDestination(Mac48Address("00:00:00:00:00:04"));
i->second->RequestDestination(Mac48Address("00:00:00:00:00:20"));
i->second->RequestDestination(dst);
}
m_preqTimeouts[dst] = Simulator::Schedule (

View File

@@ -107,8 +107,6 @@ private:
*/
bool DropDataFrame(uint32_t, Mac48Address);
//\}
///\brief if the packet is ours - plugins should remove tag
bool RemoveTags (Mac48Address dst);
private:
///\name Methods related to Queue/Dequeue procedures
//\{