blob: 4f4205c328e893f5605f0baadb7a095b7465e80f [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{
17 Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
18 Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
19
20 CommandLine cmd;
21 cmd.Parse (argc, argv);
22
23 // Here, we will explicitly create seven nodes.
24 NodeContainer c;
25 c.Create (2);
26
27 NodeContainer n = NodeContainer (c.Get (0), c.Get (2));
28
29 // Ipv4StaticRoutingHelper staticRouting;
30
31 // Ipv4ListRoutingHelper list;
32 // list.Add (staticRouting, 1);
33
34 CcnxStackHelper ccnx;
35 ccnx.Install (c);
36
37 //Add static routing
38 // InternetStackHelper internet;
39 // internet.SetRoutingHelper (list); // has effect on the next Install ()
40 // internet.Install (c);
41
42 // We create the channels first without any IP addressing information
43 // NS_LOG_INFO ("Create channels.");
44 // PointToPointHelper p2p;
45 // p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
46 // p2p.SetChannelAttribute ("Delay", StringValue ("1ms"));
47 // NetDeviceContainer nd = p2p.Install (n);
48
49 // Create the OnOff application to send UDP datagrams of size
50 // 210 bytes at a rate of 448 Kb/s from n0 to n4
51 NS_LOG_INFO ("Create Applications.");
52
53 // std::string sendsizeattr = "SendSize";
54 // //flow2 7-->2
55 // BulkSendHelper bulksend0 ("ns3::CcnxLocalFaceFactory", InetSocketAddress (i23.GetAddress (0), port));
56 // //bulksend0.SetAttribute(sendsizeattr, AttributeValue(ConstantVariable(2560)));
57 // bulksend0.SetAttribute("MaxBytes", UintegerValue(2560));
58 // ApplicationContainer apps = bulksend0.Install(c.Get(6));
59 // apps.Start(Seconds (1.0));
60 // apps.Stop(Seconds (10.0));
61
62 // AsciiTraceHelper ascii;
63 // p2p.EnableAsciiAll (ascii.CreateFileStream ("ccnx-test.tr"));
64 // p2p.EnablePcapAll ("ccnx-test");
65
66 Simulator::Stop (Seconds (20));
67
68 NS_LOG_INFO ("Run Simulation.");
69 Simulator::Run ();
70 Simulator::Destroy ();
71 NS_LOG_INFO ("Done.");
72
73 return 0;
74}