ReactOS 0.4.16-dev-297-gc569aee
tdiconn.c File Reference
#include <afd.h>
Include dependency graph for tdiconn.c:

Go to the source code of this file.

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)
 
NTSTATUS TdiBuildNullConnectionInfo (PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type)
 
NTSTATUS TdiBuildConnectionInfoInPlace (PTDI_CONNECTION_INFORMATION ConnectionInfo, PTRANSPORT_ADDRESS Address)
 
NTSTATUS TdiBuildConnectionInfo (PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTRANSPORT_ADDRESS Address)
 

Function Documentation

◆ TaBuildNullTransportAddress()

PTRANSPORT_ADDRESS TaBuildNullTransportAddress ( UINT  AddressType)

Definition at line 113 of file tdiconn.c.

114{
115 UINT AddrLen;
117
118 AddrLen = TaLengthOfTransportAddressByType(AddressType);
119 if (!AddrLen)
120 return NULL;
121
123
124 if (A)
125 {
127 {
129 return NULL;
130 }
131 }
132
133 return A;
134}
#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:60
NTSTATUS TdiBuildNullTransportAddressInPlace(PTRANSPORT_ADDRESS A, UINT AddressType)
Definition: tdiconn.c:98

Referenced by AfdPacketSocketWriteData(), and AfdStreamSocketConnect().

◆ TaCopyTransportAddress()

PTRANSPORT_ADDRESS TaCopyTransportAddress ( PTRANSPORT_ADDRESS  OtherAddress)

Definition at line 80 of file tdiconn.c.

80 {
81 UINT AddrLen;
83
84 AddrLen = TaLengthOfTransportAddress( OtherAddress );
85 if (!AddrLen)
86 return NULL;
87
89 AddrLen,
91
92 if( A )
93 TaCopyTransportAddressInPlace( A, OtherAddress );
94
95 return A;
96}
UINT TaLengthOfTransportAddress(PTRANSPORT_ADDRESS Addr)
Definition: tdiconn.c:46
VOID TaCopyTransportAddressInPlace(PTRANSPORT_ADDRESS Target, PTRANSPORT_ADDRESS Source)
Definition: tdiconn.c:74

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

◆ TaCopyTransportAddressInPlace()

VOID TaCopyTransportAddressInPlace ( PTRANSPORT_ADDRESS  Target,
PTRANSPORT_ADDRESS  Source 
)

Definition at line 74 of file tdiconn.c.

75 {
77 RtlCopyMemory( Target, Source, AddrLen );
78}
_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 32 of file tdiconn.c.

33{
34 UINT AddrLen = Addr->AddressLength;
35
36 if (!AddrLen)
37 return 0;
38
39 AddrLen += 2 * sizeof( USHORT );
40
41 AFD_DbgPrint(MID_TRACE,("AddrLen %x\n", AddrLen));
42
43 return AddrLen;
44}
#define MID_TRACE
Definition: debug.h:15
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
unsigned short USHORT
Definition: pedump.c:61
USHORT AddressLength
Definition: tdi.h:338

Referenced by TaLengthOfTransportAddress().

◆ TaLengthOfTransportAddress()

UINT TaLengthOfTransportAddress ( PTRANSPORT_ADDRESS  Addr)

Definition at line 46 of file tdiconn.c.

47{
48 UINT AddrLen = TaLengthOfAddress(&Addr->Address[0]);
49
50 if (!AddrLen)
51 return 0;
52
53 AddrLen += sizeof(ULONG);
54
55 AFD_DbgPrint(MID_TRACE,("AddrLen %x\n", AddrLen));
56
57 return AddrLen;
58}
TA_ADDRESS Address[1]
Definition: tdi.h:377
UINT TaLengthOfAddress(PTA_ADDRESS Addr)
Definition: tdiconn.c:32
uint32_t ULONG
Definition: typedefs.h:59

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

◆ TaLengthOfTransportAddressByType()

UINT TaLengthOfTransportAddressByType ( UINT  AddressType)

Definition at line 60 of file tdiconn.c.

61{
62 UINT AddrLen = TdiAddressSizeFromType(AddressType);
63
64 if (!AddrLen)
65 return 0;
66
67 AddrLen += sizeof(ULONG) + 2 * sizeof(USHORT);
68
69 AFD_DbgPrint(MID_TRACE,("AddrLen %x\n", AddrLen));
70
71 return AddrLen;
72}
UINT TdiAddressSizeFromType(UINT AddressType)
Definition: tdiconn.c:13

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

◆ TdiAddressSizeFromType()

UINT TdiAddressSizeFromType ( UINT  AddressType)

Definition at line 13 of file tdiconn.c.

13 {
14 switch( AddressType ) {
21 /* case TDI_ADDRESS_TYPE_NS: */
26 default:
27 DbgPrint("TdiAddressSizeFromType - invalid type: %x\n", AddressType);
28 return 0;
29 }
30}
#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 236 of file tdiconn.c.

238 {
240 ( ConnectionInfo, Address->Address[0].AddressType );
241
242 if( NT_SUCCESS(Status) )
243 TdiBuildConnectionInfoInPlace( *ConnectionInfo, Address );
244
245 return Status;
246}
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)
Definition: tdiconn.c:171
NTSTATUS TdiBuildConnectionInfoInPlace(PTDI_CONNECTION_INFORMATION ConnectionInfo, PTRANSPORT_ADDRESS Address)
Definition: tdiconn.c:219

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

◆ TdiBuildConnectionInfoInPlace()

NTSTATUS TdiBuildConnectionInfoInPlace ( PTDI_CONNECTION_INFORMATION  ConnectionInfo,
PTRANSPORT_ADDRESS  Address 
)

Definition at line 218 of file tdiconn.c.

220 {
222
223 _SEH2_TRY {
224 RtlCopyMemory( ConnectionInfo->RemoteAddress,
225 Address,
226 ConnectionInfo->RemoteAddressLength );
229 } _SEH2_END;
230
231 return Status;
232}
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55

Referenced by TdiBuildConnectionInfo().

◆ TdiBuildNullConnectionInfo()

NTSTATUS TdiBuildNullConnectionInfo ( PTDI_CONNECTION_INFORMATION ConnectionInfo,
ULONG  Type 
)

Definition at line 170 of file tdiconn.c.

182{
184 ULONG TdiAddressSize;
186
187 TdiAddressSize = TaLengthOfTransportAddressByType(Type);
188 if (!TdiAddressSize) {
189 AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n"));
190 *ConnectionInfo = NULL;
192 }
193
194 ConnInfo = (PTDI_CONNECTION_INFORMATION)
196 sizeof(TDI_CONNECTION_INFORMATION) + TdiAddressSize,
198 if (!ConnInfo) {
199 *ConnectionInfo = NULL;
201 }
202
204
205 if (!NT_SUCCESS(Status))
206 {
208 ConnInfo = NULL;
209 }
210
211 *ConnectionInfo = ConnInfo;
212
213 return Status;
214}
Type
Definition: Type.h:7
#define TAG_AFD_TDI_CONNECTION_INFORMATION
Definition: afd.h:53
#define MIN_TRACE
Definition: debug.h:14
struct _TDI_CONNECTION_INFORMATION * PTDI_CONNECTION_INFORMATION
NTSTATUS TdiBuildNullConnectionInfoInPlace(PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type)
Definition: tdiconn.c:137
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

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

◆ TdiBuildNullConnectionInfoInPlace()

NTSTATUS TdiBuildNullConnectionInfoInPlace ( PTDI_CONNECTION_INFORMATION  ConnInfo,
ULONG  Type 
)

Definition at line 136 of file tdiconn.c.

147{
148 ULONG TdiAddressSize;
149 PTRANSPORT_ADDRESS TransportAddress;
150
151 TdiAddressSize = TaLengthOfTransportAddressByType(Type);
152 if (!TdiAddressSize)
153 {
154 AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n"));
156 }
157
158 RtlZeroMemory(ConnInfo,
160 TdiAddressSize);
161
162 ConnInfo->OptionsLength = sizeof(ULONG);
163 ConnInfo->RemoteAddressLength = TdiAddressSize;
164 ConnInfo->RemoteAddress = TransportAddress =
165 (PTRANSPORT_ADDRESS)&ConnInfo[1];
166
167 return TdiBuildNullTransportAddressInPlace(TransportAddress, Type);
168}
struct _TRANSPORT_ADDRESS * PTRANSPORT_ADDRESS
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by ListenComplete(), and TdiBuildNullConnectionInfo().

◆ TdiBuildNullTransportAddressInPlace()

NTSTATUS TdiBuildNullTransportAddressInPlace ( PTRANSPORT_ADDRESS  A,
UINT  AddressType 
)

Definition at line 98 of file tdiconn.c.

99{
100 A->TAAddressCount = 1;
101
102 A->Address[0].AddressLength = TdiAddressSizeFromType(AddressType);
103 if (!A->Address[0].AddressLength)
105
106 A->Address[0].AddressType = AddressType;
107
108 RtlZeroMemory(A->Address[0].Address, A->Address[0].AddressLength);
109
110 return STATUS_SUCCESS;
111}

Referenced by TaBuildNullTransportAddress(), and TdiBuildNullConnectionInfoInPlace().