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.",
130 if ((*i)->GetDevice () == device)
148 NS_LOG_LOGIC (
"ARP: received packet of size "<< packet->GetSize ());
160 uint32_t size = packet->RemoveHeader (arp);
167 " node="<<
m_node->
GetId ()<<
", got request from " <<
170 for (uint32_t i = 0; i < cache->GetInterface ()->GetNAddresses (); i++)
172 NS_LOG_LOGIC (cache->GetInterface ()->GetAddress (i).GetLocal () <<
", ");
180 for (uint32_t i = 0; i < cache->GetInterface ()->GetNAddresses (); i++)
183 cache->GetInterface ()->GetAddress (i).GetLocal ())
205 <<
" for waiting entry -- flush");
211 cache->GetInterface ()->Send (pending,
222 " for non-waiting entry -- drop");
257 ", dead entry for " << destination <<
" expired -- send arp request");
264 ", alive entry for " << destination <<
" expired -- send arp request");
270 NS_FATAL_ERROR (
"Test for possibly unreachable code-- please file a bug report, with a test case, if this is ever hit");
278 ", dead entry for " << destination <<
" valid -- drop");
284 ", alive entry for " << destination <<
" valid -- send");
291 ", wait reply for " << destination <<
" valid -- drop previous");
303 ", no entry for " << destination <<
" -- send arp request");
304 entry = cache->
Add (destination);
325 " || src: " << device->GetAddress () <<
" / " << source <<
326 " || dst: " << device->GetBroadcast () <<
" / " << to);
327 arp.
SetRequest (device->GetAddress (), source, device->GetBroadcast (), to);
329 cache->GetDevice ()->Send (packet, device->GetBroadcast (),
PROT_NUMBER);
338 "|| src: " << cache->GetDevice ()->GetAddress () <<
340 " || dst: " << toMac <<
" / " << toIp);
341 arp.
SetReply (cache->GetDevice ()->GetAddress (), myIp, toMac, toIp);
344 cache->GetDevice ()->Send (packet, toMac,
PROT_NUMBER);