/* This function gets EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE by known owner handle. */
EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE* GetInstanceByOwner(IN EFI_HANDLE ImageHandle, IN EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *TargetNetworkInterface, IN EFI_REDFISH_DISCOVER_FLAG DiscoverFlags)
/* This function gets EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE by known owner handle. */
EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE* GetInstanceByOwner(IN EFI_HANDLE ImageHandle, IN EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *TargetNetworkInterface, IN EFI_REDFISH_DISCOVER_FLAG DiscoverFlags)
{
  EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE  *ThisInstance;
  if (IsListEmpty (&mRedfishDiscoverList)) {
    return NULL;
  }
  ThisInstance =
    (EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE *)GetFirstNode (&mRedfishDiscoverList);
  while (TRUE) {
    if ((ThisInstance->Owner == ImageHandle) &&
        (ThisInstance->DiscoverFlags == DiscoverFlags) &&
        (ThisInstance->NetworkInterface == TargetNetworkInterface))
    {
      return ThisInstance;
    }
    if (IsNodeAtEnd (&mRedfishDiscoverList, &ThisInstance->Entry)) {
      break;
    }
    ThisInstance =
      (EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE *)GetNextNode (&mRedfishDiscoverList, &ThisInstance->Entry);
  }
  return NULL;
}