/* The reference count of the newly created net buffer is set to 1. The reference count of the associated net vector is increased by one. */
NET_BUF* EFIAPI NetbufClone(IN NET_BUF *Nbuf)
/* The reference count of the newly created net buffer is set to 1. The reference count of the associated net vector is increased by one. */
NET_BUF* EFIAPI NetbufClone(IN NET_BUF *Nbuf)
{
  NET_BUF  *Clone;
  NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);
  Clone = AllocatePool (NET_BUF_SIZE (Nbuf->BlockOpNum));
  if (Clone == NULL) {
    return NULL;
  }
  Clone->Signature = NET_BUF_SIGNATURE;
  Clone->RefCnt    = 1;
  InitializeListHead (&Clone->List);
  Clone->Ip  = Nbuf->Ip;
  Clone->Tcp = Nbuf->Tcp;
  CopyMem (Clone->ProtoData, Nbuf->ProtoData, NET_PROTO_DATA);
  NET_GET_REF (Nbuf->Vector);
  Clone->Vector     = Nbuf->Vector;
  Clone->BlockOpNum = Nbuf->BlockOpNum;
  Clone->TotalSize  = Nbuf->TotalSize;
  CopyMem (Clone->BlockOp, Nbuf->BlockOp, sizeof (NET_BLOCK_OP) * Nbuf->BlockOpNum);
  return Clone;
}