LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 PointToPointHelper p2p; | 62 PointToPointHelper p2p; |
63 p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); | 63 p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); |
64 p2p.SetChannelAttribute ("Delay", StringValue ("2ms")); | 64 p2p.SetChannelAttribute ("Delay", StringValue ("2ms")); |
65 NetDeviceContainer dAdB = p2p.Install (nAnB); | 65 NetDeviceContainer dAdB = p2p.Install (nAnB); |
66 | 66 |
67 NetDeviceContainer dBdC = p2p.Install (nBnC);; | 67 NetDeviceContainer dBdC = p2p.Install (nBnC);; |
68 | 68 |
69 Ptr<CsmaNetDevice> deviceA = CreateObject<CsmaNetDevice> (); | 69 Ptr<CsmaNetDevice> deviceA = CreateObject<CsmaNetDevice> (); |
70 deviceA->SetAddress (Mac48Address::Allocate ()); | 70 deviceA->SetAddress (Mac48Address::Allocate ()); |
71 nA->AddDevice (deviceA); | 71 nA->AddDevice (deviceA); |
72 deviceA->SetQueue (CreateObject<PacketDropTailQueue> ()); | 72 deviceA->SetQueue (CreateObject<DropTailQueue<Packet> > ()); |
73 | 73 |
74 Ptr<CsmaNetDevice> deviceC = CreateObject<CsmaNetDevice> (); | 74 Ptr<CsmaNetDevice> deviceC = CreateObject<CsmaNetDevice> (); |
75 deviceC->SetAddress (Mac48Address::Allocate ()); | 75 deviceC->SetAddress (Mac48Address::Allocate ()); |
76 nC->AddDevice (deviceC); | 76 nC->AddDevice (deviceC); |
77 deviceC->SetQueue (CreateObject<PacketDropTailQueue> ()); | 77 deviceC->SetQueue (CreateObject<DropTailQueue<Packet> > ()); |
78 | 78 |
79 // Later, we add IP addresses. | 79 // Later, we add IP addresses. |
80 Ipv4AddressHelper ipv4; | 80 Ipv4AddressHelper ipv4; |
81 ipv4.SetBase ("10.1.1.0", "255.255.255.252"); | 81 ipv4.SetBase ("10.1.1.0", "255.255.255.252"); |
82 Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB); | 82 Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB); |
83 | 83 |
84 ipv4.SetBase ("10.1.1.4", "255.255.255.252"); | 84 ipv4.SetBase ("10.1.1.4", "255.255.255.252"); |
85 Ipv4InterfaceContainer iBiC = ipv4.Assign (dBdC); | 85 Ipv4InterfaceContainer iBiC = ipv4.Assign (dBdC); |
86 | 86 |
87 Ptr<Ipv4> ipv4A = nA->GetObject<Ipv4> (); | 87 Ptr<Ipv4> ipv4A = nA->GetObject<Ipv4> (); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 AsciiTraceHelper ascii; | 129 AsciiTraceHelper ascii; |
130 p2p.EnableAsciiAll (ascii.CreateFileStream ("static-routing-slash32.tr")); | 130 p2p.EnableAsciiAll (ascii.CreateFileStream ("static-routing-slash32.tr")); |
131 p2p.EnablePcapAll ("static-routing-slash32"); | 131 p2p.EnablePcapAll ("static-routing-slash32"); |
132 | 132 |
133 Simulator::Run (); | 133 Simulator::Run (); |
134 Simulator::Destroy (); | 134 Simulator::Destroy (); |
135 | 135 |
136 return 0; | 136 return 0; |
137 } | 137 } |
LEFT | RIGHT |