TDI setsockopt??

I’m currently working on porting a vista driver that uses Winsock Kernel
back to XP. Consequently, I’m needing to reimplement my network interface
using TDI rather than WSK. I’m using the PCAUSA examples to help with
this, and these are good, as far as they go, but they don’t cover setting
options on the connection. My driver needs to be able to set multicast
options as well as reuseaddr and the like.

After a lot of searching, I believe that what I need to do is to send
IOCTL IRPs to TDI to set the required options. I even found
IOCTL_TDI_TL_IO_CONTROL_ENDPOINT whose data structure contains a control
type that can be set to SetSockOptIoControlType.

Unfortunately, I can’t find any documentation about the IOCTL anywhere in
the WDK or on the web. And this IOCTL still gets me only half of the way.
I also need to know about the specific IoControlCode values needed to set
my required options, which I suspect will be device-specific.

One of PCAUSA’s headers (smpltcp.h) has a number of #defines relating to
multicast options, such as AO_OPTION_ADD_MCAST and AO_OPTION_MCASTIF, but
it makes no mention of the context of these macros and they are not used
anywhere in their sample code. There is also no mention of reuseaddr and
other socket options.

Finally, the PCAUSA sample code has a function KS_TCPSetInformation which
“uses the IOCTL_TCP_SET_INFORMATION_EX call mechanism to pass a
TCP_REQUEST_SET_INFORMATION request to the underlying transport.” However
they state that it apparently has no effect, and that “It appears that
Microsoft has a proprietary interface that is more useful.” Unfortunately,
they neglect to mention what that interface is (maybe they mean Winsock
Kernel?). Does anyone know if it does in fact exist and if so where it is
documented?

Regards,
Joe.

I suggest you try to put your hands on the NT4 DDK and look at the
src\network\wshsmple sample which is the most likely origin of that header
file (or its contents). You might also try searching the net for a file
published by MSFT some years back in regards to (of all things) VXD based
TDI interfacing and the Win9x equivalent of Winsock helpers. I think it was
called VXDTDI.ZIP or something like that.

But basically, yes, you are looking to find by hook or by crook the IOCTL
requests that are passed from the Winsock helper through AFD into the TDI
transport (TCPIP in this case) for those socket options which actually are
implemented in TCPIP itself (as opposed to in AFD, for instance).

Calling any of it ‘documented’ (at least out here in the world) would be a
stretch. The Winsock helper sample was (and is) AFAIK about the only hint
as to how it all worked.

Good Luck,
-dave

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Joseph Thomas-Kerr
Sent: Tuesday, April 15, 2008 7:26 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] TDI setsockopt??

I’m currently working on porting a vista driver that uses Winsock Kernel
back to XP. Consequently, I’m needing to reimplement my network interface
using TDI rather than WSK. I’m using the PCAUSA examples to help with
this, and these are good, as far as they go, but they don’t cover setting
options on the connection. My driver needs to be able to set multicast
options as well as reuseaddr and the like.

After a lot of searching, I believe that what I need to do is to send
IOCTL IRPs to TDI to set the required options. I even found
IOCTL_TDI_TL_IO_CONTROL_ENDPOINT whose data structure contains a control
type that can be set to SetSockOptIoControlType.

Unfortunately, I can’t find any documentation about the IOCTL anywhere in
the WDK or on the web. And this IOCTL still gets me only half of the way.
I also need to know about the specific IoControlCode values needed to set
my required options, which I suspect will be device-specific.

One of PCAUSA’s headers (smpltcp.h) has a number of #defines relating to
multicast options, such as AO_OPTION_ADD_MCAST and AO_OPTION_MCASTIF, but
it makes no mention of the context of these macros and they are not used
anywhere in their sample code. There is also no mention of reuseaddr and
other socket options.

Finally, the PCAUSA sample code has a function KS_TCPSetInformation which
“uses the IOCTL_TCP_SET_INFORMATION_EX call mechanism to pass a
TCP_REQUEST_SET_INFORMATION request to the underlying transport.” However
they state that it apparently has no effect, and that “It appears that
Microsoft has a proprietary interface that is more useful.” Unfortunately,
they neglect to mention what that interface is (maybe they mean Winsock
Kernel?). Does anyone know if it does in fact exist and if so where it is
documented?

Regards,
Joe.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer