View | Details | Raw Unified | Return to bug 760
Collapse All | Expand All

(-)a/src/internet-stack/ipv4-interface.cc (+17 lines)
 Lines 337-341    Link Here 
337
  return (addr);  // quiet compiler
337
  return (addr);  // quiet compiler
338
}
338
}
339
339
340
Ipv4InterfaceAddress
341
Ipv4Interface::RemoveAddress(Ipv4Address addr)
342
{
343
  NS_LOG_FUNCTION(this << addr);
344
345
  for(Ipv4InterfaceAddressListI it = m_ifaddrs.begin(); it != m_ifaddrs.end(); it++)
346
    {
347
      if((*it).GetLocal() == addr)
348
        {
349
          Ipv4InterfaceAddress ifAddr = *it;
350
          m_ifaddrs.erase(it);
351
          return ifAddr;
352
        }
353
    }
354
  return Ipv4InterfaceAddress();
355
}
356
340
}; // namespace ns3
357
}; // namespace ns3
341
358
(-)a/src/internet-stack/ipv4-interface.h (+6 lines)
 Lines 152-157    Link Here 
152
   */
152
   */
153
  Ipv4InterfaceAddress RemoveAddress (uint32_t index);
153
  Ipv4InterfaceAddress RemoveAddress (uint32_t index);
154
154
155
  /**
156
   * \param addr The address to remove
157
   * \returns The Ipv4InterfaceAddress whose address is addr
158
   */
159
  Ipv4InterfaceAddress RemoveAddress (Ipv4Address addr);
160
155
protected:
161
protected:
156
  virtual void DoDispose (void);
162
  virtual void DoDispose (void);
157
private:
163
private:
(-)a/src/internet-stack/ipv4-l3-protocol.cc (+17 lines)
 Lines 866-871    Link Here 
866
  return false;
866
  return false;
867
}
867
}
868
868
869
bool
870
Ipv4L3Protocol::RemoveAddress (uint32_t i, Ipv4Address address)
871
{
872
  NS_LOG_FUNCTION (this << i << address);
873
  Ptr<Ipv4Interface> interface = GetInterface (i);
874
  Ipv4InterfaceAddress ifAddr = interface->RemoveAddress (address);
875
  if (ifAddr != Ipv4InterfaceAddress ())
876
    {
877
      if (m_routingProtocol != 0)
878
        {
879
          m_routingProtocol->NotifyRemoveAddress (i, ifAddr);
880
        }
881
      return true;
882
    }
883
  return false;
884
}
885
869
void 
886
void 
870
Ipv4L3Protocol::SetMetric (uint32_t i, uint16_t metric)
887
Ipv4L3Protocol::SetMetric (uint32_t i, uint16_t metric)
871
{
888
{
(-)a/src/internet-stack/ipv4-l3-protocol.h (+1 lines)
 Lines 176-181    Link Here 
176
  Ipv4InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const;
176
  Ipv4InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const;
177
  uint32_t GetNAddresses (uint32_t interface) const;
177
  uint32_t GetNAddresses (uint32_t interface) const;
178
  bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
178
  bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
179
  virtual bool RemoveAddress (uint32_t interface, Ipv4Address address);
179
180
180
  void SetMetric (uint32_t i, uint16_t metric);
181
  void SetMetric (uint32_t i, uint16_t metric);
181
  uint16_t GetMetric (uint32_t i) const;
182
  uint16_t GetMetric (uint32_t i) const;
(-)a/src/internet-stack/ipv6-interface.cc (+16 lines)
 Lines 283-288    Link Here 
283
  return addr;  /* quiet compiler */
283
  return addr;  /* quiet compiler */
284
}
284
}
285
285
286
Ipv6InterfaceAddress Ipv6Interface::RemoveAddress(Ipv6Address addr)
287
{
288
  NS_LOG_FUNCTION(this << addr);
289
290
  for (Ipv6InterfaceAddressListI it = m_addresses.begin (); it != m_addresses.end (); ++it)
291
    {
292
      if((*it).GetAddress() == addr)
293
        {
294
          Ipv6InterfaceAddress iface = (*it);
295
          m_addresses.erase(it);
296
          return iface;
297
        }
298
    }
299
  return Ipv6InterfaceAddress();
300
}
301
286
Ipv6InterfaceAddress Ipv6Interface::GetAddressMatchingDestination (Ipv6Address dst)
302
Ipv6InterfaceAddress Ipv6Interface::GetAddressMatchingDestination (Ipv6Address dst)
287
{
303
{
288
  NS_LOG_FUNCTION (this << dst);
304
  NS_LOG_FUNCTION (this << dst);
(-)a/src/internet-stack/ipv6-interface.h (+7 lines)
 Lines 228-233    Link Here 
228
    Ipv6InterfaceAddress RemoveAddress (uint32_t index);
228
    Ipv6InterfaceAddress RemoveAddress (uint32_t index);
229
    
229
    
230
    /**
230
    /**
231
     * \brief Remove an address from interface.
232
     * \param addr the address to remove
233
     * \return Ipv6InterfaceAddress whose address is addr
234
     */
235
    Ipv6InterfaceAddress RemoveAddress (Ipv6Address addr);
236
237
    /**
231
     * \brief Update state of an interface address.
238
     * \brief Update state of an interface address.
232
     * \param address IPv6 address
239
     * \param address IPv6 address
233
     * \param state new state
240
     * \param state new state
(-)a/src/internet-stack/ipv6-l3-protocol.cc (+16 lines)
 Lines 370-375    Link Here 
370
  return false;
370
  return false;
371
}
371
}
372
372
373
bool Ipv6L3Protocol::RemoveAddress (uint32_t i, Ipv6Address address)
374
{
375
  NS_LOG_FUNCTION (this << i << address);
376
  Ptr<Ipv6Interface> interface = GetInterface (i);
377
  Ipv6InterfaceAddress ifAddr = interface->RemoveAddress (address);
378
  if (ifAddr != Ipv6InterfaceAddress ())
379
  {
380
    if (m_routingProtocol != 0)
381
    {
382
      m_routingProtocol->NotifyRemoveAddress (i, ifAddr);
383
    }
384
    return true;
385
  }
386
  return false;
387
}
388
373
void Ipv6L3Protocol::SetMetric (uint32_t i, uint16_t metric) 
389
void Ipv6L3Protocol::SetMetric (uint32_t i, uint16_t metric) 
374
{
390
{
375
  NS_LOG_FUNCTION (this << i << metric);
391
  NS_LOG_FUNCTION (this << i << metric);
(-)a/src/internet-stack/ipv6-l3-protocol.h (+7 lines)
 Lines 243-248    Link Here 
243
    bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
243
    bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
244
    
244
    
245
    /**
245
    /**
246
     * \brief Remove an address from an interface.
247
     * \param interfaceIndex interface index
248
     * \param address address on the interface
249
     */
250
    bool RemoveAddress (uint32_t interface, Ipv6Address address);
251
252
    /**
246
     * \brief Set metric for an interface.
253
     * \brief Set metric for an interface.
247
     * \param i index
254
     * \param i index
248
     * \param metric
255
     * \param metric
(-)a/src/node/ipv4.h (+9 lines)
 Lines 216-221    Link Here 
216
  virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex) = 0;
216
  virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex) = 0;
217
217
218
  /**
218
  /**
219
   * Remove the given address on named interface.
220
   *
221
   * \param interface Interface number of an Ipv4 interface
222
   * \param address The address to remove
223
   * \returns true if the operation succeeded
224
   */
225
  virtual bool RemoveAddress (uint32_t interface, Ipv4Address address) = 0;
226
227
  /**
219
   * \param interface The interface number of an Ipv4 interface
228
   * \param interface The interface number of an Ipv4 interface
220
   * \param metric routing metric (cost) associated to the underlying 
229
   * \param metric routing metric (cost) associated to the underlying 
221
   *          Ipv4 interface
230
   *          Ipv4 interface
(-)a/src/node/ipv6.h (+9 lines)
 Lines 218-223    Link Here 
218
  virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex) = 0;
218
  virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex) = 0;
219
219
220
  /**
220
  /**
221
   * \brief Remove an address on specified IPv6 interface.
222
   *
223
   * \param interface Interface number of an IPv6 interface
224
   * \param address the address to remove
225
   * \returns true if the operation succeeded
226
   */
227
  virtual bool RemoveAddress (uint32_t interface, Ipv6Address address) = 0;
228
229
  /**
221
   * \brief Set metric on specified Ipv6 interface.
230
   * \brief Set metric on specified Ipv6 interface.
222
   *
231
   *
223
   * \param interface The interface number of an IPv6 interface
232
   * \param interface The interface number of an IPv6 interface

Return to bug 760