sendlist.cpp
来自「CIRRUS 公司EP93XX系列CPU的WINCE下的BSP」· C++ 代码 · 共 98 行
CPP
98 行
//**********************************************************************
//
// Filename: sendlist.cpp
//
// Description: Contains the list of packets for sending.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
// Copyright(c) Cirrus Logic Corporation 2001, All Rights Reserved
//
//**********************************************************************
#include <windows.h>
extern "C"
{
#include <ndis.h>
#include <ntddndis.h>
}
#include <linklist.h>
#include <ceddk.h>
#include "sendlist.h"
//****************************************************************************
// SendList::SendList
//****************************************************************************
// Constructor
//
//
SendList::SendList()
{
InitializeListHead(&m_PendingList);
}
//****************************************************************************
// SendList::AddPendingBuffer
//****************************************************************************
// Add an item to the list.
//
//
void SendList::AddPendingPacket
(
PNDIS_PACKET pNdisPacket
)
{
InsertTailList( &m_PendingList, (LIST_ENTRY *)&(pNdisPacket->MiniportReserved));
}
//****************************************************************************
// SendList::RemoveNextBuffer
//****************************************************************************
// Remove the next item in the list.
//
//
PNDIS_PACKET SendList::RemoveNextPacket()
{
LIST_ENTRY *pListItem;
PNDIS_PACKET pNdisPacket = 0;
if(!IsListEmpty(&m_PendingList))
{
pListItem = RemoveTailList(&m_PendingList);
pNdisPacket = ConvertListToSendNDISPacket(pListItem);
}
return (pNdisPacket);
}
//****************************************************************************
// SendList::MorePackets
//****************************************************************************
// Check to see if there are any more packets on the list.
//
//
BOOL SendList::MorePackets()
{
return (!IsListEmpty(&m_PendingList));
}
//****************************************************************************
// ConvertListToNDISPacket
//****************************************************************************
// This routine converts the address of the list item to the address of the
// NDIS_PACKET.
//
// Important:
// This is based on the fact that the size of MiniportReserved portion of
// the NDIS_PACKET is 8 characters and the LIST_ENTRY size is also 8
// characters.
//
//
PNDIS_PACKET ConvertListToSendNDISPacket(LIST_ENTRY *pListEntry)
{
return((PNDIS_PACKET)(((char *)pListEntry) - sizeof(NDIS_PACKET_PRIVATE)));
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?