/* Convert the decimal dotted IPv4 address into the binary IPv4 address. */
EFI_STATUS Ip4Config2StrToIp(IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS *Ip)
/* Convert the decimal dotted IPv4 address into the binary IPv4 address. */
EFI_STATUS Ip4Config2StrToIp(IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS *Ip)
{
  UINTN  Index;
  UINTN  Number;
  Index = 0;
  while (*Str != L'\0') {
    if (Index > 3) {
      return EFI_INVALID_PARAMETER;
    }
    Number = 0;
    while ((*Str >= L'0') && (*Str <= L'9')) {
      Number = Number * 10 + (*Str - L'0');
      Str++;
    }
    if (Number > 0xFF) {
      return EFI_INVALID_PARAMETER;
    }
    Ip->Addr[Index] = (UINT8)Number;
    if ((*Str != L'\0') && (*Str != L'.')) {
      return EFI_INVALID_PARAMETER;
    }
    if (*Str == L'.') {
      Str++;
    }
    Index++;
  }
  if (Index != 4) {
    return EFI_INVALID_PARAMETER;
  }
  return EFI_SUCCESS;
}