-
Notifications
You must be signed in to change notification settings - Fork 0
/
manet.cc
56 lines (44 loc) · 1.78 KB
/
manet.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "ManetSim.hh"
#include "ns3/core-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE("Manet");
int main(int argc, char *argv[])
{
LogComponentEnable("ManetSim", LOG_LEVEL_INFO);
uint32_t numNodes = 10;
std::string whichMobility = "random2d";
std::string allowCollisions = "yes";
uint32_t numPackets = 1;
uint32_t packetSize = 1;
double sendInterval = 1;
double sendStartTime = 10.0;
std::string routingProtocol = "olsr";
std::string whichApplication = "packet_flooding";
CommandLine cmd;
cmd.AddValue("numNodes", "number of nodes total", numNodes);
cmd.AddValue("mobility", "set mobility model to use [grid|random2d]", whichMobility);
cmd.AddValue("collisions", "allow packet collisions [yes|no]. If no, sends are staggered", allowCollisions);
cmd.AddValue("numPackets", "set number of packets to send [default=1]", numPackets);
cmd.AddValue("packetSize", "set packet size [default=1]", packetSize);
cmd.AddValue("sendInterval", "set send time interval [default=1sec]", sendInterval);
cmd.AddValue("startSend", "set time at which sends begin [default=10sec]", sendStartTime);
cmd.AddValue("routingProtocol", "set MANET routing protocol to use [default=olsr]", routingProtocol);
cmd.AddValue("application",
"select application to use [packet_flooding|gnutella|gnutella_query_caching]", whichApplication);
cmd.Parse(argc, argv);
ManetSim manet(
numNodes,
whichMobility,
allowCollisions == "yes" ? true : false,
numPackets,
packetSize,
sendInterval,
sendStartTime,
routingProtocol,
whichApplication);
Simulator::Stop(Seconds(300.));
Simulator::Run();
manet.logResults();
Simulator::Destroy();
return 0;
}