/* Append an option to the memory, if the option is longer than 255 bytes, splits it into several options. */
UINT8* DhcpAppendOption(OUT UINT8 *Buf, IN UINT8 Tag, IN UINT16 DataLen, IN UINT8 *Data)
/* Append an option to the memory, if the option is longer than 255 bytes, splits it into several options. */
UINT8* DhcpAppendOption(OUT UINT8 *Buf, IN UINT8 Tag, IN UINT16 DataLen, IN UINT8 *Data)
{
  INTN  Index;
  INTN  Len;
  ASSERT (DataLen != 0);
  for (Index = 0; Index < (DataLen + 254) / 255; Index++) {
    Len = MIN (255, DataLen - Index * 255);
    *(Buf++) = Tag;
    *(Buf++) = (UINT8)Len;
    CopyMem (Buf, Data + Index * 255, (UINTN)Len);
    Buf += Len;
  }
  return Buf;
}