/* Set a random value of the delay timer for the multicast address from the range . If a timer for any address is already running, it is reset to the new random value only if the requested Maximum Response Delay is less than the remaining value of the running timer. If the Query packet specifies a Maximum Response Delay of zero, each timer is effectively set to zero, and the action specified below for timer expiration is performed immediately. */
EFI_STATUS Ip6UpdateDelayTimer(IN IP6_SERVICE *IpSb, IN UINT16 MaxRespDelay, IN EFI_IPv6_ADDRESS *MulticastAddr, IN OUT IP6_MLD_GROUP *Group)
/* Set a random value of the delay timer for the multicast address from the range . If a timer for any address is already running, it is reset to the new random value only if the requested Maximum Response Delay is less than the remaining value of the running timer. If the Query packet specifies a Maximum Response Delay of zero, each timer is effectively set to zero, and the action specified below for timer expiration is performed immediately. */
EFI_STATUS Ip6UpdateDelayTimer(IN IP6_SERVICE *IpSb, IN UINT16 MaxRespDelay, IN EFI_IPv6_ADDRESS *MulticastAddr, IN OUT IP6_MLD_GROUP *Group)
{
  UINT32  Delay;
  if (MaxRespDelay == 0) {
    Group->DelayTimer = 0;
    return Ip6SendMldReport (IpSb, NULL, MulticastAddr);
  }
  Delay = (UINT32)(MaxRespDelay / 1000);
  if ((Group->DelayTimer == 0) || (Delay < Group->DelayTimer)) {
    Group->DelayTimer = Delay / 4294967295UL * NET_RANDOM (NetRandomInitSeed ());
  }
  return EFI_SUCCESS;
}