47 #include "ns3/internet-node.h" |
47 #include "ns3/internet-node.h" |
48 #include "ns3/csma-channel.h" |
48 #include "ns3/csma-channel.h" |
49 #include "ns3/csma-net-device.h" |
49 #include "ns3/csma-net-device.h" |
50 #include "ns3/csma-topology.h" |
50 #include "ns3/csma-topology.h" |
51 #include "ns3/csma-ipv4-topology.h" |
51 #include "ns3/csma-ipv4-topology.h" |
52 #include "ns3/eui48-address.h" |
52 #include "ns3/mac48-address.h" |
53 #include "ns3/ipv4-address.h" |
53 #include "ns3/ipv4-address.h" |
54 #include "ns3/inet-socket-address.h" |
54 #include "ns3/inet-socket-address.h" |
55 #include "ns3/ipv4.h" |
55 #include "ns3/ipv4.h" |
56 #include "ns3/socket.h" |
56 #include "ns3/socket.h" |
57 #include "ns3/ipv4-route.h" |
57 #include "ns3/ipv4-route.h" |
114 Ptr<CsmaChannel> channel1 = |
114 Ptr<CsmaChannel> channel1 = |
115 CsmaTopology::CreateCsmaChannel( |
115 CsmaTopology::CreateCsmaChannel( |
116 DataRate(5000000), MilliSeconds(2)); |
116 DataRate(5000000), MilliSeconds(2)); |
117 |
117 |
118 uint32_t n0ifIndex0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel0, |
118 uint32_t n0ifIndex0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel0, |
119 Eui48Address("10:54:23:54:0:50")); |
119 Mac48Address("10:54:23:54:0:50")); |
120 uint32_t n0ifIndex1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel1, |
120 uint32_t n0ifIndex1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel1, |
121 Eui48Address("10:54:23:54:0:51")); |
121 Mac48Address("10:54:23:54:0:51")); |
122 uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, channel0, |
122 uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, channel0, |
123 Eui48Address("10:54:23:54:23:51")); |
123 Mac48Address("10:54:23:54:23:51")); |
124 uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channel1, |
124 uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channel1, |
125 Eui48Address("10:54:23:54:23:52")); |
125 Mac48Address("10:54:23:54:23:52")); |
126 |
126 |
127 // Later, we add IP addresses. |
127 // Later, we add IP addresses. |
128 CsmaIpv4Topology::AddIpv4Address ( |
128 CsmaIpv4Topology::AddIpv4Address ( |
129 n0, n0ifIndex0, Ipv4Address("10.1.0.1"), Ipv4Mask("255.255.0.0")); |
129 n0, n0ifIndex0, Ipv4Address("10.1.0.1"), Ipv4Mask("255.255.0.0")); |
130 |
130 |