Implementing ProtocolReceive query

Hi All,

In DDK, I read:
“The intermediate driver must queue th copied net packets in ProtocolReceive
so that they are available to ProtocolReceiveComplete for postproessing”

where to queue these packets ? user-specified queue or some internal queue ?
If it is user-specified queue, can I be sure that the order of insertion and
removing the packets from this queue will not cause any problems.
If it is system queue, how to use this queue ?

Amit Manocha

> Hi All,

In DDK, I read:
“The intermediate driver must queue th copied net packets in ProtocolReceive
so that they are available to ProtocolReceiveComplete for postproessing”

where to queue these packets ? user-specified queue or some internal queue ?
If it is user-specified queue, can I be sure that the order of insertion and
removing the packets from this queue will not cause any problems.
If it is system queue, how to use this queue ?

See macro.h in ndisuio DDK sample drivers to learn how to deal with
queues.
You should initialize these queues in your driver either in bind or in
open.

-Sanjeev

Thanks Sanjeev.

I’m thinking of following flow for passthru for post-processing. Can anybody
please go thro’ it and recommend/suggest somethings:

PtReceive ()
{
Packet = NdisGetReceivedPacket ();
if (Packet = NULL)

// Allocate myPacket, single buffer here and copy Packet into
myPacket
// I’m using single buffer, so all the data including header goes
here
NdisReInitializePacket (myPacket);
}
else
{
// Allocate myPacket and single buffer
// Again, I’m using single buffer, so all the data including header
goes here
NdisReInitializePacket (myPacket);
// Copy HeaderBuffer into memory allcated above
// Copy lookaheadbuffer into memory allocated above
// Call NdisTransferData with myPacket as argument
if (status == success)
{
// call PtTransferDataComplete. i read it somewhere in archive
}
}
NDIS_SET_PACKET_HEADER_SIZE (myPacket, 14); // i’m sure i’ve ethernet
// insert myPacket in the queue
return NDIS_STATUS_SUCCESS;
}

PtReceiveComplete ()
{
// remove myPacket from the queue
// post-process it
NDIS_SET_PACKET_STATUS (myPacket, NDIS_STATUS_SUCCESS);
NdisMIndicateReceivePacket (pAdapt, &myPacket, 1);
}

I’ll change PtReceivePackets later on.

Amit Manocha
“Sanjeev Manral” wrote in message
news:xxxxx@ntdev…
>
> > Hi All,
> >
> > In DDK, I read:
> > “The intermediate driver must queue th copied net packets in
ProtocolReceive
> > so that they are available to ProtocolReceiveComplete for postproessing”
> >
> > where to queue these packets ? user-specified queue or some internal
queue ?
> > If it is user-specified queue, can I be sure that the order of insertion
and
> > removing the packets from this queue will not cause any problems.
> > If it is system queue, how to use this queue ?
>
> See macro.h in ndisuio DDK sample drivers to learn how to deal with
> queues.
> You should initialize these queues in your driver either in bind or in
> open.
>
> -Sanjeev
>
>

I assume this is a typo and not an intended assign:

if (Packet = NULL)

Bryan S. Burgin
xxxxx@microsoft.com

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Amit Manocha
Sent: Tuesday, June 10, 2003 10:57 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Implementing ProtocolReceive query

Thanks Sanjeev.

I’m thinking of following flow for passthru for post-processing. Can
anybody
please go thro’ it and recommend/suggest somethings:

PtReceive ()
{
Packet = NdisGetReceivedPacket ();
if (Packet = NULL)

// Allocate myPacket, single buffer here and copy Packet into
myPacket
// I’m using single buffer, so all the data including header
goes
here
NdisReInitializePacket (myPacket);
}
else
{
// Allocate myPacket and single buffer
// Again, I’m using single buffer, so all the data including
header
goes here
NdisReInitializePacket (myPacket);
// Copy HeaderBuffer into memory allcated above
// Copy lookaheadbuffer into memory allocated above
// Call NdisTransferData with myPacket as argument
if (status == success)
{
// call PtTransferDataComplete. i read it somewhere in
archive
}
}
NDIS_SET_PACKET_HEADER_SIZE (myPacket, 14); // i’m sure i’ve
ethernet
// insert myPacket in the queue
return NDIS_STATUS_SUCCESS;
}

PtReceiveComplete ()
{
// remove myPacket from the queue
// post-process it
NDIS_SET_PACKET_STATUS (myPacket, NDIS_STATUS_SUCCESS);
NdisMIndicateReceivePacket (pAdapt, &myPacket, 1);
}

I’ll change PtReceivePackets later on.

Amit Manocha
“Sanjeev Manral” wrote in message
news:xxxxx@ntdev…
>
> > Hi All,
> >
> > In DDK, I read:
> > “The intermediate driver must queue th copied net packets in
ProtocolReceive
> > so that they are available to ProtocolReceiveComplete for
postproessing”
> >
> > where to queue these packets ? user-specified queue or some internal
queue ?
> > If it is user-specified queue, can I be sure that the order of
insertion
and
> > removing the packets from this queue will not cause any problems.
> > If it is system queue, how to use this queue ?
>
> See macro.h in ndisuio DDK sample drivers to learn how to deal with
> queues.
> You should initialize these queues in your driver either in bind or in
> open.
>
> -Sanjeev
>
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

The old Wizard C compiler would put out a warning when people wrote code
like this, under the assumption that maybe the programmer really meant “==”
instead of “=”. I used to be very fond of that compiler, but hey, that was
way back when. Can Microsoft C be told to put out a warning too ?

Alberto.

-----Original Message-----
From: Bryan Burgin [mailto:xxxxx@microsoft.com]
Sent: Wednesday, June 11, 2003 1:29 PM
To: NT Developers Interest List
Cc: xxxxx@mynetsec.com
Subject: [ntdev] Re: Implementing ProtocolReceive query

I assume this is a typo and not an intended assign:

if (Packet = NULL)

Bryan S. Burgin
xxxxx@microsoft.com

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Amit Manocha
Sent: Tuesday, June 10, 2003 10:57 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Implementing ProtocolReceive query

Thanks Sanjeev.

I’m thinking of following flow for passthru for post-processing. Can
anybody
please go thro’ it and recommend/suggest somethings:

PtReceive ()
{
Packet = NdisGetReceivedPacket ();
if (Packet = NULL)

// Allocate myPacket, single buffer here and copy Packet into
myPacket
// I’m using single buffer, so all the data including header
goes
here
NdisReInitializePacket (myPacket);
}
else
{
// Allocate myPacket and single buffer
// Again, I’m using single buffer, so all the data including
header
goes here
NdisReInitializePacket (myPacket);
// Copy HeaderBuffer into memory allcated above
// Copy lookaheadbuffer into memory allocated above
// Call NdisTransferData with myPacket as argument
if (status == success)
{
// call PtTransferDataComplete. i read it somewhere in
archive
}
}
NDIS_SET_PACKET_HEADER_SIZE (myPacket, 14); // i’m sure i’ve
ethernet
// insert myPacket in the queue
return NDIS_STATUS_SUCCESS;
}

PtReceiveComplete ()
{
// remove myPacket from the queue
// post-process it
NDIS_SET_PACKET_STATUS (myPacket, NDIS_STATUS_SUCCESS);
NdisMIndicateReceivePacket (pAdapt, &myPacket, 1);
}

I’ll change PtReceivePackets later on.

Amit Manocha
“Sanjeev Manral” wrote in message
news:xxxxx@ntdev…
>
> > Hi All,
> >
> > In DDK, I read:
> > “The intermediate driver must queue th copied net packets in
ProtocolReceive
> > so that they are available to ProtocolReceiveComplete for
postproessing”
> >
> > where to queue these packets ? user-specified queue or some internal
queue ?
> > If it is user-specified queue, can I be sure that the order of
insertion
and
> > removing the packets from this queue will not cause any problems.
> > If it is system queue, how to use this queue ?
>
> See macro.h in ndisuio DDK sample drivers to learn how to deal with
> queues.
> You should initialize these queues in your driver either in bind or in
> open.
>
> -Sanjeev
>
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

Yes, enable level 4 warning C4706 or use /W4. Or better, use PC-lint
regularly and it would force you to write solid code :wink:

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]


From:
xxxxx@compuware.com[SMTP:xxxxx@compuware.com]
Reply To: xxxxx@lists.osr.com
Sent: Wednesday, June 11, 2003 9:42 PM
To: xxxxx@lists.osr.com
Subject: [ntdev] Re: Implementing ProtocolReceive query

The old Wizard C compiler would put out a warning when people wrote code
like this, under the assumption that maybe the programmer really meant
“==”
instead of “=”. I used to be very fond of that compiler, but hey, that was
way back when. Can Microsoft C be told to put out a warning too ?

Alberto.

-----Original Message-----
From: Bryan Burgin [mailto:xxxxx@microsoft.com]
Sent: Wednesday, June 11, 2003 1:29 PM
To: NT Developers Interest List
Cc: xxxxx@mynetsec.com
Subject: [ntdev] Re: Implementing ProtocolReceive query

I assume this is a typo and not an intended assign:

if (Packet = NULL)

Bryan S. Burgin
xxxxx@microsoft.com

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Amit Manocha
Sent: Tuesday, June 10, 2003 10:57 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Implementing ProtocolReceive query

Thanks Sanjeev.

I’m thinking of following flow for passthru for post-processing. Can
anybody
please go thro’ it and recommend/suggest somethings:

PtReceive ()
{
Packet = NdisGetReceivedPacket ();
if (Packet = NULL)

// Allocate myPacket, single buffer here and copy Packet into
myPacket
// I’m using single buffer, so all the data including header
goes
here
NdisReInitializePacket (myPacket);
}
else
{
// Allocate myPacket and single buffer
// Again, I’m using single buffer, so all the data including
header
goes here
NdisReInitializePacket (myPacket);
// Copy HeaderBuffer into memory allcated above
// Copy lookaheadbuffer into memory allocated above
// Call NdisTransferData with myPacket as argument
if (status == success)
{
// call PtTransferDataComplete. i read it somewhere in
archive
}
}
NDIS_SET_PACKET_HEADER_SIZE (myPacket, 14); // i’m sure i’ve
ethernet
// insert myPacket in the queue
return NDIS_STATUS_SUCCESS;
}

PtReceiveComplete ()
{
// remove myPacket from the queue
// post-process it
NDIS_SET_PACKET_STATUS (myPacket, NDIS_STATUS_SUCCESS);
NdisMIndicateReceivePacket (pAdapt, &myPacket, 1);
}

I’ll change PtReceivePackets later on.

Amit Manocha
“Sanjeev Manral” wrote in message
> news:xxxxx@ntdev…
> >
> > > Hi All,
> > >
> > > In DDK, I read:
> > > “The intermediate driver must queue th copied net packets in
> ProtocolReceive
> > > so that they are available to ProtocolReceiveComplete for
> postproessing”
> > >
> > > where to queue these packets ? user-specified queue or some internal
> queue ?
> > > If it is user-specified queue, can I be sure that the order of
> insertion
> and
> > > removing the packets from this queue will not cause any problems.
> > > If it is system queue, how to use this queue ?
> >
> > See macro.h in ndisuio DDK sample drivers to learn how to deal with
> > queues.
> > You should initialize these queues in your driver either in bind or in
> > open.
> >
> > -Sanjeev
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
> disclose
> it to anyone else. If you received it in error please notify us
> immediately
> and then destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as: michal.vodicka@st.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Thanks for your replies. Yes, that was just a typo error. I want to know
from logic point of view only.

Amit Manocha

“Michal Vodicka” wrote in message
news:xxxxx@ntdev…
>
> Yes, enable level 4 warning C4706 or use /W4. Or better, use PC-lint
> regularly and it would force you to write solid code :wink:
>
> Best regards,
>
> Michal Vodicka
> STMicroelectronics Design and Application s.r.o.
> [michal.vodicka@st.com, http:://www.st.com]
>
> > ----------
> > From:
> > xxxxx@compuware.com[SMTP:xxxxx@compuware.com]
> > Reply To: xxxxx@lists.osr.com
> > Sent: Wednesday, June 11, 2003 9:42 PM
> > To: xxxxx@lists.osr.com
> > Subject: [ntdev] Re: Implementing ProtocolReceive query
> >
> > The old Wizard C compiler would put out a warning when people wrote code
> > like this, under the assumption that maybe the programmer really meant
> > “==”
> > instead of “=”. I used to be very fond of that compiler, but hey, that
was
> > way back when. Can Microsoft C be told to put out a warning too ?
> >
> > Alberto.
> >
> >
> >
> > -----Original Message-----
> > From: Bryan Burgin [mailto:xxxxx@microsoft.com]
> > Sent: Wednesday, June 11, 2003 1:29 PM
> > To: NT Developers Interest List
> > Cc: xxxxx@mynetsec.com
> > Subject: [ntdev] Re: Implementing ProtocolReceive query
> >
> >
> > I assume this is a typo and not an intended assign:
> >
> > if (Packet = NULL)
> >
> > Bryan S. Burgin
> > xxxxx@microsoft.com
> >
> > This posting is provided “AS IS” with no warranties, and confers no
> > rights
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Amit Manocha
> > Sent: Tuesday, June 10, 2003 10:57 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Implementing ProtocolReceive query
> >
> > Thanks Sanjeev.
> >
> > I’m thinking of following flow for passthru for post-processing. Can
> > anybody
> > please go thro’ it and recommend/suggest somethings:
> >
> > PtReceive ()
> > {
> > Packet = NdisGetReceivedPacket ();
> > if (Packet = NULL)
> >
> >
> > // Allocate myPacket, single buffer here and copy Packet into
> > myPacket
> > // I’m using single buffer, so all the data including header
> > goes
> > here
> > NdisReInitializePacket (myPacket);
> > }
> > else
> > {
> > // Allocate myPacket and single buffer
> > // Again, I’m using single buffer, so all the data including
> > header
> > goes here
> > NdisReInitializePacket (myPacket);
> > // Copy HeaderBuffer into memory allcated above
> > // Copy lookaheadbuffer into memory allocated above
> > // Call NdisTransferData with myPacket as argument
> > if (status == success)
> > {
> > // call PtTransferDataComplete. i read it somewhere in
> > archive
> > }
> > }
> > NDIS_SET_PACKET_HEADER_SIZE (myPacket, 14); // i’m sure i’ve
> > ethernet
> > // insert myPacket in the queue
> > return NDIS_STATUS_SUCCESS;
> > }
> >
> > PtReceiveComplete ()
> > {
> > // remove myPacket from the queue
> > // post-process it
> > NDIS_SET_PACKET_STATUS (myPacket, NDIS_STATUS_SUCCESS);
> > NdisMIndicateReceivePacket (pAdapt, &myPacket, 1);
> > }
> >
> > I’ll change PtReceivePackets later on.
> >
> > Amit Manocha
> > “Sanjeev Manral” wrote in message
> > news:xxxxx@ntdev…
> > >
> > > > Hi All,
> > > >
> > > > In DDK, I read:
> > > > “The intermediate driver must queue th copied net packets in
> > ProtocolReceive
> > > > so that they are available to ProtocolReceiveComplete for
> > postproessing”
> > > >
> > > > where to queue these packets ? user-specified queue or some internal
> > queue ?
> > > > If it is user-specified queue, can I be sure that the order of
> > insertion
> > and
> > > > removing the packets from this queue will not cause any problems.
> > > > If it is system queue, how to use this queue ?
> > >
> > > See macro.h in ndisuio DDK sample drivers to learn how to deal with
> > > queues.
> > > You should initialize these queues in your driver either in bind or in
> > > open.
> > >
> > > -Sanjeev
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@microsoft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@compuware.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > The contents of this e-mail are intended for the named addressee only.
It
> > contains information that may be confidential. Unless you are the named
> > addressee or an authorized designee, you may not copy or use it, or
> > disclose
> > it to anyone else. If you received it in error please notify us
> > immediately
> > and then destroy it.
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: michal.vodicka@st.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>