Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > Receiving Udp Packets

Reply
Thread Tools Display Modes

Receiving Udp Packets

 
 
Harald
Guest
Posts: n/a

 
      07-01-2009

Hi
I set an EventHandler for receiving UDP Packet over TDI. When I receive a
packet the function is called but i dont get the IP Address and the Port from
where the packet was send. There is an Pointer to an struct with the
SourceAddress but i dont found which structure is used?

NTSTATUS ReceiveData(PVOID TdiEventContext,
LONG SourceAddressLength,
PVOID SourceAddress,
LONG OptionsLength,
PVOID Options,
ULONG ReceiveDatagramFlags,
ULONG BytesIndicated,
ULONG BytesAvailable,
ULONG *BytesTaken,
PVOID Tsdu,
PIRP *IoRequestPacket)

Did somebody know which structure sourceAddress is?
TDI_CONNECTION_INFORMATION, TA_IP_ADDRESS, ....

Harald
 
Reply With Quote
 
 
 
 
Volodymyr Shcherbyna
Guest
Posts: n/a

 
      07-01-2009

SourceAddress is a pointer to TRANSPORT_ADDRESS structure in all UDP event
handlers.

--
Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)

"Harald" <> wrote in message
news:2FE3F621-C978-476A-897F-...
> Hi
> I set an EventHandler for receiving UDP Packet over TDI. When I receive a
> packet the function is called but i dont get the IP Address and the Port
> from
> where the packet was send. There is an Pointer to an struct with the
> SourceAddress but i dont found which structure is used?
>
> NTSTATUS ReceiveData(PVOID TdiEventContext,
> LONG SourceAddressLength,
> PVOID SourceAddress,
> LONG OptionsLength,
> PVOID Options,
> ULONG ReceiveDatagramFlags,
> ULONG BytesIndicated,
> ULONG BytesAvailable,
> ULONG *BytesTaken,
> PVOID Tsdu,
> PIRP *IoRequestPacket)
>
> Did somebody know which structure sourceAddress is?
> TDI_CONNECTION_INFORMATION, TA_IP_ADDRESS, ....
>
> Harald



 
Reply With Quote
 
Harald
Guest
Posts: n/a

 
      07-01-2009

Thanks for the answer! Another Question about these function. In the
documentation is written that the function works at dispatchlevel. Now i have
to read and write variables fom nonpagedpool but i alwas get an BLuescreen
with Irqlevel_not_less_or_equal! Is there an possibility to use this function
in the passive level?

NTSTATUS ReceiveData(PVOID TdiEventContext,
LONG SourceAddressLength,
PVOID SourceAddress,
LONG OptionsLength,
PVOID Options,
ULONG ReceiveDatagramFlags,
ULONG BytesIndicated,
ULONG BytesAvailable,
ULONG *BytesTaken,
PVOID Tsdu,
PIRP *IoRequestPacket)
{
SESSION_INFO* tmpSession = (SESSION_INFO*)TdiEventContext;
TRANSPORT_ADDRESS* transAddr = (TRANSPORT_ADDRESS*)SourceAddress;
TA_ADDRESS* addr = (TA_ADDRESS*)transAddr->Address;
TDI_ADDRESS_IP* ipAddr = (TDI_ADDRESS_IP*)addr->Address;
rtp_send_hdr_t* rtpHeader;

//DbgPrint("ReceiveData: Packet Received for session %i from IP %0x\n",
tmpSession->SessionId, ipAddr->in_addr);

if(driverExtension->UnloadStatus == TRUE)
{
DbgPrint("ReceiveData: Driver is Unloaded\n");
return STATUS_SUCCESS;
}

if(tmpSession = NULL)
{
DbgPrint("ReceiveData: RtpSession is NULL\n");
return STATUS_SUCCESS;
}

// checks if the packet is from the rigth IP address
if(ipAddr->in_addr != tmpSession->DestIp) <====BSOD
{
DbgPrint("ReceiveData: Packet with wrong IP received for session %i\n",
tmpSession->SessionId);
// send an event to the service that an packet for no session received
tmpSession->WrongPacketIn = 1;
tmpSession->WrongPacketIp = ipAddr->in_addr;
tmpSession->WrongPacketPort = ipAddr->sin_port;

return STATUS_SUCCESS;
}

return STATUS_SUCCESS;
}

 
Reply With Quote
 
Volodymyr Shcherbyna
Guest
Posts: n/a

 
      07-01-2009

"Harald" <> wrote in message
news:833AEA72-9732-454D-AD67-...
> Thanks for the answer! Another Question about these function. In the
> documentation is written that the function works at dispatchlevel. Now i
> have
> to read and write variables fom nonpagedpool but i alwas get an BLuescreen
> with Irqlevel_not_less_or_equal! Is there an possibility to use this
> function
> in the passive level?


The fact that this function is mentioned to be executed at dispatch level
means that you have to operate with non paged data and with functions which
are capable to work at dispatch level. Period. If you got any problems with
that - check your code in order to fullfill these requirements.

No, you can't get it to work at passive level, because system invokes your
callback on it's own, you can't force OS to change her mind, do you?

--
Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)


 
Reply With Quote
 
Harald
Guest
Posts: n/a

 
      07-01-2009

Thats not a good answer for me because i have an driverExtension which is
allocated form nonpagedpool and in my receive function i have to read and
write valuse from this driverExtension.

"Volodymyr Shcherbyna" wrote:

> "Harald" <> wrote in message
> news:833AEA72-9732-454D-AD67-...
> > Thanks for the answer! Another Question about these function. In the
> > documentation is written that the function works at dispatchlevel. Now i
> > have
> > to read and write variables fom nonpagedpool but i alwas get an BLuescreen
> > with Irqlevel_not_less_or_equal! Is there an possibility to use this
> > function
> > in the passive level?

>
> The fact that this function is mentioned to be executed at dispatch level
> means that you have to operate with non paged data and with functions which
> are capable to work at dispatch level. Period. If you got any problems with
> that - check your code in order to fullfill these requirements.
>
> No, you can't get it to work at passive level, because system invokes your
> callback on it's own, you can't force OS to change her mind, do you?
>
> --
> Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
> (This posting is provided "AS IS" with no warranties, and confers no
> rights)
>
>
>

 
Reply With Quote
 
Volodymyr Shcherbyna
Guest
Posts: n/a

 
      07-01-2009

"Harald" <> wrote in message
news:A2391B49-2DA2-4244-855E-...
> Thats not a good answer for me because i have an driverExtension which is
> allocated form nonpagedpool and in my receive function i have to read and
> write valuse from this driverExtension.


So recheck your code. I told you two conditions under which you would cause
IRQL NOT LESS OR EQUAL in event callback.

--
Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)


 
Reply With Quote
 
Volodymyr Shcherbyna
Guest
Posts: n/a

 
      07-01-2009

You could also get this problem if the data you are accessing is wrong,
i.e., accessing variable by a wrong pointer, it could be not connected to
irql level. Check the output of analyze -v and check all variables in
debugger before you access them.

--
Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)
"Volodymyr Shcherbyna" <> wrote in message
news:uiEjXWl%...
> "Harald" <> wrote in message
> news:A2391B49-2DA2-4244-855E-...
>> Thats not a good answer for me because i have an driverExtension which is
>> allocated form nonpagedpool and in my receive function i have to read and
>> write valuse from this driverExtension.

>
> So recheck your code. I told you two conditions under which you would
> cause IRQL NOT LESS OR EQUAL in event callback.
>
> --
> Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
> (This posting is provided "AS IS" with no warranties, and confers no
> rights)
>



 
Reply With Quote
 
Harald
Guest
Posts: n/a

 
      07-01-2009

you wrote "that you have to operate with non paged data and". I understand
that so that i only have to work with buffer from nonpegedpool and not with
buffer from pagedpool. My driverExtension is allocated with parameter
nonpagedpool so that should be ok or to i understand that wrong?!

Harald
"Volodymyr Shcherbyna" wrote:

> "Harald" <> wrote in message
> news:A2391B49-2DA2-4244-855E-...
> > Thats not a good answer for me because i have an driverExtension which is
> > allocated form nonpagedpool and in my receive function i have to read and
> > write valuse from this driverExtension.

>
> So recheck your code. I told you two conditions under which you would cause
> IRQL NOT LESS OR EQUAL in event callback.
>
> --
> Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
> (This posting is provided "AS IS" with no warranties, and confers no
> rights)
>
>
>

 
Reply With Quote
 
Volodymyr Shcherbyna
Guest
Posts: n/a

 
      07-01-2009

"Harald" <> wrote in message
news:AE9A936C-4C3A-4F8B-9C59-...
> you wrote "that you have to operate with non paged data and". I understand
> that so that i only have to work with buffer from nonpegedpool and not
> with
> buffer from pagedpool. My driverExtension is allocated with parameter
> nonpagedpool so that should be ok or to i understand that wrong?!


You should use as much as possible paged buffers, in cases when you have to
access or store data at high irql you should use non paged. The reason for
this is that the non paged pool is an expensive and limited resource.

--
Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)


 
Reply With Quote
 
Volodymyr Shcherbyna
Guest
Posts: n/a

 
      07-01-2009

Show here the analyze -v output, it should help to narrow down the issue.

--
Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)
"Harald" <> wrote in message
news:AE9A936C-4C3A-4F8B-9C59-...
> you wrote "that you have to operate with non paged data and". I understand
> that so that i only have to work with buffer from nonpegedpool and not
> with
> buffer from pagedpool. My driverExtension is allocated with parameter
> nonpagedpool so that should be ok or to i understand that wrong?!
>
> Harald
> "Volodymyr Shcherbyna" wrote:
>
>> "Harald" <> wrote in message
>> news:A2391B49-2DA2-4244-855E-...
>> > Thats not a good answer for me because i have an driverExtension which
>> > is
>> > allocated form nonpagedpool and in my receive function i have to read
>> > and
>> > write valuse from this driverExtension.

>>
>> So recheck your code. I told you two conditions under which you would
>> cause
>> IRQL NOT LESS OR EQUAL in event callback.
>>
>> --
>> Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
>> (This posting is provided "AS IS" with no warranties, and confers no
>> rights)
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How many packets in a PNET_BUFFER_LIST Fredrik Jansson Windows Vista Drivers 2 10-16-2007 09:33 AM
receiving packets on multiprocessor machine Peter Windows Vista Drivers 10 10-20-2006 02:56 PM
Problem of receiving TCP packets on Virtual adapter raj.rr7@gmail.com Windows Vista Drivers 1 04-10-2006 03:55 PM
IM driver not receiving packets for Intel NIC jyotsna Windows Vista Drivers 6 12-08-2004 04:43 AM
Malformed TCP packets John Smith Windows Vista Drivers 4 07-21-2004 02:21 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59