OLD | NEW |
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 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 //------------------------------------------------------------ | 122 //------------------------------------------------------------ |
123 //-- Create nodes and network stacks | 123 //-- Create nodes and network stacks |
124 //-------------------------------------------- | 124 //-------------------------------------------- |
125 NS_LOG_INFO("Creating nodes."); | 125 NS_LOG_INFO("Creating nodes."); |
126 NodeContainer nodes; | 126 NodeContainer nodes; |
127 nodes.Create(2); | 127 nodes.Create(2); |
128 | 128 |
129 NS_LOG_INFO("Installing WiFi and Internet stack."); | 129 NS_LOG_INFO("Installing WiFi and Internet stack."); |
130 WifiHelper wifi = WifiHelper::Default (); | 130 WifiHelper wifi = WifiHelper::Default (); |
131 wifi.SetMac("ns3::AdhocWifiMac"); | 131 NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); |
| 132 wifiMac.SetType ("ns3::AdhocWifiMac"); |
132 YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); | 133 YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
133 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); | 134 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); |
134 wifiPhy.SetChannel (wifiChannel.Create ()); | 135 wifiPhy.SetChannel (wifiChannel.Create ()); |
135 NetDeviceContainer nodeDevices = wifi.Install(wifiPhy, nodes); | 136 NetDeviceContainer nodeDevices = wifi.Install(wifiPhy, wifiMac, nodes); |
136 | 137 |
137 InternetStackHelper internet; | 138 InternetStackHelper internet; |
138 internet.Install(nodes); | 139 internet.Install(nodes); |
139 Ipv4AddressHelper ipAddrs; | 140 Ipv4AddressHelper ipAddrs; |
140 ipAddrs.SetBase("192.168.0.0", "255.255.255.0"); | 141 ipAddrs.SetBase("192.168.0.0", "255.255.255.0"); |
141 ipAddrs.Assign(nodeDevices); | 142 ipAddrs.Assign(nodeDevices); |
142 | 143 |
143 | 144 |
144 | 145 |
145 | 146 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 NS_LOG_ERROR("Unknown output format " << format); | 312 NS_LOG_ERROR("Unknown output format " << format); |
312 } | 313 } |
313 | 314 |
314 // Finally, have that writer interrogate the DataCollector and save | 315 // Finally, have that writer interrogate the DataCollector and save |
315 // the results. | 316 // the results. |
316 if (output != 0) | 317 if (output != 0) |
317 output->Output(data); | 318 output->Output(data); |
318 | 319 |
319 // end main | 320 // end main |
320 } | 321 } |
OLD | NEW |