ReactOS 0.4.16-dev-2293-g4d8327b
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(), AfdStreamSocketSuperConnect(), 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 515 of file tdi.c.

531{
533
534 DPRINT("Called\n");
535
536 if (!AcceptConnectionObject) {
537 DPRINT("Bad connection object.\n");
539 }
540
541 DeviceObject = IoGetRelatedDeviceObject(AcceptConnectionObject);
542 if (!DeviceObject) {
543 DPRINT("Bad device object.\n");
545 }
546
549 AcceptConnectionObject,
550 NULL,
551 NULL);
552 if (*Irp == NULL)
554
557 AcceptConnectionObject,
560 RequestConnectionInfo,
561 ReturnConnectionInfo);
562
563 TdiCall(*Irp, DeviceObject, NULL /* Don't wait for completion */, NULL);
564
565 return STATUS_PENDING;
566}
_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 364 of file tdi.c.

375{
379 PIRP Irp;
380
381 DPRINT("Called. AddressHandle (%p) ConnectionObject (%p)\n", AddressHandle, ConnectionObject);
382
383 if (!ConnectionObject) {
384 DPRINT("Bad connection object.\n");
386 }
387
388 DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
389 if (!DeviceObject) {
390 DPRINT("Bad device object.\n");
392 }
393
395
398 ConnectionObject,
399 &Event,
400 &Iosb);
401 if (!Irp)
403
406 ConnectionObject,
407 NULL,
408 NULL,
409 AddressHandle);
410
411 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
412}
#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(), AfdStreamSocketSuperConnect(), 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:54
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 414 of file tdi.c.

423{
427 PIRP Irp;
428
429 DPRINT("Called. ConnectionObject (%p)\n", ConnectionObject);
430
431 if (!ConnectionObject) {
432 DPRINT("Bad connection object.\n");
434 }
435
436 DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
437 if (!DeviceObject) {
438 DPRINT("Bad device object.\n");
440 }
441
443
446 ConnectionObject,
447 &Event,
448 &Iosb);
449 if (!Irp)
451
454 ConnectionObject,
455 NULL,
456 NULL);
457
458 return TdiCall(Irp, DeviceObject, &Event, &Iosb);
459}
#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 461 of file tdi.c.

477{
479
480 DPRINT("Called\n");
481
482 if (!ConnectionObject) {
483 DPRINT("Bad connection object.\n");
485 }
486
487 DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
488 if (!DeviceObject) {
489 DPRINT("Bad device object.\n");
491 }
492
495 ConnectionObject,
496 NULL,
497 NULL);
498 if (*Irp == NULL)
500
503 ConnectionObject,
506 0,
507 *RequestConnectionInfo,
508 *ReturnConnectionInfo);
509
510 TdiCall(*Irp, DeviceObject, NULL /* Don't wait for completion */, NULL);
511
512 return STATUS_PENDING;
513}
#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:51
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:691
#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 995 of file tdi.c.

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

1095{
1097 PMDL Mdl;
1098
1099 if (!TransportObject) {
1100 DPRINT("Bad tranport object.\n");
1102 }
1103
1104 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
1105 if (!DeviceObject) {
1106 DPRINT("Bad device object.\n");
1108 }
1109
1112 TransportObject,
1113 NULL,
1114 NULL);
1115
1116 if (!*Irp) {
1117 DPRINT("Insufficient resources.\n");
1119 }
1120
1121 DPRINT("Allocating irp for %p:%u\n", Buffer,BufferLength);
1122
1123 Mdl = IoAllocateMdl(Buffer, /* Virtual address */
1124 BufferLength, /* Length of buffer */
1125 FALSE, /* Not secondary */
1126 FALSE, /* Don't charge quota */
1127 NULL); /* Don't use IRP */
1128 if (!Mdl) {
1129 DPRINT("Insufficient resources.\n");
1131 *Irp = NULL;
1133 }
1134
1135 _SEH2_TRY {
1136 MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoModifyAccess);
1138 DPRINT("MmProbeAndLockPages() failed.\n");
1139 IoFreeMdl(Mdl);
1141 *Irp = NULL;
1143 } _SEH2_END;
1144
1145 DPRINT("AFD>>> Got an MDL: %p\n", Mdl);
1146
1149 TransportObject,
1152 Mdl,
1154 Addr,
1155 Addr,
1156 Flags);
1157
1159 /* Does not block... The MDL is deleted in the receive completion
1160 routine. */
1161
1162 return STATUS_PENDING;
1163}
#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 921 of file tdi.c.

929{
931 PMDL Mdl;
932
933 if (!TransportObject) {
934 DPRINT("Bad transport object.\n");
936 }
937
938 DeviceObject = IoGetRelatedDeviceObject(TransportObject);
939 if (!DeviceObject) {
940 DPRINT("Bad device object.\n");
942 }
943
946 TransportObject,
947 NULL,
948 NULL);
949
950 if (!*Irp) {
951 DPRINT("Insufficient resources.\n");
953 }
954
955 DPRINT("Allocating irp for %p:%u\n", Buffer,BufferLength);
956
957 Mdl = IoAllocateMdl(Buffer, /* Virtual address */
958 BufferLength, /* Length of buffer */
959 FALSE, /* Not secondary */
960 FALSE, /* Don't charge quota */
961 NULL); /* Don't use IRP */
962 if (!Mdl) {
963 DPRINT("Insufficient resources.\n");
965 *Irp = NULL;
967 }
968
969 _SEH2_TRY {
970 MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoReadAccess);
972 DPRINT("MmProbeAndLockPages() failed.\n");
973 IoFreeMdl(Mdl);
975 *Irp = NULL;
977 } _SEH2_END;
978
979 DPRINT("AFD>>> Got an MDL: %p\n", Mdl);
980
983 TransportObject,
986 Mdl,
987 Flags,
989
990 /* Does not block... The MDL is deleted in the receive completion
991 routine. */
992 return TdiCall(*Irp, DeviceObject, NULL, NULL);
993}
#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(), StreamSocketConnectComplete(), 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 1166 of file tdi.c.

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