equal
deleted
inserted
replaced
43 |
43 |
44 static Ptr<Node> |
44 static Ptr<Node> |
45 CreateAdhocNode (Ptr<WifiChannel> channel, |
45 CreateAdhocNode (Ptr<WifiChannel> channel, |
46 Vector position, const char *address) |
46 Vector position, const char *address) |
47 { |
47 { |
48 Ptr<Node> node = Create<Node> (); |
48 Ptr<Node> node = CreateObject<Node> (); |
49 Ptr<AdhocWifiNetDevice> device = Create<AdhocWifiNetDevice> (node, Mac48Address (address)); |
49 Ptr<AdhocWifiNetDevice> device = CreateObject<AdhocWifiNetDevice> (node, Mac48Address (address)); |
50 device->Attach (channel); |
50 device->Attach (channel); |
51 Ptr<MobilityModel> mobility = Create<StaticMobilityModel> (); |
51 Ptr<MobilityModel> mobility = CreateObject<StaticMobilityModel> (); |
52 mobility->SetPosition (position); |
52 mobility->SetPosition (position); |
53 node->AddInterface (mobility); |
53 node->AddInterface (mobility); |
54 |
54 |
55 return node; |
55 return node; |
56 } |
56 } |
106 static void |
106 static void |
107 RunOneExperiment (void) |
107 RunOneExperiment (void) |
108 { |
108 { |
109 g_bytesTotal = 0; |
109 g_bytesTotal = 0; |
110 |
110 |
111 Ptr<WifiChannel> channel = Create<WifiChannel> (); |
111 Ptr<WifiChannel> channel = CreateObject<WifiChannel> (); |
112 |
112 |
113 Ptr<Node> a = CreateAdhocNode (channel, |
113 Ptr<Node> a = CreateAdhocNode (channel, |
114 Vector (5.0,0.0,0.0), |
114 Vector (5.0,0.0,0.0), |
115 "00:00:00:00:00:01"); |
115 "00:00:00:00:00:01"); |
116 Ptr<Node> b = CreateAdhocNode (channel, |
116 Ptr<Node> b = CreateAdhocNode (channel, |
119 |
119 |
120 PacketSocketAddress destination = PacketSocketAddress (); |
120 PacketSocketAddress destination = PacketSocketAddress (); |
121 destination.SetProtocol (1); |
121 destination.SetProtocol (1); |
122 destination.SetSingleDevice (0); |
122 destination.SetSingleDevice (0); |
123 destination.SetPhysicalAddress (Mac48Address ("00:00:00:00:00:02")); |
123 destination.SetPhysicalAddress (Mac48Address ("00:00:00:00:00:02")); |
124 Ptr<Application> app = Create<OnOffApplication> (a, destination, |
124 Ptr<Application> app = CreateObject<OnOffApplication> (a, destination, |
125 "Packet", |
125 "Packet", |
126 ConstantVariable (250), |
126 ConstantVariable (250), |
127 ConstantVariable (0), |
127 ConstantVariable (0), |
128 DataRate (60000000), |
128 DataRate (60000000), |
129 2000); |
129 2000); |