In my intermediate driver (ndis5.1), i just want to check each tcp/udp
packet's port number. I check the packet in the way that copy each packet
content to my own buffer and then check the port number.
I want to know is there any way to know the tcp/ucp packet port number
without copying the content each time?
Or the copy procedure is the must be....?
Thanks for your advice!

Re: How to get a tcp/ucp port in im driver without copying all packet by PCAUSA

PCAUSA
Mon Feb 04 08:20:30 CST 2008

On Feb 4, 12:02=A0am, "LIMING" <someblue2...@hotmail.com> wrote:
> In my intermediate driver (ndis5.1), i just want to check each tcp/udp
> packet's port number. I check the packet in the way that copy each packet
> content to my own buffer and then check the port number.
> I want to know is there any way to know the tcp/ucp packet port number
> without copying the content each time?
> Or the copy procedure is the must be....?
> Thanks for your advice!

NDIS 6 has an interesting NDIS library function called
"NdisGetDataBuffer" that can be helpful.

There isn't a similar function for NDIS 5, but it should be easy for
you to write a similar function that operates on NDIS 5 packets.
Basically the function would walk the MDL chain until it found the MDL
containing a header and then return a pointer for the data in the MDL.
The premise is that any single specific header would reside in a
single MDL.

NDIS.com shows a somewhat useful function that is called
UtilReadOnPacket the can read parts of packet contents. See the "NDIS
Packet Discussion" at the URL:

http://ndis.com/papers/default.htm

Good luck,

Thomas F. DIvine

Re: How to get a tcp/ucp port in im driver without copying all packet content? by Alireza

Alireza
Tue Feb 05 01:45:59 CST 2008

NdisGetDataBuffer makes parsing the headers easier by copying them to a
contiguous buffer -if- necessary.

That's all.

To OP, I don't understand why you have to copy the headers before checking
out for the port number.

-ali

--
This posting is provided "AS IS" with no warranties, and confers no rights.

NDIS does not
"PCAUSA" <pcausa@gmail.com> wrote in message
news:05e9b5d4-d30a-4af6-bde1-5c70f13a88d0@j78g2000hsd.googlegroups.com...
On Feb 4, 12:02 am, "LIMING" <someblue2...@hotmail.com> wrote:
> In my intermediate driver (ndis5.1), i just want to check each tcp/udp
> packet's port number. I check the packet in the way that copy each packet
> content to my own buffer and then check the port number.
> I want to know is there any way to know the tcp/ucp packet port number
> without copying the content each time?
> Or the copy procedure is the must be....?
> Thanks for your advice!

NDIS 6 has an interesting NDIS library function called
"NdisGetDataBuffer" that can be helpful.

There isn't a similar function for NDIS 5, but it should be easy for
you to write a similar function that operates on NDIS 5 packets.
Basically the function would walk the MDL chain until it found the MDL
containing a header and then return a pointer for the data in the MDL.
The premise is that any single specific header would reside in a
single MDL.

NDIS.com shows a somewhat useful function that is called
UtilReadOnPacket the can read parts of packet contents. See the "NDIS
Packet Discussion" at the URL:

http://ndis.com/papers/default.htm

Good luck,

Thomas F. DIvine