All information elements are tested inside WifiInformationElementVector test
This commit is contained in:
@@ -220,36 +220,6 @@ operator== (const IeBeaconTiming & a, const IeBeaconTiming& b)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef RUN_SELF_TESTS
|
||||
struct IeBeaconTimingBist : public IeTest
|
||||
{
|
||||
IeBeaconTimingBist () :
|
||||
IeTest ("Mesh/802.11s/IE/BeaconTiming")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
RunTests ();
|
||||
};
|
||||
|
||||
/// Test instance
|
||||
static IeBeaconTimingBist g_IePerrBist;
|
||||
|
||||
bool
|
||||
IeBeaconTimingBist::RunTests ()
|
||||
{
|
||||
bool result (true);
|
||||
// create test information element
|
||||
IeBeaconTiming a;
|
||||
a.IeBeaconTiming::AddNeighboursTimingElementUnit (1, Seconds (1.0), Seconds (4.0));
|
||||
a.IeBeaconTiming::AddNeighboursTimingElementUnit (2, Seconds (2.0), Seconds (3.0));
|
||||
a.IeBeaconTiming::AddNeighboursTimingElementUnit (3, Seconds (3.0), Seconds (2.0));
|
||||
a.IeBeaconTiming::AddNeighboursTimingElementUnit (4, Seconds (4.0), Seconds (1.0));
|
||||
|
||||
result = TestRoundtripSerialization (a);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
} // namespace dot11s
|
||||
} //namespace ns3
|
||||
|
||||
|
||||
@@ -212,32 +212,7 @@ operator== (const IeConfiguration & a, const IeConfiguration & b)
|
||||
== b.m_SPId) && (a.m_APId == b.m_APId) && (a.m_neighbors == b.m_neighbors) && (a.m_meshCap
|
||||
== b.m_meshCap));
|
||||
}
|
||||
#ifdef RUN_SELF_TESTS
|
||||
|
||||
/// Built-in self test for IePreq
|
||||
struct IeConfigurationBist : public IeTest
|
||||
{
|
||||
IeConfigurationBist () :
|
||||
IeTest ("Mesh/802.11s/IE/Configuration")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
RunTests ();
|
||||
};
|
||||
|
||||
/// Test instance
|
||||
static IeConfigurationBist g_IeConfigurationBist;
|
||||
|
||||
bool
|
||||
IeConfigurationBist::RunTests ()
|
||||
{
|
||||
bool result (true);
|
||||
IeConfiguration a;
|
||||
|
||||
result = TestRoundtripSerialization (a);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
} // namespace dot11s
|
||||
} //namespace ns3
|
||||
|
||||
|
||||
@@ -139,32 +139,5 @@ operator << (std::ostream &os, const IeMeshId &meshId)
|
||||
os << meshId.PeekString ();
|
||||
return os;
|
||||
}
|
||||
#ifdef RUN_SELF_TESTS
|
||||
|
||||
/// Built-in self test for IeMeshId
|
||||
struct IeMeshIdBist : public IeTest
|
||||
{
|
||||
IeMeshIdBist () :
|
||||
IeTest ("Mesh/802.11s/IE/MESH_ID")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
RunTests ();
|
||||
};
|
||||
|
||||
/// Test instance
|
||||
static IeMeshIdBist g_IeMeshIdBist;
|
||||
|
||||
bool
|
||||
IeMeshIdBist::RunTests ()
|
||||
{
|
||||
bool result (true);
|
||||
|
||||
// create test information element
|
||||
IeMeshId a ("qwerty");
|
||||
result = result && TestRoundtripSerialization (a);
|
||||
return result;
|
||||
}
|
||||
#endif // RUN_SELF_TESTS
|
||||
} //namespace dot11s
|
||||
} // namespace ns3
|
||||
|
||||
@@ -73,32 +73,5 @@ operator== (const IeLinkMetricReport & a, const IeLinkMetricReport & b)
|
||||
{
|
||||
return (a.m_metric == b.m_metric);
|
||||
};
|
||||
#ifdef RUN_SELF_TESTS
|
||||
|
||||
/// Built-in self test for IeLinkMetricReport
|
||||
struct IeLinkMetricReportBist : public IeTest
|
||||
{
|
||||
IeLinkMetricReportBist () :
|
||||
IeTest ("Mesh/802.11s/IE/LINK_METRIC_REPORT")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
RunTests ();
|
||||
};
|
||||
|
||||
/// Test instance
|
||||
static IeLinkMetricReportBist g_IeLinkMetricReportBist;
|
||||
|
||||
bool
|
||||
IeLinkMetricReportBist::RunTests ()
|
||||
{
|
||||
bool result (true);
|
||||
|
||||
// create test information element
|
||||
IeLinkMetricReport a (123456);
|
||||
result = result && TestRoundtripSerialization (a);
|
||||
return result;
|
||||
}
|
||||
#endif // RUN_SELF_TESTS
|
||||
} //namespace dot11s
|
||||
} // namespace ns3
|
||||
|
||||
@@ -165,42 +165,6 @@ operator== (const IePeerManagement & a, const IePeerManagement & b)
|
||||
return ((a.m_length == b.m_length) && (a.m_subtype == b.m_subtype) && (a.m_localLinkId == b.m_localLinkId)
|
||||
&& (a.m_peerLinkId == b.m_peerLinkId) && (a.m_reasonCode == b.m_reasonCode));
|
||||
}
|
||||
#ifdef RUN_SELF_TESTS
|
||||
struct IePeerManagementBist : public IeTest
|
||||
{
|
||||
IePeerManagementBist () :
|
||||
IeTest ("Mesh/802.11s/IE/PeerManagement")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
RunTests ();
|
||||
};
|
||||
|
||||
/// Test instance
|
||||
static IePeerManagementBist g_IePerrBist;
|
||||
|
||||
bool
|
||||
IePeerManagementBist::RunTests ()
|
||||
{
|
||||
bool result (true);
|
||||
{
|
||||
IePeerManagement a;
|
||||
a.SetPeerOpen (1);
|
||||
result = result && TestRoundtripSerialization (a);
|
||||
}
|
||||
{
|
||||
IePeerManagement a;
|
||||
a.SetPeerConfirm (1, 2);
|
||||
result = result && TestRoundtripSerialization (a);
|
||||
}
|
||||
{
|
||||
IePeerManagement a;
|
||||
a.SetPeerClose (1, 2, REASON11S_MESH_CAPABILITY_POLICY_VIOLATION);
|
||||
result = result && TestRoundtripSerialization (a);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
} // namespace dot11s
|
||||
} //namespace ns3
|
||||
|
||||
|
||||
@@ -153,44 +153,6 @@ operator== (const IePerr & a, const IePerr & b)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef RUN_SELF_TESTS
|
||||
|
||||
/// Built-in self test for IePreq
|
||||
struct IePerrBist : public IeTest
|
||||
{
|
||||
IePerrBist () :
|
||||
IeTest ("Mesh/802.11s/IE/PERR")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
RunTests ();
|
||||
};
|
||||
|
||||
/// Test instance
|
||||
static IePerrBist g_IePerrBist;
|
||||
|
||||
bool
|
||||
IePerrBist::RunTests ()
|
||||
{
|
||||
bool result (true);
|
||||
// create test information element
|
||||
IePerr a;
|
||||
IePerr::FailedDestination dest;
|
||||
dest.destination = Mac48Address ("11:22:33:44:55:66");
|
||||
dest.seqnum = 1;
|
||||
a.AddAddressUnit (dest);
|
||||
dest.destination = Mac48Address ("10:20:30:40:50:60");
|
||||
dest.seqnum = 2;
|
||||
a.AddAddressUnit (dest);
|
||||
dest.destination = Mac48Address ("01:02:03:04:05:06");
|
||||
dest.seqnum = 3;
|
||||
a.AddAddressUnit (dest);
|
||||
|
||||
result = result && TestRoundtripSerialization (a);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // RUN_SELF_TESTS
|
||||
} // namespace dot11s
|
||||
} //namespace ns3
|
||||
|
||||
|
||||
@@ -203,45 +203,6 @@ operator== (const IePrep & a, const IePrep & b)
|
||||
&& (a.m_lifetime == b.m_lifetime) && (a.m_metric == b.m_metric) && (a.m_originatorAddress
|
||||
== b.m_originatorAddress) && (a.m_originatorSeqNumber == b.m_originatorSeqNumber));
|
||||
}
|
||||
|
||||
#ifdef RUN_SELF_TESTS
|
||||
|
||||
/// Built-in self test for IePrep
|
||||
struct IePrepBist : public IeTest
|
||||
{
|
||||
IePrepBist () :
|
||||
IeTest ("Mesh/802.11s/IE/PREP")
|
||||
{
|
||||
};
|
||||
virtual bool
|
||||
RunTests ();
|
||||
};
|
||||
|
||||
/// Test instance
|
||||
static IePrepBist g_IePrepBist;
|
||||
|
||||
bool
|
||||
IePrepBist::RunTests ()
|
||||
{
|
||||
bool result (true);
|
||||
|
||||
// create test information element
|
||||
IePrep a;
|
||||
a.SetFlags (12);
|
||||
a.SetHopcount (11);
|
||||
a.SetTtl (10);
|
||||
a.SetDestinationAddress (Mac48Address ("11:22:33:44:55:66"));
|
||||
a.SetDestinationSeqNumber (123);
|
||||
a.SetLifetime (5000);
|
||||
a.SetMetric (4321);
|
||||
a.SetOriginatorAddress (Mac48Address ("33:00:22:00:11:00"));
|
||||
a.SetOriginatorSeqNumber (666);
|
||||
|
||||
result = result && TestRoundtripSerialization (a);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // RUN_SELF_TESTS
|
||||
} // namespace dot11s
|
||||
} //namespace ns3
|
||||
|
||||
|
||||
@@ -444,43 +444,6 @@ IePreq::IsFull () const
|
||||
{
|
||||
return ((GetInformationSize () + 11) > 255);
|
||||
}
|
||||
#ifdef RUN_SELF_TESTS
|
||||
|
||||
/// Built-in self test for IePreq
|
||||
struct IePreqBist : public IeTest
|
||||
{
|
||||
IePreqBist () :
|
||||
IeTest ("Mesh/802.11s/IE/PREQ")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
RunTests ();
|
||||
};
|
||||
|
||||
/// Test instance
|
||||
static IePreqBist g_IePreqBist;
|
||||
|
||||
bool
|
||||
IePreqBist::RunTests ()
|
||||
{
|
||||
bool result (true);
|
||||
|
||||
// create test information element
|
||||
IePreq a;
|
||||
a.SetHopcount (0);
|
||||
a.SetTTL (1);
|
||||
a.SetPreqID (2);
|
||||
a.SetOriginatorAddress (Mac48Address ("11:22:33:44:55:66"));
|
||||
a.SetOriginatorSeqNumber (3);
|
||||
a.SetLifetime (4);
|
||||
a.AddDestinationAddressElement (false, false, Mac48Address ("11:11:11:11:11:11"), 5);
|
||||
a.AddDestinationAddressElement (false, false, Mac48Address ("22:22:22:22:22:22"), 6);
|
||||
|
||||
result = result && TestRoundtripSerialization (a);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // RUN_SELF_TESTS
|
||||
} // namespace dot11s
|
||||
} //namespace ns3
|
||||
|
||||
|
||||
@@ -168,46 +168,6 @@ operator== (const IeRann & a, const IeRann & b)
|
||||
&& a.m_originatorAddress == b.m_originatorAddress && a.m_destSeqNumber == b.m_destSeqNumber
|
||||
&& a.m_metric == b.m_metric);
|
||||
}
|
||||
|
||||
#ifdef RUN_SELF_TESTS
|
||||
|
||||
/// Built-in self test for IeRann
|
||||
struct IeRannBist : public IeTest
|
||||
{
|
||||
IeRannBist () :
|
||||
IeTest ("Mesh/802.11s/IE/RANN")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
RunTests ();
|
||||
};
|
||||
|
||||
/// Test instance
|
||||
static IeRannBist g_IeRannBist;
|
||||
|
||||
bool
|
||||
IeRannBist::RunTests ()
|
||||
{
|
||||
bool result (true);
|
||||
|
||||
// create test information element
|
||||
IeRann a;
|
||||
|
||||
a.SetFlags (1);
|
||||
a.SetHopcount (2);
|
||||
a.SetTTL (4);
|
||||
a.DecrementTtl ();
|
||||
NS_TEST_ASSERT_EQUAL (a.GetTtl (), 3);
|
||||
a.SetOriginatorAddress (Mac48Address ("11:22:33:44:55:66"));
|
||||
a.SetDestSeqNumber (5);
|
||||
a.SetMetric (6);
|
||||
a.IncrementMetric (2);
|
||||
NS_TEST_ASSERT_EQUAL (a.GetMetric (), 8);
|
||||
|
||||
result = result && TestRoundtripSerialization (a);
|
||||
return result;
|
||||
}
|
||||
#endif // RUN_SELF_TESTS
|
||||
}
|
||||
} // namespace ns3::dot11s
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ operator== (const PeerLinkFrameStart & a, const PeerLinkFrameStart & b)
|
||||
struct PeerLinkFrameStartBist : public Test
|
||||
{
|
||||
PeerLinkFrameStartBist () :
|
||||
Test ("Mesh/802.11s/IE/PeerLinkFrameStart")
|
||||
Test ("Mesh/802.11s/PeerLinkFrameStart")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
|
||||
@@ -149,7 +149,7 @@ operator== (const FlameHeader & a, const FlameHeader & b)
|
||||
struct FlameHeaderBist : public Test
|
||||
{
|
||||
FlameHeaderBist () :
|
||||
Test ("mesh/flame/FlameHeader")
|
||||
Test ("mesh/Flame/FlameHeader")
|
||||
{
|
||||
}
|
||||
virtual bool
|
||||
|
||||
@@ -146,7 +146,7 @@ private:
|
||||
static FlameRtableTest g_FlameRtableTest;
|
||||
|
||||
FlameRtableTest::FlameRtableTest () :
|
||||
Test ("Mesh/flame/FlameRtable"), result (true), dst ("01:00:00:01:00:01"), hop ("01:00:00:01:00:03"),
|
||||
Test ("Mesh/Flame/FlameRtable"), result (true), dst ("01:00:00:01:00:01"), hop ("01:00:00:01:00:03"),
|
||||
iface (8010), cost (10), seqnum (1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ operator== (const WifiInformationElementVector & a, const WifiInformationElement
|
||||
WifiInformationElementVector::IE_VECTOR::const_iterator j = b.m_elements.begin ();
|
||||
for (WifiInformationElementVector::IE_VECTOR::const_iterator i = a.m_elements.begin (); i
|
||||
!= a.m_elements.end (); i++, j++)
|
||||
{
|
||||
{
|
||||
if ((*i)->ElementId () != (*j)->ElementId ())
|
||||
{
|
||||
return false;
|
||||
@@ -217,6 +217,143 @@ operator== (const WifiInformationElementVector & a, const WifiInformationElement
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint8_t id = (*i)->ElementId ();
|
||||
switch (id)
|
||||
{
|
||||
case IE11S_MESH_CONFIGURATION:
|
||||
if (DynamicCast<dot11s::IeConfiguration> ((*i)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (DynamicCast<dot11s::IeConfiguration> ((*j)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*DynamicCast<dot11s::IeConfiguration> ((*i)) == *DynamicCast<dot11s::IeConfiguration> ((*j))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case IE11S_MESH_ID:
|
||||
if (DynamicCast<dot11s::IeMeshId> ((*i)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (DynamicCast<dot11s::IeMeshId> ((*j)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*DynamicCast<dot11s::IeMeshId> ((*i)) == *DynamicCast<dot11s::IeMeshId> ((*j))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case IE11S_LINK_METRIC_REPORT:
|
||||
if (DynamicCast<dot11s::IeLinkMetricReport> ((*i)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (DynamicCast<dot11s::IeLinkMetricReport> ((*j)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*DynamicCast<dot11s::IeLinkMetricReport> ((*i)) == *DynamicCast<dot11s::IeLinkMetricReport> (
|
||||
(*j))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case IE11S_PEERING_MANAGEMENT:
|
||||
if (DynamicCast<dot11s::IePeerManagement> ((*i)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (DynamicCast<dot11s::IePeerManagement> ((*j)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*DynamicCast<dot11s::IePeerManagement> ((*i)) == *DynamicCast<dot11s::IePeerManagement> ((*j))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case IE11S_BEACON_TIMING:
|
||||
if (DynamicCast<dot11s::IeBeaconTiming> ((*i)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (DynamicCast<dot11s::IeBeaconTiming> ((*j)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*DynamicCast<dot11s::IeBeaconTiming> ((*i)) == *DynamicCast<dot11s::IeBeaconTiming> ((*j))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case IE11S_RANN:
|
||||
if (DynamicCast<dot11s::IeRann> ((*i)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (DynamicCast<dot11s::IeRann> ((*j)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*DynamicCast<dot11s::IeRann> ((*i)) == *DynamicCast<dot11s::IeRann> ((*j))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case IE11S_PREQ:
|
||||
if (DynamicCast<dot11s::IePreq> ((*i)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (DynamicCast<dot11s::IePreq> ((*j)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*DynamicCast<dot11s::IePreq> ((*i)) == *DynamicCast<dot11s::IePreq> ((*j))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case IE11S_PREP:
|
||||
if (DynamicCast<dot11s::IePrep> ((*i)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (DynamicCast<dot11s::IePrep> ((*j)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*DynamicCast<dot11s::IePrep> ((*i)) == *DynamicCast<dot11s::IePrep> ((*j))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
case IE11S_PERR:
|
||||
if (DynamicCast<dot11s::IePerr> ((*i)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (DynamicCast<dot11s::IePerr> ((*j)) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*DynamicCast<dot11s::IePerr> ((*i)) == *DynamicCast<dot11s::IePerr> ((*j))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case IE11S_MESH_PEERING_PROTOCOL_VERSION:
|
||||
break;
|
||||
default:
|
||||
NS_FATAL_ERROR ("Information element " << (uint16_t) id << " is not implemented");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -241,15 +378,91 @@ WifiInformationElementVectorBist::RunTests ()
|
||||
{
|
||||
bool result = true;
|
||||
WifiInformationElementVector vector;
|
||||
vector.AddInformationElement (Create<dot11s::IeMeshId> ());
|
||||
vector.AddInformationElement (Create<dot11s::IeConfiguration> ());
|
||||
vector.AddInformationElement (Create<dot11s::IeLinkMetricReport> ());
|
||||
vector.AddInformationElement (Create<dot11s::IePeerManagement> ());
|
||||
vector.AddInformationElement (Create<dot11s::IeBeaconTiming> ());
|
||||
vector.AddInformationElement (Create<dot11s::IeRann> ());
|
||||
vector.AddInformationElement (Create<dot11s::IePreq> ());
|
||||
vector.AddInformationElement (Create<dot11s::IePrep> ());
|
||||
vector.AddInformationElement (Create<dot11s::IePerr> ());
|
||||
{
|
||||
//Mesh ID test
|
||||
Ptr<dot11s::IeMeshId> meshId = Create<dot11s::IeMeshId> ("qwerty");
|
||||
vector.AddInformationElement (meshId);
|
||||
}
|
||||
{
|
||||
Ptr<dot11s::IeConfiguration> config = Create<dot11s::IeConfiguration> ();
|
||||
vector.AddInformationElement (config);
|
||||
}
|
||||
{
|
||||
Ptr<dot11s::IeLinkMetricReport> report = Create<dot11s::IeLinkMetricReport> (123456);
|
||||
vector.AddInformationElement (report);
|
||||
}
|
||||
{
|
||||
Ptr<dot11s::IePeerManagement> peerMan1 = Create<dot11s::IePeerManagement> ();
|
||||
peerMan1->SetPeerOpen (1);
|
||||
Ptr<dot11s::IePeerManagement> peerMan2 = Create<dot11s::IePeerManagement> ();
|
||||
peerMan2->SetPeerConfirm (1, 2);
|
||||
Ptr<dot11s::IePeerManagement> peerMan3 = Create<dot11s::IePeerManagement> ();
|
||||
peerMan3->SetPeerClose (1, 2, dot11s::REASON11S_MESH_CAPABILITY_POLICY_VIOLATION);
|
||||
vector.AddInformationElement (peerMan1);
|
||||
vector.AddInformationElement (peerMan2);
|
||||
vector.AddInformationElement (peerMan3);
|
||||
}
|
||||
{
|
||||
Ptr<dot11s::IeBeaconTiming> beaconTiming = Create<dot11s::IeBeaconTiming> ();
|
||||
beaconTiming->AddNeighboursTimingElementUnit (1, Seconds (1.0), Seconds (4.0));
|
||||
beaconTiming->AddNeighboursTimingElementUnit (2, Seconds (2.0), Seconds (3.0));
|
||||
beaconTiming->AddNeighboursTimingElementUnit (3, Seconds (3.0), Seconds (2.0));
|
||||
beaconTiming->AddNeighboursTimingElementUnit (4, Seconds (4.0), Seconds (1.0));
|
||||
vector.AddInformationElement (beaconTiming);
|
||||
}
|
||||
{
|
||||
Ptr<dot11s::IeRann> rann = Create<dot11s::IeRann> ();
|
||||
rann->SetFlags (1);
|
||||
rann->SetHopcount (2);
|
||||
rann->SetTTL (4);
|
||||
rann->DecrementTtl ();
|
||||
NS_TEST_ASSERT_EQUAL (rann->GetTtl (), 3);
|
||||
rann->SetOriginatorAddress (Mac48Address ("11:22:33:44:55:66"));
|
||||
rann->SetDestSeqNumber (5);
|
||||
rann->SetMetric (6);
|
||||
rann->IncrementMetric (2);
|
||||
NS_TEST_ASSERT_EQUAL (rann->GetMetric (), 8);
|
||||
vector.AddInformationElement (rann);
|
||||
}
|
||||
{
|
||||
Ptr<dot11s::IePreq> preq = Create<dot11s::IePreq> ();
|
||||
preq->SetHopcount (0);
|
||||
preq->SetTTL (1);
|
||||
preq->SetPreqID (2);
|
||||
preq->SetOriginatorAddress (Mac48Address ("11:22:33:44:55:66"));
|
||||
preq->SetOriginatorSeqNumber (3);
|
||||
preq->SetLifetime (4);
|
||||
preq->AddDestinationAddressElement (false, false, Mac48Address ("11:11:11:11:11:11"), 5);
|
||||
preq->AddDestinationAddressElement (false, false, Mac48Address ("22:22:22:22:22:22"), 6);
|
||||
vector.AddInformationElement (preq);
|
||||
}
|
||||
{
|
||||
Ptr<dot11s::IePrep> prep = Create<dot11s::IePrep> ();
|
||||
prep->SetFlags (12);
|
||||
prep->SetHopcount (11);
|
||||
prep->SetTtl (10);
|
||||
prep->SetDestinationAddress (Mac48Address ("11:22:33:44:55:66"));
|
||||
prep->SetDestinationSeqNumber (123);
|
||||
prep->SetLifetime (5000);
|
||||
prep->SetMetric (4321);
|
||||
prep->SetOriginatorAddress (Mac48Address ("33:00:22:00:11:00"));
|
||||
prep->SetOriginatorSeqNumber (666);
|
||||
vector.AddInformationElement (prep);
|
||||
}
|
||||
{
|
||||
Ptr<dot11s::IePerr> perr = Create<dot11s::IePerr> ();
|
||||
dot11s::IePerr::FailedDestination dest;
|
||||
dest.destination = Mac48Address ("11:22:33:44:55:66");
|
||||
dest.seqnum = 1;
|
||||
perr->AddAddressUnit (dest);
|
||||
dest.destination = Mac48Address ("10:20:30:40:50:60");
|
||||
dest.seqnum = 2;
|
||||
perr->AddAddressUnit (dest);
|
||||
dest.destination = Mac48Address ("01:02:03:04:05:06");
|
||||
dest.seqnum = 3;
|
||||
perr->AddAddressUnit (dest);
|
||||
vector.AddInformationElement (perr);
|
||||
}
|
||||
Ptr<Packet> packet = Create<Packet> ();
|
||||
packet->AddHeader (vector);
|
||||
WifiInformationElementVector resultVector;
|
||||
|
||||
Reference in New Issue
Block a user