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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 app.Stop (Seconds (10.0)); | 100 app.Stop (Seconds (10.0)); |
101 ·· | 101 ·· |
102 // Create an optional packet sink to receive these packets | 102 // Create an optional packet sink to receive these packets |
103 PacketSinkHelper sink ("ns3::UdpSocketFactory", | 103 PacketSinkHelper sink ("ns3::UdpSocketFactory", |
104 Address (InetSocketAddress (Ipv4Address::GetAny (), port))); | 104 Address (InetSocketAddress (Ipv4Address::GetAny (), port))); |
105 app = sink.Install (c0.Get (1)); | 105 app = sink.Install (c0.Get (1)); |
106 app.Add (sink.Install (c1.Get (1))); | 106 app.Add (sink.Install (c1.Get (1))); |
107 app.Start (Seconds (1.0)); | 107 app.Start (Seconds (1.0)); |
108 app.Stop (Seconds (10.0)); | 108 app.Stop (Seconds (10.0)); |
109 | 109 |
| 110 // Configure ascii tracing of all enqueue, dequeue, and NetDevice receive· |
| 111 // events on all devices. Trace output will be sent to the file· |
| 112 // "csma-one-subnet.tr" |
| 113 AsciiTraceHelper ascii; |
| 114 csma.EnableAsciiAll (ascii.CreateFileStream ("csma-broadcast.tr")); |
| 115 |
110 // Also configure some tcpdump traces; each interface will be traced | 116 // Also configure some tcpdump traces; each interface will be traced |
111 // The output files will be named· | 117 // The output files will be named· |
112 // csma-broadcast-<nodeId>-<interfaceId>.pcap | 118 // csma-broadcast-<nodeId>-<interfaceId>.pcap |
113 // and can be read by the "tcpdump -tt -r" command· | 119 // and can be read by the "tcpdump -tt -r" command· |
114 CsmaHelper::EnablePcapAll ("csma-broadcast", false); | 120 csma.EnablePcapAll ("csma-broadcast", false); |
115 std::ofstream ascii; | |
116 ascii.open ("csma-broadcast.tr", std::ios_base::binary | std::ios_base::out); | |
117 CsmaHelper::EnableAsciiAll (ascii); | |
118 | 121 |
119 NS_LOG_INFO ("Run Simulation."); | 122 NS_LOG_INFO ("Run Simulation."); |
120 Simulator::Run ();···· | 123 Simulator::Run ();···· |
121 Simulator::Destroy (); | 124 Simulator::Destroy (); |
122 NS_LOG_INFO ("Done."); | 125 NS_LOG_INFO ("Done."); |
123 } | 126 } |
OLD | NEW |