/// <summary> /// ARP cache update. /// </summary> /// <param name="arp_reply">ARP reply.</param> /// <exception cref="sys.ArgumentException">Thrown if arp_reply.SenderIP is not a IPv4Address.</exception> internal static void ARPCache_Update(ARPReply_Ethernet arp_reply) { EnsureQueueExists(); //foreach (BufferEntry entry in queue) for (int e = 0; e < queue.Count; e++) { BufferEntry entry = queue[e]; if (entry.Status == BufferEntry.EntryStatus.ARP_SENT) { var xDestIP = entry.Packet.DestinationIP.Hash; var xSenderIP = arp_reply.SenderIP.Hash; if (entry.Packet.DestinationIP.CompareTo(arp_reply.SenderIP) == 0) { entry.Packet.DestinationMAC = arp_reply.SenderMAC; entry.Status = BufferEntry.EntryStatus.JUST_SEND; } } else if (entry.Status == BufferEntry.EntryStatus.ROUTE_ARP_SENT) { if (entry.nextHop.CompareTo(arp_reply.SenderIP) == 0) { entry.Packet.DestinationMAC = arp_reply.SenderMAC; entry.Status = BufferEntry.EntryStatus.JUST_SEND; } } } }
internal static void ARPCache_Update(ARPReply_Ethernet arp_reply) { ensureQueueExists(); //foreach (BufferEntry entry in queue) for (int e = 0; e < queue.Count; e++) { BufferEntry entry = queue[e]; if (entry.Status == BufferEntry.EntryStatus.ARP_SENT) { var xDestIP = entry.Packet.DestinationIP.Hash; var xSenderIP = arp_reply.SenderIP.Hash; if (entry.Packet.DestinationIP.CompareTo(arp_reply.SenderIP) == 0) { entry.Packet.DestinationMAC = arp_reply.SenderMAC; entry.Status = BufferEntry.EntryStatus.DONE; } } else if (entry.Status == BufferEntry.EntryStatus.ROUTE_ARP_SENT) { if (entry.nextHop.CompareTo(arp_reply.SenderIP) == 0) { entry.Packet.DestinationMAC = arp_reply.SenderMAC; entry.Status = BufferEntry.EntryStatus.JUST_SEND; } } } }