|
Lines 185-191
ArpCache::HandleWaitReplyTimeout (void)
|
Link Here
|
|---|
|
| 185 |
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) |
185 |
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) |
| 186 |
{ |
186 |
{ |
| 187 |
entry = (*i).second; |
187 |
entry = (*i).second; |
| 188 |
if (entry != 0 && entry->IsWaitReply () && entry->IsExpired ()) |
188 |
if (entry != 0 && entry->IsWaitReply () && entry->IsExpiring () ) |
| 189 |
{ |
189 |
{ |
| 190 |
if (entry->GetRetries () < m_maxRetries) |
190 |
if (entry->GetRetries () < m_maxRetries) |
| 191 |
{ |
191 |
{ |
|
Lines 358-394
ArpCache::Entry::SetIpv4Address (Ipv4Add
|
Link Here
|
|---|
|
| 358 |
NS_LOG_FUNCTION (this << destination); |
358 |
NS_LOG_FUNCTION (this << destination); |
| 359 |
m_ipv4Address = destination; |
359 |
m_ipv4Address = destination; |
| 360 |
} |
360 |
} |
| 361 |
|
361 |
Time |
| 362 |
bool |
362 |
ArpCache::Entry::GetTimeout (void) const |
| 363 |
ArpCache::Entry::IsExpired (void) |
363 |
{ |
|
|
364 |
switch (m_state) { |
| 365 |
case ArpCache::Entry::WAIT_REPLY: |
| 366 |
return m_arp->GetWaitReplyTimeout (); |
| 367 |
case ArpCache::Entry::DEAD: |
| 368 |
return m_arp->GetDeadTimeout (); |
| 369 |
case ArpCache::Entry::ALIVE: |
| 370 |
return m_arp->GetAliveTimeout (); |
| 371 |
default: |
| 372 |
NS_ASSERT (false); |
| 373 |
return Seconds (0); |
| 374 |
/* NOTREACHED */ |
| 375 |
} |
| 376 |
} |
| 377 |
bool |
| 378 |
ArpCache::Entry::IsExpiring (void) const |
| 364 |
{ |
379 |
{ |
| 365 |
NS_LOG_FUNCTION_NOARGS (); |
380 |
NS_LOG_FUNCTION_NOARGS (); |
| 366 |
Time timeout; |
381 |
Time timeout = GetTimeout (); |
| 367 |
switch (m_state) { |
|
|
| 368 |
case ArpCache::Entry::WAIT_REPLY: |
| 369 |
timeout = m_arp->GetWaitReplyTimeout (); |
| 370 |
break; |
| 371 |
case ArpCache::Entry::DEAD: |
| 372 |
timeout = m_arp->GetDeadTimeout (); |
| 373 |
break; |
| 374 |
case ArpCache::Entry::ALIVE: |
| 375 |
timeout = m_arp->GetAliveTimeout (); |
| 376 |
break; |
| 377 |
default: |
| 378 |
NS_ASSERT (false); |
| 379 |
timeout = Seconds (0); |
| 380 |
/* NOTREACHED */ |
| 381 |
break; |
| 382 |
} |
| 383 |
Time delta = Simulator::Now () - m_lastSeen; |
382 |
Time delta = Simulator::Now () - m_lastSeen; |
| 384 |
if (delta >= timeout) |
383 |
NS_LOG_DEBUG ("delta=" << delta.GetSeconds () << "s"); |
|
|
384 |
if (delta >= timeout) |
| 385 |
{ |
| 386 |
return true; |
| 387 |
} |
| 388 |
return false; |
| 389 |
} |
| 390 |
bool |
| 391 |
ArpCache::Entry::IsExpired (void) const |
| 392 |
{ |
| 393 |
NS_LOG_FUNCTION_NOARGS (); |
| 394 |
Time timeout = GetTimeout (); |
| 395 |
Time delta = Simulator::Now () - m_lastSeen; |
| 396 |
NS_LOG_DEBUG ("delta=" << delta.GetSeconds () << "s"); |
| 397 |
if (delta > timeout) |
| 385 |
{ |
398 |
{ |
| 386 |
return true; |
399 |
return true; |
| 387 |
} |
400 |
} |
| 388 |
else |
401 |
return false; |
| 389 |
{ |
|
|
| 390 |
return false; |
| 391 |
} |
| 392 |
} |
402 |
} |
| 393 |
Ptr<Packet> |
403 |
Ptr<Packet> |
| 394 |
ArpCache::Entry::DequeuePending (void) |
404 |
ArpCache::Entry::DequeuePending (void) |
|
|
| 408 |
void |
418 |
void |
| 409 |
ArpCache::Entry::UpdateSeen (void) |
419 |
ArpCache::Entry::UpdateSeen (void) |
| 410 |
{ |
420 |
{ |
| 411 |
NS_LOG_FUNCTION_NOARGS (); |
421 |
NS_LOG_FUNCTION (m_macAddress << m_ipv4Address); |
| 412 |
m_lastSeen = Simulator::Now (); |
422 |
m_lastSeen = Simulator::Now (); |
| 413 |
} |
423 |
} |
| 414 |
uint32_t |
424 |
uint32_t |
| 415 |
ArpCache::Entry::GetRetries (void) const |
425 |
ArpCache::Entry::GetRetries (void) const |
| 416 |
{ |
426 |
{ |
| 417 |
NS_LOG_FUNCTION_NOARGS (); |
427 |
NS_LOG_FUNCTION (m_macAddress << m_ipv4Address); |
| 418 |
return m_retries; |
428 |
return m_retries; |
| 419 |
} |
429 |
} |
| 420 |
void |
430 |
void |