/* Send an initial DISCOVER or REQUEST message according to the DHCP service's current state. */
EFI_STATUS DhcpInitRequest(IN DHCP_SERVICE *DhcpSb)
/* Send an initial DISCOVER or REQUEST message according to the DHCP service's current state. */
EFI_STATUS DhcpInitRequest(IN DHCP_SERVICE *DhcpSb)
{
  EFI_STATUS  Status;
  ASSERT ((DhcpSb->DhcpState == Dhcp4Init) || (DhcpSb->DhcpState == Dhcp4InitReboot));
  DhcpSb->ActiveChild->ElaspedTime = 0;
  if (DhcpSb->DhcpState == Dhcp4Init) {
    DhcpSetState (DhcpSb, Dhcp4Selecting, FALSE);
    Status = DhcpSendMessage (DhcpSb, NULL, NULL, DHCP_MSG_DISCOVER, NULL);
    if (EFI_ERROR (Status)) {
      DhcpSb->DhcpState = Dhcp4Init;
      return Status;
    }
  } else {
    DhcpSetState (DhcpSb, Dhcp4Rebooting, FALSE);
    Status = DhcpSendMessage (DhcpSb, NULL, NULL, DHCP_MSG_REQUEST, NULL);
    if (EFI_ERROR (Status)) {
      DhcpSb->DhcpState = Dhcp4InitReboot;
      return Status;
    }
  }
  return EFI_SUCCESS;
}