TdiBuildAccept

Hello,

I have to write TDI driver to serve TCP connection from ring-0.
And after careful reading MSDN, DDK and this mail list still could not
understand some very simple things.

My way of connection establishment.

  1. Open transport using address 0L:wPort.
  2. Open connection end-point.
  3. Associate address from p.1 with connection end-point from p.2
    3X. Optional Open transport using address 192.168.1.9:wPort. Local
    address of server.
  4. Setup ClientConnectEvent function
  5. Wait for connection.
  6. Receive connection request in
    ClientConnectEvent(…)
    {

    a) IoAllocateIrp
    b) build TDI_CONNECTION_INFORMATION AcceptRequestInfo using Ip and
    Port of remote node requesting connection
    c) TdiBuildAccept(
    Irp/*from 6a*/,
    DevObj/*from 1*/,
    TdiAcceptCompeteFunction/* IoCompetionProc*/,
    AcceptRequestInfo/*from 6b*/,
    NULL)
    d) IoSetNextIrpStackLocation(pIrp)
    e) filling up parameters of ClientConnectEvent
  • ConnectionContext with eaBuffer from p.1
  • Irp from 6a, 6c
    g) return STATUS_MORE_PROCESSING_REQUIRED
    }
    TdiAcceptComplete(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
    {
    IoFreeIrp(Irp);
    return STATUS_MORE_PROCESSING_REQUIRED;
    }
    If I exec step 3x then step 6 repeats three times.
    In TdiAcceptComplete I have IoStatusBlock.Status :
    STATUS_CONNECTION_INVALID=0xC000023AL. Of course remote node cannot
    establish link with server.

So, questions:

  • What I’m doing wrong?
  • Where should I get new(if any)FileObject to be used later with
    TDI_SEND?
  • How to modify algorithm to have few established connections?
  • How to serve disconnect gracefully?


Best regards,
Sergey mailto:kipnis@wp.pl

I’ve done this sort of thing, except that I had no step 3X. Get
TDIClient.zip at http://home.mindspring.com/~antognini/drivers/ and
start by looking at TDIClnEventConnect, which is the Connection Event
handler used on the server path of this rather extended example.


If replying by e-mail, please remove “nospam.” from the address.

James Antognini

Hello James,

Monday, April 28, 2003, 4:17:41 PM, you wrote:

Thank you, James.

JA> I’ve done this sort of thing, except that I had no step 3X.

Yes, you are right. I also was not sure in this step and mark them as 3x.

JA> Get
JA> TDIClient.zip at http://home.mindspring.com/~antognini/drivers/ and
JA> start by looking at TDIClnEventConnect, which is the Connection Event
JA> handler used on the server path of this rather extended example.

Everything is looking pretty clear for me.

JA> –
JA> If replying by e-mail, please remove “nospam.” from the address.

JA> James Antognini

JA> —
JA> You are currently subscribed to ntdev as: kipnis@wp.pl
JA> To unsubscribe send a blank email to xxxxx@lists.osr.com


Best regards,
Sergey mailto:kipnis@wp.pl