Data frames can go

This commit is contained in:
Kirill Andreev
2009-03-31 18:50:12 +04:00
parent 9ca44123a5
commit 6ba7122c7b
5 changed files with 14 additions and 6 deletions

View File

@@ -39,8 +39,8 @@ int
main (int argc, char *argv[])
{
// Creating square topology with nNodes x nNodes grid:
int xSize = 4;
int ySize = 4;
int xSize =5;
int ySize = 5;
double step = 100.0; //Grid with one-hop edge
double randomStart = 0.1; //One beacon interval
NodeContainer nodes;

View File

@@ -59,7 +59,6 @@ HwmpMacPlugin::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
HwmpTag tag;
packet->RemoveHeader(meshHdr);
//TODO: address extension
NS_LOG_UNCOND("Received Data frame");
Mac48Address destination;
switch (meshHdr.GetAddressExt ())
{
@@ -69,7 +68,8 @@ HwmpMacPlugin::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
default:
NS_ASSERT(false);
};
tag.SetSeqno (2);//meshHdr.GetMeshSeqno ());
NS_LOG_UNCOND("Received Data frame to "<<destination);
tag.SetSeqno (meshHdr.GetMeshSeqno ());
if(meshHdr.GetMeshTtl () == 0)
return false;
tag.SetTtl (meshHdr.GetMeshTtl () - 1);
@@ -134,6 +134,7 @@ HwmpMacPlugin::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header,
//TODO: add a mesh header and remove a TAG
NS_ASSERT(header.IsData ());
HwmpTag tag;
NS_LOG_UNCOND("sending packet to "<<to);
NS_ASSERT(packet->FindFirstMatchingTag(tag));
WifiMeshHeader meshHdr;
meshHdr.SetMeshSeqno(tag.GetSeqno());

View File

@@ -159,7 +159,6 @@ HwmpProtocol::RequestRoute (
MeshL2RoutingProtocol::RouteReplyCallback routeReply
)
{
NS_LOG_UNCOND("Packet has come!");
HwmpTag tag;
if (sourceIface == GetMeshPoint ()->GetIfIndex())
// packet from level 3
@@ -186,11 +185,19 @@ HwmpProtocol::ForwardUnicast(uint32_t sourceIface, const Mac48Address source, c
{
NS_ASSERT(destination != Mac48Address::GetBroadcast ());
HwmpRtable::LookupResult result = m_rtable->LookupReactive(destination);
NS_LOG_UNCOND("FORWARD UNICAST");
if(result.retransmitter == Mac48Address::GetBroadcast ())
result = m_rtable->LookupProactive ();
if(result.retransmitter != Mac48Address::GetBroadcast ())
{
NS_LOG_UNCOND("Reply now:");
//reply immediately:
packet->RemoveAllTags ();
//Add a proper HWMP-tag:
HwmpTag tag;
tag.SetAddress (result.retransmitter);
//seqno and metric is not used;
packet->AddTag(tag);
routeReply (true, packet, source, destination, protocolType, result.ifIndex);
return true;
}

View File

@@ -77,6 +77,7 @@ MeshPointDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packe
NS_LOG_DEBUG ("UID is " << packet->GetUid ());
const Mac48Address src48 = Mac48Address::ConvertFrom (src);
const Mac48Address dst48 = Mac48Address::ConvertFrom (dst);
NS_LOG_UNCOND("SRC="<<src48<<", DST = "<<dst48<<", I am: "<<m_address);
if (!m_promiscRxCallback.IsNull ())
m_promiscRxCallback (this, packet, protocol, src, dst, packetType);
switch (packetType)

View File

@@ -327,7 +327,6 @@ MeshWifiInterfaceMac::ForwardDown (Ptr<const Packet> const_packet, Mac48Address
hdr.SetAddr4 (from);
hdr.SetDsFrom ();
hdr.SetDsTo ();
// Address 1 is unknwon here. Routing plugin is responsible to correctly set it.
hdr.SetAddr1 (Mac48Address ());