author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Sun, 25 May 2008 14:44:36 -0700 | |
changeset 3151 | 428f8ec6da29 |
parent 3146 | 98629e087bb1 |
permissions | -rw-r--r-- |
242 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2006 INRIA |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License version 2 as |
|
7 |
* published by the Free Software Foundation; |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
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 | 21 |
#include "ns3/packet.h" |
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" |
242 | 25 |
|
26 |
#include "arp-cache.h" |
|
27 |
#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
|
28 |
#include "ipv4-interface.h" |
242 | 29 |
|
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
30 |
NS_LOG_COMPONENT_DEFINE ("ArpCache"); |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
31 |
|
242 | 32 |
namespace ns3 { |
33 |
||
3146
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
34 |
TypeId |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
35 |
ArpCache::GetTypeId (void) |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
36 |
{ |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
37 |
static TypeId tid = TypeId ("ns3::ArpCache") |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
38 |
.SetParent<Object> () |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
39 |
.AddAttribute ("AliveTimeout", |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
40 |
"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
|
41 |
TimeValue (Seconds (120)), |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
42 |
MakeTimeAccessor (&ArpCache::m_aliveTimeout), |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
43 |
MakeTimeChecker ()) |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
44 |
.AddAttribute ("DeadTimeout", |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
45 |
"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
|
46 |
TimeValue (Seconds (100)), |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
47 |
MakeTimeAccessor (&ArpCache::m_deadTimeout), |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
48 |
MakeTimeChecker ()) |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
49 |
.AddAttribute ("WaitReplyTimeout", |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
50 |
"When this timeout expires, the matching cache entry is marked dead", |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
51 |
TimeValue (Seconds (1)), |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
52 |
MakeTimeAccessor (&ArpCache::m_waitReplyTimeout), |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
53 |
MakeTimeChecker ()) |
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
54 |
.AddAttribute ("PendingQueueSize", |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
55 |
"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
|
56 |
UintegerValue (3), |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
57 |
MakeUintegerAccessor (&ArpCache::m_pendingQueueSize), |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
58 |
MakeUintegerChecker<uint32_t> ()) |
3146
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
59 |
; |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
60 |
return tid; |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
61 |
} |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
62 |
|
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
63 |
ArpCache::ArpCache () |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
64 |
: m_device (0), |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
65 |
m_interface (0) |
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
66 |
{ |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
67 |
NS_LOG_FUNCTION (this); |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
68 |
} |
242 | 69 |
|
70 |
ArpCache::~ArpCache () |
|
71 |
{ |
|
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
72 |
NS_LOG_FUNCTION (this); |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
73 |
} |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
74 |
|
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
75 |
void |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
76 |
ArpCache::DoDispose (void) |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
77 |
{ |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
78 |
NS_LOG_FUNCTION (this); |
242 | 79 |
Flush (); |
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
80 |
m_device = 0; |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
81 |
m_interface = 0; |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
82 |
Object::DoDispose (); |
242 | 83 |
} |
84 |
||
3146
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
85 |
void |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
86 |
ArpCache::SetDevice (Ptr<NetDevice> device, Ptr<Ipv4Interface> interface) |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
87 |
{ |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
88 |
m_device = device; |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
89 |
m_interface = interface; |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
90 |
} |
98629e087bb1
add attributes to ArpCache
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
91 |
|
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
551
diff
changeset
|
92 |
Ptr<NetDevice> |
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
551
diff
changeset
|
93 |
ArpCache::GetDevice (void) const |
242 | 94 |
{ |
95 |
return m_device; |
|
96 |
} |
|
97 |
||
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
|
98 |
Ptr<Ipv4Interface> |
242 | 99 |
ArpCache::GetInterface (void) const |
100 |
{ |
|
101 |
return m_interface; |
|
102 |
} |
|
103 |
||
104 |
void |
|
105 |
ArpCache::SetAliveTimeout (Time aliveTimeout) |
|
106 |
{ |
|
107 |
m_aliveTimeout = aliveTimeout; |
|
108 |
} |
|
109 |
void |
|
110 |
ArpCache::SetDeadTimeout (Time deadTimeout) |
|
111 |
{ |
|
112 |
m_deadTimeout = deadTimeout; |
|
113 |
} |
|
114 |
void |
|
115 |
ArpCache::SetWaitReplyTimeout (Time waitReplyTimeout) |
|
116 |
{ |
|
117 |
m_waitReplyTimeout = waitReplyTimeout; |
|
118 |
} |
|
119 |
||
120 |
Time |
|
121 |
ArpCache::GetAliveTimeout (void) const |
|
122 |
{ |
|
123 |
return m_aliveTimeout; |
|
124 |
} |
|
125 |
Time |
|
126 |
ArpCache::GetDeadTimeout (void) const |
|
127 |
{ |
|
128 |
return m_deadTimeout; |
|
129 |
} |
|
130 |
Time |
|
131 |
ArpCache::GetWaitReplyTimeout (void) const |
|
132 |
{ |
|
133 |
return m_waitReplyTimeout; |
|
134 |
} |
|
135 |
||
136 |
void |
|
137 |
ArpCache::Flush (void) |
|
138 |
{ |
|
139 |
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) |
|
140 |
{ |
|
141 |
delete (*i).second; |
|
142 |
} |
|
143 |
m_arpCache.erase (m_arpCache.begin (), m_arpCache.end ()); |
|
144 |
} |
|
145 |
||
146 |
ArpCache::Entry * |
|
147 |
ArpCache::Lookup (Ipv4Address to) |
|
148 |
{ |
|
149 |
if (m_arpCache.find (to) != m_arpCache.end ()) |
|
150 |
{ |
|
151 |
ArpCache::Entry *entry = m_arpCache[to]; |
|
152 |
return entry; |
|
153 |
} |
|
154 |
return 0; |
|
155 |
} |
|
156 |
||
157 |
ArpCache::Entry * |
|
158 |
ArpCache::Add (Ipv4Address to) |
|
159 |
{ |
|
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
|
160 |
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
|
161 |
|
242 | 162 |
ArpCache::Entry *entry = new ArpCache::Entry (this); |
163 |
m_arpCache[to] = entry; |
|
164 |
return entry; |
|
165 |
} |
|
166 |
||
167 |
ArpCache::Entry::Entry (ArpCache *arp) |
|
168 |
: m_arp (arp), |
|
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
169 |
m_state (ALIVE) |
242 | 170 |
{} |
171 |
||
172 |
||
173 |
bool |
|
174 |
ArpCache::Entry::IsDead (void) |
|
175 |
{ |
|
176 |
return (m_state == DEAD)?true:false; |
|
177 |
} |
|
178 |
bool |
|
179 |
ArpCache::Entry::IsAlive (void) |
|
180 |
{ |
|
181 |
return (m_state == ALIVE)?true:false; |
|
182 |
} |
|
183 |
bool |
|
184 |
ArpCache::Entry::IsWaitReply (void) |
|
185 |
{ |
|
186 |
return (m_state == WAIT_REPLY)?true:false; |
|
187 |
} |
|
188 |
||
189 |
||
190 |
void |
|
191 |
ArpCache::Entry::MarkDead (void) |
|
192 |
{ |
|
193 |
m_state = DEAD; |
|
194 |
UpdateSeen (); |
|
195 |
} |
|
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
196 |
void |
1161
bb72baff8b26
replace MacAddress by Address
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
568
diff
changeset
|
197 |
ArpCache::Entry::MarkAlive (Address macAddress) |
242 | 198 |
{ |
286
57e6a2006962
convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
243
diff
changeset
|
199 |
NS_ASSERT (m_state == WAIT_REPLY); |
242 | 200 |
m_macAddress = macAddress; |
201 |
m_state = ALIVE; |
|
202 |
UpdateSeen (); |
|
203 |
} |
|
204 |
||
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
205 |
bool |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1341
diff
changeset
|
206 |
ArpCache::Entry::UpdateWaitReply (Ptr<Packet> waiting) |
242 | 207 |
{ |
286
57e6a2006962
convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
243
diff
changeset
|
208 |
NS_ASSERT (m_state == WAIT_REPLY); |
242 | 209 |
/* We are already waiting for an answer so |
210 |
* we dump the previously waiting packet and |
|
211 |
* replace it with this one. |
|
212 |
*/ |
|
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
213 |
if (m_pending.size () >= m_arp->m_pendingQueueSize) |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
214 |
{ |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
215 |
return false; |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
216 |
} |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
217 |
m_pending.push_back (waiting); |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
218 |
return true; |
242 | 219 |
} |
220 |
void |
|
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1341
diff
changeset
|
221 |
ArpCache::Entry::MarkWaitReply (Ptr<Packet> waiting) |
242 | 222 |
{ |
286
57e6a2006962
convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
243
diff
changeset
|
223 |
NS_ASSERT (m_state == ALIVE || m_state == DEAD); |
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
224 |
NS_ASSERT (m_pending.empty ()); |
242 | 225 |
m_state = WAIT_REPLY; |
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
226 |
m_pending.push_back (waiting); |
242 | 227 |
UpdateSeen (); |
228 |
} |
|
229 |
||
1161
bb72baff8b26
replace MacAddress by Address
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
568
diff
changeset
|
230 |
Address |
242 | 231 |
ArpCache::Entry::GetMacAddress (void) |
232 |
{ |
|
286
57e6a2006962
convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
243
diff
changeset
|
233 |
NS_ASSERT (m_state == ALIVE); |
242 | 234 |
return m_macAddress; |
235 |
} |
|
236 |
bool |
|
237 |
ArpCache::Entry::IsExpired (void) |
|
238 |
{ |
|
239 |
Time timeout; |
|
240 |
switch (m_state) { |
|
241 |
case ArpCache::Entry::WAIT_REPLY: |
|
242 |
timeout = m_arp->GetWaitReplyTimeout (); |
|
243 |
break; |
|
244 |
case ArpCache::Entry::DEAD: |
|
245 |
timeout = m_arp->GetDeadTimeout (); |
|
246 |
break; |
|
247 |
case ArpCache::Entry::ALIVE: |
|
248 |
timeout = m_arp->GetAliveTimeout (); |
|
249 |
break; |
|
250 |
default: |
|
286
57e6a2006962
convert use of <cassert> to "ns3/assert.h"
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
243
diff
changeset
|
251 |
NS_ASSERT (false); |
242 | 252 |
timeout = Seconds (0); |
253 |
/* NOTREACHED */ |
|
254 |
break; |
|
255 |
} |
|
256 |
Time delta = Simulator::Now () - m_lastSeen; |
|
257 |
if (delta >= timeout) |
|
258 |
{ |
|
259 |
return true; |
|
260 |
} |
|
261 |
else |
|
262 |
{ |
|
263 |
return false; |
|
264 |
} |
|
265 |
} |
|
3151
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
266 |
Ptr<Packet> |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
267 |
ArpCache::Entry::DequeuePending (void) |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
268 |
{ |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
269 |
if (m_pending.empty ()) |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
270 |
{ |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
271 |
return 0; |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
272 |
} |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
273 |
else |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
274 |
{ |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
275 |
Ptr<Packet> p = m_pending.front (); |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
276 |
m_pending.pop_front (); |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
277 |
return p; |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
278 |
} |
428f8ec6da29
fix bug 185
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3146
diff
changeset
|
279 |
} |
242 | 280 |
void |
281 |
ArpCache::Entry::UpdateSeen (void) |
|
282 |
{ |
|
283 |
m_lastSeen = Simulator::Now (); |
|
284 |
} |
|
285 |
||
286 |
} // namespace ns3 |
|
287 |