author | Tom Henderson <tomh@tomh.org> |
Sat, 16 Jan 2016 08:14:40 -0800 | |
changeset 11683 | 9142266fbb25 |
parent 10968 | 2d29fee2b7b8 |
permissions | -rw-r--r-- |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
2 |
/* |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 University of Washington |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
4 |
* |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
8 |
* |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
13 |
* |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
17 |
* |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
18 |
*/ |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
19 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
20 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
21 |
// This program configures a grid (default 5x5) of nodes on an |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
22 |
// 802.11b physical layer, with |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
23 |
// 802.11b NICs in adhoc mode, and by default, sends one packet of 1000 |
7196
0f12b1572bca
general examples coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
24 |
// (application) bytes to node 1. |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
25 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
26 |
// The default layout is like this, on a 2-D grid. |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
27 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
28 |
// n20 n21 n22 n23 n24 |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
29 |
// n15 n16 n17 n18 n19 |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
30 |
// n10 n11 n12 n13 n14 |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
31 |
// n5 n6 n7 n8 n9 |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
32 |
// n0 n1 n2 n3 n4 |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
33 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
34 |
// the layout is affected by the parameters given to GridPositionAllocator; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
35 |
// by default, GridWidth is 5 and numNodes is 25.. |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
36 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
37 |
// There are a number of command-line options available to control |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
38 |
// the default behavior. The list of available command-line options |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
39 |
// can be listed with the following command: |
5884
46614fa27eae
remove reference to scratch/ directory in wireless examples
Tom Henderson <tomh@tomh.org>
parents:
5853
diff
changeset
|
40 |
// ./waf --run "wifi-simple-adhoc-grid --help" |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
41 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
42 |
// Note that all ns-3 attributes (not just the ones exposed in the below |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
43 |
// script) can be changed at command line; see the ns-3 documentation. |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
44 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
45 |
// For instance, for this configuration, the physical layer will |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
46 |
// stop successfully receiving packets when distance increases beyond |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
47 |
// the default of 500m. |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
48 |
// To see this effect, try running: |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
49 |
// |
5884
46614fa27eae
remove reference to scratch/ directory in wireless examples
Tom Henderson <tomh@tomh.org>
parents:
5853
diff
changeset
|
50 |
// ./waf --run "wifi-simple-adhoc --distance=500" |
46614fa27eae
remove reference to scratch/ directory in wireless examples
Tom Henderson <tomh@tomh.org>
parents:
5853
diff
changeset
|
51 |
// ./waf --run "wifi-simple-adhoc --distance=1000" |
46614fa27eae
remove reference to scratch/ directory in wireless examples
Tom Henderson <tomh@tomh.org>
parents:
5853
diff
changeset
|
52 |
// ./waf --run "wifi-simple-adhoc --distance=1500" |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
53 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
54 |
// The source node and sink node can be changed like this: |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
55 |
// |
5884
46614fa27eae
remove reference to scratch/ directory in wireless examples
Tom Henderson <tomh@tomh.org>
parents:
5853
diff
changeset
|
56 |
// ./waf --run "wifi-simple-adhoc --sourceNode=20 --sinkNode=10" |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
57 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
58 |
// This script can also be helpful to put the Wifi layer into verbose |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
59 |
// logging mode; this command will turn on all wifi logging: |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
60 |
// |
5884
46614fa27eae
remove reference to scratch/ directory in wireless examples
Tom Henderson <tomh@tomh.org>
parents:
5853
diff
changeset
|
61 |
// ./waf --run "wifi-simple-adhoc-grid --verbose=1" |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
62 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
63 |
// By default, trace file writing is off-- to enable it, try: |
5884
46614fa27eae
remove reference to scratch/ directory in wireless examples
Tom Henderson <tomh@tomh.org>
parents:
5853
diff
changeset
|
64 |
// ./waf --run "wifi-simple-adhoc-grid --tracing=1" |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
65 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
66 |
// When you are done tracing, you will notice many pcap trace files |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
67 |
// in your directory. If you have tcpdump installed, you can try this: |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
68 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
69 |
// tcpdump -r wifi-simple-adhoc-grid-0-0.pcap -nn -tt |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
70 |
// |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
71 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
72 |
#include "ns3/core-module.h" |
6823
a27f86fb4e55
Merge node and common modules into new network module
Tom Henderson <tomh@tomh.org>
parents:
6759
diff
changeset
|
73 |
#include "ns3/network-module.h" |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
74 |
#include "ns3/mobility-module.h" |
6941
9d2c79c992d7
Split contrib module into config-store and tools
Mitch Watrous <watrous@u.washington.edu>
parents:
6865
diff
changeset
|
75 |
#include "ns3/config-store-module.h" |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
76 |
#include "ns3/wifi-module.h" |
6848
1f453ad50ef3
Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6823
diff
changeset
|
77 |
#include "ns3/internet-module.h" |
6640
8285fbb8b04d
Fix some examples, broken after bridge/olsr reorganization
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6373
diff
changeset
|
78 |
#include "ns3/olsr-helper.h" |
6648
d1785ce489c5
Module layout rework for static-routing, list-routing, global-routing
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6640
diff
changeset
|
79 |
#include "ns3/ipv4-static-routing-helper.h" |
d1785ce489c5
Module layout rework for static-routing, list-routing, global-routing
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6640
diff
changeset
|
80 |
#include "ns3/ipv4-list-routing-helper.h" |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
81 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
82 |
#include <iostream> |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
83 |
#include <fstream> |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
84 |
#include <vector> |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
85 |
#include <string> |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
86 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10965
diff
changeset
|
87 |
using namespace ns3; |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
88 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10965
diff
changeset
|
89 |
NS_LOG_COMPONENT_DEFINE ("WifiSimpleAdhocGrid"); |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
90 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
91 |
void ReceivePacket (Ptr<Socket> socket) |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
92 |
{ |
10906
29ef028eae7b
Bug 1858 - wireless examples not correctly recording packet reception - reported by Scott Carpenter <scarpen_at_ncsu.edu>
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7256
diff
changeset
|
93 |
while (socket->Recv ()) |
29ef028eae7b
Bug 1858 - wireless examples not correctly recording packet reception - reported by Scott Carpenter <scarpen_at_ncsu.edu>
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7256
diff
changeset
|
94 |
{ |
29ef028eae7b
Bug 1858 - wireless examples not correctly recording packet reception - reported by Scott Carpenter <scarpen_at_ncsu.edu>
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7256
diff
changeset
|
95 |
NS_LOG_UNCOND ("Received one packet!"); |
29ef028eae7b
Bug 1858 - wireless examples not correctly recording packet reception - reported by Scott Carpenter <scarpen_at_ncsu.edu>
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
7256
diff
changeset
|
96 |
} |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
97 |
} |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
98 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
99 |
static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
100 |
uint32_t pktCount, Time pktInterval ) |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
101 |
{ |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
102 |
if (pktCount > 0) |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
103 |
{ |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
104 |
socket->Send (Create<Packet> (pktSize)); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
105 |
Simulator::Schedule (pktInterval, &GenerateTraffic, |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
106 |
socket, pktSize,pktCount-1, pktInterval); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
107 |
} |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
108 |
else |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
109 |
{ |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
110 |
socket->Close (); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
111 |
} |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
112 |
} |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
113 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
114 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
115 |
int main (int argc, char *argv[]) |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
116 |
{ |
6360
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6041
diff
changeset
|
117 |
std::string phyMode ("DsssRate1Mbps"); |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
118 |
double distance = 500; // m |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
119 |
uint32_t packetSize = 1000; // bytes |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
120 |
uint32_t numPackets = 1; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
121 |
uint32_t numNodes = 25; // by default, 5x5 |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
122 |
uint32_t sinkNode = 0; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
123 |
uint32_t sourceNode = 24; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
124 |
double interval = 1.0; // seconds |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
125 |
bool verbose = false; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
126 |
bool tracing = false; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
127 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
128 |
CommandLine cmd; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
129 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
130 |
cmd.AddValue ("phyMode", "Wifi Phy mode", phyMode); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
131 |
cmd.AddValue ("distance", "distance (m)", distance); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
132 |
cmd.AddValue ("packetSize", "size of application packet sent", packetSize); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
133 |
cmd.AddValue ("numPackets", "number of packets generated", numPackets); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
134 |
cmd.AddValue ("interval", "interval (seconds) between packets", interval); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
135 |
cmd.AddValue ("verbose", "turn on all WifiNetDevice log components", verbose); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
136 |
cmd.AddValue ("tracing", "turn on ascii and pcap tracing", tracing); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
137 |
cmd.AddValue ("numNodes", "number of nodes", numNodes); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
138 |
cmd.AddValue ("sinkNode", "Receiver node number", sinkNode); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
139 |
cmd.AddValue ("sourceNode", "Sender node number", sourceNode); |
7196
0f12b1572bca
general examples coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
140 |
|
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
141 |
cmd.Parse (argc, argv); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
142 |
// Convert to time object |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
143 |
Time interPacketInterval = Seconds (interval); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
144 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
145 |
// disable fragmentation for frames below 2200 bytes |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
146 |
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200")); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
147 |
// turn off RTS/CTS for frames below 2200 bytes |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
148 |
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200")); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
149 |
// Fix non-unicast data rate to be the same as that of unicast |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
150 |
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
151 |
StringValue (phyMode)); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
152 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
153 |
NodeContainer c; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
154 |
c.Create (numNodes); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
155 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
156 |
// The below set of helpers will help us to put together the wifi NICs we want |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
157 |
WifiHelper wifi; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
158 |
if (verbose) |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
159 |
{ |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
160 |
wifi.EnableLogComponents (); // Turn on all Wifi logging |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
161 |
} |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
162 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
163 |
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
164 |
// set it to zero; otherwise, gain will be added |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
165 |
wifiPhy.Set ("RxGain", DoubleValue (-10) ); |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
5884
diff
changeset
|
166 |
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b |
6041 | 167 |
wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO); |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
168 |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7196
diff
changeset
|
169 |
YansWifiChannelHelper wifiChannel; |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
170 |
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
171 |
wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel"); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
172 |
wifiPhy.SetChannel (wifiChannel.Create ()); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
173 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
174 |
// Add a non-QoS upper mac, and disable rate control |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
175 |
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); |
6373
5467d6ae6ebe
Bug 853: Use consistent standards/rates for examples and tests that use Wi-Fi
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
176 |
wifi.SetStandard (WIFI_PHY_STANDARD_80211b); |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
177 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7252
diff
changeset
|
178 |
"DataMode",StringValue (phyMode), |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7252
diff
changeset
|
179 |
"ControlMode",StringValue (phyMode)); |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
180 |
// Set it to adhoc mode |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
181 |
wifiMac.SetType ("ns3::AdhocWifiMac"); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
182 |
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
183 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
184 |
MobilityHelper mobility; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
185 |
mobility.SetPositionAllocator ("ns3::GridPositionAllocator", |
7196
0f12b1572bca
general examples coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
186 |
"MinX", DoubleValue (0.0), |
0f12b1572bca
general examples coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
187 |
"MinY", DoubleValue (0.0), |
0f12b1572bca
general examples coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
188 |
"DeltaX", DoubleValue (distance), |
0f12b1572bca
general examples coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
189 |
"DeltaY", DoubleValue (distance), |
0f12b1572bca
general examples coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
190 |
"GridWidth", UintegerValue (5), |
0f12b1572bca
general examples coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
191 |
"LayoutType", StringValue ("RowFirst")); |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
192 |
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
193 |
mobility.Install (c); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
194 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
195 |
// Enable OLSR |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
196 |
OlsrHelper olsr; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
197 |
Ipv4StaticRoutingHelper staticRouting; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
198 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
199 |
Ipv4ListRoutingHelper list; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
200 |
list.Add (staticRouting, 0); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
201 |
list.Add (olsr, 10); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
202 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
203 |
InternetStackHelper internet; |
7157
43d2fb5bfb12
bug 1058: InternetStackHelper pitfall: calling Install before adding routing protocols
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6941
diff
changeset
|
204 |
internet.SetRoutingHelper (list); // has effect on the next Install () |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
205 |
internet.Install (c); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
206 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
207 |
Ipv4AddressHelper ipv4; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
208 |
NS_LOG_INFO ("Assign IP Addresses."); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
209 |
ipv4.SetBase ("10.1.1.0", "255.255.255.0"); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
210 |
Ipv4InterfaceContainer i = ipv4.Assign (devices); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
211 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
212 |
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); |
5853
4ad1072a8791
bug 776: sinkNode hardcoded in example program
Tom Henderson <tomh@tomh.org>
parents:
5369
diff
changeset
|
213 |
Ptr<Socket> recvSink = Socket::CreateSocket (c.Get (sinkNode), tid); |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
214 |
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
215 |
recvSink->Bind (local); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
216 |
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket)); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
217 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
218 |
Ptr<Socket> source = Socket::CreateSocket (c.Get (sourceNode), tid); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
219 |
InetSocketAddress remote = InetSocketAddress (i.GetAddress (sinkNode, 0), 80); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
220 |
source->Connect (remote); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
221 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
222 |
if (tracing == true) |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
223 |
{ |
6014 | 224 |
AsciiTraceHelper ascii; |
225 |
wifiPhy.EnableAsciiAll (ascii.CreateFileStream ("wifi-simple-adhoc-grid.tr")); |
|
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
226 |
wifiPhy.EnablePcap ("wifi-simple-adhoc-grid", devices); |
6701
a590022a1536
[bug 947] Pretty-print IPv4 routing tables (patch originated by Hemanth Narra)
Tom Henderson <tomh@tomh.org>
parents:
6648
diff
changeset
|
227 |
// Trace routing tables |
a590022a1536
[bug 947] Pretty-print IPv4 routing tables (patch originated by Hemanth Narra)
Tom Henderson <tomh@tomh.org>
parents:
6648
diff
changeset
|
228 |
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("wifi-simple-adhoc-grid.routes", std::ios::out); |
a590022a1536
[bug 947] Pretty-print IPv4 routing tables (patch originated by Hemanth Narra)
Tom Henderson <tomh@tomh.org>
parents:
6648
diff
changeset
|
229 |
olsr.PrintRoutingTableAllEvery (Seconds (2), routingStream); |
10965
14cde591d8e4
Bug 652 - no public API for IPv4 neighbor table - Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10906
diff
changeset
|
230 |
Ptr<OutputStreamWrapper> neighborStream = Create<OutputStreamWrapper> ("wifi-simple-adhoc-grid.neighbors", std::ios::out); |
14cde591d8e4
Bug 652 - no public API for IPv4 neighbor table - Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10906
diff
changeset
|
231 |
olsr.PrintNeighborCacheAllEvery (Seconds (2), neighborStream); |
6014 | 232 |
|
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
233 |
// To do-- enable an IP-level trace that shows forwarding events only |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
234 |
} |
7196
0f12b1572bca
general examples coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
235 |
|
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
236 |
// Give OLSR time to converge-- 30 seconds perhaps |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
237 |
Simulator::Schedule (Seconds (30.0), &GenerateTraffic, |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
238 |
source, packetSize, numPackets, interPacketInterval); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
239 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
240 |
// Output what we are doing |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
241 |
NS_LOG_UNCOND ("Testing from node " << sourceNode << " to " << sinkNode << " with grid distance " << distance); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
242 |
|
10965
14cde591d8e4
Bug 652 - no public API for IPv4 neighbor table - Print functions
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10906
diff
changeset
|
243 |
Simulator::Stop (Seconds (33.0)); |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
244 |
Simulator::Run (); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
245 |
Simulator::Destroy (); |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
246 |
|
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
247 |
return 0; |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
248 |
} |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
249 |