src/internet-stack/arp-cache.cc
author Craig Dowell <craigdo@ee.washington.edu>
Wed, 17 Feb 2010 21:50:11 -0800
changeset 5994 ced6c14c957e
parent 4455 0708e7fdf676
child 6560 771dbe777984
permissions -rw-r--r--
branch merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2006 INRIA
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
286
57e6a2006962 convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 243
diff changeset
    20
#include "ns3/assert.h"
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#include "ns3/packet.h"
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#include "ns3/simulator.h"
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    23
#include "ns3/uinteger.h"
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    24
#include "ns3/log.h"
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    25
#include "ns3/node.h"
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    26
#include "ns3/trace-source-accessor.h"
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
#include "arp-cache.h"
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
#include "arp-header.h"
1341
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1167
diff changeset
    30
#include "ipv4-interface.h"
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    32
NS_LOG_COMPONENT_DEFINE ("ArpCache");
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    33
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
namespace ns3 {
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
4455
0708e7fdf676 Fix bug 570 (ArpCache not registered)
Tom Henderson <tomh@tomh.org>
parents: 4250
diff changeset
    36
NS_OBJECT_ENSURE_REGISTERED (ArpCache);
0708e7fdf676 Fix bug 570 (ArpCache not registered)
Tom Henderson <tomh@tomh.org>
parents: 4250
diff changeset
    37
3146
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    38
TypeId 
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    39
ArpCache::GetTypeId (void)
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    40
{
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    41
  static TypeId tid = TypeId ("ns3::ArpCache")
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    42
    .SetParent<Object> ()
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    43
    .AddAttribute ("AliveTimeout",
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    44
                   "When this timeout expires, the matching cache entry needs refreshing",
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    45
                   TimeValue (Seconds (120)),
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    46
                   MakeTimeAccessor (&ArpCache::m_aliveTimeout),
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    47
                   MakeTimeChecker ())
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    48
    .AddAttribute ("DeadTimeout",
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    49
                   "When this timeout expires, a new attempt to resolve the matching entry is made",
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    50
                   TimeValue (Seconds (100)),
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    51
                   MakeTimeAccessor (&ArpCache::m_deadTimeout),
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    52
                   MakeTimeChecker ())
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    53
    .AddAttribute ("WaitReplyTimeout",
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    54
                   "When this timeout expires, the cache entries will be scanned and entries in WaitReply state will resend ArpRequest unless MaxRetries has been exceeded, in which case the entry is marked dead",           
3146
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    55
                   TimeValue (Seconds (1)),
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    56
                   MakeTimeAccessor (&ArpCache::m_waitReplyTimeout),
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    57
                   MakeTimeChecker ())
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    58
    .AddAttribute ("MaxRetries",                   
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    59
                   "Number of retransmissions of ArpRequest before marking dead",                  
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    60
                   UintegerValue (3),
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    61
                   MakeUintegerAccessor (&ArpCache::m_maxRetries),
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    62
                   MakeUintegerChecker<uint32_t> ())
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    63
    .AddAttribute ("PendingQueueSize",
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    64
                   "The size of the queue for packets pending an arp reply.",
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    65
                   UintegerValue (3),
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    66
                   MakeUintegerAccessor (&ArpCache::m_pendingQueueSize),
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    67
                   MakeUintegerChecker<uint32_t> ())
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    68
    .AddTraceSource ("Drop",                     
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    69
                     "Packet dropped due to ArpCache entry in WaitReply expiring.",
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    70
                     MakeTraceSourceAccessor (&ArpCache::m_dropTrace))
3146
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    71
    ;
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    72
  return tid;
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    73
}
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    74
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    75
ArpCache::ArpCache ()
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    76
  : m_device (0), 
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    77
    m_interface (0)
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    78
{
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    79
  NS_LOG_FUNCTION (this);
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    80
}
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
ArpCache::~ArpCache ()
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
{
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    84
  NS_LOG_FUNCTION (this);
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    85
}
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    86
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    87
void 
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    88
ArpCache::DoDispose (void)
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    89
{
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    90
  NS_LOG_FUNCTION (this);
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
  Flush ();
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    92
  m_device = 0;
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    93
  m_interface = 0;
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    94
  if (!m_waitReplyTimer.IsRunning ())
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    95
    {
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    96
      Simulator::Remove (m_waitReplyTimer);
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
    97
    }
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
    98
  Object::DoDispose ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
3146
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   101
void
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   102
ArpCache::SetDevice (Ptr<NetDevice> device, Ptr<Ipv4Interface> interface)
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   103
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   104
  NS_LOG_FUNCTION_NOARGS ();
3146
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   105
  m_device = device;
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   106
  m_interface = interface;
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   107
}
98629e087bb1 add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   108
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 551
diff changeset
   109
Ptr<NetDevice>
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 551
diff changeset
   110
ArpCache::GetDevice (void) const
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   112
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   113
  return m_device;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   114
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   115
1341
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1167
diff changeset
   116
Ptr<Ipv4Interface>
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   117
ArpCache::GetInterface (void) const
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   119
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   120
  return m_interface;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   121
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   122
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   123
void 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
ArpCache::SetAliveTimeout (Time aliveTimeout)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   126
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   127
  m_aliveTimeout = aliveTimeout;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
void 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
ArpCache::SetDeadTimeout (Time deadTimeout)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   132
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
  m_deadTimeout = deadTimeout;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   135
void 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   136
ArpCache::SetWaitReplyTimeout (Time waitReplyTimeout)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   137
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   138
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   139
  m_waitReplyTimeout = waitReplyTimeout;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   140
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   141
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   142
Time
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   143
ArpCache::GetAliveTimeout (void) const
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   144
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   145
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   146
  return m_aliveTimeout;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   147
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   148
Time
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   149
ArpCache::GetDeadTimeout (void) const
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   151
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   152
  return m_deadTimeout;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   154
Time
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   155
ArpCache::GetWaitReplyTimeout (void) const
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   157
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
  return m_waitReplyTimeout;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   159
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   160
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
void 
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   162
ArpCache::SetArpRequestCallback (Callback<void, Ptr<const ArpCache>,
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   163
                             Ipv4Address> arpRequestCallback)
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   164
{
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   165
  NS_LOG_FUNCTION_NOARGS ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   166
  m_arpRequestCallback = arpRequestCallback;
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   167
}
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   168
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   169
void 
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   170
ArpCache::StartWaitReplyTimer (void)
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   171
{
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   172
  NS_LOG_FUNCTION_NOARGS ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   173
  if (!m_waitReplyTimer.IsRunning ())
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   174
    {
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   175
      NS_LOG_LOGIC ("Starting WaitReplyTimer at " << Simulator::Now ().GetSeconds ());
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   176
      m_waitReplyTimer = Simulator::Schedule (m_waitReplyTimeout, 
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   177
        &ArpCache::HandleWaitReplyTimeout, this);
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   178
    }
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   179
}
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   180
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   181
void
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   182
ArpCache::HandleWaitReplyTimeout (void)
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   183
{
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   184
  NS_LOG_FUNCTION_NOARGS ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   185
  ArpCache::Entry* entry;
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   186
  bool restartWaitReplyTimer = false;
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   187
  for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) 
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   188
    {
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   189
      entry = (*i).second;
4250
724c9442a9f0 fix for bug 468
Tom Henderson <tomh@tomh.org>
parents: 4084
diff changeset
   190
      if (entry != 0 && entry->IsWaitReply ())
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   191
          {
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   192
          if (entry->GetRetries () < m_maxRetries)
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   193
            {
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   194
              NS_LOG_LOGIC ("node="<< m_device->GetNode ()->GetId () <<
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   195
                ", ArpWaitTimeout for " << entry->GetIpv4Address () <<
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   196
                " expired -- retransmitting arp request since retries = " << 
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   197
                entry->GetRetries ());
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   198
              m_arpRequestCallback (this, entry->GetIpv4Address ());
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   199
              restartWaitReplyTimer = true;
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   200
              entry->IncrementRetries ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   201
            }
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   202
          else
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   203
            {
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   204
              NS_LOG_LOGIC ("node="<<m_device->GetNode ()->GetId () <<
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   205
                ", wait reply for " << entry->GetIpv4Address () << 
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   206
                " expired -- drop since max retries exceeded: " << 
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   207
                 entry->GetRetries ());
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   208
              entry->MarkDead ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   209
              entry->ClearRetries ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   210
              Ptr<Packet> pending = entry->DequeuePending();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   211
              while (pending != 0)
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   212
                {
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   213
                  m_dropTrace (pending);
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   214
                  pending = entry->DequeuePending();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   215
                }
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   216
            }
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   217
       }
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   218
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   219
    }
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   220
  if (restartWaitReplyTimer)
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   221
    {
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   222
      NS_LOG_LOGIC ("Restarting WaitReplyTimer at " << Simulator::Now ().GetSeconds ());
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   223
      m_waitReplyTimer = Simulator::Schedule (m_waitReplyTimeout, 
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   224
        &ArpCache::HandleWaitReplyTimeout, this);
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   225
    }
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   226
}
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   227
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   228
void 
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   229
ArpCache::Flush (void)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   230
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   231
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   232
  for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   233
    {
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   234
      delete (*i).second;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   235
    }
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   236
  m_arpCache.erase (m_arpCache.begin (), m_arpCache.end ());
3823
761f94afe2a2 Fix bug 362; cancel WaitReplyTimer when ArpCache is flushed
Tom Henderson <tomh@tomh.org>
parents: 3499
diff changeset
   237
  if (m_waitReplyTimer.IsRunning ())
761f94afe2a2 Fix bug 362; cancel WaitReplyTimer when ArpCache is flushed
Tom Henderson <tomh@tomh.org>
parents: 3499
diff changeset
   238
    {
761f94afe2a2 Fix bug 362; cancel WaitReplyTimer when ArpCache is flushed
Tom Henderson <tomh@tomh.org>
parents: 3499
diff changeset
   239
      NS_LOG_LOGIC ("Stopping WaitReplyTimer at " << Simulator::Now ().GetSeconds () << " due to ArpCache flush");
761f94afe2a2 Fix bug 362; cancel WaitReplyTimer when ArpCache is flushed
Tom Henderson <tomh@tomh.org>
parents: 3499
diff changeset
   240
      m_waitReplyTimer.Cancel ();
761f94afe2a2 Fix bug 362; cancel WaitReplyTimer when ArpCache is flushed
Tom Henderson <tomh@tomh.org>
parents: 3499
diff changeset
   241
    }
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   242
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   243
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   244
ArpCache::Entry *
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   245
ArpCache::Lookup (Ipv4Address to)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   246
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   247
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   248
  if (m_arpCache.find (to) != m_arpCache.end ()) 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   249
    {
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   250
      ArpCache::Entry *entry = m_arpCache[to];
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   251
      return entry;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   252
    }
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   253
  return 0;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   254
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   255
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   256
ArpCache::Entry *
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   257
ArpCache::Add (Ipv4Address to)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   258
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   259
  NS_LOG_FUNCTION_NOARGS ();
933
df68dad55087 WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 568
diff changeset
   260
  NS_ASSERT (m_arpCache.find (to) == m_arpCache.end ());
df68dad55087 WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 568
diff changeset
   261
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   262
  ArpCache::Entry *entry = new ArpCache::Entry (this);
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   263
  m_arpCache[to] = entry;  
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   264
  entry->SetIpv4Address (to);
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   265
  return entry;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   266
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   267
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   268
ArpCache::Entry::Entry (ArpCache *arp)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   269
  : m_arp (arp),
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   270
    m_state (ALIVE),
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   271
    m_retries (0)
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   272
{
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   273
  NS_LOG_FUNCTION_NOARGS ();
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   274
}
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   275
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   276
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   277
bool 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   278
ArpCache::Entry::IsDead (void)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   279
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   280
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   281
  return (m_state == DEAD)?true:false;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   282
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   283
bool 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   284
ArpCache::Entry::IsAlive (void)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   285
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   286
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   287
  return (m_state == ALIVE)?true:false;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   288
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   289
bool
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   290
ArpCache::Entry::IsWaitReply (void)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   291
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   292
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   293
  return (m_state == WAIT_REPLY)?true:false;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   294
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   295
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   296
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   297
void 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   298
ArpCache::Entry::MarkDead (void) 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   299
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   300
  NS_LOG_FUNCTION_NOARGS ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   301
  m_state = DEAD;
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   302
  ClearRetries ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   303
  UpdateSeen ();
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   304
}
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   305
void
1161
bb72baff8b26 replace MacAddress by Address
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 568
diff changeset
   306
ArpCache::Entry::MarkAlive (Address macAddress) 
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   307
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   308
  NS_LOG_FUNCTION_NOARGS ();
286
57e6a2006962 convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 243
diff changeset
   309
  NS_ASSERT (m_state == WAIT_REPLY);
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   310
  m_macAddress = macAddress;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   311
  m_state = ALIVE;
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   312
  ClearRetries ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   313
  UpdateSeen ();
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   314
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   315
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   316
bool
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1341
diff changeset
   317
ArpCache::Entry::UpdateWaitReply (Ptr<Packet> waiting)
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   318
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   319
  NS_LOG_FUNCTION_NOARGS ();
286
57e6a2006962 convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 243
diff changeset
   320
  NS_ASSERT (m_state == WAIT_REPLY);
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   321
  /* We are already waiting for an answer so
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   322
   * we dump the previously waiting packet and
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   323
   * replace it with this one.
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   324
   */
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   325
  if (m_pending.size () >= m_arp->m_pendingQueueSize)
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   326
    {
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   327
      return false;
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   328
    }
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   329
  m_pending.push_back (waiting);
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   330
  return true;
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   331
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   332
void 
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1341
diff changeset
   333
ArpCache::Entry::MarkWaitReply (Ptr<Packet> waiting)
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   334
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   335
  NS_LOG_FUNCTION_NOARGS ();
286
57e6a2006962 convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 243
diff changeset
   336
  NS_ASSERT (m_state == ALIVE || m_state == DEAD);
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   337
  NS_ASSERT (m_pending.empty ());
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   338
  m_state = WAIT_REPLY;
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   339
  m_pending.push_back (waiting);
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   340
  UpdateSeen ();
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   341
  m_arp->StartWaitReplyTimer ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   342
}
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   343
1161
bb72baff8b26 replace MacAddress by Address
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 568
diff changeset
   344
Address
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   345
ArpCache::Entry::GetMacAddress (void) const
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   346
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   347
  NS_LOG_FUNCTION_NOARGS ();
286
57e6a2006962 convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 243
diff changeset
   348
  NS_ASSERT (m_state == ALIVE);
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   349
  return m_macAddress;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   350
}
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   351
Ipv4Address 
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   352
ArpCache::Entry::GetIpv4Address (void) const
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   353
{
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   354
  NS_LOG_FUNCTION_NOARGS ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   355
  return m_ipv4Address;
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   356
}
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   357
void 
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   358
ArpCache::Entry::SetIpv4Address (Ipv4Address destination)
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   359
{
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   360
  NS_LOG_FUNCTION (this << destination);
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   361
  m_ipv4Address = destination;
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   362
}
4084
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   363
Time
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   364
ArpCache::Entry::GetTimeout (void) const
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   365
{
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   366
  switch (m_state) {
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   367
  case ArpCache::Entry::WAIT_REPLY:
4084
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   368
    return m_arp->GetWaitReplyTimeout ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   369
  case ArpCache::Entry::DEAD:
4084
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   370
    return m_arp->GetDeadTimeout ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   371
  case ArpCache::Entry::ALIVE:
4084
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   372
    return m_arp->GetAliveTimeout ();
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   373
  default:
286
57e6a2006962 convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 243
diff changeset
   374
    NS_ASSERT (false);
4084
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   375
    return Seconds (0);
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   376
    /* NOTREACHED */
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   377
  }
4084
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   378
}
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   379
bool 
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   380
ArpCache::Entry::IsExpired (void) const
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   381
{
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   382
  NS_LOG_FUNCTION_NOARGS ();
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   383
  Time timeout = GetTimeout ();
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   384
  Time delta = Simulator::Now () - m_lastSeen;
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   385
  NS_LOG_DEBUG ("delta=" << delta.GetSeconds () << "s");
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   386
  if (delta > timeout) 
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   387
    {
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   388
      return true;
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   389
    } 
4084
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   390
  return false;
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   391
}
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   392
Ptr<Packet> 
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   393
ArpCache::Entry::DequeuePending (void)
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   394
{
3430
a8eb6b890f14 Add NS_LOG_FUNCTION calls in arp implementation
Tom Henderson <tomh@tomh.org>
parents: 3260
diff changeset
   395
  NS_LOG_FUNCTION_NOARGS ();
3151
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   396
  if (m_pending.empty ())
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   397
    {
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   398
      return 0;
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   399
    }
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   400
  else
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   401
    {
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   402
      Ptr<Packet> p = m_pending.front ();
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   403
      m_pending.pop_front ();
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   404
      return p;
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   405
    }
428f8ec6da29 fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3146
diff changeset
   406
}
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   407
void 
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   408
ArpCache::Entry::UpdateSeen (void)
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   409
{
4084
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   410
  NS_LOG_FUNCTION (m_macAddress << m_ipv4Address);
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   411
  m_lastSeen = Simulator::Now ();
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   412
}
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   413
uint32_t
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   414
ArpCache::Entry::GetRetries (void) const
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   415
{
4084
dd514b5e0bc6 fix for bug451-- arp cache
Tom Henderson <tomh@tomh.org>
parents: 3823
diff changeset
   416
  NS_LOG_FUNCTION (m_macAddress << m_ipv4Address);
3499
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   417
  return m_retries;
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   418
}
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   419
void
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   420
ArpCache::Entry::IncrementRetries (void)
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   421
{
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   422
  NS_LOG_FUNCTION_NOARGS ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   423
  m_retries++;
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   424
  UpdateSeen ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   425
}
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   426
void
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   427
ArpCache::Entry::ClearRetries (void)
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   428
{
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   429
  NS_LOG_FUNCTION_NOARGS ();
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   430
  m_retries = 0;
a18520551cdf revised patch to fix bug 253
Tom Henderson <tomh@tomh.org>
parents: 3430
diff changeset
   431
}
242
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   432
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   433
} // namespace ns3
a44932709b47 add arp stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   434