author | Josh Pelkey <jpelkey@gatech.edu> |
Fri, 13 May 2011 14:58:13 -0400 | |
changeset 7184 | a15feb312428 |
parent 7157 | 43d2fb5bfb12 |
child 7252 | c8200621e252 |
permissions | -rw-r--r-- |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
2 |
/* |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
3 |
* |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
4 |
* This program is free software; you can redistribute it and/or modify |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
5 |
* it under the terms of the GNU General Public License version 2 as |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
6 |
* published by the Free Software Foundation; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
7 |
* |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
8 |
* This program is distributed in the hope that it will be useful, |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
11 |
* GNU General Public License for more details. |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
12 |
* |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
13 |
* You should have received a copy of the GNU General Public License |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
14 |
* along with this program; if not, write to the Free Software |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
15 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
16 |
* |
6351
c3b1af142f96
hnaEntries Create() moved into if block for clarity
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6140
diff
changeset
|
17 |
* Authors: Lalith Suresh <suresh.lalith@gmail.com> |
c3b1af142f96
hnaEntries Create() moved into if block for clarity
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6140
diff
changeset
|
18 |
* |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
19 |
*/ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
20 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
21 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
22 |
// This script, adapted from examples/wireless/wifi-simple-adhoc illustrates |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
23 |
// the use of OLSR HNA. |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
24 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
25 |
// Network Topology: |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
26 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
27 |
// |------ OLSR ------| |---- non-OLSR ----| |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
28 |
// A )))) (((( B ------------------- C |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
29 |
// 10.1.1.1 10.1.1.2 172.16.1.2 172.16.1.1 |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
30 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
31 |
// Node A needs to send a UDP packet to node C. This can be done only after |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
32 |
// A receives an HNA message from B, in which B announces 172.16.1.0/24 |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
33 |
// as an associated network. |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
34 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
35 |
// If no HNA message is generated by B, a will not be able to form a route to C. |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
36 |
// This can be verified as follows: |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
37 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
38 |
// ./waf --run olsr-hna |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
39 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
40 |
// There are two ways to make a node to generate HNA messages. |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
41 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
42 |
// One way is to use olsr::RoutingProtocol::SetRoutingTableAssociation () |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
43 |
// to use which you may run: |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
44 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
45 |
// ./waf --run "olsr-hna --assocMethod1=1" |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
46 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
47 |
// The other way is to use olsr::RoutingProtocol::AddHostNetworkAssociation () |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
48 |
// to use which you may run: |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
49 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
50 |
// ./waf --run "olsr-hna --assocMethod2=1" |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
51 |
// |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
52 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
53 |
#include "ns3/core-module.h" |
6823
a27f86fb4e55
Merge node and common modules into new network module
Tom Henderson <tomh@tomh.org>
parents:
6648
diff
changeset
|
54 |
#include "ns3/network-module.h" |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
55 |
#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
|
56 |
#include "ns3/config-store-module.h" |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
57 |
#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
|
58 |
#include "ns3/csma-module.h" |
7089
ebe626d82692
Bug 1105 Move topology helpers into separate per-device modules
John Abraham<john.abraham@gatech.edu>
parents:
6941
diff
changeset
|
59 |
#include "ns3/internet-module.h" |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
60 |
#include "ns3/olsr-routing-protocol.h" |
6640
8285fbb8b04d
Fix some examples, broken after bridge/olsr reorganization
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6634
diff
changeset
|
61 |
#include "ns3/olsr-helper.h" |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
62 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
63 |
#include <iostream> |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
64 |
#include <fstream> |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
65 |
#include <vector> |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
66 |
#include <string> |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
67 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
68 |
NS_LOG_COMPONENT_DEFINE ("OlsrHna"); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
69 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
70 |
using namespace ns3; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
71 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
72 |
void ReceivePacket (Ptr<Socket> socket) |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
73 |
{ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
74 |
NS_LOG_UNCOND ("Received one packet!"); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
75 |
} |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
76 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
77 |
static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
78 |
uint32_t pktCount, Time pktInterval ) |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
79 |
{ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
80 |
if (pktCount > 0) |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
81 |
{ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
82 |
socket->Send (Create<Packet> (pktSize)); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
83 |
Simulator::Schedule (pktInterval, &GenerateTraffic, |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
84 |
socket, pktSize,pktCount-1, pktInterval); |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
85 |
} |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
86 |
else |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
87 |
{ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
88 |
socket->Close (); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
89 |
} |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
90 |
} |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
91 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
92 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
93 |
int main (int argc, char *argv[]) |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
94 |
{ |
6360
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6351
diff
changeset
|
95 |
std::string phyMode ("DsssRate1Mbps"); |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
96 |
double rss = -80; // -dBm |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
97 |
uint32_t packetSize = 1000; // bytes |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
98 |
uint32_t numPackets = 1; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
99 |
double interval = 1.0; // seconds |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
100 |
bool verbose = false; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
101 |
bool assocMethod1 = false; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
102 |
bool assocMethod2 = false; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
103 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
104 |
CommandLine cmd; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
105 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
106 |
cmd.AddValue ("phyMode", "Wifi Phy mode", phyMode); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
107 |
cmd.AddValue ("rss", "received signal strength", rss); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
108 |
cmd.AddValue ("packetSize", "size of application packet sent", packetSize); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
109 |
cmd.AddValue ("numPackets", "number of packets generated", numPackets); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
110 |
cmd.AddValue ("interval", "interval (seconds) between packets", interval); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
111 |
cmd.AddValue ("verbose", "turn on all WifiNetDevice log components", verbose); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
112 |
cmd.AddValue ("assocMethod1", "Use SetRoutingTableAssociation () method", assocMethod1); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
113 |
cmd.AddValue ("assocMethod2", "Use AddHostNetworkAssociation () method", assocMethod2); |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
114 |
|
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
115 |
cmd.Parse (argc, argv); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
116 |
// Convert to time object |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
117 |
Time interPacketInterval = Seconds (interval); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
118 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
119 |
// disable fragmentation for frames below 2200 bytes |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
120 |
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200")); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
121 |
// turn off RTS/CTS for frames below 2200 bytes |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
122 |
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200")); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
123 |
// Fix non-unicast data rate to be the same as that of unicast |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
124 |
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
125 |
StringValue (phyMode)); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
126 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
127 |
NodeContainer olsrNodes; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
128 |
olsrNodes.Create (2); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
129 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
130 |
NodeContainer csmaNodes; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
131 |
csmaNodes.Create (1); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
132 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
133 |
// The below set of helpers will help us to put together the wifi NICs we want |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
134 |
WifiHelper wifi; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
135 |
if (verbose) |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
136 |
{ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
137 |
wifi.EnableLogComponents (); // Turn on all Wifi logging |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
138 |
} |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
139 |
wifi.SetStandard (WIFI_PHY_STANDARD_80211b); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
140 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
141 |
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
142 |
// This is one parameter that matters when using FixedRssLossModel |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
143 |
// set it to zero; otherwise, gain will be added |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
144 |
wifiPhy.Set ("RxGain", DoubleValue (0) ); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
145 |
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
146 |
wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
147 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
148 |
YansWifiChannelHelper wifiChannel ; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
149 |
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
150 |
// The below FixedRssLossModel will cause the rss to be fixed regardless |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
151 |
// of the distance between the two stations, and the transmit power |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
152 |
wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss)); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
153 |
wifiPhy.SetChannel (wifiChannel.Create ()); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
154 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
155 |
// Add a non-QoS upper mac, and disable rate control |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
156 |
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
157 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
158 |
"DataMode",StringValue(phyMode), |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
159 |
"ControlMode",StringValue(phyMode)); |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
160 |
// Set it to adhoc mode |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
161 |
wifiMac.SetType ("ns3::AdhocWifiMac"); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
162 |
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, olsrNodes); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
163 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
164 |
CsmaHelper csma; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
165 |
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
166 |
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
167 |
NetDeviceContainer csmaDevices = csma.Install (NodeContainer (csmaNodes.Get(0), olsrNodes.Get(1))); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
168 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
169 |
// Note that with FixedRssLossModel, the positions below are not |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
170 |
// used for received signal strength. |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
171 |
MobilityHelper mobility; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
172 |
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> (); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
173 |
positionAlloc->Add (Vector (0.0, 0.0, 0.0)); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
174 |
positionAlloc->Add (Vector (5.0, 0.0, 0.0)); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
175 |
mobility.SetPositionAllocator (positionAlloc); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
176 |
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
177 |
mobility.Install (olsrNodes); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
178 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
179 |
OlsrHelper olsr; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
180 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
181 |
// Specify Node B's csma device as a non-OLSR device. |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
182 |
olsr.ExcludeInterface (olsrNodes.Get (1), 2); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
183 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
184 |
Ipv4StaticRoutingHelper staticRouting; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
185 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
186 |
Ipv4ListRoutingHelper list; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
187 |
list.Add (staticRouting, 0); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
188 |
list.Add (olsr, 10); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
189 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
190 |
InternetStackHelper internet_olsr; |
7157
43d2fb5bfb12
bug 1058: InternetStackHelper pitfall: calling Install before adding routing protocols
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7089
diff
changeset
|
191 |
internet_olsr.SetRoutingHelper (list); // has effect on the next Install () |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
192 |
internet_olsr.Install (olsrNodes); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
193 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
194 |
InternetStackHelper internet_csma; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
195 |
internet_csma.Install (csmaNodes); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
196 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
197 |
Ipv4AddressHelper ipv4; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
198 |
NS_LOG_INFO ("Assign IP Addresses."); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
199 |
ipv4.SetBase ("10.1.1.0", "255.255.255.0"); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
200 |
ipv4.Assign (devices); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
201 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
202 |
ipv4.SetBase ("172.16.1.0", "255.255.255.0"); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
203 |
ipv4.Assign (csmaDevices); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
204 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
205 |
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
206 |
Ptr<Socket> recvSink = Socket::CreateSocket (csmaNodes.Get(0), tid); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
207 |
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
208 |
recvSink->Bind (local); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
209 |
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket)); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
210 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
211 |
Ptr<Socket> source = Socket::CreateSocket (olsrNodes.Get (0), tid); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
212 |
InetSocketAddress remote = InetSocketAddress (Ipv4Address ("172.16.1.1"), 80); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
213 |
source->Connect (remote); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
214 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
215 |
// Obtain olsr::RoutingProtocol instance of gateway node |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
216 |
// (namely, node B) and add the required association |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
7157
diff
changeset
|
217 |
Ptr<Ipv4> stack = olsrNodes.Get (1)->GetObject<Ipv4> (); |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
218 |
Ptr<Ipv4RoutingProtocol> rp_Gw = (stack->GetRoutingProtocol ()); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
219 |
Ptr<Ipv4ListRouting> lrp_Gw = DynamicCast<Ipv4ListRouting> (rp_Gw); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
220 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
221 |
Ptr<olsr::RoutingProtocol> olsrrp_Gw; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
222 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
223 |
for (uint32_t i = 0; i < lrp_Gw->GetNRoutingProtocols (); i++) |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
224 |
{ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
225 |
int16_t priority; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
226 |
Ptr<Ipv4RoutingProtocol> temp = lrp_Gw->GetRoutingProtocol (i, priority); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
227 |
if (DynamicCast<olsr::RoutingProtocol> (temp)) |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
228 |
{ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
229 |
olsrrp_Gw = DynamicCast<olsr::RoutingProtocol> (temp); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
230 |
} |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
231 |
} |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
232 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
233 |
if (assocMethod1) |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
234 |
{ |
6351
c3b1af142f96
hnaEntries Create() moved into if block for clarity
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6140
diff
changeset
|
235 |
// Create a special Ipv4StaticRouting instance for RoutingTableAssociation |
c3b1af142f96
hnaEntries Create() moved into if block for clarity
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6140
diff
changeset
|
236 |
// Even the Ipv4StaticRouting instance added to list may be used |
c3b1af142f96
hnaEntries Create() moved into if block for clarity
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6140
diff
changeset
|
237 |
Ptr<Ipv4StaticRouting> hnaEntries = Create<Ipv4StaticRouting> (); |
c3b1af142f96
hnaEntries Create() moved into if block for clarity
Lalith Suresh <suresh.lalith@gmail.com>
parents:
6140
diff
changeset
|
238 |
|
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
239 |
// Add the required routes into the Ipv4StaticRouting Protocol instance |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
240 |
// and have the node generate HNA messages for all these routes |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
241 |
// which are associated with non-OLSR interfaces specified above. |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
242 |
hnaEntries->AddNetworkRouteTo (Ipv4Address ("172.16.1.0"), Ipv4Mask ("255.255.255.0"), uint32_t(2), uint32_t(1)); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
243 |
olsrrp_Gw->SetRoutingTableAssociation (hnaEntries); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
244 |
} |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
245 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
246 |
if (assocMethod2) |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
247 |
{ |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
248 |
// Specify the required associations directly. |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
249 |
olsrrp_Gw->AddHostNetworkAssociation (Ipv4Address ("172.16.1.0"), Ipv4Mask ("255.255.255.0")); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
250 |
} |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
251 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
252 |
// Tracing |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
253 |
wifiPhy.EnablePcap ("olsr-hna", devices); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
254 |
csma.EnablePcap ("olsr-hna", csmaDevices, false); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
255 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
256 |
Simulator::ScheduleWithContext (source->GetNode ()->GetId (), |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
257 |
Seconds (15.0), &GenerateTraffic, |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
258 |
source, packetSize, numPackets, interPacketInterval); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
259 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
260 |
Simulator::Stop (Seconds (20.0)); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
261 |
Simulator::Run (); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
262 |
Simulator::Destroy (); |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
263 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
264 |
return 0; |
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
diff
changeset
|
265 |
} |