/* Call user provided callback function, and return the value the function returns. If the user doesn't provide a callback, a proper return value is selected to let the caller continue the normal process. */
EFI_STATUS DhcpCallUser(IN DHCP_SERVICE *DhcpSb, IN EFI_DHCP4_EVENT Event, IN EFI_DHCP4_PACKET *Packet OPTIONAL, OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL)
/* Call user provided callback function, and return the value the function returns. If the user doesn't provide a callback, a proper return value is selected to let the caller continue the normal process. */
EFI_STATUS DhcpCallUser(IN DHCP_SERVICE *DhcpSb, IN EFI_DHCP4_EVENT Event, IN EFI_DHCP4_PACKET *Packet OPTIONAL, OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL)
{
  EFI_DHCP4_CONFIG_DATA  *Config;
  EFI_STATUS             Status;
  if (NewPacket != NULL) {
    *NewPacket = NULL;
  }
  Config = &DhcpSb->ActiveConfig;
  if (Config->Dhcp4Callback == NULL) {
    if (Event == Dhcp4RcvdOffer) {
      return EFI_NOT_READY;
    }
    return EFI_SUCCESS;
  }
  Status = Config->Dhcp4Callback (
                     &DhcpSb->ActiveChild->Dhcp4Protocol,
                     Config->CallbackContext,
                     (EFI_DHCP4_STATE)DhcpSb->DhcpState,
                     Event,
                     Packet,
                     NewPacket
                     );
  if ((Status == EFI_SUCCESS) || (Status == EFI_NOT_READY)) {
    return Status;
  }
  return EFI_ABORTED;
}