20 #include "ns3/config.h" 
   21 #include "ns3/string.h" 
   22 #include "ns3/node-list.h" 
   23 #include "ns3/mobility-model.h" 
   24 #include "ns3/yans-wifi-helper.h" 
   25 #include "ns3/mobility-helper.h" 
   26 #include "ns3/wave-net-device.h" 
   27 #include "ns3/wave-mac-helper.h" 
   28 #include "ns3/wave-helper.h" 
   60   void NotifyCchStartNow (
Time duration);
 
   65   void NotifySchStartNow (
Time duration);
 
   71   void NotifyGuardStartNow (
Time duration, 
bool inCchInterval);
 
   79   void TestIntervalAfter (
bool cchi, 
bool schi, 
bool guardi);
 
   80   virtual void DoRun (
void);
 
  100     : m_coordinatorTest (coordinatorTest)
 
  108     m_coordinatorTest->NotifyCchStartNow (duration);
 
  112     m_coordinatorTest->NotifySchStartNow (duration);
 
  116     m_coordinatorTest->NotifyGuardStartNow (duration, cchi);
 
  134                          "check whether is CCH interval");
 
  136                          "check whether is SCH interval");
 
  138                          "check whether is Guard interval");
 
  150   bool test = (((now - guardi) % synci) == 0);
 
  170   bool test = ((now - guardi - cchi) % synci == 0);
 
  188       test = ((now % sync) == 0);
 
  194       test = (((now - cchi) % sync) == 0);
 
  246   Simulator::Stop (
Seconds (1.0));
 
  248   Simulator::Destroy ();
 
  250   m_coordinator = CreateObject<ChannelCoordinator> ();
 
  253   m_coordinator->RegisterListener (ptr);
 
  254   Simulator::Stop (
Seconds (100.0));
 
  256   Simulator::Destroy ();
 
  276 #define PI 3.14159265 
  282   nodes.
Create (nodesNumber);
 
  290   for (uint32_t n = 1; n != nodesNumber; ++n)
 
  292       double angle = (
PI / 180) * (360 / (nodesNumber - 1) * n);
 
  293       double x = cos (angle) * 10;
 
  294       double y = sin (angle) * 10;
 
  303   WaveHelper waveHelper = WaveHelper::Default ();
 
  324   void SendIp (
bool shouldSucceed, 
bool ipv6);
 
  339   virtual void DoRun (
void);
 
  373   const Address dest = Mac48Address::GetBroadcast ();
 
  374   uint16_t protocol = 0x80dd; 
 
  375   bool result = 
m_sender->
SendX (packet, dest, protocol, txInfo);
 
  382   const Address dest = Mac48Address::GetBroadcast ();
 
  383   const static uint16_t IPv4_PROT_NUMBER = 0x0800;
 
  384   const static uint16_t IPv6_PROT_NUMBER = 0x86DD;
 
  385   uint16_t protocol = ipv6 ? IPv6_PROT_NUMBER : IPv4_PROT_NUMBER;
 
  403     m_sender = DynamicCast<WaveNetDevice> (devices.
Get (0));
 
  410     Simulator::Schedule (
Seconds (0.2), &WaveNetDevice::StartSch, 
m_sender, schInfo);
 
  439     Simulator::Stop (
Seconds (1.0));
 
  441     Simulator::Destroy ();
 
  447     m_sender = DynamicCast<WaveNetDevice> (devices.
Get (0));
 
  449     bool ipv6 = 
true, ipv4 = 
false;
 
  454     Simulator::Schedule (
Seconds (0.2), &WaveNetDevice::StartSch, 
m_sender, schInfo);
 
  460     Simulator::Schedule (
Seconds (0.4), &WaveNetDevice::RegisterTxProfile, 
m_sender, txProfile);
 
  478     Simulator::Stop (
Seconds (1.0));
 
  480     Simulator::Destroy ();
 
  486     m_sender = DynamicCast<WaveNetDevice> (devices.
Get (0));
 
  489     const Mac48Address dest = Mac48Address::GetBroadcast ();
 
  501     Simulator::Schedule (
Seconds (0.4), &WaveNetDevice::StartSch, 
m_sender, schInfo);
 
  520     Simulator::Stop (
Seconds (1.0));
 
  522     Simulator::Destroy ();
 
  593   virtual void DoRun (
void);
 
  649   const static uint16_t WSMP_PROT_NUMBER = 0x88DC;
 
  650   const Mac48Address dest = Mac48Address::GetBroadcast ();
 
  653   uint8_t *
data = 
new uint8_t [112];
 
  654   data [0] = (receiverId >> 24) & 0xFF;
 
  655   data [1] = (receiverId >> 16) & 0xFF;
 
  656   data [2] = (receiverId >> 8) & 0xFF;
 
  657   data [3] = (receiverId >> 0) & 0xFF;
 
  660   data [4] = (ts >> 56) & 0xFF;
 
  661   data [5] = (ts >> 48) & 0xFF;
 
  662   data [6] = (ts >> 40) & 0xFF;
 
  663   data [7] = (ts >> 32) & 0xFF;
 
  664   data [8] = (ts >> 24) & 0xFF;
 
  665   data [9] = (ts >> 16) & 0xFF;
 
  666   data [10] = (ts >> 8) & 0xFF;
 
  667   data [11] = (ts >> 0) & 0xFF;
 
  682   uint32_t seq = data [0];
 
  690   uint64_t ts = data [4];
 
  755     Simulator::Stop (
Seconds (7.0));
 
  757     Simulator::Destroy ();
 
  766     for (uint32_t i = 1; i != 8; ++i)
 
  772         static std::vector<uint32_t> WaveChannels = ChannelManager::GetWaveChannels ();
 
  773         uint32_t 
channel = WaveChannels[i - 1];
 
  775         Simulator::Schedule (
Seconds (0), &WaveNetDevice::StartSch, device, info);
 
  790     Simulator::Schedule (
Seconds (1), &WaveNetDevice::StartSch, 
m_sender, info);
 
  800     Simulator::Stop (
Seconds (10.0));
 
  802     Simulator::Destroy ();
 
  852     Simulator::Stop (
Seconds (6.0));
 
  854     Simulator::Destroy ();
 
  863     for (uint32_t i = 1; i != 8; ++i)
 
  869         static std::vector<uint32_t> WaveChannels = ChannelManager::GetWaveChannels ();
 
  870         uint32_t 
channel = WaveChannels[i - 1];
 
  872         Simulator::Schedule (
Seconds (0), &WaveNetDevice::StartSch, device, info);
 
  888     Simulator::Schedule (
Seconds (1), &WaveNetDevice::StartSch, 
m_sender, info);
 
  907     Simulator::Stop (
Seconds (10.0));
 
  909     Simulator::Destroy ();
 
  950     Simulator::Stop (
Seconds (6.0));
 
  952     Simulator::Destroy ();
 
  961     for (uint32_t i = 1; i != 8; ++i)
 
  967         static std::vector<uint32_t> WaveChannels = ChannelManager::GetWaveChannels ();
 
  968         uint32_t 
channel = WaveChannels[i - 1];
 
  970         Simulator::Schedule (
Seconds (0), &WaveNetDevice::StartSch, device, info);
 
  985     Simulator::Schedule (
Seconds (1), &WaveNetDevice::StartSch, 
m_sender, info);
 
 1007     Simulator::Stop (
Seconds (10.0));
 
 1009     Simulator::Destroy ();
 
 1028   virtual void DoRun (
void);
 
 1064   const static uint16_t WSMP_PROT_NUMBER = 0x88DC;
 
 1068   data [0] = (sequence >> 24) & 0xFF;
 
 1069   data [1] = (sequence >> 16) & 0xFF;
 
 1070   data [2] = (sequence >> 8) & 0xFF;
 
 1071   data [3] = (sequence >> 0) & 0xFF;
 
 1074   data [4] = (ts >> 56) & 0xFF;
 
 1075   data [5] = (ts >> 48) & 0xFF;
 
 1076   data [6] = (ts >> 40) & 0xFF;
 
 1077   data [7] = (ts >> 32) & 0xFF;
 
 1078   data [8] = (ts >> 24) & 0xFF;
 
 1079   data [9] = (ts >> 16) & 0xFF;
 
 1080   data [10] = (ts >> 8) & 0xFF;
 
 1081   data [11] = (ts >> 0) & 0xFF;
 
 1096   uint32_t seq = data [0];
 
 1104   uint64_t ts = data [4];
 
 1124   Time duration = curTime - sendTime;
 
 1128       NS_TEST_EXPECT_MSG_GT (duration, ChannelCoordinator::GetDefaultSchInterval (), 
"fail to test Annex C when packet sequence is " << seq);
 
 1132       NS_TEST_EXPECT_MSG_LT (duration, ChannelCoordinator::GetDefaultSchInterval (), 
"fail to test Annex C when packet sequence is " << seq);
 
 1136       NS_TEST_EXPECT_MSG_GT (duration, ChannelCoordinator::GetDefaultCchInterval (), 
"fail to test Annex C when packet sequence is " << seq);
 
 1140       NS_TEST_EXPECT_MSG_LT (duration, ChannelCoordinator::GetDefaultCchInterval (), 
"fail to test Annex C when packet sequence is " << seq);
 
 1155   Simulator::Schedule (
MilliSeconds (0), &WaveNetDevice::StartSch, m_receiver, infoReceiver);
 
 1179   Simulator::Stop (
Seconds (1.0));
 
 1181   Simulator::Destroy ();
 
 1197   : 
TestSuite (
"wave-mac-extension", UNIT)
 
virtual Address GetAddress(void) const 
 
void SendX(uint32_t channel, uint32_t receiverId)
Send X function. 
 
virtual ~ChannelRoutingTestCase(void)
 
bool IsGuardInterval(Time duration=Seconds(0.0)) const 
 
Simulation virtual time values and global simulation resolution. 
 
This test case tests channel access assignments which is done by StartSch and StopSch method of WaveN...
 
virtual void NotifyGuardSlotStart(Time duration, bool cchi)
 
bool StartSch(const SchInfo &schInfo)
 
void TestContinuousAfter(uint32_t channelNumber, bool isAccessAssigned)
Test continuous after function. 
 
Ptr< YansWifiChannel > Create(void) const 
 
Ptr< T > GetObject(void) const 
Get a pointer to the requested aggregated Object. 
 
Ptr< NetDevice > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
 
void NotifySchStartNow(Time duration)
Notify SCH start now function. 
 
void TestContinuous(SchInfo &info, bool shouldSucceed)
Test continuous function. 
 
bool Receive(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive function. 
 
virtual Ptr< Node > GetNode(void) const =0
 
bool SendX(Ptr< Packet > packet, const Address &dest, uint32_t protocol, const TxInfo &txInfo)
 
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit. 
 
static NetDeviceContainer CreatWaveDevice(uint32_t nodesNumber=2)
Create WAVE device function. 
 
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not. 
 
uint32_t GetSize(void) const 
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
 
void SetCchInterval(Time cchi)
 
Ptr< ChannelCoordinator > m_coordinator
coordinator 
 
void SendWsmp(bool shouldSucceed, const TxInfo &txInfo)
Send WSMP or other packets. 
 
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const 
 
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
 
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
 
bool IsSchInterval(Time duration=Seconds(0.0)) const 
 
a polymophic address class 
 
The Annex C of IEEE 1609.4 : "Avoiding transmission at scheduled guard intervals" This feature is imp...
 
bool IsValidConfig(void) const 
 
void TestExtended(SchInfo &info, bool shouldSucceed)
Test extended function. 
 
virtual ~ChannelCoordinationTestCase(void)
 
ChannelAccessTestCase(void)
 
bool ReceiveVsa(Ptr< const Packet > pkt, const Address &address, uint32_t, uint32_t)
Receive VSA functon. 
 
Keep track of the current position and velocity of an object. 
 
void SetChannel(Ptr< YansWifiChannel > channel)
 
void Install(Ptr< Node > node) const 
"Layout" a single node according to the current position allocator type. 
 
Ptr< WaveNetDevice > m_sender
sender 
 
#define EXTENDED_ALTERNATING
 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
 
the organization identifier is a public organizationally unique identifier assigned by the IEEE...
 
virtual ~CoordinationTestListener(void)
 
helps to create WaveNetDevice objects 
 
Time GetGuardInterval(void) const 
 
holds a vector of ns3::NetDevice pointers 
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
#define EXTENDED_CONTINUOUS
 
Ptr< WaveNetDevice > m_sender
sender 
 
Qos Wave Mac Helper class. 
 
void SendPacket(uint32_t packetSize, const TxInfo &txInfo, uint32_t sequence)
Send packet function. 
 
This test case tests the channel coordination. 
 
NetDeviceContainer m_devices
devices 
 
void SendIp(bool shouldSucceed, bool ipv6)
Send IP-based packets. 
 
bool IsCchInterval(Time duration=Seconds(0.0)) const 
 
CoordinationTestListener(ChannelCoordinationTestCase *coordinatorTest)
Constructor. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
keep track of a set of node pointers. 
 
void NotifyGuardStartNow(Time duration, bool inCchInterval)
Notify guard start now function. 
 
uint32_t channelNumber
channel number 
 
Time GetCchInterval(void) const 
 
void SendWsa(bool shouldSucceed, const VsaInfo &vsaInfo)
Send VSA management frames. 
 
CoordinationTestListener is used to test channel coordination events. 
 
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
 
route packets or frames in different approaches see 1609.4-2010 chapter 5.3.4 
 
int64_t GetTimeStep(void) const 
Get the raw time value, in the current resolution unit. 
 
Time TimeStep(uint64_t ts)
 
bool Receive(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive function. 
 
void TestAlternating(SchInfo &info, bool shouldSucceed)
Test aternating function. 
 
manage and create wifi channel objects for the yans model. 
 
Time GetSchInterval(void) const 
 
virtual ~ChannelAccessTestCase(void)
 
To trace WaveNetDevice, we have to overwrite the trace functions of class YansWifiPhyHelper. 
 
NetDeviceContainer m_devices
the devices 
 
ChannelCoordinationTestCase * m_coordinatorTest
coordinator test 
 
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report if not. 
 
void SetPosition(const Vector &position)
 
virtual void NotifySchSlotStart(Time duration)
 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
 
void TestAlternatingAfter(uint32_t channelNumber, bool isAccessAssigned)
Test alternating after function. 
 
void NotifyCchStartNow(Time duration)
Notify CCS start now function. 
 
Helper class used to assign positions and mobility models to nodes. 
 
bool StartVsa(const VsaInfo &vsaInfo)
 
virtual ~AnnexC_TestCase()
 
Ptr< WaveNetDevice > m_sender
sender 
 
uint32_t GetId(void) const 
 
void TestExtendedAfter(uint32_t channelNumber, bool isAccessAssigned)
Test extended after function. 
 
receive notifications about channel coordination events. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
void SetSchInterval(Time schi)
 
uint32_t m_received
received 
 
Time GetSyncInterval(void) const 
 
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not. 
 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
 
uint32_t CopyData(uint8_t *buffer, uint32_t size) const 
Copy the packet contents to a byte buffer. 
 
bool Receive(Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
Receive function. 
 
Time Now(void)
create an ns3::Time instance which contains the current simulation time. 
 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
 
static const uint32_t packetSize
 
ChannelCoordinationTestCase(void)
 
static WaveMacTestSuite waveMacTestSuite
the test suite 
 
void TestIntervalAfter(bool cchi, bool schi, bool guardi)
Test interval after function. 
 
Ptr< ChannelScheduler > GetChannelScheduler(void) const 
 
int64_t GetMilliSeconds(void) const 
Get an approximation of the time stored in this instance in the indicated unit. 
 
virtual void NotifyCchSlotStart(Time duration)
 
Ptr< WaveNetDevice > m_receiver
receiver 
 
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
 
void SetGuardInterval(Time guardi)
 
ChannelRoutingTestCase(void)