- How to get the offset in the chained NDIS packet buffer?
- Posted by Liang Chen on June 13th, 2005
Hi all,
I am a fledging in NDIS driver. Currently, I try to get the packet buffer
via the function
VOID
NdisGetFirstBufferFromPacket(
IN PNDIS_PACKET Packet,
OUT PNDIS_BUFFER *FirstBuffer,
OUT PVOID *FirstBufferVA,
OUT PUINT FirstBufferLength,
OUT PUINT TotalBufferLength
);
However, if the offset I want to get is out of the current buffer, for
example, the IP header, how can I get the pointer? Access FirstBufferVA[
sizeof( MAC_HEADER ) ] directly or go through the buffer list one by one?
And what should be considerated when I access virtual address and physical
address>
Many thanks!
-Liang
- Posted by Maxim S. Shatskih on June 13th, 2005
NdisQueryBuffer can help.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
- Posted by Calvin Guan on June 13th, 2005
Or better, NdisQueryBufferSafe if you don't care 9x.
--
Calvin Guan Windows DDK MVP
Staff SW Engineer, NetXtreme MINIPORT
Enterprise Network Controller Engineering
Broadcom Corporation www.broadcom.com
"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:uyk13T$bFHA.3320@TK2MSFTNGP10.phx.gbl...
- Posted by Liang Chen on June 13th, 2005
Thank for your immediate replies.
Actually, I get the first block buffer of a packet by
NdisGetFirstBufferFromPacketSafe( pNdisPacket, pNdisBuffer, &pEthHeader,
&BufLen, &TotalBufLen );
When I find the present buffer block is insufficient for the ip header by
NdisBufferLength(), how can I update the pointer to the next buffer in the
linked list?
NdisGetNextBuffer( pNdisBuffer, &pNdisNextBuffer );
or
NdisGetNextBuffer( (PNDIS_BUFFER) pEthHeader, &pNdisNextBuffer );
Thanks!
-Liang
"Calvin Guan" wrote:
- Posted by Stephan Wolf [MVP] on June 13th, 2005
Liang Chen wrote:
Since the actual packet (frame) data of each NDIS_PACKET is an
NDIS_BUFFER list, the first method is correct, i.e.
NdisGetNextBuffer( pNdisBuffer, &pNdisNextBuffer );
[Note that a packet can also consist of just one single NDIS_BUFFER,
usually true for received packets.]
Stephan