ReactOS 0.4.16-dev-1948-gd260c1d
tdi_proto.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

NTSTATUS TdiConnect (PIRP *PendingIrp, PFILE_OBJECT ConnectionObject, PTDI_CONNECTION_INFORMATION ConnectionCallInfo, PTDI_CONNECTION_INFORMATION ConnectionReturnInfo, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext)
 Connect a connection endpoint to a remote peer.
 
NTSTATUS TdiOpenConnectionEndpointFile (PUNICODE_STRING DeviceName, PHANDLE ConnectionHandle, PFILE_OBJECT *ConnectionObject)
 Opens a connection endpoint file object.
 
NTSTATUS TdiCloseDevice (HANDLE Handle, PFILE_OBJECT FileObject)
 
NTSTATUS TdiDisconnect (PIRP *Irp, PFILE_OBJECT TransportObject, PLARGE_INTEGER Time, USHORT Flags, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext, PTDI_CONNECTION_INFORMATION RequestConnectionInfo, PTDI_CONNECTION_INFORMATION ReturnConnectionInfo)
 
NTSTATUS TdiQueryInformation (PFILE_OBJECT FileObject, LONG QueryType, PMDL MdlBuffer)
 Query for information.
 
NTSTATUS TdiSetEventHandler (PFILE_OBJECT FileObject, LONG EventType, PVOID Handler, PVOID Context)
 Sets or resets an event handler.
 
NTSTATUS TdiQueryDeviceControl (PFILE_OBJECT FileObject, ULONG IoControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength, PULONG Return)
 Queries a device for information.
 

Function Documentation

◆ TdiCloseDevice()

NTSTATUS TdiCloseDevice ( HANDLE  Handle,
PFILE_OBJECT  FileObject 
)

Definition at line 158 of file tditest.c.

161{
162 if (FileObject)
164
165 if (Handle)
167
168 return STATUS_SUCCESS;
169}
ULONG Handle
Definition: gdb_input.c:15
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by TdiUnload().

◆ TdiConnect()

NTSTATUS TdiConnect ( PIRP Irp,
PFILE_OBJECT  ConnectionObject,
PTDI_CONNECTION_INFORMATION  ConnectionCallInfo,
PTDI_CONNECTION_INFORMATION  ConnectionReturnInfo,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext 
)

Connect a connection endpoint to a remote peer.

Parameters
ConnectionObject= Pointer to connection endpoint file object
RemoteAddress= Pointer to remote address
Returns
Status of operation

Definition at line 311 of file tdi.c.

326{
328
329 DPRINT("Called\n");
330
331 if (!ConnectionObject) {
332 DPRINT("Bad connection object.\n");
334 }
335
336 DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
337 if (!DeviceObject) {
338 DPRINT("Bad device object.\n");
340 }
341
344 ConnectionObject,
345 NULL,
346 NULL);
347 if (!*Irp) {
349 }
350
353 ConnectionObject,
356 NULL,
357 ConnectionCallInfo,
358 ConnectionReturnInfo);
359
361
362 return STATUS_PENDING;
363}
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
static NTSTATUS TdiCall(PIRP Irp, PDEVICE_OBJECT DeviceObject, PKEVENT Event, PIO_STATUS_BLOCK Iosb)
Calls a transport driver device.
Definition: tdi.c:26
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
#define DPRINT
Definition: sndvol32.h:73
#define TdiBuildInternalDeviceControlIrp(IrpSubFunction, DeviceObject, FileObject, Event, IoStatusBlock)
Definition: tdikrnl.h:573
#define TDI_CONNECT
Definition: tdikrnl.h:49
#define TdiBuildConnect( Irp, DevObj, FileObj, CompRoutine, Contxt, Time, RequestConnectionInfo, ReturnConnectionInfo)
Definition: tdikrnl.h:494
#define STATUS_PENDING
Definition: telnetd.h:14
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE _In_opt_ __drv_aliasesMem WDFCONTEXT CompletionContext
Definition: wdfrequest.h:898
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
Definition: wdfrequest.h:895

Referenced by AfdStreamSocketConnect(), and WskConnect().

◆ TdiDisconnect()

NTSTATUS TdiDisconnect ( PIRP Irp,
PFILE_OBJECT  TransportObject,
PLARGE_INTEGER  Time,
USHORT  Flags,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext,
PTDI_CONNECTION_INFORMATION  RequestConnectionInfo,
PTDI_CONNECTION_INFORMATION  ReturnConnectionInfo 
)

Definition at line 1266 of file tdi.c.

1274 {
1276
1277 if (!TransportObject) {
1278 DPRINT("Bad transport object.\n");
1280 }
1281
1282 DPRINT("Called(TransportObject %p)\n", TransportObject);
1283
1284 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1285 if (!DeviceObject) {
1286 DPRINT("Bad device object.\n");
1288 }
1289
1292 TransportObject,
1293 NULL,
1294 NULL);
1295
1296 if (!*Irp) {
1297 DPRINT("Insufficient resources.\n");
1299 }
1300
1303 TransportObject,
1306 Time,
1307 Flags,
1308 RequestConnectionInfo,
1309 ReturnConnectionInfo);
1310
1312
1313 return STATUS_PENDING;
1314}
static PLARGE_INTEGER Time
Definition: time.c:105
#define TdiBuildDisconnect( Irp, DevObj, FileObj, CompRoutine, Contxt, Time, Flags, RequestConnectionInfo, ReturnConnectionInfo)
Definition: tdikrnl.h:545
#define TDI_DISCONNECT
Definition: tdikrnl.h:52
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by DoDisconnect().

◆ TdiOpenConnectionEndpointFile()

NTSTATUS TdiOpenConnectionEndpointFile ( PUNICODE_STRING  DeviceName,
PHANDLE  ConnectionHandle,
PFILE_OBJECT ConnectionObject 
)

Opens a connection endpoint file object.

Parameters
DeviceName= Pointer to counted string with name of device
ConnectionHandle= Address of buffer to place connection endpoint file handle
ConnectionObject= Address of buffer to place connection endpoint file object
Returns
Status of operation

Definition at line 258 of file tdi.c.

271{
273 PVOID *ContextArea;
276
277 DPRINT("Called. DeviceName (%wZ)\n", DeviceName);
278
279 /* EaName must be 0-terminated, even though TDI_TRANSPORT_ADDRESS_LENGTH does *not* include the 0 */
282 sizeof(PVOID) + 1;
283
285 EaLength,
287 if (!EaInfo)
289
290 RtlZeroMemory(EaInfo, EaLength);
292 /* Don't copy the terminating 0; we have already zeroed it */
293 RtlCopyMemory(EaInfo->EaName,
296 EaInfo->EaValueLength = sizeof(PVOID);
297 ContextArea = (PVOID*)(EaInfo->EaName + TDI_CONNECTION_CONTEXT_LENGTH + 1); /* 0-terminated */
298 /* FIXME: Allocate context area */
299 *ContextArea = NULL;
301 EaLength,
302 EaInfo,
305 ConnectionObject);
307 return Status;
308}
#define TAG_AFD_EA_INFO
Definition: afd.h:50
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS TdiOpenDevice(PUNICODE_STRING DeviceName, ULONG EaLength, PFILE_FULL_EA_INFORMATION EaInfo, ULONG ShareType, PHANDLE Handle, PFILE_OBJECT *Object)
Opens a device.
Definition: tdi.c:68
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
IN PVCB IN PDIRENT OUT PULONG EaLength
Definition: fatprocs.h:879
struct _FILE_FULL_EA_INFORMATION * PFILE_FULL_EA_INFORMATION
struct _FILE_FULL_EA_INFORMATION FILE_FULL_EA_INFORMATION
Status
Definition: gdiplustypes.h:25
_In_ PKSPIN_CONNECT _In_ ACCESS_MASK _Out_ PHANDLE ConnectionHandle
Definition: ks.h:4538
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define AFD_SHARE_UNIQUE
Definition: netio.c:67
#define TDI_CONNECTION_CONTEXT_LENGTH
Definition: tdi.h:373
#define TdiConnectionContext
Definition: tdi.h:371
void * PVOID
Definition: typedefs.h:50
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281

Referenced by WarmSocketForConnection(), and WskSocket().

◆ TdiQueryDeviceControl()

NTSTATUS TdiQueryDeviceControl ( PFILE_OBJECT  FileObject,
ULONG  IoControlCode,
PVOID  InputBuffer,
ULONG  InputBufferLength,
PVOID  OutputBuffer,
ULONG  OutputBufferLength,
PULONG  Return 
)

Queries a device for information.

Parameters
FileObject= Pointer to file object
IoControlCode= I/O control code
InputBuffer= Pointer to buffer with input data
InputBufferLength= Length of InputBuffer
OutputBuffer= Address of buffer to place output data
OutputBufferLength= Length of OutputBuffer
Returns
Status of operation

Definition at line 632 of file tdi.c.

652{
657 PIRP Irp;
658
659 if (!FileObject) {
660 DPRINT("Bad file object.\n");
662 }
663
665 if (!DeviceObject) {
666 DPRINT("Bad device object.\n");
668 }
669
671
678 FALSE,
679 &Event,
680 &Iosb);
681 if (!Irp)
683
685
686 if (Return)
687 *Return = Iosb.Information;
688
689 return Status;
690}
#define FALSE
Definition: types.h:117
return Iosb
Definition: create.c:4403
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
@ NotificationEvent
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_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

Referenced by TdiQueryInformationEx().

◆ TdiQueryInformation()

NTSTATUS TdiQueryInformation ( PFILE_OBJECT  FileObject,
LONG  QueryType,
PMDL  MdlBuffer 
)

Query for information.

Parameters
FileObject= Pointer to file object
QueryType= Query type
MdlBuffer= Pointer to MDL buffer specific for query type
Returns
Status of operation

Definition at line 693 of file tdi.c.

706{
710 PIRP Irp;
711
712 if (!FileObject) {
713 DPRINT("Bad file object.\n");
715 }
716
718 if (!DeviceObject) {
719 DPRINT("Bad device object.\n");
721 }
722
724
727 ConnectionObject,
728 &Event,
729 &Iosb);
730 if (!Irp) {
732 }
733
737 NULL,
738 NULL,
739 QueryType,
740 MdlBuffer);
741
742 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
743}
_Must_inspect_result_ _In_ KTMOBJECT_TYPE QueryType
Definition: nttmapi.h:404
#define TDI_QUERY_INFORMATION
Definition: tdikrnl.h:58
#define TdiBuildQueryInformation( Irp, DevObj, FileObj, CompRoutine, Contxt, QType, MdlAddr)
Definition: tdikrnl.h:638

Referenced by AfdGetSockName(), and TdiQueryMaxDatagramLength().

◆ TdiSetEventHandler()

NTSTATUS TdiSetEventHandler ( PFILE_OBJECT  FileObject,
LONG  EventType,
PVOID  Handler,
PVOID  Context 
)

Sets or resets an event handler.

Parameters
FileObject= Pointer to file object
EventType= Event code
Handler= Event handler to be called when the event occurs
Context= Context input to handler when the event occurs
Returns
Status of operation

Specify NULL for Handler to stop calling event handler

Definition at line 571 of file tdi.c.

588{
592 PIRP Irp;
593
594 DPRINT("Called\n");
595
596 if (!FileObject) {
597 DPRINT("Bad file object.\n");
599 }
600
602 if (!DeviceObject) {
603 DPRINT("Bad device object.\n");
605 }
606
608
612 &Event,
613 &Iosb);
614 if (!Irp)
616
617
618
622 NULL,
623 NULL,
624 EventType,
625 Handler,
626 Context);
627
628 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
629}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE EventType
Definition: exfuncs.h:167
#define TdiBuildSetEventHandler( Irp, DevObj, FileObj, CompRoutine, Contxt, InEventType, InEventHandler, InEventContext)
Definition: tdikrnl.h:791
#define TDI_SET_EVENT_HANDLER
Definition: tdikrnl.h:57

Referenced by AfdDeregisterEventHandlers(), and AfdRegisterEventHandlers().