equal
deleted
inserted
replaced
118 ++m_network; |
118 ++m_network; |
119 m_address = m_base; |
119 m_address = m_base; |
120 return Ipv4Address (m_network << m_shift); |
120 return Ipv4Address (m_network << m_shift); |
121 } |
121 } |
122 |
122 |
123 void |
123 Ipv4InterfaceContainer |
124 Ipv4AddressHelper::Allocate (const NetDeviceContainer &c) |
124 Ipv4AddressHelper::Allocate (const NetDeviceContainer &c) |
125 { |
125 { |
126 NS_LOG_FUNCTION; |
126 NS_LOG_FUNCTION; |
|
127 Ipv4InterfaceContainer retval; |
127 for (uint32_t i = 0; i < c.GetN (); ++i) { |
128 for (uint32_t i = 0; i < c.GetN (); ++i) { |
128 Ptr<NetDevice> device = c.Get (i); |
129 Ptr<NetDevice> device = c.Get (i); |
129 |
130 |
130 Ptr<Node> node = device->GetNode (); |
131 Ptr<Node> node = device->GetNode (); |
131 NS_ASSERT_MSG (node, "Ipv4AddressHelper::Allocate(): Bad node"); |
132 NS_ASSERT_MSG (node, "Ipv4AddressHelper::Allocate(): Bad node"); |
143 |
144 |
144 ipv4->SetAddress (ifIndex, NewAddress ()); |
145 ipv4->SetAddress (ifIndex, NewAddress ()); |
145 ipv4->SetNetworkMask (ifIndex, m_mask); |
146 ipv4->SetNetworkMask (ifIndex, m_mask); |
146 ipv4->SetMetric (ifIndex, 1); |
147 ipv4->SetMetric (ifIndex, 1); |
147 ipv4->SetUp (ifIndex); |
148 ipv4->SetUp (ifIndex); |
|
149 retval.Add (ipv4, ifIndex); |
148 } |
150 } |
|
151 return retval; |
149 } |
152 } |
150 |
153 |
151 const uint32_t N_BITS = 32; |
154 const uint32_t N_BITS = 32; |
152 |
155 |
153 uint32_t |
156 uint32_t |