Lines 313-318
ArpCache::Add (Ipv4Address to)
|
Link Here
|
---|
|
313 |
return entry; |
313 |
return entry; |
314 |
} |
314 |
} |
315 |
|
315 |
|
|
|
316 |
void |
317 |
ArpCache::Remove (ArpCache::Entry *entry) |
318 |
{ |
319 |
NS_LOG_FUNCTION (this << entry); |
320 |
|
321 |
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) |
322 |
{ |
323 |
if ((*i).second == entry) |
324 |
{ |
325 |
m_arpCache.erase (i); |
326 |
entry->ClearPendingPacket (); //clear the pending packets for entry's ipaddress |
327 |
delete entry; |
328 |
return; |
329 |
} |
330 |
} |
331 |
NS_LOG_WARN ("Entry not found in this ARP Cache"); |
332 |
} |
333 |
|
316 |
ArpCache::Entry::Entry (ArpCache *arp) |
334 |
ArpCache::Entry::Entry (ArpCache *arp) |
317 |
: m_arp (arp), |
335 |
: m_arp (arp), |
318 |
m_state (ALIVE), |
336 |
m_state (ALIVE), |
Lines 340-351
ArpCache::Entry::IsWaitReply (void)
|
Link Here
|
---|
|
340 |
NS_LOG_FUNCTION (this); |
358 |
NS_LOG_FUNCTION (this); |
341 |
return (m_state == WAIT_REPLY) ? true : false; |
359 |
return (m_state == WAIT_REPLY) ? true : false; |
342 |
} |
360 |
} |
|
|
361 |
bool |
362 |
ArpCache::Entry::IsPermanent (void) |
363 |
{ |
364 |
NS_LOG_FUNCTION (this); |
365 |
return (m_state == PERMANENT) ? true : false; |
366 |
} |
343 |
|
367 |
|
344 |
|
368 |
|
345 |
void |
369 |
void |
346 |
ArpCache::Entry::MarkDead (void) |
370 |
ArpCache::Entry::MarkDead (void) |
347 |
{ |
371 |
{ |
348 |
NS_LOG_FUNCTION (this); |
372 |
NS_LOG_FUNCTION (this); |
|
|
373 |
NS_ASSERT (m_state == ALIVE || m_state == WAIT_REPLY || m_state == DEAD); |
349 |
m_state = DEAD; |
374 |
m_state = DEAD; |
350 |
ClearRetries (); |
375 |
ClearRetries (); |
351 |
UpdateSeen (); |
376 |
UpdateSeen (); |
Lines 360-366
ArpCache::Entry::MarkAlive (Address macAddress)
|
Link Here
|
---|
|
360 |
ClearRetries (); |
385 |
ClearRetries (); |
361 |
UpdateSeen (); |
386 |
UpdateSeen (); |
362 |
} |
387 |
} |
363 |
|
388 |
void |
|
|
389 |
ArpCache::Entry::MarkPermanent (void) |
390 |
{ |
391 |
NS_LOG_FUNCTION (this); |
392 |
NS_ASSERT (m_state == ALIVE); |
393 |
m_state = PERMANENT; |
394 |
ClearRetries (); |
395 |
UpdateSeen (); |
396 |
} |
397 |
void |
398 |
ArpCache::Entry::MarkWaitReply (Ptr<Packet> waiting) |
399 |
{ |
400 |
NS_LOG_FUNCTION (this << waiting); |
401 |
NS_ASSERT (m_state == ALIVE || m_state == DEAD); |
402 |
NS_ASSERT (m_pending.empty ()); |
403 |
m_state = WAIT_REPLY; |
404 |
m_pending.push_back (waiting); |
405 |
UpdateSeen (); |
406 |
m_arp->StartWaitReplyTimer (); |
407 |
} |
364 |
bool |
408 |
bool |
365 |
ArpCache::Entry::UpdateWaitReply (Ptr<Packet> waiting) |
409 |
ArpCache::Entry::UpdateWaitReply (Ptr<Packet> waiting) |
366 |
{ |
410 |
{ |
Lines 377-393
ArpCache::Entry::UpdateWaitReply (Ptr<Packet> waiting)
|
Link Here
|
---|
|
377 |
m_pending.push_back (waiting); |
421 |
m_pending.push_back (waiting); |
378 |
return true; |
422 |
return true; |
379 |
} |
423 |
} |
380 |
void |
424 |
|
381 |
ArpCache::Entry::MarkWaitReply (Ptr<Packet> waiting) |
|
|
382 |
{ |
383 |
NS_LOG_FUNCTION (this << waiting); |
384 |
NS_ASSERT (m_state == ALIVE || m_state == DEAD); |
385 |
NS_ASSERT (m_pending.empty ()); |
386 |
m_state = WAIT_REPLY; |
387 |
m_pending.push_back (waiting); |
388 |
UpdateSeen (); |
389 |
m_arp->StartWaitReplyTimer (); |
390 |
} |
391 |
|
425 |
|
392 |
Address |
426 |
Address |
393 |
ArpCache::Entry::GetMacAddress (void) const |
427 |
ArpCache::Entry::GetMacAddress (void) const |
Lines 418-423
ArpCache::Entry::GetTimeout (void) const
|
Link Here
|
---|
|
418 |
return m_arp->GetDeadTimeout (); |
452 |
return m_arp->GetDeadTimeout (); |
419 |
case ArpCache::Entry::ALIVE: |
453 |
case ArpCache::Entry::ALIVE: |
420 |
return m_arp->GetAliveTimeout (); |
454 |
return m_arp->GetAliveTimeout (); |
|
|
455 |
case ArpCache::Entry::PERMANENT: |
456 |
return Time::Max (); |
421 |
default: |
457 |
default: |
422 |
NS_ASSERT (false); |
458 |
NS_ASSERT (false); |
423 |
return Seconds (0); |
459 |
return Seconds (0); |
Lines 453-458
ArpCache::Entry::DequeuePending (void)
|
Link Here
|
---|
|
453 |
} |
489 |
} |
454 |
} |
490 |
} |
455 |
void |
491 |
void |
|
|
492 |
ArpCache::Entry::ClearPendingPacket (void) |
493 |
{ |
494 |
NS_LOG_FUNCTION (this); |
495 |
m_pending.clear (); |
496 |
} |
497 |
void |
456 |
ArpCache::Entry::UpdateSeen (void) |
498 |
ArpCache::Entry::UpdateSeen (void) |
457 |
{ |
499 |
{ |
458 |
NS_LOG_FUNCTION (this); |
500 |
NS_LOG_FUNCTION (this); |