ReactOS 0.4.15-dev-7681-g776c3a3
dispatch.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TCP/IP protocol driver
4 * FILE: tcpip/dispatch.h
5 * PURPOSE: TDI dispatch routines
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * REVISIONS:
8 * CSH 01/08-2000 Created
9 * TODO: Validate device object in all dispatch routines
10 */
11
12#include "precomp.h"
13
14#include <datagram.h>
15#include <pseh/pseh2.h>
16
17typedef struct _QUERY_HW_WORK_ITEM {
25
28
29 if (Status != STATUS_PENDING) {
30 Irp->IoStatus.Status = Status;
34
36 }
37
38 return Status;
39}
40
43 PIRP Irp,
45/*
46 * FUNCTION: Prepare an IRP for cancellation
47 * ARGUMENTS:
48 * Context = Pointer to context information
49 * Irp = Pointer to an I/O request packet
50 * CancelRoutine = Routine to be called when I/O request is cancelled
51 * RETURNS:
52 * Status of operation
53 */
54{
57 PTRANSPORT_CONTEXT TransContext;
58
59 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
60
62 TransContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;
63
65
66 if (!Irp->Cancel && !TransContext->CancelIrps) {
69
70 TI_DbgPrint(DEBUG_IRP, ("Leaving (IRP at 0x%X can now be cancelled).\n", Irp));
71
72 return STATUS_SUCCESS;
73 }
74
75 /* IRP has already been cancelled */
76
78
79 Irp->IoStatus.Status = STATUS_CANCELLED;
80 Irp->IoStatus.Information = 0;
81
82 TI_DbgPrint(DEBUG_IRP, ("Leaving (IRP was already cancelled).\n"));
83
84 return Irp->IoStatus.Status;
85}
86
91/*
92 * FUNCTION: Completes a send/receive IRP
93 * ARGUMENTS:
94 * Context = Pointer to context information (IRP)
95 * Status = Status of the request
96 * Count = Number of bytes sent or received
97 */
98{
100
101 TI_DbgPrint(DEBUG_IRP, ("Called for irp %x (%x, %d).\n",
102 Irp, Status, Count));
103
104 Irp->IoStatus.Status = Status;
105 Irp->IoStatus.Information = Count;
106
107 TI_DbgPrint(MID_TRACE, ("Irp->IoStatus.Status = %x\n",
108 Irp->IoStatus.Status));
109 TI_DbgPrint(MID_TRACE, ("Irp->IoStatus.Information = %d\n",
110 Irp->IoStatus.Information));
111 TI_DbgPrint(DEBUG_IRP, ("Completing IRP at (0x%X).\n", Irp));
112
114
115 TI_DbgPrint(DEBUG_IRP, ("Done Completing IRP\n"));
116}
117
120 PIRP Irp)
121/*
122 * FUNCTION: Cancels an IRP
123 * ARGUMENTS:
124 * Device = Pointer to device object
125 * Irp = Pointer to an I/O request packet
126 */
127{
129 PTRANSPORT_CONTEXT TranContext;
132 PCONNECTION_ENDPOINT Connection;
133 BOOLEAN DequeuedIrp = TRUE;
134
135 IoReleaseCancelSpinLock(Irp->CancelIrql);
136
137 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
138
141 TranContext = (PTRANSPORT_CONTEXT)FileObject->FsContext;
143
144 TI_DbgPrint(DEBUG_IRP, ("IRP at (0x%X) MinorFunction (0x%X) IrpSp (0x%X).\n", Irp, MinorFunction, IrpSp));
145
146 Irp->IoStatus.Status = STATUS_CANCELLED;
147 Irp->IoStatus.Information = 0;
148
149#if DBG
150 if (!Irp->Cancel)
151 TI_DbgPrint(MIN_TRACE, ("Irp->Cancel is FALSE, should be TRUE.\n"));
152#endif
153
154 /* Try canceling the request */
155 switch(MinorFunction) {
156 case TDI_SEND:
157 case TDI_RECEIVE:
158 DequeuedIrp = TCPRemoveIRP( TranContext->Handle.ConnectionContext, Irp );
159 break;
160
162 if (FileObject->FsContext2 != (PVOID)TDI_TRANSPORT_ADDRESS_FILE) {
163 TI_DbgPrint(MIN_TRACE, ("TDI_SEND_DATAGRAM, but no address file.\n"));
164 break;
165 }
166
167 DequeuedIrp = DGRemoveIRP(TranContext->Handle.AddressHandle, Irp);
168 break;
169
171 if (FileObject->FsContext2 != (PVOID)TDI_TRANSPORT_ADDRESS_FILE) {
172 TI_DbgPrint(MIN_TRACE, ("TDI_RECEIVE_DATAGRAM, but no address file.\n"));
173 break;
174 }
175
176 DequeuedIrp = DGRemoveIRP(TranContext->Handle.AddressHandle, Irp);
177 break;
178
179 case TDI_CONNECT:
180 DequeuedIrp = TCPRemoveIRP(TranContext->Handle.ConnectionContext, Irp);
181 break;
182
183 case TDI_DISCONNECT:
184 Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
185
186 DequeuedIrp = TCPRemoveIRP(TranContext->Handle.ConnectionContext, Irp);
187 if (DequeuedIrp)
188 {
189 if (KeCancelTimer(&Connection->DisconnectTimer))
190 {
191 DereferenceObject(Connection);
192 }
193 }
194 break;
195
196 default:
197 TI_DbgPrint(MIN_TRACE, ("Unknown IRP. MinorFunction (0x%X).\n", MinorFunction));
198 ASSERT(FALSE);
199 break;
200 }
201
202 if (DequeuedIrp)
204
205 TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
206}
207
208
211 PIRP Irp)
212/*
213 * FUNCTION: Cancels a listen IRP
214 * ARGUMENTS:
215 * Device = Pointer to device object
216 * Irp = Pointer to an I/O request packet
217 */
218{
220 PTRANSPORT_CONTEXT TranContext;
222 PCONNECTION_ENDPOINT Connection;
223
224 IoReleaseCancelSpinLock(Irp->CancelIrql);
225
226 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
227
230 TranContext = (PTRANSPORT_CONTEXT)FileObject->FsContext;
232
233 TI_DbgPrint(DEBUG_IRP, ("IRP at (0x%X).\n", Irp));
234
235#if DBG
236 if (!Irp->Cancel)
237 TI_DbgPrint(MIN_TRACE, ("Irp->Cancel is FALSE, should be TRUE.\n"));
238#endif
239
240 /* Try canceling the request */
241 Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
242
244 Connection))
245 {
246 Irp->IoStatus.Information = 0;
248 }
249
250 TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
251}
252
253
255 PIRP Irp)
256/*
257 * FUNCTION: TDI_ACCEPT handler
258 * ARGUMENTS:
259 * Irp = Pointer to an I/O request packet
260 * RETURNS:
261 * Status of operation
262 */
263{
264 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
265
267}
268
269
271 PIRP Irp)
272/*
273 * FUNCTION: TDI_ASSOCIATE_ADDRESS handler
274 * ARGUMENTS:
275 * Irp = Pointer to an I/O request packet
276 * RETURNS:
277 * Status of operation
278 */
279{
281 PTRANSPORT_CONTEXT TranContext;
283 PCONNECTION_ENDPOINT Connection, LastConnection;
285 PADDRESS_FILE AddrFile = NULL;
287
288 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
289
291
292 /* Get associated connection endpoint file object. Quit if none exists */
293
294 TranContext = IrpSp->FileObject->FsContext;
295 if (!TranContext) {
296 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
298 }
299
300 Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
301 if (!Connection) {
302 TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
304 }
305
307
309 Parameters->AddressHandle,
310 0,
313 (PVOID*)&FileObject,
314 NULL);
315 if (!NT_SUCCESS(Status)) {
316 TI_DbgPrint(MID_TRACE, ("Bad address file object handle (0x%X): %x.\n",
317 Parameters->AddressHandle, Status));
319 }
320
321 LockObject(Connection);
322
323 if (Connection->AddressFile) {
325 UnlockObject(Connection);
326 TI_DbgPrint(MID_TRACE, ("An address file is already associated.\n"));
328 }
329
330 if (FileObject->FsContext2 != (PVOID)TDI_TRANSPORT_ADDRESS_FILE) {
332 UnlockObject(Connection);
333 TI_DbgPrint(MID_TRACE, ("Bad address file object. Magic (0x%X).\n",
334 FileObject->FsContext2));
336 }
337
338 /* Get associated address file object. Quit if none exists */
339
340 TranContext = FileObject->FsContext;
341 if (!TranContext) {
343 UnlockObject(Connection);
344 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
346 }
347
348 AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle;
349 if (!AddrFile) {
350 UnlockObject(Connection);
352 TI_DbgPrint(MID_TRACE, ("No address file object.\n"));
354 }
355
356 LockObject(AddrFile);
357
358 ReferenceObject(AddrFile);
359 Connection->AddressFile = AddrFile;
360
361 /* Add connection endpoint to the address file */
362 ReferenceObject(Connection);
363 if (AddrFile->Connection == NULL)
364 AddrFile->Connection = Connection;
365 else
366 {
367 LastConnection = AddrFile->Connection;
368 while (LastConnection->Next != NULL)
369 LastConnection = LastConnection->Next;
370 LastConnection->Next = Connection;
371 }
372
374
375 UnlockObject(AddrFile);
376 UnlockObject(Connection);
377
378 return STATUS_SUCCESS;
379}
380
381
383 PIRP Irp)
384/*
385 * FUNCTION: TDI_CONNECT handler
386 * ARGUMENTS:
387 * Irp = Pointer to an I/O request packet
388 * RETURNS:
389 * Status of operation
390 */
391{
392 PCONNECTION_ENDPOINT Connection;
394 PTRANSPORT_CONTEXT TranContext;
397
398 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
399
401
403
404 /* Get associated connection endpoint file object. Quit if none exists */
405
406 TranContext = IrpSp->FileObject->FsContext;
407 if (!TranContext) {
408 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
410 goto done;
411 }
412
413 Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
414 if (!Connection) {
415 TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
417 goto done;
418 }
419
421
423 Irp,
425
426 if (NT_SUCCESS(Status)) {
428 TranContext->Handle.ConnectionContext,
429 Parameters->RequestConnectionInformation,
430 Parameters->ReturnConnectionInformation,
432 Irp );
433 }
434
435done:
436 if (Status != STATUS_PENDING) {
438 }
439
440 TI_DbgPrint(MAX_TRACE, ("TCP Connect returned %08x\n", Status));
441
442 return STATUS_PENDING;
443}
444
445
447 PIRP Irp)
448/*
449 * FUNCTION: TDI_DISASSOCIATE_ADDRESS handler
450 * ARGUMENTS:
451 * Irp = Pointer to an I/O request packet
452 * RETURNS:
453 * Status of operation
454 */
455{
456 PCONNECTION_ENDPOINT Connection;
457 PTRANSPORT_CONTEXT TranContext;
459
460 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
461
463
464 /* Get associated connection endpoint file object. Quit if none exists */
465
466 TranContext = IrpSp->FileObject->FsContext;
467 if (!TranContext) {
468 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
470 }
471
472 Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
473 if (!Connection) {
474 TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
476 }
477
478 /* NO-OP because we need the address to deallocate the port when the connection closes */
479
480 return STATUS_SUCCESS;
481}
482
483
485 PIRP Irp)
486/*
487 * FUNCTION: TDI_DISCONNECT handler
488 * ARGUMENTS:
489 * Irp = Pointer to an I/O request packet
490 * RETURNS:
491 * Status of operation
492 */
493{
496 PCONNECTION_ENDPOINT Connection;
497 PTRANSPORT_CONTEXT TranContext;
499
500 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
501
504
506
507 /* Get associated connection endpoint file object. Quit if none exists */
508
509 TranContext = IrpSp->FileObject->FsContext;
510 if (!TranContext) {
511 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
513 goto done;
514 }
515
516 Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
517 if (!Connection) {
518 TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
520 goto done;
521 }
522
524 (TranContext->Handle.ConnectionContext,
525 Irp,
527
528 if (NT_SUCCESS(Status))
529 {
531 DisReq->RequestFlags,
532 DisReq->RequestSpecific,
536 Irp);
537 }
538
539done:
540 if (Status != STATUS_PENDING) {
542 }
543
544 TI_DbgPrint(MAX_TRACE, ("TCP Disconnect returned %08x\n", Status));
545
546 return STATUS_PENDING;
547}
548
549
551 PIRP Irp)
552/*
553 * FUNCTION: TDI_LISTEN handler
554 * ARGUMENTS:
555 * Irp = Pointer to an I/O request packet
556 * RETURNS:
557 * Status of operation
558 */
559{
560 PCONNECTION_ENDPOINT Connection;
562 PTRANSPORT_CONTEXT TranContext;
565
566 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
567
569
571
572 /* Get associated connection endpoint file object. Quit if none exists */
573
574 TranContext = IrpSp->FileObject->FsContext;
575 if (TranContext == NULL)
576 {
577 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
579 goto done;
580 }
581
582 Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
583 if (Connection == NULL)
584 {
585 TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
587 goto done;
588 }
589
591
593 (TranContext->Handle.ConnectionContext,
594 Irp,
596
597 LockObject(Connection);
598
599 if (Connection->AddressFile == NULL)
600 {
601 TI_DbgPrint(MID_TRACE, ("No associated address file\n"));
602 UnlockObject(Connection);
604 goto done;
605 }
606
607 LockObject(Connection->AddressFile);
608
609 /* Listening will require us to create a listening socket and store it in
610 * the address file. It will be signalled, and attempt to complete an irp
611 * when a new connection arrives. */
612 /* The important thing to note here is that the irp we'll complete belongs
613 * to the socket to be accepted onto, not the listener */
614 if( NT_SUCCESS(Status) && !Connection->AddressFile->Listener ) {
615 Connection->AddressFile->Listener =
617
618 if( !Connection->AddressFile->Listener )
620
621 if( NT_SUCCESS(Status) ) {
622 ReferenceObject(Connection->AddressFile);
623 Connection->AddressFile->Listener->AddressFile =
624 Connection->AddressFile;
625
626 Status = TCPSocket( Connection->AddressFile->Listener,
627 Connection->AddressFile->Family,
629 Connection->AddressFile->Protocol );
630 }
631
632 if( NT_SUCCESS(Status) ) {
634 Status = TCPListen( Connection->AddressFile->Listener, 1024 );
635 /* BACKLOG */
636 }
637 }
638
639 if( NT_SUCCESS(Status) ) {
642 Connection->AddressFile->Listener,
643 Connection,
645 Irp );
646 }
647
648 UnlockObject(Connection->AddressFile);
649 UnlockObject(Connection);
650
651done:
652 if (Status != STATUS_PENDING) {
654 }
655
656 TI_DbgPrint(MID_TRACE,("Leaving %x\n", Status));
657
658 return STATUS_PENDING;
659}
660
661
664 PIRP Irp)
665/*
666 * FUNCTION: TDI_QUERY_INFORMATION handler
667 * ARGUMENTS:
668 * DeviceObject = Pointer to device object structure
669 * Irp = Pointer to an I/O request packet
670 * RETURNS:
671 * Status of operation
672 */
673{
675 PTRANSPORT_CONTEXT TranContext;
677
678 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
679
682
683 TranContext = IrpSp->FileObject->FsContext;
684 if (!TranContext) {
685 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
687 }
688
689 switch (Parameters->QueryType)
690 {
692 {
693 PTDI_ADDRESS_INFO AddressInfo;
694 PADDRESS_FILE AddrFile;
696 PCONNECTION_ENDPOINT Endpoint = NULL;
697
698
699 if (MmGetMdlByteCount(Irp->MdlAddress) <
700 (FIELD_OFFSET(TDI_ADDRESS_INFO, Address.Address[0].Address) +
701 sizeof(TDI_ADDRESS_IP))) {
702 TI_DbgPrint(MID_TRACE, ("MDL buffer too small.\n"));
704 }
705
706 AddressInfo = (PTDI_ADDRESS_INFO)MmGetSystemAddressForMdl(Irp->MdlAddress);
707 Address = (PTA_IP_ADDRESS)&AddressInfo->Address;
708
709 switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
711 AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle;
712 if (AddrFile == NULL)
713 {
714 TI_DbgPrint(MIN_TRACE, ("FIXME: No address file object.\n"));
715 ASSERT(AddrFile != NULL);
717 }
718
719 Address->TAAddressCount = 1;
720 Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
721 Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
722 Address->Address[0].Address[0].sin_port = AddrFile->Port;
723 Address->Address[0].Address[0].in_addr = AddrFile->Address.Address.IPv4Address;
725 &Address->Address[0].Address[0].sin_zero,
726 sizeof(Address->Address[0].Address[0].sin_zero));
727 return STATUS_SUCCESS;
728
730 Endpoint =
732 if (Endpoint == NULL || Endpoint->AddressFile == NULL)
733 {
734 TI_DbgPrint(MIN_TRACE, ("FIXME: No connection endpoint file object.\n"));
735 ASSERT(Endpoint != NULL && Endpoint->AddressFile != NULL);
737 }
738
739 Address->TAAddressCount = 1;
740 Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
741 Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
742 Address->Address[0].Address[0].sin_port = Endpoint->AddressFile->Port;
743 Address->Address[0].Address[0].in_addr = Endpoint->AddressFile->Address.Address.IPv4Address;
745 &Address->Address[0].Address[0].sin_zero,
746 sizeof(Address->Address[0].Address[0].sin_zero));
747 return STATUS_SUCCESS;
748
749 default:
750 TI_DbgPrint(MIN_TRACE, ("Invalid transport context\n"));
752 }
753 }
754
756 {
757 PTDI_CONNECTION_INFO ConnectionInfo;
758 //PCONNECTION_ENDPOINT Endpoint;
759
760 if (MmGetMdlByteCount(Irp->MdlAddress) < sizeof(*ConnectionInfo)) {
761 TI_DbgPrint(MID_TRACE, ("MDL buffer too small.\n"));
763 }
764
765 ConnectionInfo = (PTDI_CONNECTION_INFO)
766 MmGetSystemAddressForMdl(Irp->MdlAddress);
767
768 switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
770 //Endpoint = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
771 RtlZeroMemory(ConnectionInfo, sizeof(*ConnectionInfo));
772 return STATUS_SUCCESS;
773
774 default:
775 TI_DbgPrint(MIN_TRACE, ("Invalid transport context\n"));
777 }
778 }
779
781 {
782 PTDI_MAX_DATAGRAM_INFO MaxDatagramInfo;
783
784 if (MmGetMdlByteCount(Irp->MdlAddress) < sizeof(*MaxDatagramInfo)) {
785 TI_DbgPrint(MID_TRACE, ("MDL buffer too small.\n"));
787 }
788
789 MaxDatagramInfo = (PTDI_MAX_DATAGRAM_INFO)
790 MmGetSystemAddressForMdl(Irp->MdlAddress);
791
792 MaxDatagramInfo->MaxDatagramSize = 0xFFFF;
793
794 return STATUS_SUCCESS;
795 }
796 }
797
799}
800
801
803 PIRP Irp)
804/*
805 * FUNCTION: TDI_RECEIVE handler
806 * ARGUMENTS:
807 * Irp = Pointer to an I/O request packet
808 * RETURNS:
809 * Status of operation
810 */
811{
813 PTDI_REQUEST_KERNEL_RECEIVE ReceiveInfo;
814 PTRANSPORT_CONTEXT TranContext;
816 ULONG BytesReceived = 0;
817
818 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
819
822
824
825 TranContext = IrpSp->FileObject->FsContext;
826 if (TranContext == NULL)
827 {
828 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
830 goto done;
831 }
832
833 if (TranContext->Handle.ConnectionContext == NULL)
834 {
835 TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
837 goto done;
838 }
839
840 /* Initialize a receive request */
842 (TranContext->Handle.ConnectionContext,
843 Irp,
845
846 TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n", Irp->MdlAddress));
847 if (NT_SUCCESS(Status))
848 {
850 TranContext->Handle.ConnectionContext,
851 (PNDIS_BUFFER)Irp->MdlAddress,
852 ReceiveInfo->ReceiveLength,
853 &BytesReceived,
854 ReceiveInfo->ReceiveFlags,
856 Irp);
857 }
858
859done:
860 if (Status != STATUS_PENDING) {
861 DispDataRequestComplete(Irp, Status, BytesReceived);
862 }
863
864 TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
865
866 return STATUS_PENDING;
867}
868
869
871 PIRP Irp)
872/*
873 * FUNCTION: TDI_RECEIVE_DATAGRAM handler
874 * ARGUMENTS:
875 * Irp = Pointer to an I/O request packet
876 * RETURNS:
877 * Status of operation
878 */
879{
882 PTRANSPORT_CONTEXT TranContext;
885 ULONG BytesReceived = 0;
886
887 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
888
891
893
894 TranContext = IrpSp->FileObject->FsContext;
895 if (TranContext == NULL)
896 {
897 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
899 goto done;
900 }
901
902 /* Initialize a receive request */
903 Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
904 Request.RequestNotifyObject = DispDataRequestComplete;
905 Request.RequestContext = Irp;
906
908 IrpSp->FileObject->FsContext,
909 Irp,
911
912 if (NT_SUCCESS(Status))
913 {
914 PVOID DataBuffer;
916
917 NdisQueryBuffer( (PNDIS_BUFFER)Irp->MdlAddress,
918 &DataBuffer,
919 &BufferSize );
920
922 Request.Handle.AddressHandle,
924 DataBuffer,
925 DgramInfo->ReceiveLength,
926 DgramInfo->ReceiveFlags,
927 DgramInfo->ReturnDatagramInformation,
928 &BytesReceived,
930 Irp,
931 Irp);
932 }
933
934done:
935 if (Status != STATUS_PENDING) {
936 DispDataRequestComplete(Irp, Status, BytesReceived);
937 }
938
939 TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
940
941 return STATUS_PENDING;
942}
943
944
946 PIRP Irp)
947/*
948 * FUNCTION: TDI_SEND handler
949 * ARGUMENTS:
950 * Irp = Pointer to an I/O request packet
951 * RETURNS:
952 * Status of operation
953 */
954{
957 PTRANSPORT_CONTEXT TranContext;
959 ULONG BytesSent = 0;
960
961 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
962
965
967
968 TranContext = IrpSp->FileObject->FsContext;
969 if (TranContext == NULL)
970 {
971 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
973 goto done;
974 }
975
976 if (TranContext->Handle.ConnectionContext == NULL)
977 {
978 TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
980 goto done;
981 }
982
984 IrpSp->FileObject->FsContext,
985 Irp,
987
988 TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n", Irp->MdlAddress));
989 if (NT_SUCCESS(Status))
990 {
991 PVOID Data;
992 UINT Len;
993
994 NdisQueryBuffer( Irp->MdlAddress, &Data, &Len );
995
996 TI_DbgPrint(MID_TRACE,("About to TCPSendData\n"));
998 TranContext->Handle.ConnectionContext,
999 Data,
1000 SendInfo->SendLength,
1001 &BytesSent,
1002 SendInfo->SendFlags,
1004 Irp);
1005 }
1006
1007done:
1008 if (Status != STATUS_PENDING) {
1009 DispDataRequestComplete(Irp, Status, BytesSent);
1010 }
1011
1012 TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
1013
1014 return STATUS_PENDING;
1015}
1016
1017
1019 PIRP Irp)
1020/*
1021 * FUNCTION: TDI_SEND_DATAGRAM handler
1022 * ARGUMENTS:
1023 * Irp = Pointer to an I/O request packet
1024 * RETURNS:
1025 * Status of operation
1026 */
1027{
1031 PTRANSPORT_CONTEXT TranContext;
1033
1034 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1035
1038
1040
1041 TranContext = IrpSp->FileObject->FsContext;
1042 if (TranContext == NULL)
1043 {
1044 TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
1046 goto done;
1047 }
1048
1049 /* Initialize a send request */
1050 Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
1051 Request.RequestNotifyObject = DispDataRequestComplete;
1052 Request.RequestContext = Irp;
1053
1055 IrpSp->FileObject->FsContext,
1056 Irp,
1058
1059 if (NT_SUCCESS(Status)) {
1060 PVOID DataBuffer;
1062
1063 TI_DbgPrint(MID_TRACE,("About to query buffer %x\n", Irp->MdlAddress));
1064
1065 NdisQueryBuffer( (PNDIS_BUFFER)Irp->MdlAddress,
1066 &DataBuffer,
1067 &BufferSize );
1068
1069 /* FIXME: DgramInfo->SendDatagramInformation->RemoteAddress
1070 must be of type PTDI_ADDRESS_IP */
1072 ("About to call send routine %x\n",
1073 (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)));
1074
1075 if( (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send != NULL) )
1076 {
1077 ULONG DataUsed = 0;
1078 Status = (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)(
1079 Request.Handle.AddressHandle,
1080 DgramInfo->SendDatagramInformation,
1081 DataBuffer,
1082 BufferSize,
1083 &DataUsed);
1084 Irp->IoStatus.Information = DataUsed;
1085 }
1086 else {
1088 ASSERT(FALSE);
1089 }
1090 }
1091
1092done:
1093 if (Status != STATUS_PENDING) {
1094 DispDataRequestComplete(Irp, Status, Irp->IoStatus.Information);
1095 }
1096
1097 TI_DbgPrint(DEBUG_IRP, ("Leaving.\n"));
1098
1099 return STATUS_PENDING;
1100}
1101
1102
1104/*
1105 * FUNCTION: TDI_SET_EVENT_HANDER handler
1106 * ARGUMENTS:
1107 * Irp = Pointer to a I/O request packet
1108 * RETURNS:
1109 * Status of operation
1110 */
1111{
1113 PTRANSPORT_CONTEXT TranContext;
1115 PADDRESS_FILE AddrFile;
1117
1118 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1119
1121
1122 /* Get associated address file object. Quit if none exists */
1123
1124 TranContext = IrpSp->FileObject->FsContext;
1125 if (!TranContext) {
1126 TI_DbgPrint(MIN_TRACE, ("Bad transport context.\n"));
1128 }
1129
1130 AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle;
1131 if (!AddrFile) {
1132 TI_DbgPrint(MIN_TRACE, ("No address file object.\n"));
1134 }
1135
1138
1139 LockObject(AddrFile);
1140
1141 /* Set the event handler. if an event handler is associated with
1142 a specific event, it's flag (RegisteredXxxHandler) is TRUE.
1143 If an event handler is not used it's flag is FALSE */
1144 switch (Parameters->EventType) {
1145 case TDI_EVENT_CONNECT:
1146 if (!Parameters->EventHandler) {
1147 AddrFile->ConnectHandlerContext = NULL;
1148 AddrFile->RegisteredConnectHandler = FALSE;
1149 } else {
1150 AddrFile->ConnectHandler =
1151 (PTDI_IND_CONNECT)Parameters->EventHandler;
1152 AddrFile->ConnectHandlerContext = Parameters->EventContext;
1153 AddrFile->RegisteredConnectHandler = TRUE;
1154 }
1155 break;
1156
1158 if (!Parameters->EventHandler) {
1159 AddrFile->DisconnectHandlerContext = NULL;
1161 } else {
1162 AddrFile->DisconnectHandler =
1163 (PTDI_IND_DISCONNECT)Parameters->EventHandler;
1164 AddrFile->DisconnectHandlerContext = Parameters->EventContext;
1166 }
1167 break;
1168
1169 case TDI_EVENT_ERROR:
1170 if (Parameters->EventHandler == NULL) {
1171 AddrFile->ErrorHandlerContext = NULL;
1172 AddrFile->RegisteredErrorHandler = FALSE;
1173 } else {
1174 AddrFile->ErrorHandler =
1175 (PTDI_IND_ERROR)Parameters->EventHandler;
1176 AddrFile->ErrorHandlerContext = Parameters->EventContext;
1177 AddrFile->RegisteredErrorHandler = TRUE;
1178 }
1179 break;
1180
1181 case TDI_EVENT_RECEIVE:
1182 if (Parameters->EventHandler == NULL) {
1183 AddrFile->ReceiveHandlerContext = NULL;
1184 AddrFile->RegisteredReceiveHandler = FALSE;
1185 } else {
1186 AddrFile->ReceiveHandler =
1187 (PTDI_IND_RECEIVE)Parameters->EventHandler;
1188 AddrFile->ReceiveHandlerContext = Parameters->EventContext;
1189 AddrFile->RegisteredReceiveHandler = TRUE;
1190 }
1191 break;
1192
1194 if (Parameters->EventHandler == NULL) {
1197 } else {
1198 AddrFile->ReceiveDatagramHandler =
1200 AddrFile->ReceiveDatagramHandlerContext = Parameters->EventContext;
1202 }
1203 break;
1204
1206 if (Parameters->EventHandler == NULL) {
1209 } else {
1210 AddrFile->ExpeditedReceiveHandler =
1212 AddrFile->ExpeditedReceiveHandlerContext = Parameters->EventContext;
1214 }
1215 break;
1216
1218 if (Parameters->EventHandler == NULL) {
1221 } else {
1222 AddrFile->ChainedReceiveHandler =
1223 (PTDI_IND_CHAINED_RECEIVE)Parameters->EventHandler;
1224 AddrFile->ChainedReceiveHandlerContext = Parameters->EventContext;
1226 }
1227 break;
1228
1230 if (Parameters->EventHandler == NULL) {
1233 } else {
1236 AddrFile->ChainedReceiveDatagramHandlerContext = Parameters->EventContext;
1238 }
1239 break;
1240
1242 if (Parameters->EventHandler == NULL) {
1245 } else {
1248 AddrFile->ChainedReceiveExpeditedHandlerContext = Parameters->EventContext;
1250 }
1251 break;
1252
1253 default:
1254 TI_DbgPrint(MIN_TRACE, ("Unknown event type (0x%X).\n",
1255 Parameters->EventType));
1256
1258 }
1259
1260 UnlockObject(AddrFile);
1261
1262 return Status;
1263}
1264
1265
1267 PIRP Irp)
1268/*
1269 * FUNCTION: TDI_SET_INFORMATION handler
1270 * ARGUMENTS:
1271 * Irp = Pointer to an I/O request packet
1272 * RETURNS:
1273 * Status of operation
1274 */
1275{
1276 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1277
1279}
1280
1281
1283 PVOID Context,
1284 ULONG Status,
1286/*
1287 * FUNCTION: Completes a TDI QueryInformationEx request
1288 * ARGUMENTS:
1289 * Context = Pointer to the IRP for the request
1290 * Status = TDI status of the request
1291 * ByteCount = Number of bytes returned in output buffer
1292 */
1293{
1294 PTI_QUERY_CONTEXT QueryContext;
1295
1296 QueryContext = (PTI_QUERY_CONTEXT)Context;
1297 if (NT_SUCCESS(Status)) {
1299 QueryContext->InputMdl,
1301 (PCHAR)&QueryContext->QueryInfo.Context,
1302 CONTEXT_SIZE);
1303 }
1304
1305 MmUnlockPages(QueryContext->InputMdl);
1306 IoFreeMdl(QueryContext->InputMdl);
1307 if( QueryContext->OutputMdl ) {
1308 MmUnlockPages(QueryContext->OutputMdl);
1309 IoFreeMdl(QueryContext->OutputMdl);
1310 }
1311
1312 QueryContext->Irp->IoStatus.Information = ByteCount;
1313 QueryContext->Irp->IoStatus.Status = Status;
1314
1315 ExFreePoolWithTag(QueryContext, QUERY_CONTEXT_TAG);
1316}
1317
1318
1320 PIRP Irp,
1322/*
1323 * FUNCTION: TDI QueryInformationEx handler
1324 * ARGUMENTS:
1325 * Irp = Pointer to I/O request packet
1326 * IrpSp = Pointer to current stack location of Irp
1327 * RETURNS:
1328 * Status of operation
1329 */
1330{
1332 PTRANSPORT_CONTEXT TranContext;
1333 PTI_QUERY_CONTEXT QueryContext;
1336 UINT Size;
1339 BOOLEAN InputMdlLocked = FALSE;
1340 BOOLEAN OutputMdlLocked = FALSE;
1341 PMDL InputMdl = NULL;
1342 PMDL OutputMdl = NULL;
1344
1345 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1346
1347 TranContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;
1348
1349 switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
1351 Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
1352 break;
1353
1355 Request.Handle.ConnectionContext = TranContext->Handle.ConnectionContext;
1356 break;
1357
1359 Request.Handle.ControlChannel = TranContext->Handle.ControlChannel;
1360 break;
1361
1362 default:
1363 TI_DbgPrint(MIN_TRACE, ("Invalid transport context\n"));
1365 }
1366
1367 InputBufferLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
1368 OutputBufferLength = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
1369
1370 /* Validate parameters */
1372 (OutputBufferLength != 0)) {
1373
1375 IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
1376 OutputBuffer = Irp->UserBuffer;
1377
1379 if (QueryContext) {
1380 _SEH2_TRY {
1381 InputMdl = IoAllocateMdl(InputBuffer,
1383 FALSE, TRUE, NULL);
1384
1385 OutputMdl = IoAllocateMdl(OutputBuffer,
1387
1388 if (InputMdl && OutputMdl) {
1389
1390 MmProbeAndLockPages(InputMdl, Irp->RequestorMode,
1392
1393 InputMdlLocked = TRUE;
1394
1395 MmProbeAndLockPages(OutputMdl, Irp->RequestorMode,
1397
1398 OutputMdlLocked = TRUE;
1399
1400 RtlCopyMemory(&QueryContext->QueryInfo,
1402 } else
1406 } _SEH2_END;
1407
1408 if (NT_SUCCESS(Status)) {
1409 Size = MmGetMdlByteCount(OutputMdl);
1410
1411 QueryContext->Irp = Irp;
1412 QueryContext->InputMdl = InputMdl;
1413 QueryContext->OutputMdl = OutputMdl;
1414
1415 Request.RequestNotifyObject = DispTdiQueryInformationExComplete;
1416 Request.RequestContext = QueryContext;
1418 &QueryContext->QueryInfo.ID, OutputMdl,
1419 &Size, &QueryContext->QueryInfo.Context);
1421
1422 TI_DbgPrint(MAX_TRACE, ("Leaving. Status = (0x%X)\n", Status));
1423
1424 return Status;
1425 }
1426
1427 /* An error occurred if we get here */
1428
1429 if (InputMdl) {
1430 if (InputMdlLocked)
1431 MmUnlockPages(InputMdl);
1432 IoFreeMdl(InputMdl);
1433 }
1434
1435 if (OutputMdl) {
1436 if (OutputMdlLocked)
1437 MmUnlockPages(OutputMdl);
1438 IoFreeMdl(OutputMdl);
1439 }
1440
1441 ExFreePoolWithTag(QueryContext, QUERY_CONTEXT_TAG);
1442 } else
1444 } else if( InputBufferLength ==
1446 /* Handle the case where the user is probing the buffer for length */
1447 TI_DbgPrint(MAX_TRACE, ("InputBufferLength %d OutputBufferLength %d\n",
1450 IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
1451
1452 Size = 0;
1453
1455 if (!QueryContext) return STATUS_INSUFFICIENT_RESOURCES;
1456
1457 _SEH2_TRY {
1458 InputMdl = IoAllocateMdl(InputBuffer,
1460 FALSE, TRUE, NULL);
1461
1462 MmProbeAndLockPages(InputMdl, Irp->RequestorMode,
1464
1465 InputMdlLocked = TRUE;
1468 TI_DbgPrint(MAX_TRACE, ("Failed to acquire client buffer\n"));
1470 } _SEH2_END;
1471
1472 if( !NT_SUCCESS(Status) || !InputMdl ) {
1473 if( InputMdl ) IoFreeMdl( InputMdl );
1474 ExFreePoolWithTag(QueryContext, QUERY_CONTEXT_TAG);
1475 return Status;
1476 }
1477
1478 RtlCopyMemory(&QueryContext->QueryInfo,
1480
1481 QueryContext->Irp = Irp;
1482 QueryContext->InputMdl = InputMdl;
1483 QueryContext->OutputMdl = NULL;
1484
1485 Request.RequestNotifyObject = DispTdiQueryInformationExComplete;
1486 Request.RequestContext = QueryContext;
1488 &QueryContext->QueryInfo.ID,
1489 NULL,
1490 &Size,
1491 &QueryContext->QueryInfo.Context);
1493 TI_DbgPrint(MAX_TRACE, ("Leaving. Status = (0x%X)\n", Status));
1495
1496 TI_DbgPrint(MIN_TRACE, ("Leaving. Status = (0x%X)\n", Status));
1497
1498 return Status;
1499}
1500
1501
1503 PIRP Irp,
1505/*
1506 * FUNCTION: TDI SetInformationEx handler
1507 * ARGUMENTS:
1508 * Irp = Pointer to I/O request packet
1509 * IrpSp = Pointer to current stack location of Irp
1510 * RETURNS:
1511 * Status of operation
1512 */
1513{
1514 PTRANSPORT_CONTEXT TranContext;
1518
1519 TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
1520
1521 TranContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;
1522 Info = (PTCP_REQUEST_SET_INFORMATION_EX)Irp->AssociatedIrp.SystemBuffer;
1523
1524 switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) {
1526 Request.Handle.AddressHandle = TranContext->Handle.AddressHandle;
1527 break;
1528
1530 Request.Handle.ConnectionContext = TranContext->Handle.ConnectionContext;
1531 break;
1532
1534 Request.Handle.ControlChannel = TranContext->Handle.ControlChannel;
1535 break;
1536
1537 default:
1538 Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
1539 Irp->IoStatus.Information = 0;
1540
1541 TI_DbgPrint(DEBUG_IRP, ("Completing IRP at (0x%X).\n", Irp));
1542
1543 return Irp->IoStatus.Status;
1544 }
1545
1546 Request.RequestNotifyObject = NULL;
1547 Request.RequestContext = NULL;
1548
1550 &Info->Buffer, Info->BufferSize);
1551
1552 return Status;
1553}
1554
1555/* TODO: Support multiple addresses per interface.
1556 * For now just set the nte context to the interface index.
1557 *
1558 * Later on, create an NTE context and NTE instance
1559 */
1560
1563 PIP_SET_ADDRESS IpAddrChange =
1564 (PIP_SET_ADDRESS)Irp->AssociatedIrp.SystemBuffer;
1565 IF_LIST_ITER(IF);
1566
1567 TI_DbgPrint(MID_TRACE,("Setting IP Address for adapter %d\n",
1568 IpAddrChange->NteIndex));
1569
1570 ForEachInterface(IF) {
1571 TI_DbgPrint(MID_TRACE,("Looking at adapter %d\n", IF->Index));
1572
1573 if( IF->Unicast.Address.IPv4Address == IpAddrChange->Address ) {
1575 break;
1576 }
1577 if( IF->Index == IpAddrChange->NteIndex ) {
1579
1580 IF->Unicast.Type = IP_ADDRESS_V4;
1581 IF->Unicast.Address.IPv4Address = IpAddrChange->Address;
1582
1583 IF->Netmask.Type = IP_ADDRESS_V4;
1584 IF->Netmask.Address.IPv4Address = IpAddrChange->Netmask;
1585
1586 IF->Broadcast.Type = IP_ADDRESS_V4;
1587 IF->Broadcast.Address.IPv4Address =
1588 IF->Unicast.Address.IPv4Address |
1589 ~IF->Netmask.Address.IPv4Address;
1590
1591 TI_DbgPrint(MID_TRACE,("New Unicast Address: %x\n",
1592 IF->Unicast.Address.IPv4Address));
1593 TI_DbgPrint(MID_TRACE,("New Netmask : %x\n",
1594 IF->Netmask.Address.IPv4Address));
1595
1596 IPAddInterfaceRoute( IF );
1597
1598 IpAddrChange->Address = IF->Index;
1600 Irp->IoStatus.Information = IF->Index;
1601 break;
1602 }
1603 } EndFor(IF);
1604
1605 Irp->IoStatus.Status = Status;
1606 return Status;
1607}
1608
1611 PUSHORT NteIndex = Irp->AssociatedIrp.SystemBuffer;
1612 IF_LIST_ITER(IF);
1613
1614 ForEachInterface(IF) {
1615 if( IF->Index == *NteIndex ) {
1617 IF->Unicast.Type = IP_ADDRESS_V4;
1618 IF->Unicast.Address.IPv4Address = 0;
1619
1620 IF->Netmask.Type = IP_ADDRESS_V4;
1621 IF->Netmask.Address.IPv4Address = 0;
1622
1623 IF->Broadcast.Type = IP_ADDRESS_V4;
1624 IF->Broadcast.Address.IPv4Address = 0;
1625
1627 }
1628 } EndFor(IF);
1629
1630 Irp->IoStatus.Status = Status;
1631 return Status;
1632}
1633
1634VOID NTAPI
1639 IP_ADDRESS Remote;
1640 PIRP Irp;
1643
1644 IoFreeWorkItem(WorkItem->WorkItem);
1645 Irp = WorkItem->Irp;
1646 AddrInitIPv4(&Remote, WorkItem->RemoteIP);
1648 while (Now.QuadPart - WorkItem->StartTime.QuadPart < 10000 * 1000 && !Irp->Cancel) {
1649 NCE = NBLocateNeighbor(&Remote, WorkItem->Interface);
1650 if (NCE && !(NCE->State & NUD_INCOMPLETE)) {
1651 break;
1652 }
1653
1654 NCE = NULL;
1655 Wait.QuadPart = -10000;
1658 }
1659
1660 if (NCE) {
1662
1663 if (NCE->LinkAddressLength > WorkItem->IrpSp->Parameters.DeviceIoControl.OutputBufferLength) {
1665 } else {
1666 OutputBuffer = Irp->AssociatedIrp.SystemBuffer;
1668 Irp->IoStatus.Information = NCE->LinkAddressLength;
1670 }
1671 }
1672
1674 if (Irp->Flags & IRP_SYNCHRONOUS_API) {
1675 Irp->IoStatus.Status = Status;
1676 } else {
1678 }
1679}
1680
1683 PULONG IPs;
1684 IP_ADDRESS Remote, Local;
1688
1689 Irp->IoStatus.Information = 0;
1690
1691 if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < 2 * sizeof(ULONG) ||
1692 IrpSp->Parameters.DeviceIoControl.OutputBufferLength == 0) {
1694 goto Exit;
1695 }
1696
1697 IPs = (PULONG)Irp->AssociatedIrp.SystemBuffer;
1698 AddrInitIPv4(&Remote, IPs[0]);
1699 AddrInitIPv4(&Local, IPs[1]);
1700
1701 if (AddrIsUnspecified(&Remote)) {
1703 goto Exit;
1704 }
1705
1706 Interface = AddrLocateInterface(&Remote);
1707 if (Interface) {
1709
1710 if (Interface->AddressLength > IrpSp->Parameters.DeviceIoControl.OutputBufferLength) {
1712 goto Exit;
1713 }
1714
1715 OutputBuffer = Irp->AssociatedIrp.SystemBuffer;
1716 RtlCopyMemory(OutputBuffer, Interface->Address, Interface->AddressLength);
1717 Irp->IoStatus.Information = Interface->AddressLength;
1719 goto Exit;
1720 }
1721
1722 if (AddrIsUnspecified(&Local)) {
1723 NCE = RouteGetRouteToDestination(&Remote);
1724 if (NCE == NULL) {
1726 goto Exit;
1727 }
1728
1729 Interface = NCE->Interface;
1730 }
1731 else {
1733 if (Interface == NULL) {
1735 if (Interface == NULL) {
1737 goto Exit;
1738 }
1739 }
1740 }
1741
1743 if (WorkItem == NULL) {
1745 goto Exit;
1746 }
1747
1749 if (WorkItem->WorkItem == NULL) {
1752 goto Exit;
1753 }
1754
1755 WorkItem->Irp = Irp;
1756 WorkItem->IrpSp = IrpSp;
1758 WorkItem->RemoteIP = IPs[0];
1759 KeQuerySystemTime(&WorkItem->StartTime);
1760
1761 NCE = NBLocateNeighbor(&Remote, Interface);
1762 if (NCE != NULL) {
1763 if (NCE->LinkAddressLength > IrpSp->Parameters.DeviceIoControl.OutputBufferLength) {
1764 IoFreeWorkItem(WorkItem->WorkItem);
1767 goto Exit;
1768 }
1769
1770 if (!(NCE->State & NUD_INCOMPLETE)) {
1772 if (LinkAddress == NULL) {
1773 IoFreeWorkItem(WorkItem->WorkItem);
1776 goto Exit;
1777 }
1778 memset(LinkAddress, 0xff, NCE->LinkAddressLength);
1779 NBUpdateNeighbor(NCE, LinkAddress, NUD_INCOMPLETE);
1781 }
1782 }
1783
1784 if (!ARPTransmit(&Remote, NULL, Interface)) {
1785 IoFreeWorkItem(WorkItem->WorkItem);
1788 goto Exit;
1789 }
1790
1791 if (Irp->Flags & IRP_SYNCHRONOUS_API) {
1793 Status = Irp->IoStatus.Status;
1794 } else {
1798 }
1799
1800Exit:
1801 return Status;
1802}
1803
1804/* EOF */
unsigned char BOOLEAN
#define AddrInitIPv4(IPAddress, RawAddress)
Definition: address.h:16
PIP_INTERFACE AddrLocateInterface(PIP_ADDRESS MatchAddress)
Definition: interface.c:89
BOOLEAN AddrIsUnspecified(PIP_ADDRESS Address)
Definition: address.c:113
BOOLEAN ARPTransmit(PIP_ADDRESS Address, PVOID LinkAddress, PIP_INTERFACE Interface)
Definition: arp.c:111
LONG NTSTATUS
Definition: precomp.h:26
#define MIN_TRACE
Definition: debug.h:14
#define MID_TRACE
Definition: debug.h:15
#define MAX_TRACE
Definition: debug.h:16
UINT CopyBufferToBufferChain(PNDIS_BUFFER DstBuffer, UINT DstOffset, PUCHAR SrcData, UINT Length)
Definition: buffer.c:56
_In_ PIRP Irp
Definition: csq.h:116
BOOLEAN DGRemoveIRP(PADDRESS_FILE AddrFile, PIRP Irp)
Definition: datagram.c:13
NTSTATUS DGReceiveDatagram(PADDRESS_FILE AddrFile, PTDI_CONNECTION_INFORMATION ConnInfo, PCHAR Buffer, ULONG ReceiveLength, ULONG ReceiveFlags, PTDI_CONNECTION_INFORMATION ReturnInfo, PULONG BytesReceived, PDATAGRAM_COMPLETION_ROUTINE Complete, PVOID Context, PIRP Irp)
Definition: datagram.c:226
#define Len
Definition: deflate.h:82
#define BufferSize
Definition: mmc.h:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
switch(r->id)
Definition: btrfs.c:3046
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define DEBUG_IRP
Definition: debug.h:19
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
VOID IPAddInterfaceRoute(PIP_INTERFACE IF)
Definition: ip.c:262
#define IP_ADDRESS_V4
Definition: ip.h:32
VOID IPRemoveInterfaceRoute(PIP_INTERFACE IF)
Definition: ip.c:331
struct _IP_SET_ADDRESS * PIP_SET_ADDRESS
PNEIGHBOR_CACHE_ENTRY RouteGetRouteToDestination(PIP_ADDRESS Destination)
Definition: router.c:300
#define QUERY_CONTEXT_TAG
Definition: tags.h:17
#define SOCK_STREAM
Definition: tcpip.h:118
#define IO_NETWORK_INCREMENT
Definition: tcpip.h:43
NTSTATUS DispTdiQueryIpHwAddress(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: dispatch.c:1681
NTSTATUS DispTdiQueryInformationEx(PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: dispatch.c:1319
NTSTATUS DispPrepareIrpForCancel(PTRANSPORT_CONTEXT Context, PIRP Irp, PDRIVER_CANCEL CancelRoutine)
Definition: dispatch.c:41
NTSTATUS DispTdiQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatch.c:662
NTSTATUS DispTdiAssociateAddress(PIRP Irp)
Definition: dispatch.c:270
NTSTATUS DispTdiConnect(PIRP Irp)
Definition: dispatch.c:382
NTSTATUS DispTdiReceive(PIRP Irp)
Definition: dispatch.c:802
NTSTATUS DispTdiDeleteIPAddress(PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: dispatch.c:1609
NTSTATUS DispTdiSend(PIRP Irp)
Definition: dispatch.c:945
NTSTATUS DispTdiSetIPAddress(PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: dispatch.c:1561
VOID NTAPI DispCancelListenRequest(PDEVICE_OBJECT Device, PIRP Irp)
Definition: dispatch.c:209
struct _QUERY_HW_WORK_ITEM * PQUERY_HW_WORK_ITEM
VOID NTAPI WaitForHwAddress(PDEVICE_OBJECT DeviceObject, PVOID Context)
Definition: dispatch.c:1635
NTSTATUS DispTdiDisconnect(PIRP Irp)
Definition: dispatch.c:484
VOID DispTdiQueryInformationExComplete(PVOID Context, ULONG Status, UINT ByteCount)
Definition: dispatch.c:1282
NTSTATUS DispTdiSetInformation(PIRP Irp)
Definition: dispatch.c:1266
VOID NTAPI DispCancelRequest(PDEVICE_OBJECT Device, PIRP Irp)
Definition: dispatch.c:118
struct _QUERY_HW_WORK_ITEM QUERY_HW_WORK_ITEM
NTSTATUS DispTdiReceiveDatagram(PIRP Irp)
Definition: dispatch.c:870
NTSTATUS DispTdiSetInformationEx(PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: dispatch.c:1502
NTSTATUS DispTdiSetEventHandler(PIRP Irp)
Definition: dispatch.c:1103
NTSTATUS DispTdiSendDatagram(PIRP Irp)
Definition: dispatch.c:1018
NTSTATUS DispTdiAccept(PIRP Irp)
Definition: dispatch.c:254
NTSTATUS DispTdiDisassociateAddress(PIRP Irp)
Definition: dispatch.c:446
NTSTATUS IRPFinish(PIRP Irp, NTSTATUS Status)
Definition: dispatch.c:26
NTSTATUS DispTdiListen(PIRP Irp)
Definition: dispatch.c:550
VOID DispDataRequestComplete(PVOID Context, NTSTATUS Status, ULONG Count)
Definition: dispatch.c:87
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define NonPagedPool
Definition: env_spec_w32.h:307
#define KeDelayExecutionThread(mode, foo, t)
Definition: env_spec_w32.h:484
#define PagedPool
Definition: env_spec_w32.h:308
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define IoFreeMdl
Definition: fxmdl.h:89
#define IoAllocateMdl
Definition: fxmdl.h:88
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOLEAN TCPRemoveIRP(PCONNECTION_ENDPOINT Connection, PIRP Irp)
Definition: tcp.c:695
NTSTATUS TCPSendData(PCONNECTION_ENDPOINT Connection, PCHAR Buffer, ULONG DataSize, PULONG DataUsed, ULONG Flags, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: tcp.c:580
BOOLEAN TCPAbortListenForSocket(PCONNECTION_ENDPOINT Listener, PCONNECTION_ENDPOINT Connection)
Definition: accept.c:108
NTSTATUS TCPSocket(PCONNECTION_ENDPOINT Connection, UINT Family, UINT Type, UINT Proto)
Definition: tcp.c:153
NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog)
Definition: accept.c:47
NTSTATUS TCPAccept(PTDI_REQUEST Request, PCONNECTION_ENDPOINT Listener, PCONNECTION_ENDPOINT Connection, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: accept.c:139
NTSTATUS TCPDisconnect(PCONNECTION_ENDPOINT Connection, UINT Flags, PLARGE_INTEGER Timeout, PTDI_CONNECTION_INFORMATION ConnInfo, PTDI_CONNECTION_INFORMATION ReturnInfo, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: tcp.c:427
NTSTATUS TCPConnect(PCONNECTION_ENDPOINT Connection, PTDI_CONNECTION_INFORMATION ConnInfo, PTDI_CONNECTION_INFORMATION ReturnInfo, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: tcp.c:302
PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint(PVOID ClientContext)
Definition: tcp.c:107
NTSTATUS TCPReceiveData(PCONNECTION_ENDPOINT Connection, PNDIS_BUFFER Buffer, ULONG ReceiveLength, PULONG BytesReceived, ULONG ReceiveFlags, PTCP_COMPLETION_ROUTINE Complete, PVOID Context)
Definition: tcp.c:529
TDI_STATUS InfoTdiSetInformationEx(PTDI_REQUEST Request, TDIObjectID *ID, PVOID Buffer, UINT BufferSize)
Definition: info.c:383
TDI_STATUS InfoTdiQueryInformationEx(PTDI_REQUEST Request, TDIObjectID *ID, PNDIS_BUFFER Buffer, PUINT BufferSize, PVOID Context)
Definition: info.c:215
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
Definition: iowork.c:40
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
IoMarkIrpPending(Irp)
IoSetCancelRoutine(Irp, CancelRoutine)
if(dx< 0)
Definition: linetemp.h:194
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:931
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
unsigned int UINT
Definition: ndis.h:50
MDL * PNDIS_BUFFER
Definition: ndis.h:343
#define NdisQueryBuffer(_Buffer, _VirtualAddress, _Length)
Definition: ndis.h:3029
#define KernelMode
Definition: asm.h:34
PNEIGHBOR_CACHE_ENTRY NBLocateNeighbor(PIP_ADDRESS Address, PIP_INTERFACE Interface)
Definition: neighbor.c:417
#define NUD_INCOMPLETE
Definition: neighbor.h:41
VOID NBUpdateNeighbor(PNEIGHBOR_CACHE_ENTRY NCE, PVOID LinkAddress, UCHAR State)
Definition: neighbor.c:346
PIP_INTERFACE GetDefaultInterface(VOID)
Definition: interface.c:156
int Count
Definition: noreturn.cpp:7
#define IoCompleteRequest
Definition: irp.c:1240
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
Definition: util.c:56
#define STATUS_NETWORK_UNREACHABLE
Definition: ntstatus.h:704
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:650
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:428
#define STATUS_DUPLICATE_OBJECTID
Definition: ntstatus.h:686
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
struct tm * Now
Definition: output.c:19
static WCHAR Address[46]
Definition: ping.c:68
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define memset(x, y, z)
Definition: compat.h:39
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
static void Exit(void)
Definition: sock.c:1330
Definition: ip.h:23
union IP_ADDRESS::@1005 Address
IPv4_RAW_ADDRESS IPv4Address
Definition: ip.h:26
Definition: neighbor.h:28
PIP_INTERFACE Interface
Definition: neighbor.h:33
PVOID LinkAddress
Definition: neighbor.h:35
UCHAR State
Definition: neighbor.h:30
UINT LinkAddressLength
Definition: neighbor.h:34
BOOLEAN RegisteredReceiveDatagramHandler
Definition: titypes.h:163
struct _CONNECTION_ENDPOINT * Connection
Definition: titypes.h:131
BOOLEAN RegisteredConnectHandler
Definition: titypes.h:146
PTDI_IND_CHAINED_RECEIVE ChainedReceiveHandler
Definition: titypes.h:169
PVOID ChainedReceiveHandlerContext
Definition: titypes.h:170
BOOLEAN RegisteredChainedReceiveExpeditedHandler
Definition: titypes.h:179
PTDI_IND_DISCONNECT DisconnectHandler
Definition: titypes.h:148
PVOID ConnectHandlerContext
Definition: titypes.h:145
PTDI_IND_CHAINED_RECEIVE_DATAGRAM ChainedReceiveDatagramHandler
Definition: titypes.h:173
USHORT Family
Definition: titypes.h:118
USHORT Port
Definition: titypes.h:120
PVOID DisconnectHandlerContext
Definition: titypes.h:149
IP_ADDRESS Address
Definition: titypes.h:117
PTDI_IND_ERROR ErrorHandler
Definition: titypes.h:152
PVOID ReceiveHandlerContext
Definition: titypes.h:158
PVOID ExpeditedReceiveHandlerContext
Definition: titypes.h:166
BOOLEAN RegisteredErrorHandler
Definition: titypes.h:155
PTDI_IND_CONNECT ConnectHandler
Definition: titypes.h:144
BOOLEAN RegisteredChainedReceiveHandler
Definition: titypes.h:171
BOOLEAN RegisteredReceiveHandler
Definition: titypes.h:159
PVOID ChainedReceiveDatagramHandlerContext
Definition: titypes.h:174
PVOID ReceiveDatagramHandlerContext
Definition: titypes.h:162
BOOLEAN RegisteredDisconnectHandler
Definition: titypes.h:150
PTDI_IND_RECEIVE_DATAGRAM ReceiveDatagramHandler
Definition: titypes.h:161
PTDI_IND_RECEIVE ReceiveHandler
Definition: titypes.h:157
PVOID ErrorHandlerContext
Definition: titypes.h:153
USHORT Protocol
Definition: titypes.h:119
BOOLEAN RegisteredExpeditedReceiveHandler
Definition: titypes.h:167
PTDI_IND_CHAINED_RECEIVE_EXPEDITED ChainedReceiveExpeditedHandler
Definition: titypes.h:177
struct _CONNECTION_ENDPOINT * Listener
Definition: titypes.h:133
BOOLEAN RegisteredChainedReceiveDatagramHandler
Definition: titypes.h:175
PTDI_IND_RECEIVE_EXPEDITED ExpeditedReceiveHandler
Definition: titypes.h:165
PVOID ChainedReceiveExpeditedHandlerContext
Definition: titypes.h:178
PADDRESS_FILE AddressFile
Definition: titypes.h:247
struct _CONNECTION_ENDPOINT * Next
Definition: titypes.h:269
KTIMER DisconnectTimer
Definition: titypes.h:259
PINTERFACE Interface
Definition: iotypes.h:3248
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
ULONG NteIndex
Definition: ip.h:174
IPv4_RAW_ADDRESS Address
Definition: ip.h:175
IPv4_RAW_ADDRESS Netmask
Definition: ip.h:176
IO_STATUS_BLOCK IoStatus
PIO_WORKITEM WorkItem
Definition: dispatch.c:18
PIO_STACK_LOCATION IrpSp
Definition: dispatch.c:20
LARGE_INTEGER StartTime
Definition: dispatch.c:22
PIP_INTERFACE Interface
Definition: dispatch.c:21
ULONG_PTR Context[CONTEXT_SIZE/sizeof(ULONG_PTR)]
Definition: tdiinfo.h:84
TRANSPORT_ADDRESS Address
Definition: tdi.h:388
ULONG MaxDatagramSize
Definition: tdi.h:230
PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation
Definition: tdikrnl.h:109
PTDI_CONNECTION_INFORMATION ReturnDatagramInformation
Definition: tdikrnl.h:110
PVOID RequestSpecific
Definition: tdikrnl.h:43
PTDI_CONNECTION_INFORMATION RequestConnectionInformation
Definition: tdikrnl.h:41
PTDI_CONNECTION_INFORMATION ReturnConnectionInformation
Definition: tdikrnl.h:42
ULONG RequestFlags
Definition: tdikrnl.h:40
TCP_REQUEST_QUERY_INFORMATION_EX QueryInfo
Definition: titypes.h:303
HANDLE AddressHandle
Definition: titypes.h:291
union _TRANSPORT_CONTEXT::@1023 Handle
BOOLEAN CancelIrps
Definition: titypes.h:295
HANDLE ControlChannel
Definition: titypes.h:293
CONNECTION_CONTEXT ConnectionContext
Definition: titypes.h:292
#define TDI_QUERY_MAX_DATAGRAM_INFO
Definition: tdi.h:187
#define TDI_QUERY_CONNECTION_INFO
Definition: tdi.h:182
struct _TA_ADDRESS_IP * PTA_IP_ADDRESS
struct _TDI_CONNECTION_INFO * PTDI_CONNECTION_INFO
#define TDI_ADDRESS_LENGTH_IP
Definition: tdi.h:413
struct _TDI_ADDRESS_INFO * PTDI_ADDRESS_INFO
#define TDI_ADDRESS_TYPE_IP
Definition: tdi.h:345
LONG TDI_STATUS
Definition: tdi.h:36
#define TDI_QUERY_ADDRESS_INFO
Definition: tdi.h:181
struct _TDI_MAX_DATAGRAM_INFO * PTDI_MAX_DATAGRAM_INFO
#define CONTEXT_SIZE
Definition: tdiinfo.h:80
struct _TCP_REQUEST_QUERY_INFORMATION_EX * PTCP_REQUEST_QUERY_INFORMATION_EX
#define TDI_EVENT_ERROR
Definition: tdikrnl.h:148
NTSTATUS(NTAPI * PTDI_IND_RECEIVE_EXPEDITED)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ ULONG ReceiveFlags, _In_ ULONG BytesIndicated, _In_ ULONG BytesAvailable, _Out_ ULONG *BytesTaken, _In_ PVOID Tsdu, _Out_opt_ PIRP *IoRequestPacket)
Definition: tdikrnl.h:278
#define TDI_EVENT_CHAINED_RECEIVE_EXPEDITED
Definition: tdikrnl.h:155
#define TDI_SEND_DATAGRAM
Definition: tdikrnl.h:55
#define TDI_CONTROL_CHANNEL_FILE
Definition: tdikrnl.h:67
#define TDI_RECEIVE_DATAGRAM
Definition: tdikrnl.h:56
#define TDI_SEND
Definition: tdikrnl.h:53
#define TDI_EVENT_RECEIVE_EXPEDITED
Definition: tdikrnl.h:151
#define TDI_EVENT_CHAINED_RECEIVE
Definition: tdikrnl.h:153
struct _TDI_REQUEST_KERNEL_RECEIVEDG * PTDI_REQUEST_KERNEL_RECEIVEDG
#define TDI_LISTEN
Definition: tdikrnl.h:50
#define TDI_EVENT_CONNECT
Definition: tdikrnl.h:146
NTSTATUS(NTAPI * PTDI_IND_CHAINED_RECEIVE_DATAGRAM)(_In_opt_ PVOID TdiEventContext, _In_ LONG SourceAddressLength, _In_reads_bytes_(SourceAddressLength) PVOID SourceAddress, _In_ LONG OptionsLength, _In_reads_bytes_opt_(OptionsLength) PVOID Options, _In_ ULONG ReceiveDatagramFlags, _In_ ULONG ReceiveDatagramLength, _In_ ULONG StartingOffset, _In_ PMDL Tsdu, _In_ PVOID TsduDescriptor)
Definition: tdikrnl.h:324
struct _TDI_REQUEST_KERNEL_SENDDG * PTDI_REQUEST_KERNEL_SENDDG
#define TDI_CONNECT
Definition: tdikrnl.h:49
NTSTATUS(NTAPI * PTDI_IND_CHAINED_RECEIVE)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ ULONG ReceiveFlags, _In_ ULONG ReceiveLength, _In_ ULONG StartingOffset, _In_ PMDL Tsdu, _In_ PVOID TsduDescriptor)
Definition: tdikrnl.h:302
NTSTATUS(NTAPI * PTDI_IND_ERROR)(_In_opt_ PVOID TdiEventContext, _In_ NTSTATUS Status)
Definition: tdikrnl.h:207
struct _TDI_REQUEST_KERNEL_SET_EVENT * PTDI_REQUEST_KERNEL_SET_EVENT
#define TDI_EVENT_CHAINED_RECEIVE_DATAGRAM
Definition: tdikrnl.h:154
NTSTATUS(NTAPI * PTDI_IND_CHAINED_RECEIVE_EXPEDITED)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ ULONG ReceiveFlags, _In_ ULONG ReceiveLength, _In_ ULONG StartingOffset, _In_ PMDL Tsdu, _In_ PVOID TsduDescriptor)
Definition: tdikrnl.h:352
struct _TDI_REQUEST_KERNEL * PTDI_REQUEST_KERNEL
#define TDI_EVENT_DISCONNECT
Definition: tdikrnl.h:147
struct _TDI_REQUEST_KERNEL_RECEIVE * PTDI_REQUEST_KERNEL_RECEIVE
NTSTATUS(NTAPI * PTDI_IND_RECEIVE_DATAGRAM)(_In_opt_ PVOID TdiEventContext, _In_ LONG SourceAddressLength, _In_reads_bytes_(SourceAddressLength) PVOID SourceAddress, _In_ LONG OptionsLength, _In_reads_bytes_opt_(OptionsLength) PVOID Options, _In_ ULONG ReceiveDatagramFlags, _In_ ULONG BytesIndicated, _In_ ULONG BytesAvailable, _Out_ ULONG *BytesTaken, _In_ PVOID Tsdu, _Out_opt_ PIRP *IoRequestPacket)
Definition: tdikrnl.h:249
#define TDI_TRANSPORT_ADDRESS_FILE
Definition: tdikrnl.h:65
struct _TDI_REQUEST_KERNEL_SEND * PTDI_REQUEST_KERNEL_SEND
NTSTATUS(NTAPI * PTDI_IND_RECEIVE)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ ULONG ReceiveFlags, _In_ ULONG BytesIndicated, _In_ ULONG BytesAvailable, _Out_ ULONG *BytesTaken, _In_ PVOID Tsdu, _Out_opt_ PIRP *IoRequestPacket)
Definition: tdikrnl.h:225
struct _TDI_REQUEST_KERNEL_QUERY_INFO * PTDI_REQUEST_KERNEL_QUERY_INFORMATION
NTSTATUS(NTAPI * PTDI_IND_CONNECT)(_In_opt_ PVOID TdiEventContext, _In_ LONG RemoteAddressLength, _In_reads_bytes_(RemoteAddressLength) PVOID RemoteAddress, _In_ LONG UserDataLength, _In_reads_bytes_opt_(UserDataLength) PVOID UserData, _In_ LONG OptionsLength, _In_reads_bytes_opt_(OptionsLength) PVOID Options, _Out_ CONNECTION_CONTEXT *ConnectionContext, _Out_ PIRP *AcceptIrp)
Definition: tdikrnl.h:159
#define TDI_RECEIVE
Definition: tdikrnl.h:54
#define TDI_CONNECTION_FILE
Definition: tdikrnl.h:66
struct _TDI_REQUEST_KERNEL_ASSOCIATE * PTDI_REQUEST_KERNEL_ASSOCIATE
#define TDI_EVENT_RECEIVE
Definition: tdikrnl.h:149
#define TDI_EVENT_RECEIVE_DATAGRAM
Definition: tdikrnl.h:150
#define TDI_DISCONNECT
Definition: tdikrnl.h:52
NTSTATUS(NTAPI * PTDI_IND_DISCONNECT)(_In_opt_ PVOID TdiEventContext, _In_opt_ CONNECTION_CONTEXT ConnectionContext, _In_ LONG DisconnectDataLength, _In_reads_bytes_opt_(DisconnectDataLength) PVOID DisconnectData, _In_ LONG DisconnectInformationLength, _In_reads_bytes_opt_(DisconnectInformationLength) PVOID DisconnectInformation, _In_ ULONG DisconnectFlags)
Definition: tdikrnl.h:185
TDI_REQUEST_KERNEL * PTDI_REQUEST_KERNEL_DISCONNECT
Definition: tdikrnl.h:94
#define ForEachInterface(n)
Definition: tilists.h:9
#define EndFor(n)
Definition: tilists.h:20
#define IF_LIST_ITER(n)
Definition: tilists.h:5
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
Definition: timerobj.c:206
struct _TRANSPORT_CONTEXT * PTRANSPORT_CONTEXT
DATAGRAM_COMPLETION_ROUTINE PDATAGRAM_COMPLETION_ROUTINE
Definition: titypes.h:74
#define UnlockObject(Object)
Definition: titypes.h:44
#define ReferenceObject(Object)
Definition: titypes.h:14
#define LockObject(Object)
Definition: titypes.h:34
#define DereferenceObject(Object)
Definition: titypes.h:24
struct _CONNECTION_ENDPOINT * PCONNECTION_ENDPOINT
struct _ADDRESS_FILE * PADDRESS_FILE
struct _TI_QUERY_CONTEXT * PTI_QUERY_CONTEXT
uint32_t * PULONG
Definition: typedefs.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1699
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:320
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
Definition: wdfworkitem.h:115
@ DelayedWorkQueue
Definition: extypes.h:190
_In_opt_ PDRIVER_CANCEL CancelRoutine
Definition: iofuncs.h:2744
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IRP_SYNCHRONOUS_API
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1099
DRIVER_CANCEL * PDRIVER_CANCEL
Definition: iotypes.h:2759
* PFILE_OBJECT
Definition: iotypes.h:1998
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ IoWriteAccess
Definition: ketypes.h:864
@ IoModifyAccess
Definition: ketypes.h:865
#define MmGetMdlByteCount(_Mdl)
#define MmGetSystemAddressForMdl(Mdl)
#define ObDereferenceObject
Definition: obfuncs.h:203
unsigned char UCHAR
Definition: xmlstorage.h:181