LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2013 Dalian University of Technology | 3 * Copyright (c) 2013 Dalian University of Technology |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ns3/string.h" | 25 #include "ns3/string.h" |
26 #include "ns3/ssid.h" | 26 #include "ns3/ssid.h" |
27 #include "ns3/packet-socket-address.h" | 27 #include "ns3/packet-socket-address.h" |
28 #include "ns3/mobility-model.h" | 28 #include "ns3/mobility-model.h" |
29 #include "ns3/yans-wifi-helper.h" | 29 #include "ns3/yans-wifi-helper.h" |
30 #include "ns3/position-allocator.h" | 30 #include "ns3/position-allocator.h" |
31 #include "ns3/packet-socket-helper.h" | 31 #include "ns3/packet-socket-helper.h" |
32 #include "ns3/mobility-helper.h" | 32 #include "ns3/mobility-helper.h" |
33 #include "ns3/nqos-wifi-mac-helper.h" | 33 #include "ns3/nqos-wifi-mac-helper.h" |
34 #include "ns3/wifi-net-device.h" | 34 #include "ns3/wifi-net-device.h" |
35 #include "ns3/simple-server.h" | 35 #include "ns3/packet-socket-server.h" |
36 #include "ns3/simple-client.h" | 36 #include "ns3/packet-socket-client.h" |
37 #include <iostream> | 37 #include <iostream> |
38 | 38 |
39 #include "ns3/ocb-wifi-mac.h" | 39 #include "ns3/ocb-wifi-mac.h" |
40 #include "ns3/wifi-80211p-helper.h" | 40 #include "ns3/wifi-80211p-helper.h" |
41 #include "ns3/wave-mac-helper.h" | 41 #include "ns3/wave-mac-helper.h" |
42 | 42 |
43 using namespace ns3; | 43 using namespace ns3; |
44 // helper function to assign streams to random variables, to control | 44 // helper function to assign streams to random variables, to control |
45 // randomness in the tests | 45 // randomness in the tests |
46 static void | 46 static void |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 PacketSocketAddress socket; | 276 PacketSocketAddress socket; |
277 socket.SetSingleDevice (mobile_device->GetIfIndex ()); | 277 socket.SetSingleDevice (mobile_device->GetIfIndex ()); |
278 socket.SetPhysicalAddress (static_device->GetAddress ()); | 278 socket.SetPhysicalAddress (static_device->GetAddress ()); |
279 socket.SetProtocol (1); | 279 socket.SetProtocol (1); |
280 | 280 |
281 // give packet socket powers to nodes. | 281 // give packet socket powers to nodes. |
282 PacketSocketHelper packetSocket; | 282 PacketSocketHelper packetSocket; |
283 packetSocket.Install (static_node); | 283 packetSocket.Install (static_node); |
284 packetSocket.Install (mobile_node); | 284 packetSocket.Install (mobile_node); |
285 | 285 |
286 Ptr<SimpleClient> client = CreateObject<SimpleClient> (); | 286 Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> (); |
287 client->SetRemote (socket); | 287 client->SetRemote (socket); |
288 mobile_node->AddApplication (client); | 288 mobile_node->AddApplication (client); |
289 client->SetStartTime (Seconds (0.5)); | 289 client->SetStartTime (Seconds (0.5)); |
290 client->SetStopTime (Seconds (70.0)); | 290 client->SetStopTime (Seconds (70.0)); |
291 | 291 |
292 Ptr<SimpleServer> server = CreateObject<SimpleServer> (); | 292 Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> (); |
| 293 server->SetLocal (socket); |
293 static_node->AddApplication (server); | 294 static_node->AddApplication (server); |
294 server->SetStartTime (Seconds (0.0)); | 295 server->SetStartTime (Seconds (0.0)); |
295 server->SetStopTime (Seconds (70.5)); | 296 server->SetStopTime (Seconds (70.5)); |
296 | 297 |
297 phytx_time = macassoc_time = phyrx_time = Time (); | 298 phytx_time = macassoc_time = phyrx_time = Time (); |
298 phytx_pos = macassoc_pos = phyrx_pos = Vector (); | 299 phytx_pos = macassoc_pos = phyrx_pos = Vector (); |
299 | 300 |
300 Config::Connect ("/NodeList/1/DeviceList/*/Mac/Assoc", MakeCallback (&OcbWifiM
acTestCase::MacAssoc, this)); | 301 Config::Connect ("/NodeList/1/DeviceList/*/Mac/Assoc", MakeCallback (&OcbWifiM
acTestCase::MacAssoc, this)); |
301 Config::Connect ("/NodeList/1/DeviceList/*/Phy/State/RxOk", MakeCallback (&Ocb
WifiMacTestCase::PhyRxOkTrace, this)); | 302 Config::Connect ("/NodeList/1/DeviceList/*/Phy/State/RxOk", MakeCallback (&Ocb
WifiMacTestCase::PhyRxOkTrace, this)); |
302 Config::Connect ("/NodeList/1/DeviceList/*/Phy/State/Tx", MakeCallback (&OcbWi
fiMacTestCase::PhyTxTrace, this)); | 303 Config::Connect ("/NodeList/1/DeviceList/*/Phy/State/Tx", MakeCallback (&OcbWi
fiMacTestCase::PhyTxTrace, this)); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 OcbTestSuite::OcbTestSuite () | 394 OcbTestSuite::OcbTestSuite () |
394 : TestSuite ("wifi-80211p-ocb", UNIT) | 395 : TestSuite ("wifi-80211p-ocb", UNIT) |
395 { | 396 { |
396 // TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER | 397 // TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER |
397 AddTestCase (new OcbWifiMacTestCase, TestCase::QUICK); | 398 AddTestCase (new OcbWifiMacTestCase, TestCase::QUICK); |
398 } | 399 } |
399 | 400 |
400 // Do not forget to allocate an instance of this TestSuite | 401 // Do not forget to allocate an instance of this TestSuite |
401 static OcbTestSuite ocbTestSuite; | 402 static OcbTestSuite ocbTestSuite; |
402 | 403 |
LEFT | RIGHT |