ReactOS 0.4.16-dev-1946-g52006dd
tdiconn.c File Reference
#include <afd.h>
#include <reactos/debug.h>
Include dependency graph for tdiconn.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

UINT TdiAddressSizeFromType (UINT AddressType)
 
UINT TaLengthOfAddress (PTA_ADDRESS Addr)
 
UINT TaLengthOfTransportAddress (PTRANSPORT_ADDRESS Addr)
 
UINT TaLengthOfTransportAddressByType (UINT AddressType)
 
VOID TaCopyTransportAddressInPlace (PTRANSPORT_ADDRESS Target, PTRANSPORT_ADDRESS Source)
 
PTRANSPORT_ADDRESS TaCopyTransportAddress (PTRANSPORT_ADDRESS OtherAddress)
 
NTSTATUS TdiBuildNullTransportAddressInPlace (PTRANSPORT_ADDRESS A, UINT AddressType)
 
PTRANSPORT_ADDRESS TaBuildNullTransportAddress (UINT AddressType)
 
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 TdiBuildConnectionInfoInPlace (PTDI_CONNECTION_INFORMATION ConnectionInfo, PTRANSPORT_ADDRESS Address)
 
NTSTATUS TdiBuildConnectionInfo (PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTRANSPORT_ADDRESS Address)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 20 of file tdiconn.c.

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 TaCopyTransportAddress(), and TaCopyTransportAddressInPlace().

◆ 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().

◆ TdiAddressSizeFromType()

UINT TdiAddressSizeFromType ( UINT  AddressType)

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(), and TdiBuildNullTransportAddressInPlace().

◆ TdiBuildConnectionInfo()

NTSTATUS TdiBuildConnectionInfo ( PTDI_CONNECTION_INFORMATION ConnectionInfo,
PTRANSPORT_ADDRESS  Address 
)

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  ConnectionInfo,
PTRANSPORT_ADDRESS  Address 
)

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
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by TdiBuildConnectionInfo().

◆ 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 TdiBuildNullConnectionInfo().

◆ TdiBuildNullTransportAddressInPlace()

NTSTATUS TdiBuildNullTransportAddressInPlace ( PTRANSPORT_ADDRESS  A,
UINT  AddressType 
)

Definition at line 108 of file tdiconn.c.

109{
110 A->TAAddressCount = 1;
111
112 A->Address[0].AddressLength = TdiAddressSizeFromType(AddressType);
113 if (!A->Address[0].AddressLength)
115
116 A->Address[0].AddressType = AddressType;
117
118 RtlZeroMemory(A->Address[0].Address, A->Address[0].AddressLength);
119
120 return STATUS_SUCCESS;
121}

Referenced by TaBuildNullTransportAddress(), and TdiBuildNullConnectionInfoInPlace().