/* Find the CacheEntry which matches the requirements in the specified CacheTable. */
ARP_CACHE_ENTRY* ArpFindNextCacheEntryInTable(IN LIST_ENTRY *CacheTable, IN LIST_ENTRY *StartEntry, IN FIND_OPTYPE FindOpType, IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL, IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL)
/* Find the CacheEntry which matches the requirements in the specified CacheTable. */
ARP_CACHE_ENTRY* ArpFindNextCacheEntryInTable(IN LIST_ENTRY *CacheTable, IN LIST_ENTRY *StartEntry, IN FIND_OPTYPE FindOpType, IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL, IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL)
{
  LIST_ENTRY       *Entry;
  ARP_CACHE_ENTRY  *CacheEntry;
  if (StartEntry == NULL) {
    StartEntry = CacheTable;
  }
  for (Entry = StartEntry->ForwardLink; Entry != CacheTable; Entry = Entry->ForwardLink) {
    CacheEntry = NET_LIST_USER_STRUCT (Entry, ARP_CACHE_ENTRY, List);
    if ((FindOpType & MATCH_SW_ADDRESS) != 0) {
      if (!ArpMatchAddress (ProtocolAddress, &CacheEntry->Addresses[Protocol])) {
        continue;
      }
    }
    if ((FindOpType & MATCH_HW_ADDRESS) != 0) {
      if (!ArpMatchAddress (HardwareAddress, &CacheEntry->Addresses[Hardware])) {
        continue;
      }
    }
    return CacheEntry;
  }
  return NULL;
}