/* The default time out value is 5 seconds. If IP has retrieved the default address, the UDP is reconfigured. */
BOOLEAN Dns4GetMapping(IN DNS_INSTANCE *Instance, IN UDP_IO *UdpIo, IN EFI_UDP4_CONFIG_DATA *UdpCfgData)
/* The default time out value is 5 seconds. If IP has retrieved the default address, the UDP is reconfigured. */
BOOLEAN Dns4GetMapping(IN DNS_INSTANCE *Instance, IN UDP_IO *UdpIo, IN EFI_UDP4_CONFIG_DATA *UdpCfgData)
{
  DNS_SERVICE        *Service;
  EFI_IP4_MODE_DATA  Ip4Mode;
  EFI_UDP4_PROTOCOL  *Udp;
  EFI_STATUS         Status;
  ASSERT (Instance->Dns4CfgData.UseDefaultSetting);
  Service = Instance->Service;
  Udp     = UdpIo->Protocol.Udp4;
  Status = gBS->SetTimer (
                  Service->TimerToGetMap,
                  TimerRelative,
                  DNS_TIME_TO_GETMAP * TICKS_PER_SECOND
                  );
  if (EFI_ERROR (Status)) {
    return FALSE;
  }
  while (EFI_ERROR (gBS->CheckEvent (Service->TimerToGetMap))) {
    Udp->Poll (Udp);
    if (!EFI_ERROR (Udp->GetModeData (Udp, NULL, &Ip4Mode, NULL, NULL)) &&
        Ip4Mode.IsConfigured)
    {
      Udp->Configure (Udp, NULL);
      return (BOOLEAN)(Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS);
    }
  }
  return FALSE;
}