mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed use of TA_ADDRESS in favor of TRANSPORT_ADDRESS. This still confuses
me. write, read: Handle errors correctly. svn path=/trunk/; revision=11170
This commit is contained in:
parent
81e60d8ded
commit
a52618ca99
6 changed files with 58 additions and 46 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: bind.c,v 1.4 2004/09/05 04:26:29 arty Exp $
|
/* $Id: bind.c,v 1.5 2004/10/03 20:36:45 arty Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/net/afd/afd/bind.c
|
* FILE: drivers/net/afd/afd/bind.c
|
||||||
|
@ -68,7 +68,7 @@ AfdBindSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
if( FCB->Flags & SGID_CONNECTIONLESS ) {
|
if( FCB->Flags & SGID_CONNECTIONLESS ) {
|
||||||
/* This will be the from address for subsequent recvfrom calls */
|
/* This will be the from address for subsequent recvfrom calls */
|
||||||
TdiBuildConnectionInfo( &FCB->AddressFrom,
|
TdiBuildConnectionInfo( &FCB->AddressFrom,
|
||||||
&FCB->LocalAddress->Address[0] );
|
FCB->LocalAddress );
|
||||||
/* Allocate our backup buffer */
|
/* Allocate our backup buffer */
|
||||||
FCB->Recv.Window = ExAllocatePool( NonPagedPool, FCB->Recv.Size );
|
FCB->Recv.Window = ExAllocatePool( NonPagedPool, FCB->Recv.Size );
|
||||||
FCB->PollState |= AFD_EVENT_SEND;
|
FCB->PollState |= AFD_EVENT_SEND;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: read.c,v 1.6 2004/09/23 20:48:40 arty Exp $
|
/* $Id: read.c,v 1.7 2004/10/03 20:36:45 arty Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/net/afd/afd/read.c
|
* FILE: drivers/net/afd/afd/read.c
|
||||||
|
@ -134,7 +134,8 @@ NTSTATUS DDKAPI ReceiveComplete
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NT_SUCCESS(Status) && FCB->Recv.Window && !FCB->Recv.Content ) {
|
if( NT_SUCCESS(Status) && FCB->Recv.Window && !FCB->Recv.Content &&
|
||||||
|
NT_SUCCESS(Irp->IoStatus.Status) ) {
|
||||||
AFD_DbgPrint(MID_TRACE,
|
AFD_DbgPrint(MID_TRACE,
|
||||||
("Exhausted our buffer. Requesting new: %x\n", FCB));
|
("Exhausted our buffer. Requesting new: %x\n", FCB));
|
||||||
|
|
||||||
|
@ -343,17 +344,19 @@ PacketSocketRecvComplete(
|
||||||
PollReeval( FCB->DeviceExt, FCB->FileObject );
|
PollReeval( FCB->DeviceExt, FCB->FileObject );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now relaunch the datagram request */
|
if( NT_SUCCESS(Irp->IoStatus.Status) ) {
|
||||||
Status = TdiReceiveDatagram
|
/* Now relaunch the datagram request */
|
||||||
( &FCB->ReceiveIrp.InFlightRequest,
|
Status = TdiReceiveDatagram
|
||||||
FCB->AddressFile.Object,
|
( &FCB->ReceiveIrp.InFlightRequest,
|
||||||
0,
|
FCB->AddressFile.Object,
|
||||||
FCB->Recv.Window,
|
0,
|
||||||
FCB->Recv.Size,
|
FCB->Recv.Window,
|
||||||
FCB->AddressFrom,
|
FCB->Recv.Size,
|
||||||
&FCB->ReceiveIrp.Iosb,
|
FCB->AddressFrom,
|
||||||
PacketSocketRecvComplete,
|
&FCB->ReceiveIrp.Iosb,
|
||||||
FCB );
|
PacketSocketRecvComplete,
|
||||||
|
FCB );
|
||||||
|
}
|
||||||
|
|
||||||
SocketStateUnlock( FCB );
|
SocketStateUnlock( FCB );
|
||||||
|
|
||||||
|
|
|
@ -1077,6 +1077,7 @@ NTSTATUS TdiSendDatagram(
|
||||||
FALSE, /* Not secondary */
|
FALSE, /* Not secondary */
|
||||||
FALSE, /* Don't charge quota */
|
FALSE, /* Don't charge quota */
|
||||||
*Irp); /* Don't use IRP */
|
*Irp); /* Don't use IRP */
|
||||||
|
|
||||||
if (!Mdl) {
|
if (!Mdl) {
|
||||||
AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||||
IoFreeIrp(*Irp);
|
IoFreeIrp(*Irp);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: tdiconn.c,v 1.2 2004/07/18 22:49:17 arty Exp $
|
/* $Id: tdiconn.c,v 1.3 2004/10/03 20:36:45 arty Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/net/afd/afd/tdiconn.c
|
* FILE: drivers/net/afd/afd/tdiconn.c
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
UINT TdiAddressSizeFromType( UINT AddressType ) {
|
UINT TdiAddressSizeFromType( UINT AddressType ) {
|
||||||
switch( AddressType ) {
|
switch( AddressType ) {
|
||||||
case TDI_ADDRESS_TYPE_IP:
|
case AF_INET:
|
||||||
return sizeof(TA_IP_ADDRESS);
|
return sizeof(TA_IP_ADDRESS);
|
||||||
default:
|
default:
|
||||||
KeBugCheck( 0 );
|
KeBugCheck( 0 );
|
||||||
|
@ -129,7 +129,7 @@ NTSTATUS TdiBuildNullConnectionInfo
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
TdiBuildConnectionInfoInPlace
|
TdiBuildConnectionInfoInPlace
|
||||||
( PTDI_CONNECTION_INFORMATION ConnectionInfo,
|
( PTDI_CONNECTION_INFORMATION ConnectionInfo,
|
||||||
PTA_ADDRESS Address ) {
|
PTRANSPORT_ADDRESS Address ) {
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
RtlCopyMemory( ConnectionInfo->RemoteAddress,
|
RtlCopyMemory( ConnectionInfo->RemoteAddress,
|
||||||
|
@ -143,9 +143,9 @@ TdiBuildConnectionInfoInPlace
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
TdiBuildConnectionInfo
|
TdiBuildConnectionInfo
|
||||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo,
|
( PTDI_CONNECTION_INFORMATION *ConnectionInfo,
|
||||||
PTA_ADDRESS Address ) {
|
PTRANSPORT_ADDRESS Address ) {
|
||||||
NTSTATUS Status = TdiBuildNullConnectionInfo( ConnectionInfo,
|
NTSTATUS Status = TdiBuildNullConnectionInfo
|
||||||
Address->AddressType );
|
( ConnectionInfo, Address->Address[0].AddressType );
|
||||||
|
|
||||||
if( NT_SUCCESS(Status) )
|
if( NT_SUCCESS(Status) )
|
||||||
TdiBuildConnectionInfoInPlace( *ConnectionInfo, Address );
|
TdiBuildConnectionInfoInPlace( *ConnectionInfo, Address );
|
||||||
|
@ -156,7 +156,7 @@ TdiBuildConnectionInfo
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
TdiBuildConnectionInfoPair
|
TdiBuildConnectionInfoPair
|
||||||
( PTDI_CONNECTION_INFO_PAIR ConnectionInfo,
|
( PTDI_CONNECTION_INFO_PAIR ConnectionInfo,
|
||||||
PTA_ADDRESS From, PTA_ADDRESS To )
|
PTRANSPORT_ADDRESS From, PTRANSPORT_ADDRESS To )
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Fill a TDI_CONNECTION_INFO_PAIR struct will the two addresses
|
* FUNCTION: Fill a TDI_CONNECTION_INFO_PAIR struct will the two addresses
|
||||||
* given.
|
* given.
|
||||||
|
@ -173,7 +173,7 @@ TdiBuildConnectionInfoPair
|
||||||
ULONG TdiAddressSize;
|
ULONG TdiAddressSize;
|
||||||
|
|
||||||
/* FIXME: Get from socket information */
|
/* FIXME: Get from socket information */
|
||||||
TdiAddressSize = TdiAddressSizeFromType(From->AddressType);
|
TdiAddressSize = TdiAddressSizeFromType(From->Address[0].AddressType);
|
||||||
SizeOfEntry = TdiAddressSize + sizeof(TDI_CONNECTION_INFORMATION);
|
SizeOfEntry = TdiAddressSize + sizeof(TDI_CONNECTION_INFORMATION);
|
||||||
|
|
||||||
LayoutFrame = (PCHAR)ExAllocatePool(NonPagedPool, 2 * SizeOfEntry);
|
LayoutFrame = (PCHAR)ExAllocatePool(NonPagedPool, 2 * SizeOfEntry);
|
||||||
|
@ -185,20 +185,18 @@ TdiBuildConnectionInfoPair
|
||||||
|
|
||||||
RtlZeroMemory( LayoutFrame, 2 * SizeOfEntry );
|
RtlZeroMemory( LayoutFrame, 2 * SizeOfEntry );
|
||||||
|
|
||||||
{
|
PTDI_CONNECTION_INFORMATION
|
||||||
PTDI_CONNECTION_INFORMATION
|
|
||||||
FromTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame,
|
FromTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame,
|
||||||
ToTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame + SizeOfEntry;
|
ToTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame + SizeOfEntry;
|
||||||
|
|
||||||
if (From != NULL) {
|
if (From != NULL) {
|
||||||
TdiBuildConnectionInfoInPlace( FromTdiConn, From );
|
TdiBuildConnectionInfoInPlace( FromTdiConn, From );
|
||||||
} else {
|
} else {
|
||||||
TdiBuildNullConnectionInfoInPlace( FromTdiConn,
|
TdiBuildNullConnectionInfoInPlace( FromTdiConn,
|
||||||
From->AddressType );
|
From->Address[0].AddressType );
|
||||||
}
|
|
||||||
|
|
||||||
TdiBuildConnectionInfoInPlace( ToTdiConn, To );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TdiBuildConnectionInfoInPlace( ToTdiConn, To );
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: write.c,v 1.7 2004/09/23 20:48:40 arty Exp $
|
/* $Id: write.c,v 1.8 2004/10/03 20:36:45 arty Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/net/afd/afd/write.c
|
* FILE: drivers/net/afd/afd/write.c
|
||||||
|
@ -272,6 +272,7 @@ NTSTATUS STDCALL
|
||||||
AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
PIO_STACK_LOCATION IrpSp) {
|
PIO_STACK_LOCATION IrpSp) {
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
PTDI_CONNECTION_INFORMATION TargetAddress;
|
||||||
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
||||||
PAFD_FCB FCB = FileObject->FsContext;
|
PAFD_FCB FCB = FileObject->FsContext;
|
||||||
PAFD_SEND_INFO_UDP SendReq;
|
PAFD_SEND_INFO_UDP SendReq;
|
||||||
|
@ -293,18 +294,25 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
TAAddressCount,
|
TAAddressCount,
|
||||||
((PTRANSPORT_ADDRESS)SendReq->RemoteAddress)->
|
((PTRANSPORT_ADDRESS)SendReq->RemoteAddress)->
|
||||||
Address[0].AddressType));
|
Address[0].AddressType));
|
||||||
|
|
||||||
|
TdiBuildConnectionInfo( &TargetAddress,
|
||||||
|
((PTRANSPORT_ADDRESS)SendReq->RemoteAddress) );
|
||||||
|
|
||||||
/* Check the size of the Address given ... */
|
/* Check the size of the Address given ... */
|
||||||
|
|
||||||
Status = TdiSendDatagram
|
if( TargetAddress ) {
|
||||||
( &FCB->SendIrp.InFlightRequest,
|
Status = TdiSendDatagram
|
||||||
FCB->AddressFile.Object,
|
( &FCB->SendIrp.InFlightRequest,
|
||||||
SendReq->BufferArray[0].buf,
|
FCB->AddressFile.Object,
|
||||||
SendReq->BufferArray[0].len,
|
SendReq->BufferArray[0].buf,
|
||||||
SendReq->RemoteAddress,
|
SendReq->BufferArray[0].len,
|
||||||
&FCB->SendIrp.Iosb,
|
TargetAddress,
|
||||||
PacketSocketSendComplete,
|
&FCB->SendIrp.Iosb,
|
||||||
FCB );
|
PacketSocketSendComplete,
|
||||||
|
FCB );
|
||||||
|
|
||||||
|
ExFreePool( TargetAddress );
|
||||||
|
}
|
||||||
|
|
||||||
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,17 @@ VOID TaCopyTransportAddressInPlace( PTRANSPORT_ADDRESS Target,
|
||||||
UINT TdiAddressSizeFromType( UINT Type );
|
UINT TdiAddressSizeFromType( UINT Type );
|
||||||
UINT TdiAddressSizeFromName( PTRANSPORT_ADDRESS Name );
|
UINT TdiAddressSizeFromName( PTRANSPORT_ADDRESS Name );
|
||||||
NTSTATUS TdiBuildConnectionInfoInPlace
|
NTSTATUS TdiBuildConnectionInfoInPlace
|
||||||
( PTDI_CONNECTION_INFORMATION ConnInfo, PTA_ADDRESS Name );
|
( PTDI_CONNECTION_INFORMATION ConnInfo, PTRANSPORT_ADDRESS Name );
|
||||||
NTSTATUS TdiBuildConnectionInfo
|
NTSTATUS TdiBuildConnectionInfo
|
||||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTA_ADDRESS Name );
|
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTRANSPORT_ADDRESS Name );
|
||||||
NTSTATUS TdiBuildNullConnectionInfoToPlace
|
NTSTATUS TdiBuildNullConnectionInfoToPlace
|
||||||
( PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type );
|
( PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type );
|
||||||
NTSTATUS TdiBuildNullConnectionInfo
|
NTSTATUS TdiBuildNullConnectionInfo
|
||||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type );
|
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type );
|
||||||
NTSTATUS TdiBuildConnectionInfoPair
|
NTSTATUS TdiBuildConnectionInfoPair
|
||||||
( PTDI_CONNECTION_INFO_PAIR ConnectionInfo, PTA_ADDRESS From, PTA_ADDRESS To );
|
( PTDI_CONNECTION_INFO_PAIR ConnectionInfo,
|
||||||
|
PTRANSPORT_ADDRESS From,
|
||||||
|
PTRANSPORT_ADDRESS To );
|
||||||
PTA_ADDRESS TdiGetRemoteAddress( PTDI_CONNECTION_INFORMATION TdiConn );
|
PTA_ADDRESS TdiGetRemoteAddress( PTDI_CONNECTION_INFORMATION TdiConn );
|
||||||
|
|
||||||
#endif/*_TDICONN_H*/
|
#endif/*_TDICONN_H*/
|
||||||
|
|
Loading…
Reference in a new issue