TDI FILTER: ClientEventReceive

Hi All,

I have a TDI filter driver and I notify data to AFD using its receive event
handler, when my procesing is complete.

Here is the call to AFD’s recv event handler

status = HookedReceiveEventHandler(
pTdiEventContext,
pConnectionContext,
TDI_RECEIVE_ENTIRE_MESSAGE ,
BytesIndicated, // In my case 4096 bytes
BytesIndicated, // In my case 4096 bytes
&BytesTaken,
Tsdu,
&IoRequestPacket);

On return, I can see this:

status = STATUS_MORE_PROCESSING_REQUIRED.
BytesTaken = BytesIndicated
IoRequestPacket = A valid IRP.

My doubt is, when client has accepted the full TSDU (it has set BytesTaken
as BytesIndicated),
why is it passing me an IRP?

2 approaches here:

  1. Assuming client has copied all indicated data, I keep this irp pending
    with me (till I dont have more data to pass to AFD )and I complete it when I
    get more data from tcp.
  2. Since it is passing me an IRP, I assume that it has not copied any data
    from given TSDU. I ignore the BytesTaken value and copy the TSDU in the
    IRP-buffer, and complete the irp.

I have already handled partial copy by AFD.
Though the 2nd approach is not looking correct, I want to be sure before
going for 1st approach.

Can anybody clearify my doubt, that when I am notifying a complete TSDU
(TDI_RECEIVE_ENTIRE_MESSAGE) to AFD, why it is behaving like this. And if
so, then is there any other flags that I need to set so that this condition
doesn’t arrive.

Regards
Vijender Yadav

“Vijender” wrote in message news:xxxxx@ntdev…
> Hi All,
>
> I have a TDI filter driver and I notify data to AFD using its receive
> event
> handler, when my procesing is complete.
>
> Here is the call to AFD’s recv event handler
>
> status = HookedReceiveEventHandler(
> pTdiEventContext,
> pConnectionContext,
> TDI_RECEIVE_ENTIRE_MESSAGE ,
> BytesIndicated, // In my case 4096 bytes
> BytesIndicated, // In my case 4096 bytes
> &BytesTaken,
> Tsdu,
> &IoRequestPacket);
>
> On return, I can see this:
>
> status = STATUS_MORE_PROCESSING_REQUIRED.
> BytesTaken = BytesIndicated
> IoRequestPacket = A valid IRP.
>
> My doubt is, when client has accepted the full TSDU (it has set BytesTaken
> as BytesIndicated),
> why is it passing me an IRP?
>
> 2 approaches here:
> 1. Assuming client has copied all indicated data, I keep this irp pending
> with me (till I dont have more data to pass to AFD )and I complete it when
> I
> get more data from tcp.
> 2. Since it is passing me an IRP, I assume that it has not copied any data
> from given TSDU. I ignore the BytesTaken value and copy the TSDU in the
> IRP-buffer, and complete the irp.
>
> I have already handled partial copy by AFD.
> Though the 2nd approach is not looking correct, I want to be sure before
> going for 1st approach.
>
> Can anybody clearify my doubt, that when I am notifying a complete TSDU
> (TDI_RECEIVE_ENTIRE_MESSAGE) to AFD, why it is behaving like this. And if
> so, then is there any other flags that I need to set so that this
> condition
> doesn’t arrive.
>
Approach 1.) is correct. The client has read all the data that was presented
at the event handler callback.

If you give it some thought, you handle the IRP returned from the event
handler almost exactly as you would a TDI_RECEIVE IRP received via
IoCallDriver.

So, the client is just saying “I have read what you have given me. Now give
me some more”.

Hope this helps.

Thomas F. Divine, Windows DDK MVP
http://www.pcausa.com