equal
deleted
inserted
replaced
20 #include "ns3/packet.h" |
20 #include "ns3/packet.h" |
21 #include "ns3/log.h" |
21 #include "ns3/log.h" |
22 #include "ns3/node.h" |
22 #include "ns3/node.h" |
23 #include "ns3/net-device.h" |
23 #include "ns3/net-device.h" |
24 #include "ns3/object-vector.h" |
24 #include "ns3/object-vector.h" |
|
25 #include "ns3/trace-source-accessor.h" |
25 |
26 |
26 #include "ipv4-l3-protocol.h" |
27 #include "ipv4-l3-protocol.h" |
27 #include "arp-l3-protocol.h" |
28 #include "arp-l3-protocol.h" |
28 #include "arp-header.h" |
29 #include "arp-header.h" |
29 #include "arp-cache.h" |
30 #include "arp-cache.h" |
45 .AddAttribute ("CacheList", |
46 .AddAttribute ("CacheList", |
46 "The list of ARP caches", |
47 "The list of ARP caches", |
47 ObjectVectorValue (), |
48 ObjectVectorValue (), |
48 MakeObjectVectorAccessor (&ArpL3Protocol::m_cacheList), |
49 MakeObjectVectorAccessor (&ArpL3Protocol::m_cacheList), |
49 MakeObjectVectorChecker<ArpCache> ()) |
50 MakeObjectVectorChecker<ArpCache> ()) |
|
51 .AddTraceSource ("Drop", |
|
52 "Packet dropped because not enough room in pending queue for a specific cache entry.", |
|
53 MakeTraceSourceAccessor (&ArpL3Protocol::m_dropTrace)) |
50 ; |
54 ; |
51 return tid; |
55 return tid; |
52 } |
56 } |
53 |
57 |
54 ArpL3Protocol::ArpL3Protocol () |
58 ArpL3Protocol::ArpL3Protocol () |
167 // ignore this reply which might well be an attempt |
171 // ignore this reply which might well be an attempt |
168 // at poisening my arp cache. |
172 // at poisening my arp cache. |
169 NS_LOG_LOGIC("node="<<m_node->GetId ()<<", got reply from " << |
173 NS_LOG_LOGIC("node="<<m_node->GetId ()<<", got reply from " << |
170 arp.GetSourceIpv4Address () << |
174 arp.GetSourceIpv4Address () << |
171 " for non-waiting entry -- drop"); |
175 " for non-waiting entry -- drop"); |
172 // XXX report packet as dropped. |
176 m_dropTrace (packet); |
173 } |
177 } |
174 } |
178 } |
175 else |
179 else |
176 { |
180 { |
177 NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got reply for unknown entry -- drop"); |
181 NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got reply for unknown entry -- drop"); |
178 // XXX report packet as dropped. |
182 m_dropTrace (packet); |
179 } |
183 } |
180 } |
184 } |
181 else |
185 else |
182 { |
186 { |
183 NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got request from " << |
187 NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got request from " << |
214 else if (entry->IsWaitReply ()) |
218 else if (entry->IsWaitReply ()) |
215 { |
219 { |
216 NS_LOG_LOGIC ("node="<<m_node->GetId ()<< |
220 NS_LOG_LOGIC ("node="<<m_node->GetId ()<< |
217 ", wait reply for " << destination << " expired -- drop"); |
221 ", wait reply for " << destination << " expired -- drop"); |
218 entry->MarkDead (); |
222 entry->MarkDead (); |
219 // XXX report packet as 'dropped' |
223 while (true) |
|
224 { |
|
225 Ptr<Packet> pending = entry->DequeuePending(); |
|
226 if (pending != 0) |
|
227 { |
|
228 break; |
|
229 } |
|
230 m_dropTrace (pending); |
|
231 } |
|
232 m_dropTrace (packet); |
220 } |
233 } |
221 } |
234 } |
222 else |
235 else |
223 { |
236 { |
224 if (entry->IsDead ()) |
237 if (entry->IsDead ()) |
225 { |
238 { |
226 NS_LOG_LOGIC ("node="<<m_node->GetId ()<< |
239 NS_LOG_LOGIC ("node="<<m_node->GetId ()<< |
227 ", dead entry for " << destination << " valid -- drop"); |
240 ", dead entry for " << destination << " valid -- drop"); |
228 // XXX report packet as 'dropped' |
241 m_dropTrace (packet); |
229 } |
242 } |
230 else if (entry->IsAlive ()) |
243 else if (entry->IsAlive ()) |
231 { |
244 { |
232 NS_LOG_LOGIC ("node="<<m_node->GetId ()<< |
245 NS_LOG_LOGIC ("node="<<m_node->GetId ()<< |
233 ", alive entry for " << destination << " valid -- send"); |
246 ", alive entry for " << destination << " valid -- send"); |
236 } |
249 } |
237 else if (entry->IsWaitReply ()) |
250 else if (entry->IsWaitReply ()) |
238 { |
251 { |
239 NS_LOG_LOGIC ("node="<<m_node->GetId ()<< |
252 NS_LOG_LOGIC ("node="<<m_node->GetId ()<< |
240 ", wait reply for " << destination << " valid -- drop previous"); |
253 ", wait reply for " << destination << " valid -- drop previous"); |
241 // XXX potentially report current packet as 'dropped' |
254 if (!entry->UpdateWaitReply (packet)) |
242 entry->UpdateWaitReply (packet); |
255 { |
|
256 m_dropTrace (packet); |
|
257 } |
243 } |
258 } |
244 } |
259 } |
245 } |
260 } |
246 else |
261 else |
247 { |
262 { |