// Enable OLSR
OlsrHelper olsr;
Ipv4StaticRoutingHelper staticRouting;
Ipv4ListRoutingHelper list;
list.Add (staticRouting, 0);
list.Add (olsr, 10);
InternetStackHelper internet;
internet.SetRoutingHelper (list); // has effect on the next Install ()
internet.Install (c);
Ipv4AddressHelper ipv4;
NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (devices);
uint16_t port = 9; // well-known echo port number
// Configuring Bulk Send Application and installing in the Source Node
BulkSendHelper source ("ns3::TcpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), port));
// Set the amount of data to send in bytes. Zero is unlimited.
source.SetAttribute ("SendSize", UintegerValue (1024));
source.SetAttribute ("MaxBytes", UintegerValue (5120000)); // 5 MB
ApplicationContainer sourceApps = source.Install (c.Get (sourceNode));
sourceApps.Start (Seconds (30.0)); // to give time to OLSR to converge
sourceApps.Stop (Seconds (4000.0));
// Create a packet sink Application and install it on the Sink node
PacketSinkHelper sink ("ns3::TcpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), port));
ApplicationContainer sinkApps = sink.Install (c.Get (sinkNode));
sinkApps.Start (Seconds (0.0));
sinkApps.Stop (Seconds (4000.0));
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1460));