20 #include "ns3/packet.h"
23 #include "ns3/net-device.h"
24 #include "ns3/object-vector.h"
25 #include "ns3/trace-source-accessor.h"
46 .AddConstructor<ArpL3Protocol> ()
47 .AddAttribute (
"CacheList",
48 "The list of ARP caches",
51 MakeObjectVectorChecker<ArpCache> ())
52 .AddTraceSource (
"Drop",
53 "Packet dropped because not enough room in pending queue for a specific cache entry.",
131 if ((*i)->GetDevice () == device)
149 NS_LOG_LOGIC (
"ARP: received packet of size "<< packet->GetSize ());
161 uint32_t size = packet->RemoveHeader (arp);
168 " node="<<
m_node->
GetId ()<<
", got request from " <<
171 for (uint32_t i = 0; i < cache->GetInterface ()->GetNAddresses (); i++)
173 NS_LOG_LOGIC (cache->GetInterface ()->GetAddress (i).GetLocal () <<
", ");
181 for (uint32_t i = 0; i < cache->GetInterface ()->GetNAddresses (); i++)
184 cache->GetInterface ()->GetAddress (i).GetLocal ())
206 <<
" for waiting entry -- flush");
212 cache->GetInterface ()->Send (pending,
223 " for non-waiting entry -- drop");
249 NS_LOG_FUNCTION (
this << packet << destination << device << cache << hardwareDestination);
258 ", dead entry for " << destination <<
" expired -- send arp request");
265 ", alive entry for " << destination <<
" expired -- send arp request");
271 NS_FATAL_ERROR (
"Test for possibly unreachable code-- please file a bug report, with a test case, if this is ever hit");
279 ", dead entry for " << destination <<
" valid -- drop");
285 ", alive entry for " << destination <<
" valid -- send");
292 ", wait reply for " << destination <<
" valid -- drop previous");
304 ", no entry for " << destination <<
" -- send arp request");
305 entry = cache->
Add (destination);
326 " || src: " << device->GetAddress () <<
" / " << source <<
327 " || dst: " << device->GetBroadcast () <<
" / " << to);
328 arp.
SetRequest (device->GetAddress (), source, device->GetBroadcast (), to);
330 cache->GetDevice ()->Send (packet, device->GetBroadcast (),
PROT_NUMBER);
339 "|| src: " << cache->GetDevice ()->GetAddress () <<
341 " || dst: " << toMac <<
" / " << toIp);
342 arp.
SetReply (cache->GetDevice ()->GetAddress (), myIp, toMac, toIp);
345 cache->GetDevice ()->Send (packet, toMac,
PROT_NUMBER);