ReactOS 0.4.16-dev-2208-g6350669
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 997 of file tdi.c.

1005{
1007 PMDL Mdl;
1008
1009 if (!TransportObject) {
1010 DPRINT("Bad transport object.\n");
1012 }
1013
1014 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1015 if (!DeviceObject) {
1016 DPRINT("Bad device object.\n");
1018 }
1019
1022 TransportObject,
1023 NULL,
1024 NULL);
1025
1026 if (!*Irp) {
1027 DPRINT("Insufficient resources.\n");
1029 }
1030
1031 DPRINT("Allocating irp for %p:%u\n", Buffer,BufferLength);
1032
1033 Mdl = IoAllocateMdl(Buffer, /* Virtual address */
1034 BufferLength, /* Length of buffer */
1035 FALSE, /* Not secondary */
1036 FALSE, /* Don't charge quota */
1037 NULL); /* Don't use IRP */
1038 if (!Mdl) {
1039 DPRINT("Insufficient resources.\n");
1041 *Irp = NULL;
1043 }
1044
1045 _SEH2_TRY {
1046 DPRINT("probe and lock\n");
1047 MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoModifyAccess);
1048 DPRINT("probe and lock done\n");
1050 DPRINT("MmProbeAndLockPages() failed.\n");
1051 IoFreeMdl(Mdl);
1053 *Irp = NULL;
1055 } _SEH2_END;
1056
1057 DPRINT("AFD>>> Got an MDL: %p\n", Mdl);
1058
1061 TransportObject,
1064 Mdl,
1065 Flags,
1066 BufferLength);
1067
1068
1070 /* Does not block... The MDL is deleted in the receive completion
1071 routine. */
1072
1073 return STATUS_PENDING;
1074}
#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 1077 of file tdi.c.

1097{
1099 PMDL Mdl;
1100
1101 if (!TransportObject) {
1102 DPRINT("Bad tranport object.\n");
1104 }
1105
1106 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1107 if (!DeviceObject) {
1108 DPRINT("Bad device object.\n");
1110 }
1111
1114 TransportObject,
1115 NULL,
1116 NULL);
1117
1118 if (!*Irp) {
1119 DPRINT("Insufficient resources.\n");
1121 }
1122
1123 DPRINT("Allocating irp for %p:%u\n", Buffer,BufferLength);
1124
1125 Mdl = IoAllocateMdl(Buffer, /* Virtual address */
1126 BufferLength, /* Length of buffer */
1127 FALSE, /* Not secondary */
1128 FALSE, /* Don't charge quota */
1129 NULL); /* Don't use IRP */
1130 if (!Mdl) {
1131 DPRINT("Insufficient resources.\n");
1133 *Irp = NULL;
1135 }
1136
1137 _SEH2_TRY {
1138 MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoModifyAccess);
1140 DPRINT("MmProbeAndLockPages() failed.\n");
1141 IoFreeMdl(Mdl);
1143 *Irp = NULL;
1145 } _SEH2_END;
1146
1147 DPRINT("AFD>>> Got an MDL: %p\n", Mdl);
1148
1151 TransportObject,
1154 Mdl,
1156 Addr,
1157 Addr,
1158 Flags);
1159
1161 /* Does not block... The MDL is deleted in the receive completion
1162 routine. */
1163
1164 return STATUS_PENDING;
1165}
#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
992 /* Does not block... The MDL is deleted in the receive completion
993 routine. */
994 return TdiCall(*Irp, DeviceObject, NULL, NULL);
995}
#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 1168 of file tdi.c.

1187{
1189 PMDL Mdl;
1190
1191 if (!TransportObject) {
1192 DPRINT("Bad transport object.\n");
1194 }
1195
1196 DPRINT("Called(TransportObject %p)\n", TransportObject);
1197
1198 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1199 if (!DeviceObject) {
1200 DPRINT("Bad device object.\n");
1202 }
1203
1204 if (BufferLength == 0)
1205 {
1206 DPRINT("Succeeding send with length 0.\n");
1207 return STATUS_SUCCESS;
1208 }
1209
1212 TransportObject,
1213 NULL,
1214 NULL);
1215
1216 if (!*Irp) {
1217 DPRINT("Insufficient resources.\n");
1219 }
1220
1221 DPRINT("Allocating irp for %p:%u\n", Buffer,BufferLength);
1222
1223 Mdl = IoAllocateMdl(Buffer, /* Virtual address */
1224 BufferLength, /* Length of buffer */
1225 FALSE, /* Not secondary */
1226 FALSE, /* Don't charge quota */
1227 NULL); /* Don't use IRP */
1228
1229 if (!Mdl) {
1230 DPRINT("Insufficient resources.\n");
1232 *Irp = NULL;
1234 }
1235
1236 _SEH2_TRY {
1237 MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoReadAccess);
1239 DPRINT("MmProbeAndLockPages() failed.\n");
1240 IoFreeMdl(Mdl);
1242 *Irp = NULL;
1244 } _SEH2_END;
1245
1246 DPRINT("AFD>>> Got an MDL: %p\n", Mdl);
1247
1250 TransportObject,
1253 Mdl,
1255 Addr);
1256
1257 /* Does not block... The MDL is deleted in the send completion
1258 routine. */
1259 return TdiCall(*Irp, DeviceObject, NULL, NULL);
1260}
#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().