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
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/net/afd/afd/bind.c
|
||||
|
@ -68,7 +68,7 @@ AfdBindSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
if( FCB->Flags & SGID_CONNECTIONLESS ) {
|
||||
/* This will be the from address for subsequent recvfrom calls */
|
||||
TdiBuildConnectionInfo( &FCB->AddressFrom,
|
||||
&FCB->LocalAddress->Address[0] );
|
||||
FCB->LocalAddress );
|
||||
/* Allocate our backup buffer */
|
||||
FCB->Recv.Window = ExAllocatePool( NonPagedPool, FCB->Recv.Size );
|
||||
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
|
||||
* PROJECT: ReactOS kernel
|
||||
* 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,
|
||||
("Exhausted our buffer. Requesting new: %x\n", FCB));
|
||||
|
||||
|
@ -343,17 +344,19 @@ PacketSocketRecvComplete(
|
|||
PollReeval( FCB->DeviceExt, FCB->FileObject );
|
||||
}
|
||||
|
||||
/* Now relaunch the datagram request */
|
||||
Status = TdiReceiveDatagram
|
||||
( &FCB->ReceiveIrp.InFlightRequest,
|
||||
FCB->AddressFile.Object,
|
||||
0,
|
||||
FCB->Recv.Window,
|
||||
FCB->Recv.Size,
|
||||
FCB->AddressFrom,
|
||||
&FCB->ReceiveIrp.Iosb,
|
||||
PacketSocketRecvComplete,
|
||||
FCB );
|
||||
if( NT_SUCCESS(Irp->IoStatus.Status) ) {
|
||||
/* Now relaunch the datagram request */
|
||||
Status = TdiReceiveDatagram
|
||||
( &FCB->ReceiveIrp.InFlightRequest,
|
||||
FCB->AddressFile.Object,
|
||||
0,
|
||||
FCB->Recv.Window,
|
||||
FCB->Recv.Size,
|
||||
FCB->AddressFrom,
|
||||
&FCB->ReceiveIrp.Iosb,
|
||||
PacketSocketRecvComplete,
|
||||
FCB );
|
||||
}
|
||||
|
||||
SocketStateUnlock( FCB );
|
||||
|
||||
|
|
|
@ -1077,6 +1077,7 @@ NTSTATUS TdiSendDatagram(
|
|||
FALSE, /* Not secondary */
|
||||
FALSE, /* Don't charge quota */
|
||||
*Irp); /* Don't use IRP */
|
||||
|
||||
if (!Mdl) {
|
||||
AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||
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
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/net/afd/afd/tdiconn.c
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
UINT TdiAddressSizeFromType( UINT AddressType ) {
|
||||
switch( AddressType ) {
|
||||
case TDI_ADDRESS_TYPE_IP:
|
||||
case AF_INET:
|
||||
return sizeof(TA_IP_ADDRESS);
|
||||
default:
|
||||
KeBugCheck( 0 );
|
||||
|
@ -129,7 +129,7 @@ NTSTATUS TdiBuildNullConnectionInfo
|
|||
NTSTATUS
|
||||
TdiBuildConnectionInfoInPlace
|
||||
( PTDI_CONNECTION_INFORMATION ConnectionInfo,
|
||||
PTA_ADDRESS Address ) {
|
||||
PTRANSPORT_ADDRESS Address ) {
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
RtlCopyMemory( ConnectionInfo->RemoteAddress,
|
||||
|
@ -143,9 +143,9 @@ TdiBuildConnectionInfoInPlace
|
|||
NTSTATUS
|
||||
TdiBuildConnectionInfo
|
||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo,
|
||||
PTA_ADDRESS Address ) {
|
||||
NTSTATUS Status = TdiBuildNullConnectionInfo( ConnectionInfo,
|
||||
Address->AddressType );
|
||||
PTRANSPORT_ADDRESS Address ) {
|
||||
NTSTATUS Status = TdiBuildNullConnectionInfo
|
||||
( ConnectionInfo, Address->Address[0].AddressType );
|
||||
|
||||
if( NT_SUCCESS(Status) )
|
||||
TdiBuildConnectionInfoInPlace( *ConnectionInfo, Address );
|
||||
|
@ -156,7 +156,7 @@ TdiBuildConnectionInfo
|
|||
NTSTATUS
|
||||
TdiBuildConnectionInfoPair
|
||||
( 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
|
||||
* given.
|
||||
|
@ -173,7 +173,7 @@ TdiBuildConnectionInfoPair
|
|||
ULONG TdiAddressSize;
|
||||
|
||||
/* FIXME: Get from socket information */
|
||||
TdiAddressSize = TdiAddressSizeFromType(From->AddressType);
|
||||
TdiAddressSize = TdiAddressSizeFromType(From->Address[0].AddressType);
|
||||
SizeOfEntry = TdiAddressSize + sizeof(TDI_CONNECTION_INFORMATION);
|
||||
|
||||
LayoutFrame = (PCHAR)ExAllocatePool(NonPagedPool, 2 * SizeOfEntry);
|
||||
|
@ -185,20 +185,18 @@ TdiBuildConnectionInfoPair
|
|||
|
||||
RtlZeroMemory( LayoutFrame, 2 * SizeOfEntry );
|
||||
|
||||
{
|
||||
PTDI_CONNECTION_INFORMATION
|
||||
PTDI_CONNECTION_INFORMATION
|
||||
FromTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame,
|
||||
ToTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame + SizeOfEntry;
|
||||
|
||||
if (From != NULL) {
|
||||
|
||||
if (From != NULL) {
|
||||
TdiBuildConnectionInfoInPlace( FromTdiConn, From );
|
||||
} else {
|
||||
} else {
|
||||
TdiBuildNullConnectionInfoInPlace( FromTdiConn,
|
||||
From->AddressType );
|
||||
}
|
||||
|
||||
TdiBuildConnectionInfoInPlace( ToTdiConn, To );
|
||||
From->Address[0].AddressType );
|
||||
}
|
||||
|
||||
TdiBuildConnectionInfoInPlace( ToTdiConn, To );
|
||||
|
||||
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
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/net/afd/afd/write.c
|
||||
|
@ -272,6 +272,7 @@ NTSTATUS STDCALL
|
|||
AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp) {
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PTDI_CONNECTION_INFORMATION TargetAddress;
|
||||
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
||||
PAFD_FCB FCB = FileObject->FsContext;
|
||||
PAFD_SEND_INFO_UDP SendReq;
|
||||
|
@ -293,18 +294,25 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
TAAddressCount,
|
||||
((PTRANSPORT_ADDRESS)SendReq->RemoteAddress)->
|
||||
Address[0].AddressType));
|
||||
|
||||
|
||||
TdiBuildConnectionInfo( &TargetAddress,
|
||||
((PTRANSPORT_ADDRESS)SendReq->RemoteAddress) );
|
||||
|
||||
/* Check the size of the Address given ... */
|
||||
|
||||
Status = TdiSendDatagram
|
||||
( &FCB->SendIrp.InFlightRequest,
|
||||
FCB->AddressFile.Object,
|
||||
SendReq->BufferArray[0].buf,
|
||||
SendReq->BufferArray[0].len,
|
||||
SendReq->RemoteAddress,
|
||||
&FCB->SendIrp.Iosb,
|
||||
PacketSocketSendComplete,
|
||||
FCB );
|
||||
if( TargetAddress ) {
|
||||
Status = TdiSendDatagram
|
||||
( &FCB->SendIrp.InFlightRequest,
|
||||
FCB->AddressFile.Object,
|
||||
SendReq->BufferArray[0].buf,
|
||||
SendReq->BufferArray[0].len,
|
||||
TargetAddress,
|
||||
&FCB->SendIrp.Iosb,
|
||||
PacketSocketSendComplete,
|
||||
FCB );
|
||||
|
||||
ExFreePool( TargetAddress );
|
||||
}
|
||||
|
||||
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
|
||||
|
||||
|
|
|
@ -16,15 +16,17 @@ VOID TaCopyTransportAddressInPlace( PTRANSPORT_ADDRESS Target,
|
|||
UINT TdiAddressSizeFromType( UINT Type );
|
||||
UINT TdiAddressSizeFromName( PTRANSPORT_ADDRESS Name );
|
||||
NTSTATUS TdiBuildConnectionInfoInPlace
|
||||
( PTDI_CONNECTION_INFORMATION ConnInfo, PTA_ADDRESS Name );
|
||||
( PTDI_CONNECTION_INFORMATION ConnInfo, PTRANSPORT_ADDRESS Name );
|
||||
NTSTATUS TdiBuildConnectionInfo
|
||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTA_ADDRESS Name );
|
||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTRANSPORT_ADDRESS Name );
|
||||
NTSTATUS TdiBuildNullConnectionInfoToPlace
|
||||
( PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type );
|
||||
NTSTATUS TdiBuildNullConnectionInfo
|
||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type );
|
||||
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 );
|
||||
|
||||
#endif/*_TDICONN_H*/
|
||||
|
|
Loading…
Reference in a new issue