|
99 |
ArpCache::DoDispose (void) |
99 |
ArpCache::DoDispose (void) |
100 |
{ |
100 |
{ |
101 |
NS_LOG_FUNCTION (this); |
101 |
NS_LOG_FUNCTION (this); |
102 |
Flush (); |
102 |
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) |
|
|
103 |
{ |
104 |
delete (*i).second; |
105 |
} |
106 |
m_arpCache.erase (m_arpCache.begin (), m_arpCache.end ()); |
107 |
if (m_waitReplyTimer.IsRunning ()) |
108 |
{ |
109 |
NS_LOG_LOGIC ("Stopping WaitReplyTimer at " << Simulator::Now ().GetSeconds () << " due to ArpCache flush"); |
110 |
m_waitReplyTimer.Cancel (); |
111 |
} |
103 |
m_device = 0; |
112 |
m_device = 0; |
104 |
m_interface = 0; |
113 |
m_interface = 0; |
105 |
if (!m_waitReplyTimer.IsRunning ()) |
114 |
if (!m_waitReplyTimer.IsRunning ()) |
|
241 |
ArpCache::Flush (void) |
250 |
ArpCache::Flush (void) |
242 |
{ |
251 |
{ |
243 |
NS_LOG_FUNCTION (this); |
252 |
NS_LOG_FUNCTION (this); |
|
|
253 |
std::vector<Ipv4Address> keysToErase; |
254 |
// First delete the entry |
244 |
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) |
255 |
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) |
245 |
{ |
256 |
{ |
246 |
delete (*i).second; |
257 |
if (!(*i).second->IsPermanent ()) |
|
|
258 |
{ |
259 |
delete (*i).second; |
260 |
keysToErase.push_back ((*i).first); |
261 |
} |
247 |
} |
262 |
} |
248 |
m_arpCache.erase (m_arpCache.begin (), m_arpCache.end ()); |
263 |
// Now erase the entries from the cache. Doing it outside of the above |
|
|
264 |
// for loop since erasing invalidates the iterator |
265 |
for(std::vector<Ipv4Address>::size_type i = 0; i != keysToErase.size(); i++) |
266 |
{ |
267 |
m_arpCache.erase (keysToErase[i]); |
268 |
} |
249 |
if (m_waitReplyTimer.IsRunning ()) |
269 |
if (m_waitReplyTimer.IsRunning ()) |
250 |
{ |
270 |
{ |
251 |
NS_LOG_LOGIC ("Stopping WaitReplyTimer at " << Simulator::Now ().GetSeconds () << " due to ArpCache flush"); |
271 |
NS_LOG_LOGIC ("Stopping WaitReplyTimer at " << Simulator::Now ().GetSeconds () << " due to ArpCache flush"); |
|
388 |
void |
408 |
void |
389 |
ArpCache::Entry::MarkPermanent (Address macAddress) |
409 |
ArpCache::Entry::MarkPermanent (Address macAddress) |
390 |
{ |
410 |
{ |
391 |
NS_LOG_FUNCTION (this); |
411 |
NS_LOG_FUNCTION (this << macAddress); |
392 |
m_macAddress = macAddress; |
412 |
m_macAddress = macAddress; |
393 |
m_state = PERMANENT; |
413 |
m_state = PERMANENT; |
394 |
ClearRetries (); |
414 |
ClearRetries (); |