blob: 626a2f51c728182fc8b10f4768676b2afc4f4db3 [file] [log] [blame]
Alexander Afanasyev45b92d42011-08-14 23:11:38 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2
3#include "ns3/core-module.h"
4#include "ns3/network-module.h"
5#include "ns3/internet-module.h"
6#include "ns3/point-to-point-module.h"
7#include "ns3/applications-module.h"
8#include "ns3/NDNabstraction-module.h"
9
10using namespace ns3;
11
12NS_LOG_COMPONENT_DEFINE ("CcnxTest");
13
14int
15main (int argc, char *argv[])
16{
Alexander Afanasyev7112f482011-08-17 14:05:57 -070017 LogComponentEnable ("CcnxTest", LOG_ALL);
18
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070019 Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
20 Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
21
22 CommandLine cmd;
23 cmd.Parse (argc, argv);
24
25 // Here, we will explicitly create seven nodes.
26 NodeContainer c;
27 c.Create (2);
28
29 NodeContainer n = NodeContainer (c.Get (0), c.Get (2));
30
31 // Ipv4StaticRoutingHelper staticRouting;
32
33 // Ipv4ListRoutingHelper list;
34 // list.Add (staticRouting, 1);
35
Alexander Afanasyev7112f482011-08-17 14:05:57 -070036 NS_LOG_INFO ("Create channels.");
37 PointToPointHelper p2p;
38 p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
39 p2p.SetChannelAttribute ("Delay", StringValue ("1ms"));
40 NetDeviceContainer nd = p2p.Install (n);
41
42 NS_LOG_INFO ("Installing NDN stack");
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070043 CcnxStackHelper ccnx;
Alexander Afanasyev7112f482011-08-17 14:05:57 -070044
45 // ? set up forwarding
46
47 // ccnx.Install (c);
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070048
49 //Add static routing
50 // InternetStackHelper internet;
51 // internet.SetRoutingHelper (list); // has effect on the next Install ()
52 // internet.Install (c);
53
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070054 // Create the OnOff application to send UDP datagrams of size
55 // 210 bytes at a rate of 448 Kb/s from n0 to n4
Alexander Afanasyev7112f482011-08-17 14:05:57 -070056 // NS_LOG_INFO ("Create Applications.");
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070057
58 // std::string sendsizeattr = "SendSize";
59 // //flow2 7-->2
60 // BulkSendHelper bulksend0 ("ns3::CcnxLocalFaceFactory", InetSocketAddress (i23.GetAddress (0), port));
61 // //bulksend0.SetAttribute(sendsizeattr, AttributeValue(ConstantVariable(2560)));
62 // bulksend0.SetAttribute("MaxBytes", UintegerValue(2560));
63 // ApplicationContainer apps = bulksend0.Install(c.Get(6));
64 // apps.Start(Seconds (1.0));
65 // apps.Stop(Seconds (10.0));
66
67 // AsciiTraceHelper ascii;
68 // p2p.EnableAsciiAll (ascii.CreateFileStream ("ccnx-test.tr"));
69 // p2p.EnablePcapAll ("ccnx-test");
70
71 Simulator::Stop (Seconds (20));
72
73 NS_LOG_INFO ("Run Simulation.");
74 Simulator::Run ();
75 Simulator::Destroy ();
76 NS_LOG_INFO ("Done.");
77
Alexander Afanasyev7112f482011-08-17 14:05:57 -070078 return 0;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070079}