LEFT | RIGHT |
(no file at all) | |
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) 2010 IITP RAS | 3 * Copyright (c) 2010 IITP RAS |
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 18 matching lines...) Expand all Loading... |
29 #include "ns3/internet-stack-helper.h" | 29 #include "ns3/internet-stack-helper.h" |
30 #include "ns3/ipv4-address-helper.h" | 30 #include "ns3/ipv4-address-helper.h" |
31 #include "ns3/abort.h" | 31 #include "ns3/abort.h" |
32 #include "ns3/udp-echo-helper.h" | 32 #include "ns3/udp-echo-helper.h" |
33 #include "ns3/mobility-model.h" | 33 #include "ns3/mobility-model.h" |
34 #include "ns3/pcap-file.h" | 34 #include "ns3/pcap-file.h" |
35 #include "ns3/aodv-helper.h" | 35 #include "ns3/aodv-helper.h" |
36 #include "ns3/v4ping.h" | 36 #include "ns3/v4ping.h" |
37 #include "ns3/nqos-wifi-mac-helper.h" | 37 #include "ns3/nqos-wifi-mac-helper.h" |
38 #include "ns3/config.h" | 38 #include "ns3/config.h" |
| 39 #include "ns3/boolean.h" |
39 #include "ns3/constant-position-mobility-model.h" | 40 #include "ns3/constant-position-mobility-model.h" |
40 #include "ns3/names.h" | 41 #include "ns3/names.h" |
41 #include <sstream> | 42 #include <sstream> |
42 | 43 |
43 namespace ns3 | 44 namespace ns3 |
44 { | 45 { |
45 namespace aodv | 46 namespace aodv |
46 { | 47 { |
47 | 48 |
48 static uint32_t g_count (0); | 49 static uint32_t g_count (0); |
49 | 50 |
50 static void· | 51 static void· |
51 PingRtt (std::string context, Time rtt) | 52 PingRtt (std::string context, Time rtt) |
52 { | 53 { |
53 g_count++; | 54 g_count++; |
54 } | 55 } |
55 | 56 |
56 void | 57 void |
57 LoopbackTestCase::DoRun () | 58 LoopbackTestCase::DoRun () |
58 { | 59 { |
59 NodeContainer nodes; | 60 NodeContainer nodes; |
60 nodes.Create (1); | 61 nodes.Create (1); |
61 Ptr<MobilityModel> m = CreateObject<ConstantPositionMobilityModel> (); | 62 Ptr<MobilityModel> m = CreateObject<ConstantPositionMobilityModel> (); |
62 m->SetPosition (Vector (0, 0, 0)); | 63 m->SetPosition (Vector (0, 0, 0)); |
63 nodes.Get (0)->AggregateObject (m); | 64 nodes.Get (0)->AggregateObject (m); |
| 65 Config::SetDefault ("ns3::TcpSocketBase::Timestamp", BooleanValue (false)); |
64 // Setup WiFi | 66 // Setup WiFi |
65 NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); | 67 NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); |
66 wifiMac.SetType ("ns3::AdhocWifiMac"); | 68 wifiMac.SetType ("ns3::AdhocWifiMac"); |
67 YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); | 69 YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
68 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); | 70 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); |
69 wifiPhy.SetChannel (wifiChannel.Create ()); | 71 wifiPhy.SetChannel (wifiChannel.Create ()); |
70 WifiHelper wifi = WifiHelper::Default (); | 72 WifiHelper wifi = WifiHelper::Default (); |
71 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", Stri
ngValue ("OfdmRate6Mbps"), "RtsCtsThreshold", StringValue ("2200")); | 73 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", Stri
ngValue ("OfdmRate6Mbps"), "RtsCtsThreshold", StringValue ("2200")); |
72 NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, nodes);· | 74 NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, nodes);· |
73 | 75 |
(...skipping 19 matching lines...) Expand all Loading... |
93 Simulator::Stop (Seconds (5)); | 95 Simulator::Stop (Seconds (5)); |
94 Simulator::Run (); | 96 Simulator::Run (); |
95 Simulator::Destroy (); | 97 Simulator::Destroy (); |
96 | 98 |
97 // Check that 4 packets delivered | 99 // Check that 4 packets delivered |
98 NS_TEST_ASSERT_MSG_EQ (g_count, 4, "Exactly 4 ping replies must be delivered."
); | 100 NS_TEST_ASSERT_MSG_EQ (g_count, 4, "Exactly 4 ping replies must be delivered."
); |
99 } | 101 } |
100 | 102 |
101 } | 103 } |
102 } | 104 } |
LEFT | RIGHT |