/* If Map is NULL, then ASSERT(). If CallBack is NULL, then ASSERT(). */
EFI_STATUS EFIAPI NetMapIterate(IN NET_MAP *Map, IN NET_MAP_CALLBACK CallBack, IN VOID *Arg OPTIONAL)
/* If Map is NULL, then ASSERT(). If CallBack is NULL, then ASSERT(). */
EFI_STATUS EFIAPI NetMapIterate(IN NET_MAP *Map, IN NET_MAP_CALLBACK CallBack, IN VOID *Arg OPTIONAL)
{
  LIST_ENTRY    *Entry;
  LIST_ENTRY    *Next;
  LIST_ENTRY    *Head;
  NET_MAP_ITEM  *Item;
  EFI_STATUS    Result;
  ASSERT ((Map != NULL) && (CallBack != NULL));
  Head = &Map->Used;
  if (IsListEmpty (Head)) {
    return EFI_SUCCESS;
  }
  NET_LIST_FOR_EACH_SAFE (Entry, Next, Head) {
    Item   = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);
    Result = CallBack (Map, Item, Arg);
    if (EFI_ERROR (Result)) {
      return Result;
    }
  }
  return EFI_SUCCESS;
}