Winsock Kernel

Hi All,

Quick Question -

My situation:
I wrote a windows device driver that reads & writes data to a USB device.
Part of the data that i read from the USB device needs to be formatted as an IP packet and sent to the application. All this has to be happening at the Kernel mode.

I am new to Windows driver development.
In unix, i would have created a network device and used socket buffers to filter the data buffer.

So,
can anyone of you suggest me the BEST ROUTE to proceed in this regard?

I was looking up the WINDDK documentation and there’s all sort of driver types.

Do i need to write a full fledged Network driver or can i get away with using WSKs in association with a protocol driver?

Kindly advise.

Thanks.

xxxxx@gmail.com wrote:

My situation:
I wrote a windows device driver that reads & writes data to a USB device.
Part of the data that i read from the USB device needs to be formatted as an IP packet and sent to the application. All this has to be happening at the Kernel mode.

Do you actually want this to appear to the system as a network device,
or are you merely thinking of the network model as a convenient private
communication channel to the application?

I am new to Windows driver development.
In unix, i would have created a network device and used socket buffers to filter the data buffer.

If the data is all network traffic, does the device adhere to the USB
Communication Device Class? If it does, then you don’t need a driver at
all. If not, then the easiest path might be to write a filter driver
that makes the thing look like a CDC device. That would allow the stock
Microsoft driver to expose the network functionality.

If you just need a private communication path to a single application,
then the normal ReadFile path is the way to go.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi Tim,

Thanks for the response.

NOT ALL of the traffic is NETWORK. But the device adheres to the USB CDC (atleast that’s the target).

I am thinking of the network model as a convenient private communication channel to the application? I know for sure that the part of the data stream is IP data.

What are my options? Please be a little specific as i am still coming to grips with the windows network device driver architecture and NDIS.

Thanks for your assistance.

-vj

Dear Tim,

Thanks for the response.

NOT ALL of the traffic is NETWORK. But the device adheres to the USB
CDC (atleast that’s the target).

I am thinking of the network model as a convenient private
communication channel to the application? I know for sure that the
part of the data stream is IP data.

What are my options? Please be a little specific as i am still coming
to grips with the windows network device driver architecture and NDIS.

Thanks for your assistance.

-vj

On 1/10/07, Tim Roberts wrote:
> xxxxx@gmail.com wrote:
> > My situation:
> > I wrote a windows device driver that reads & writes data to a USB device.
> > Part of the data that i read from the USB device needs to be formatted as an IP packet and sent to the application. All this has to be happening at the Kernel mode.
> >
>
> Do you actually want this to appear to the system as a network device,
> or are you merely thinking of the network model as a convenient private
> communication channel to the application?
>
> > I am new to Windows driver development.
> > In unix, i would have created a network device and used socket buffers to filter the data buffer.
> >
>
> If the data is all network traffic, does the device adhere to the USB
> Communication Device Class? If it does, then you don’t need a driver at
> all. If not, then the easiest path might be to write a filter driver
> that makes the thing look like a CDC device. That would allow the stock
> Microsoft driver to expose the network functionality.
>
> If you just need a private communication path to a single application,
> then the normal ReadFile path is the way to go.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

I’d consider using a more standard DeviceIoControl API between your driver
and its companion application if that is possible. No matter what API you
use you are just transferring a blob of bytes.

See past discussions on the “inverted call” if you think that the driver
must initiate the transfer to the application…

Thomas F. Divine

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-275289-
xxxxx@lists.osr.com] On Behalf Of vj
Sent: Wednesday, January 10, 2007 5:43 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Winsock Kernel

Dear Tim,

Thanks for the response.

NOT ALL of the traffic is NETWORK. But the device adheres to the USB
CDC (atleast that’s the target).

I am thinking of the network model as a convenient private
communication channel to the application? I know for sure that the
part of the data stream is IP data.

What are my options? Please be a little specific as i am still coming
to grips with the windows network device driver architecture and NDIS.

Thanks for your assistance.

-vj

On 1/10/07, Tim Roberts wrote:
> > xxxxx@gmail.com wrote:
> > > My situation:
> > > I wrote a windows device driver that reads & writes data to a USB
> device.
> > > Part of the data that i read from the USB device needs to be formatted
> as an IP packet and sent to the application. All this has to be happening
> at the Kernel mode.
> > >
> >
> > Do you actually want this to appear to the system as a network device,
> > or are you merely thinking of the network model as a convenient private
> > communication channel to the application?
> >
> > > I am new to Windows driver development.
> > > In unix, i would have created a network device and used socket buffers
> to filter the data buffer.
> > >
> >
> > If the data is all network traffic, does the device adhere to the USB
> > Communication Device Class? If it does, then you don’t need a driver at
> > all. If not, then the easiest path might be to write a filter driver
> > that makes the thing look like a CDC device. That would allow the stock
> > Microsoft driver to expose the network functionality.
> >
> > If you just need a private communication path to a single application,
> > then the normal ReadFile path is the way to go.
> >
> > –
> > Tim Roberts, xxxxx@probo.com
> > Providenza & Boekelheide, Inc.
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

If you will want to emulate the network device - then you will need to
emulate lots of mandatory things, which are probably absolutely extra. Like -
MAC addresses, ARP replies/responses, plugging in to NDIS and handling all
network traffic as NDIS wants, and so on.

For me, it is a complete overkill. A much simpler route is to just
implement a set of custom IOCTLs on your device and use DeviceIoControl in the
app.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi All,
>
> Quick Question -
>
> My situation:
> I wrote a windows device driver that reads & writes data to a USB device.
> Part of the data that i read from the USB device needs to be formatted as an
IP packet and sent to the application. All this has to be happening at the
Kernel mode.
>
> I am new to Windows driver development.
> In unix, i would have created a network device and used socket buffers to
filter the data buffer.
>
> So,
> can anyone of you suggest me the BEST ROUTE to proceed in this regard?
>
> I was looking up the WINDDK documentation and there’s all sort of driver
types.
>
> Do i need to write a full fledged Network driver or can i get away with using
WSKs in association with a protocol driver?
>
> Kindly advise.
>
> Thanks.
>