ReactOS 0.4.16-dev-1946-g52006dd
tdiconn.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef VOIDPTDI_CONNECTION_INFO_PAIR
 

Functions

PTRANSPORT_ADDRESS TaCopyTransportAddress (PTRANSPORT_ADDRESS OtherAddress)
 
PTRANSPORT_ADDRESS TaBuildNullTransportAddress (UINT AddressType)
 
UINT TaLengthOfAddress (PTA_ADDRESS Addr)
 
UINT TaLengthOfTransportAddress (PTRANSPORT_ADDRESS Addr)
 
UINT TaLengthOfTransportAddressByType (UINT AddressType)
 
VOID TaCopyTransportAddressInPlace (PTRANSPORT_ADDRESS Target, PTRANSPORT_ADDRESS Source)
 
UINT TdiAddressSizeFromType (UINT Type)
 
UINT TdiAddressSizeFromName (PTRANSPORT_ADDRESS Name)
 
NTSTATUS TdiBuildConnectionInfoInPlace (PTDI_CONNECTION_INFORMATION ConnInfo, PTRANSPORT_ADDRESS Name)
 
NTSTATUS TdiBuildConnectionInfo (PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTRANSPORT_ADDRESS Name)
 
NTSTATUS TdiBuildNullConnectionInfoInPlace (PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type)
 Builds a NULL TDI connection information structure.
 
NTSTATUS TdiBuildNullConnectionInfo (PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type)
 Builds a NULL TDI connection information structure.
 
NTSTATUS TdiOpenAddressFile (PUNICODE_STRING DeviceName, PTRANSPORT_ADDRESS Name, ULONG ShareType, PHANDLE AddressHandle, PFILE_OBJECT *AddressObject)
 Opens an IPv4 address file object.
 
NTSTATUS TdiAssociateAddressFile (HANDLE AddressHandle, PFILE_OBJECT ConnectionObject)
 Associates a connection endpoint to an address file object.
 
NTSTATUS TdiDisassociateAddressFile (PFILE_OBJECT ConnectionObject)
 Disassociates a connection endpoint from an address file object.
 
NTSTATUS TdiListen (PIRP *Irp, PFILE_OBJECT ConnectionObject, PTDI_CONNECTION_INFORMATION *RequestConnectionInfo, PTDI_CONNECTION_INFORMATION *ReturnConnectionInfo, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext)
 Listen on a connection endpoint for a connection request from a remote peer.
 
NTSTATUS TdiAccept (PIRP *Irp, PFILE_OBJECT AcceptConnectionObject, PTDI_CONNECTION_INFORMATION RequestConnectionInfo, PTDI_CONNECTION_INFORMATION ReturnConnectionInfo, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext)
 Listen on a connection endpoint for a connection request from a remote peer.
 
NTSTATUS TdiReceive (PIRP *Irp, PFILE_OBJECT ConnectionObject, USHORT Flags, PCHAR Buffer, UINT BufferLength, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext)
 
NTSTATUS TdiSend (PIRP *Irp, PFILE_OBJECT ConnectionObject, USHORT Flags, PCHAR Buffer, UINT BufferLength, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext)
 
NTSTATUS TdiReceiveDatagram (PIRP *Irp, PFILE_OBJECT TransportObject, USHORT Flags, PCHAR Buffer, UINT BufferLength, PTDI_CONNECTION_INFORMATION From, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext)
 Receives a datagram.
 
NTSTATUS TdiSendDatagram (PIRP *Irp, PFILE_OBJECT TransportObject, PCHAR Buffer, UINT BufferLength, PTDI_CONNECTION_INFORMATION To, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext)
 Sends a datagram.
 
NTSTATUS TdiQueryMaxDatagramLength (PFILE_OBJECT FileObject, PUINT MaxDatagramLength)
 

Typedef Documentation

◆ PTDI_CONNECTION_INFO_PAIR

Definition at line 3 of file tdiconn.h.

Function Documentation

◆ TaBuildNullTransportAddress()

PTRANSPORT_ADDRESS TaBuildNullTransportAddress ( UINT  AddressType)

Definition at line 123 of file tdiconn.c.

124{
125 UINT AddrLen;
127
128 AddrLen = TaLengthOfTransportAddressByType(AddressType);
129 if (!AddrLen)
130 return NULL;
131
133
134 if (A)
135 {
137 {
139 return NULL;
140 }
141 }
142
143 return A;
144}
#define TAG_AFD_TRANSPORT_ADDRESS
Definition: afd.h:39
Definition: ehthrow.cxx:93
#define NULL
Definition: types.h:112
#define A(row, col)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
unsigned int UINT
Definition: ndis.h:50
#define STATUS_SUCCESS
Definition: shellext.h:65
UINT TaLengthOfTransportAddressByType(UINT AddressType)
Definition: tdiconn.c:70
NTSTATUS TdiBuildNullTransportAddressInPlace(PTRANSPORT_ADDRESS A, UINT AddressType)
Definition: tdiconn.c:108

Referenced by AfdPacketSocketWriteData(), and AfdStreamSocketConnect().

◆ TaCopyTransportAddress()

PTRANSPORT_ADDRESS TaCopyTransportAddress ( PTRANSPORT_ADDRESS  OtherAddress)

Definition at line 90 of file tdiconn.c.

90 {
91 UINT AddrLen;
93
94 AddrLen = TaLengthOfTransportAddress( OtherAddress );
95 if (!AddrLen)
96 return NULL;
97
99 AddrLen,
101
102 if( A )
103 TaCopyTransportAddressInPlace( A, OtherAddress );
104
105 return A;
106}
UINT TaLengthOfTransportAddress(PTRANSPORT_ADDRESS Addr)
Definition: tdiconn.c:56
VOID TaCopyTransportAddressInPlace(PTRANSPORT_ADDRESS Target, PTRANSPORT_ADDRESS Source)
Definition: tdiconn.c:84

Referenced by AfdBindSocket(), AfdStreamSocketConnect(), PacketSocketRecvComplete(), and SatisfyAccept().

◆ TaCopyTransportAddressInPlace()

VOID TaCopyTransportAddressInPlace ( PTRANSPORT_ADDRESS  Target,
PTRANSPORT_ADDRESS  Source 
)

Definition at line 84 of file tdiconn.c.

85 {
87 RtlCopyMemory( Target, Source, AddrLen );
88}
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by ListenComplete(), SatisfyPreAccept(), TaCopyTransportAddress(), and TdiOpenAddressFile().

◆ TaLengthOfAddress()

UINT TaLengthOfAddress ( PTA_ADDRESS  Addr)

Definition at line 42 of file tdiconn.c.

43{
44 UINT AddrLen = Addr->AddressLength;
45
46 if (!AddrLen)
47 return 0;
48
49 AddrLen += 2 * sizeof( USHORT );
50
51 DPRINT("AddrLen %x\n", AddrLen);
52
53 return AddrLen;
54}
unsigned short USHORT
Definition: pedump.c:61
#define DPRINT
Definition: sndvol32.h:73
USHORT AddressLength
Definition: tdi.h:338

Referenced by TaLengthOfTransportAddress().

◆ TaLengthOfTransportAddress()

UINT TaLengthOfTransportAddress ( PTRANSPORT_ADDRESS  Addr)

Definition at line 56 of file tdiconn.c.

57{
58 UINT AddrLen = TaLengthOfAddress(&Addr->Address[0]);
59
60 if (!AddrLen)
61 return 0;
62
63 AddrLen += sizeof(ULONG);
64
65 DPRINT("AddrLen %x\n", AddrLen);
66
67 return AddrLen;
68}
TA_ADDRESS Address[1]
Definition: tdi.h:377
UINT TaLengthOfAddress(PTA_ADDRESS Addr)
Definition: tdiconn.c:42
uint32_t ULONG
Definition: typedefs.h:59

Referenced by AfdGetPeerName(), TaCopyTransportAddress(), TaCopyTransportAddressInPlace(), and TdiOpenAddressFile().

◆ TaLengthOfTransportAddressByType()

UINT TaLengthOfTransportAddressByType ( UINT  AddressType)

Definition at line 70 of file tdiconn.c.

71{
72 UINT AddrLen = TdiAddressSizeFromType(AddressType);
73
74 if (!AddrLen)
75 return 0;
76
77 AddrLen += sizeof(ULONG) + 2 * sizeof(USHORT);
78
79 DPRINT("AddrLen %x\n", AddrLen);
80
81 return AddrLen;
82}
UINT TdiAddressSizeFromType(UINT AddressType)
Definition: tdiconn.c:23

Referenced by TaBuildNullTransportAddress(), TdiBuildNullConnectionInfo(), and TdiBuildNullConnectionInfoInPlace().

◆ TdiAccept()

NTSTATUS TdiAccept ( PIRP Irp,
PFILE_OBJECT  AcceptConnectionObject,
PTDI_CONNECTION_INFORMATION  RequestConnectionInfo,
PTDI_CONNECTION_INFORMATION  ReturnConnectionInfo,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext 
)

Listen on a connection endpoint for a connection request from a remote peer.

Parameters
CompletionRoutine= Routine to be called when IRP is completed
CompletionContext= Context for CompletionRoutine
Returns
Status of operation May return STATUS_PENDING

Definition at line 517 of file tdi.c.

533{
535
536 DPRINT("Called\n");
537
538 if (!AcceptConnectionObject) {
539 DPRINT("Bad connection object.\n");
541 }
542
543 DeviceObject = IoGetRelatedDeviceObject(AcceptConnectionObject);
544 if (!DeviceObject) {
545 DPRINT("Bad device object.\n");
547 }
548
551 AcceptConnectionObject,
552 NULL,
553 NULL);
554 if (*Irp == NULL)
556
559 AcceptConnectionObject,
562 RequestConnectionInfo,
563 ReturnConnectionInfo);
564
565 TdiCall(*Irp, DeviceObject, NULL /* Don't wait for completion */, NULL);
566
567 return STATUS_PENDING;
568}
_In_ PIRP Irp
Definition: csq.h:116
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 TDI_LISTEN
Definition: tdikrnl.h:50
#define TdiBuildInternalDeviceControlIrp(IrpSubFunction, DeviceObject, FileObject, Event, IoStatusBlock)
Definition: tdikrnl.h:573
#define TdiBuildAccept( Irp, DevObj, FileObj, CompRoutine, Contxt, RequestConnectionInfo, ReturnConnectionInfo)
Definition: tdikrnl.h:417
#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

◆ TdiAddressSizeFromName()

UINT TdiAddressSizeFromName ( PTRANSPORT_ADDRESS  Name)

◆ TdiAddressSizeFromType()

UINT TdiAddressSizeFromType ( UINT  Type)

Definition at line 23 of file tdiconn.c.

23 {
24 switch( AddressType ) {
31 /* case TDI_ADDRESS_TYPE_NS: */
36 default:
37 DbgPrint("TdiAddressSizeFromType - invalid type: %x\n", AddressType);
38 return 0;
39 }
40}
#define DbgPrint
Definition: hal.h:12
#define TDI_ADDRESS_LENGTH_VNS
Definition: tdi.h:486
#define TDI_ADDRESS_TYPE_VNS
Definition: tdi.h:365
#define TDI_ADDRESS_LENGTH_APPLETALK
Definition: tdi.h:405
#define TDI_ADDRESS_LENGTH_IPX
Definition: tdi.h:421
#define TDI_ADDRESS_TYPE_NETBIOS
Definition: tdi.h:361
#define TDI_ADDRESS_LENGTH_IP
Definition: tdi.h:413
#define TDI_ADDRESS_TYPE_IPX
Definition: tdi.h:350
#define TDI_ADDRESS_TYPE_IP
Definition: tdi.h:345
#define TDI_ADDRESS_TYPE_APPLETALK
Definition: tdi.h:360
#define TDI_ADDRESS_LENGTH_NETBIOS
Definition: tdi.h:434

Referenced by TaLengthOfTransportAddressByType(), TdiBuildNullConnectionInfo(), TdiBuildNullConnectionInfoInPlace(), and TdiBuildNullTransportAddressInPlace().

◆ TdiAssociateAddressFile()

NTSTATUS TdiAssociateAddressFile ( HANDLE  AddressHandle,
PFILE_OBJECT  ConnectionObject 
)

Associates a connection endpoint to an address file object.

Parameters
AddressHandle= Handle to address file object
ConnectionObject= Connection endpoint file object
Returns
Status of operation

Definition at line 366 of file tdi.c.

377{
381 PIRP Irp;
382
383 DPRINT("Called. AddressHandle (%p) ConnectionObject (%p)\n", AddressHandle, ConnectionObject);
384
385 if (!ConnectionObject) {
386 DPRINT("Bad connection object.\n");
388 }
389
390 DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
391 if (!DeviceObject) {
392 DPRINT("Bad device object.\n");
394 }
395
397
400 ConnectionObject,
401 &Event,
402 &Iosb);
403 if (!Irp)
405
408 ConnectionObject,
409 NULL,
410 NULL,
411 AddressHandle);
412
413 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
414}
#define FALSE
Definition: types.h:117
return Iosb
Definition: create.c:4403
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
@ NotificationEvent
#define TdiBuildAssociateAddress( Irp, DevObj, FileObj, CompRoutine, Contxt, AddrHandle)
Definition: tdikrnl.h:467
#define TDI_ASSOCIATE_ADDRESS
Definition: tdikrnl.h:47

Referenced by StartListening(), WarmSocketForConnection(), and WskConnect().

◆ TdiBuildConnectionInfo()

NTSTATUS TdiBuildConnectionInfo ( PTDI_CONNECTION_INFORMATION ConnectionInfo,
PTRANSPORT_ADDRESS  Name 
)

Definition at line 246 of file tdiconn.c.

248 {
250 ( ConnectionInfo, Address->Address[0].AddressType );
251
252 if( NT_SUCCESS(Status) )
253 TdiBuildConnectionInfoInPlace( *ConnectionInfo, Address );
254
255 return Status;
256}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:25
static WCHAR Address[46]
Definition: ping.c:68
NTSTATUS TdiBuildNullConnectionInfo(PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type)
Builds a NULL TDI connection information structure.
Definition: tdiconn.c:181
NTSTATUS TdiBuildConnectionInfoInPlace(PTDI_CONNECTION_INFORMATION ConnectionInfo, PTRANSPORT_ADDRESS Address)
Definition: tdiconn.c:229

Referenced by AfdBindSocket(), AfdConnectedSocketWriteData(), AfdPacketSocketWriteData(), AfdStreamSocketConnect(), SatisfyAccept(), and TdiConnectionInfoFromSocketAddress().

◆ TdiBuildConnectionInfoInPlace()

NTSTATUS TdiBuildConnectionInfoInPlace ( PTDI_CONNECTION_INFORMATION  ConnInfo,
PTRANSPORT_ADDRESS  Name 
)

Definition at line 228 of file tdiconn.c.

230 {
232
233 _SEH2_TRY {
234 RtlCopyMemory( ConnectionInfo->RemoteAddress,
235 Address,
236 ConnectionInfo->RemoteAddressLength );
239 } _SEH2_END;
240
241 return Status;
242}
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71

Referenced by TdiBuildConnectionInfo().

◆ TdiBuildNullConnectionInfo()

NTSTATUS TdiBuildNullConnectionInfo ( PTDI_CONNECTION_INFORMATION ConnectionInfo,
ULONG  Type 
)

Builds a NULL TDI connection information structure.

Parameters
ConnectionInfo= Address of buffer pointer to allocate connection information in
Type= TDI style address type (TDI_ADDRESS_TYPE_XXX).
Returns
Status of operation

Definition at line 180 of file tdiconn.c.

192{
194 ULONG TdiAddressSize;
196
197 TdiAddressSize = TaLengthOfTransportAddressByType(Type);
198 if (!TdiAddressSize) {
199 DPRINT("Invalid parameter\n");
200 *ConnectionInfo = NULL;
202 }
203
204 ConnInfo = (PTDI_CONNECTION_INFORMATION)
206 sizeof(TDI_CONNECTION_INFORMATION) + TdiAddressSize,
208 if (!ConnInfo) {
209 *ConnectionInfo = NULL;
211 }
212
214
215 if (!NT_SUCCESS(Status))
216 {
218 ConnInfo = NULL;
219 }
220
221 *ConnectionInfo = ConnInfo;
222
223 return Status;
224}
Type
Definition: Type.h:7
#define TAG_AFD_TDI_CONNECTION_INFORMATION
Definition: afd.h:53
struct _TDI_CONNECTION_INFORMATION * PTDI_CONNECTION_INFORMATION
NTSTATUS TdiBuildNullConnectionInfoInPlace(PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type)
Builds a NULL TDI connection information structure.
Definition: tdiconn.c:147

Referenced by AfdListenSocket(), ListenComplete(), StartListening(), TdiBuildConnectionInfo(), and WskConnect().

◆ TdiBuildNullConnectionInfoInPlace()

NTSTATUS TdiBuildNullConnectionInfoInPlace ( PTDI_CONNECTION_INFORMATION  ConnInfo,
ULONG  Type 
)

Builds a NULL TDI connection information structure.

Parameters
ConnectionInfo= Address of buffer to place connection information
Type= TDI style address type (TDI_ADDRESS_TYPE_XXX).
Returns
Status of operation

Definition at line 146 of file tdiconn.c.

157{
158 ULONG TdiAddressSize;
159 PTRANSPORT_ADDRESS TransportAddress;
160
161 TdiAddressSize = TaLengthOfTransportAddressByType(Type);
162 if (!TdiAddressSize)
163 {
164 DPRINT("Invalid parameter\n");
166 }
167
168 RtlZeroMemory(ConnInfo,
170 TdiAddressSize);
171
172 ConnInfo->OptionsLength = sizeof(ULONG);
173 ConnInfo->RemoteAddressLength = TdiAddressSize;
174 ConnInfo->RemoteAddress = TransportAddress =
175 (PTRANSPORT_ADDRESS)&ConnInfo[1];
176
177 return TdiBuildNullTransportAddressInPlace(TransportAddress, Type);
178}
struct _TRANSPORT_ADDRESS * PTRANSPORT_ADDRESS
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by ListenComplete(), and TdiBuildNullConnectionInfo().

◆ TdiDisassociateAddressFile()

NTSTATUS TdiDisassociateAddressFile ( PFILE_OBJECT  ConnectionObject)

Disassociates a connection endpoint from an address file object.

Parameters
ConnectionObject= Connection endpoint file object
Returns
Status of operation

Definition at line 416 of file tdi.c.

425{
429 PIRP Irp;
430
431 DPRINT("Called. ConnectionObject (%p)\n", ConnectionObject);
432
433 if (!ConnectionObject) {
434 DPRINT("Bad connection object.\n");
436 }
437
438 DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
439 if (!DeviceObject) {
440 DPRINT("Bad device object.\n");
442 }
443
445
448 ConnectionObject,
449 &Event,
450 &Iosb);
451 if (!Irp)
453
456 ConnectionObject,
457 NULL,
458 NULL);
459
460 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
461}
#define TdiBuildDisassociateAddress( Irp, DevObj, FileObj, CompRoutine, Contxt)
Definition: tdikrnl.h:521
#define TDI_DISASSOCIATE_ADDRESS
Definition: tdikrnl.h:48

Referenced by AfdCloseSocket(), SocketShutdown(), StartListening(), and WskConnect().

◆ TdiListen()

NTSTATUS TdiListen ( PIRP Irp,
PFILE_OBJECT  ConnectionObject,
PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
PTDI_CONNECTION_INFORMATION ReturnConnectionInfo,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext 
)

Listen on a connection endpoint for a connection request from a remote peer.

Parameters
CompletionRoutine= Routine to be called when IRP is completed
CompletionContext= Context for CompletionRoutine
Returns
Status of operation May return STATUS_PENDING

Definition at line 463 of file tdi.c.

479{
481
482 DPRINT("Called\n");
483
484 if (!ConnectionObject) {
485 DPRINT("Bad connection object.\n");
487 }
488
489 DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
490 if (!DeviceObject) {
491 DPRINT("Bad device object.\n");
493 }
494
497 ConnectionObject,
498 NULL,
499 NULL);
500 if (*Irp == NULL)
502
505 ConnectionObject,
508 0,
509 *RequestConnectionInfo,
510 *ReturnConnectionInfo);
511
512 TdiCall(*Irp, DeviceObject, NULL /* Don't wait for completion */, NULL);
513
514 return STATUS_PENDING;
515}
#define TdiBuildListen( Irp, DevObj, FileObj, CompRoutine, Contxt, Flags, RequestConnectionInfo, ReturnConnectionInfo)
Definition: tdikrnl.h:593

Referenced by AfdListenSocket(), ListenComplete(), and StartListening().

◆ TdiOpenAddressFile()

NTSTATUS TdiOpenAddressFile ( PUNICODE_STRING  DeviceName,
PTRANSPORT_ADDRESS  Name,
ULONG  ShareType,
PHANDLE  AddressHandle,
PFILE_OBJECT AddressObject 
)

Opens an IPv4 address file object.

Parameters
DeviceName= Pointer to counted string with name of device
Name= Pointer to socket name (IPv4 address family)
AddressHandle= Address of buffer to place address file handle
AddressObject= Address of buffer to place address file object
Returns
Status of operation

Definition at line 148 of file tdi.c.

164{
169
170 DPRINT("Called. DeviceName (%wZ) Name (%p)\n", DeviceName, Name);
171
172 /* EaName must be 0-terminated, even though TDI_TRANSPORT_ADDRESS_LENGTH does *not* include the 0 */
177 EaLength,
179 if (!EaInfo)
181
182 RtlZeroMemory(EaInfo, EaLength);
184 /* Don't copy the terminating 0; we have already zeroed it */
185 RtlCopyMemory(EaInfo->EaName,
188 EaInfo->EaValueLength = sizeof(TA_IP_ADDRESS);
189 Address =
190 (PTRANSPORT_ADDRESS)(EaInfo->EaName + TDI_TRANSPORT_ADDRESS_LENGTH + 1); /* 0-terminated */
192
194 EaLength,
195 EaInfo,
196 ShareType,
197 AddressHandle,
198 AddressObject);
200 return Status;
201}
#define TAG_AFD_EA_INFO
Definition: afd.h:50
LPWSTR Name
Definition: desk.c:124
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
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
struct _TA_ADDRESS_IP TA_IP_ADDRESS
#define TDI_TRANSPORT_ADDRESS_LENGTH
Definition: tdi.h:372
#define TdiTransportAddress
Definition: tdi.h:370
UINT TaLengthOfTransportAddress(PTRANSPORT_ADDRESS Addr)
Definition: tdiconn.c:56
VOID TaCopyTransportAddressInPlace(PTRANSPORT_ADDRESS Target, PTRANSPORT_ADDRESS Source)
Definition: tdiconn.c:84
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281

Referenced by WarmSocketForBind(), and WskBind().

◆ TdiQueryMaxDatagramLength()

NTSTATUS TdiQueryMaxDatagramLength ( PFILE_OBJECT  FileObject,
PUINT  MaxDatagramLength 
)

Definition at line 203 of file tdi.c.

206{
207 PMDL Mdl;
210
212 sizeof(TDI_MAX_DATAGRAM_INFO),
214
215 if (!Buffer) return STATUS_NO_MEMORY;
216
218 if (!Mdl)
219 {
221 return STATUS_NO_MEMORY;
222 }
223
225 {
227 }
229 {
231 }
232 _SEH2_END;
233
234 if (!NT_SUCCESS(Status))
235 {
236 DPRINT("Failed to lock pages\n");
237 IoFreeMdl(Mdl);
239 return Status;
240 }
241
244 Mdl);
245 if (!NT_SUCCESS(Status))
246 {
248 return Status;
249 }
250
251 *MaxDatagramLength = Buffer->MaxDatagramSize;
252
254
255 return STATUS_SUCCESS;
256}
#define TAG_AFD_DATA_BUFFER
Definition: afd.h:38
Definition: bufpool.h:45
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
NTSTATUS TdiQueryInformation(PFILE_OBJECT FileObject, LONG QueryType, PMDL MdlBuffer)
Query for information.
Definition: tdi.c:693
#define IoFreeMdl
Definition: fxmdl.h:89
#define IoAllocateMdl
Definition: fxmdl.h:88
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:931
#define KernelMode
Definition: asm.h:38
#define TDI_QUERY_MAX_DATAGRAM_INFO
Definition: tdi.h:187
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
@ IoModifyAccess
Definition: ketypes.h:917

Referenced by MakeSocketIntoConnection(), and WarmSocketForBind().

◆ TdiReceive()

NTSTATUS TdiReceive ( PIRP Irp,
PFILE_OBJECT  ConnectionObject,
USHORT  Flags,
PCHAR  Buffer,
UINT  BufferLength,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext 
)

Definition at line 999 of file tdi.c.

1007{
1009 PMDL Mdl;
1010
1011 if (!TransportObject) {
1012 DPRINT("Bad transport object.\n");
1014 }
1015
1016 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1017 if (!DeviceObject) {
1018 DPRINT("Bad device object.\n");
1020 }
1021
1024 TransportObject,
1025 NULL,
1026 NULL);
1027
1028 if (!*Irp) {
1029 DPRINT("Insufficient resources.\n");
1031 }
1032
1033 DPRINT("Allocating irp for %p:%u\n", Buffer,BufferLength);
1034
1035 Mdl = IoAllocateMdl(Buffer, /* Virtual address */
1036 BufferLength, /* Length of buffer */
1037 FALSE, /* Not secondary */
1038 FALSE, /* Don't charge quota */
1039 NULL); /* Don't use IRP */
1040 if (!Mdl) {
1041 DPRINT("Insufficient resources.\n");
1043 *Irp = NULL;
1045 }
1046
1047 _SEH2_TRY {
1048 DPRINT("probe and lock\n");
1049 MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoModifyAccess);
1050 DPRINT("probe and lock done\n");
1052 DPRINT("MmProbeAndLockPages() failed.\n");
1053 IoFreeMdl(Mdl);
1055 *Irp = NULL;
1057 } _SEH2_END;
1058
1059 DPRINT("AFD>>> Got an MDL: %p\n", Mdl);
1060
1063 TransportObject,
1066 Mdl,
1067 Flags,
1068 BufferLength);
1069
1070
1072 /* Does not block... The MDL is deleted in the receive completion
1073 routine. */
1074
1075 return STATUS_PENDING;
1076}
#define IoCompleteRequest
Definition: irp.c:1240
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
#define TdiBuildReceive( Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, InFlags, ReceiveLen)
Definition: tdikrnl.h:667
#define TDI_RECEIVE
Definition: tdikrnl.h:54
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3777
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by MakeSocketIntoConnection(), RefillSocketBuffer(), and WskStreamIo().

◆ TdiReceiveDatagram()

NTSTATUS TdiReceiveDatagram ( PIRP Irp,
PFILE_OBJECT  TransportObject,
USHORT  Flags,
PCHAR  Buffer,
UINT  BufferLength,
PTDI_CONNECTION_INFORMATION  Addr,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext 
)

Receives a datagram.

Parameters
TransportObject= Pointer to transport object
From= Receive filter (NULL if none)
Address= Address of buffer to place remote address
Buffer= Address of buffer to place received data
BufferSize= Address of buffer with length of Buffer (updated)
Returns
Status of operation

Definition at line 1079 of file tdi.c.

1099{
1101 PMDL Mdl;
1102
1103 if (!TransportObject) {
1104 DPRINT("Bad tranport object.\n");
1106 }
1107
1108 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1109 if (!DeviceObject) {
1110 DPRINT("Bad device object.\n");
1112 }
1113
1116 TransportObject,
1117 NULL,
1118 NULL);
1119
1120 if (!*Irp) {
1121 DPRINT("Insufficient resources.\n");
1123 }
1124
1125 DPRINT("Allocating irp for %p:%u\n", Buffer,BufferLength);
1126
1127 Mdl = IoAllocateMdl(Buffer, /* Virtual address */
1128 BufferLength, /* Length of buffer */
1129 FALSE, /* Not secondary */
1130 FALSE, /* Don't charge quota */
1131 NULL); /* Don't use IRP */
1132 if (!Mdl) {
1133 DPRINT("Insufficient resources.\n");
1135 *Irp = NULL;
1137 }
1138
1139 _SEH2_TRY {
1140 MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoModifyAccess);
1142 DPRINT("MmProbeAndLockPages() failed.\n");
1143 IoFreeMdl(Mdl);
1145 *Irp = NULL;
1147 } _SEH2_END;
1148
1149 DPRINT("AFD>>> Got an MDL: %p\n", Mdl);
1150
1153 TransportObject,
1156 Mdl,
1158 Addr,
1159 Addr,
1160 Flags);
1161
1163 /* Does not block... The MDL is deleted in the receive completion
1164 routine. */
1165
1166 return STATUS_PENDING;
1167}
#define TDI_RECEIVE_DATAGRAM
Definition: tdikrnl.h:56
#define TdiBuildReceiveDatagram( Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, ReceiveLen, ReceiveDatagramInfo, ReturnInfo, InFlags)
Definition: tdikrnl.h:699

Referenced by PacketSocketRecvComplete(), and WarmSocketForBind().

◆ TdiSend()

NTSTATUS TdiSend ( PIRP Irp,
PFILE_OBJECT  ConnectionObject,
USHORT  Flags,
PCHAR  Buffer,
UINT  BufferLength,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext 
)

Definition at line 923 of file tdi.c.

931{
933 PMDL Mdl;
934
935 if (!TransportObject) {
936 DPRINT("Bad transport object.\n");
938 }
939
940 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
941 if (!DeviceObject) {
942 DPRINT("Bad device object.\n");
944 }
945
948 TransportObject,
949 NULL,
950 NULL);
951
952 if (!*Irp) {
953 DPRINT("Insufficient resources.\n");
955 }
956
957 DPRINT("Allocating irp for %p:%u\n", Buffer,BufferLength);
958
959 Mdl = IoAllocateMdl(Buffer, /* Virtual address */
960 BufferLength, /* Length of buffer */
961 FALSE, /* Not secondary */
962 FALSE, /* Don't charge quota */
963 NULL); /* Don't use IRP */
964 if (!Mdl) {
965 DPRINT("Insufficient resources.\n");
967 *Irp = NULL;
969 }
970
971 _SEH2_TRY {
972 MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoReadAccess);
974 DPRINT("MmProbeAndLockPages() failed.\n");
975 IoFreeMdl(Mdl);
977 *Irp = NULL;
979 } _SEH2_END;
980
981 DPRINT("AFD>>> Got an MDL: %p\n", Mdl);
982
985 TransportObject,
988 Mdl,
989 Flags,
991
993 /* Does not block... The MDL is deleted in the receive completion
994 routine. */
995
996 return STATUS_PENDING;
997}
#define TDI_SEND
Definition: tdikrnl.h:53
#define TdiBuildSend( Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, InFlags, SendLen)
Definition: tdikrnl.h:731
@ IoReadAccess
Definition: ketypes.h:915

Referenced by AfdConnectedSocketWriteData(), SendComplete(), and WskStreamIo().

◆ TdiSendDatagram()

NTSTATUS TdiSendDatagram ( PIRP Irp,
PFILE_OBJECT  TransportObject,
PCHAR  Buffer,
UINT  BufferLength,
PTDI_CONNECTION_INFORMATION  Addr,
PIO_COMPLETION_ROUTINE  CompletionRoutine,
PVOID  CompletionContext 
)

Sends a datagram.

Parameters
TransportObject= Pointer to transport object
From= Send filter (NULL if none)
Address= Address of buffer to place remote address
Buffer= Address of buffer to place send data
BufferSize= Address of buffer with length of Buffer (updated)
Returns
Status of operation

Definition at line 1170 of file tdi.c.

1189{
1191 PMDL Mdl;
1192
1193 if (!TransportObject) {
1194 DPRINT("Bad transport object.\n");
1196 }
1197
1198 DPRINT("Called(TransportObject %p)\n", TransportObject);
1199
1200 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1201 if (!DeviceObject) {
1202 DPRINT("Bad device object.\n");
1204 }
1205
1206 if (BufferLength == 0)
1207 {
1208 DPRINT("Succeeding send with length 0.\n");
1209 return STATUS_SUCCESS;
1210 }
1211
1214 TransportObject,
1215 NULL,
1216 NULL);
1217
1218 if (!*Irp) {
1219 DPRINT("Insufficient resources.\n");
1221 }
1222
1223 DPRINT("Allocating irp for %p:%u\n", Buffer,BufferLength);
1224
1225 Mdl = IoAllocateMdl(Buffer, /* Virtual address */
1226 BufferLength, /* Length of buffer */
1227 FALSE, /* Not secondary */
1228 FALSE, /* Don't charge quota */
1229 NULL); /* Don't use IRP */
1230
1231 if (!Mdl) {
1232 DPRINT("Insufficient resources.\n");
1234 *Irp = NULL;
1236 }
1237
1238 _SEH2_TRY {
1239 MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoReadAccess);
1241 DPRINT("MmProbeAndLockPages() failed.\n");
1242 IoFreeMdl(Mdl);
1244 *Irp = NULL;
1246 } _SEH2_END;
1247
1248 DPRINT("AFD>>> Got an MDL: %p\n", Mdl);
1249
1252 TransportObject,
1255 Mdl,
1257 Addr);
1258
1260 /* Does not block... The MDL is deleted in the send completion
1261 routine. */
1262
1263 return STATUS_PENDING;
1264}
#define TDI_SEND_DATAGRAM
Definition: tdikrnl.h:55
#define TdiBuildSendDatagram( Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, SendLen, SendDatagramInfo)
Definition: tdikrnl.h:761

Referenced by AfdConnectedSocketWriteData(), AfdPacketSocketWriteData(), and WskSendTo().