ReactOS  0.4.14-dev-317-g96040ec
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 }
UINT TaLengthOfTransportAddressByType(UINT AddressType)
Definition: tdiconn.c:60
#define TAG_AFD_TRANSPORT_ADDRESS
Definition: afd.h:39
NTSTATUS TdiBuildNullTransportAddressInPlace(PTRANSPORT_ADDRESS A, UINT AddressType)
Definition: tdiconn.c:98
#define A(row, col)
smooth NULL
Definition: ftsmooth.c:416
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Definition: ttei1.cpp:12
unsigned int UINT
Definition: ndis.h:50
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2938

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
#define TAG_AFD_TRANSPORT_ADDRESS
Definition: afd.h:39
#define A(row, col)
smooth NULL
Definition: ftsmooth.c:416
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Definition: ttei1.cpp:12
VOID TaCopyTransportAddressInPlace(PTRANSPORT_ADDRESS Target, PTRANSPORT_ADDRESS Source)
Definition: tdiconn.c:74
unsigned int UINT
Definition: ndis.h:50

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 }
UINT TaLengthOfTransportAddress(PTRANSPORT_ADDRESS Addr)
Definition: tdiconn.c:46
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
unsigned int UINT
Definition: ndis.h:50
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

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
unsigned int UINT
Definition: ndis.h:50
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 }
#define MID_TRACE
Definition: debug.h:15
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
UINT TaLengthOfAddress(PTA_ADDRESS Addr)
Definition: tdiconn.c:32
TA_ADDRESS Address[1]
Definition: tdi.h:377
unsigned int UINT
Definition: ndis.h:50
unsigned int ULONG
Definition: retypes.h:1

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 }
#define MID_TRACE
Definition: debug.h:15
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
UINT TdiAddressSizeFromType(UINT AddressType)
Definition: tdiconn.c:13
unsigned short USHORT
Definition: pedump.c:61
unsigned int UINT
Definition: ndis.h:50
unsigned int ULONG
Definition: retypes.h:1

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

◆ TdiAddressSizeFromType()

UINT TdiAddressSizeFromType ( UINT  AddressType)

Definition at line 13 of file tdiconn.c.

13  {
14  switch( AddressType ) {
16  return TDI_ADDRESS_LENGTH_IP;
21  /* case TDI_ADDRESS_TYPE_NS: */
26  default:
27  DbgPrint("TdiAddressSizeFromType - invalid type: %x\n", AddressType);
28  return 0;
29  }
30 }
#define DbgPrint
Definition: loader.c:25
#define TDI_ADDRESS_TYPE_IPX
Definition: tdi.h:350
#define TDI_ADDRESS_LENGTH_IPX
Definition: tdi.h:421
#define TDI_ADDRESS_TYPE_NETBIOS
Definition: tdi.h:361
#define TDI_ADDRESS_LENGTH_VNS
Definition: tdi.h:486
#define TDI_ADDRESS_TYPE_APPLETALK
Definition: tdi.h:360
#define TDI_ADDRESS_LENGTH_NETBIOS
Definition: tdi.h:434
#define TDI_ADDRESS_LENGTH_APPLETALK
Definition: tdi.h:405
#define TDI_ADDRESS_TYPE_IP
Definition: tdi.h:345
#define TDI_ADDRESS_TYPE_VNS
Definition: tdi.h:365
#define TDI_ADDRESS_LENGTH_IP
Definition: tdi.h:413

Referenced by TaLengthOfTransportAddressByType(), and TdiBuildNullTransportAddressInPlace().

◆ TdiBuildConnectionInfo()

NTSTATUS TdiBuildConnectionInfo ( PTDI_CONNECTION_INFORMATION ConnectionInfo,
PTRANSPORT_ADDRESS  Address 
)

Definition at line 237 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
static WCHAR Address[46]
Definition: ping.c:68
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS TdiBuildConnectionInfoInPlace(PTDI_CONNECTION_INFORMATION ConnectionInfo, PTRANSPORT_ADDRESS Address)
Definition: tdiconn.c:219
Status
Definition: gdiplustypes.h:24
NTSTATUS TdiBuildNullConnectionInfo(PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type)
Definition: tdiconn.c:171

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

◆ TdiBuildConnectionInfoInPlace()

NTSTATUS TdiBuildConnectionInfoInPlace ( PTDI_CONNECTION_INFORMATION  ConnectionInfo,
PTRANSPORT_ADDRESS  Address 
)

Definition at line 219 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 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static WCHAR Address[46]
Definition: ping.c:68
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by TdiBuildConnectionInfo().

◆ TdiBuildNullConnectionInfo()

NTSTATUS TdiBuildNullConnectionInfo ( PTDI_CONNECTION_INFORMATION ConnectionInfo,
ULONG  Type 
)

Definition at line 171 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 }
UINT TaLengthOfTransportAddressByType(UINT AddressType)
Definition: tdiconn.c:60
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS TdiBuildNullConnectionInfoInPlace(PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type)
Definition: tdiconn.c:137
Type
Definition: Type.h:6
#define TAG_AFD_TDI_CONNECTION_INFORMATION
Definition: afd.h:53
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _TDI_CONNECTION_INFORMATION * PTDI_CONNECTION_INFORMATION
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

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

◆ TdiBuildNullConnectionInfoInPlace()

NTSTATUS TdiBuildNullConnectionInfoInPlace ( PTDI_CONNECTION_INFORMATION  ConnInfo,
ULONG  Type 
)

Definition at line 137 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 }
UINT TaLengthOfTransportAddressByType(UINT AddressType)
Definition: tdiconn.c:60
Type
Definition: Type.h:6
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSTATUS TdiBuildNullTransportAddressInPlace(PTRANSPORT_ADDRESS A, UINT AddressType)
Definition: tdiconn.c:98
#define AFD_DbgPrint(_t_, _x_)
Definition: debug.h:60
struct _TRANSPORT_ADDRESS * PTRANSPORT_ADDRESS
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define MIN_TRACE
Definition: debug.h:14

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 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
UINT TdiAddressSizeFromType(UINT AddressType)
Definition: tdiconn.c:13
Definition: ttei1.cpp:12
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by TaBuildNullTransportAddress(), and TdiBuildNullConnectionInfoInPlace().