reactos/drivers/net/afd/afd
diff -u -r1.11 -r1.12
--- connect.c 28 Dec 2004 11:41:29 -0000 1.11
+++ connect.c 28 Dec 2004 17:05:19 -0000 1.12
@@ -1,4 +1,4 @@
-/* $Id: connect.c,v 1.11 2004/12/28 11:41:29 navaraf Exp $
+/* $Id: connect.c,v 1.12 2004/12/28 17:05:19 navaraf Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/net/afd/afd/connect.c
@@ -193,7 +193,13 @@
case SOCKET_STATE_BOUND:
FCB->RemoteAddress =
TaCopyTransportAddress( &ConnectReq->RemoteAddress );
-
+
+ if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS )
+ {
+ Status = STATUS_SUCCESS;
+ break;
+ }
+
Status = WarmSocketForConnection( FCB );
if( !NT_SUCCESS(Status) )
reactos/drivers/net/afd/afd
diff -u -r1.16 -r1.17
--- read.c 28 Dec 2004 16:53:26 -0000 1.16
+++ read.c 28 Dec 2004 17:05:19 -0000 1.17
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.16 2004/12/28 16:53:26 gvg Exp $
+/* $Id: read.c,v 1.17 2004/12/28 17:05:19 navaraf Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/net/afd/afd/read.c
@@ -240,6 +240,13 @@
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS )
+ {
+ AFD_DbgPrint(MID_TRACE,("Receive on connection-less sockets not implemented\n"));
+ return UnlockAndMaybeComplete( FCB, STATUS_NOT_IMPLEMENTED,
+ Irp, 0, NULL, FALSE );
+ }
+
FCB->EventsFired &= ~AFD_EVENT_RECEIVE;
PollReeval( FCB->DeviceExt, FCB->FileObject );
reactos/drivers/net/afd/afd
diff -u -r1.13 -r1.14
--- write.c 30 Nov 2004 04:49:50 -0000 1.13
+++ write.c 28 Dec 2004 17:05:19 -0000 1.14
@@ -1,4 +1,4 @@
-/* $Id: write.c,v 1.13 2004/11/30 04:49:50 arty Exp $
+/* $Id: write.c,v 1.14 2004/12/28 17:05:19 navaraf Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/net/afd/afd/write.c
@@ -152,6 +152,33 @@
return STATUS_SUCCESS;
}
+NTSTATUS DDKAPI PacketSocketSendComplete
+( PDEVICE_OBJECT DeviceObject,
+ PIRP Irp,
+ PVOID Context ) {
+ PAFD_FCB FCB = (PAFD_FCB)Context;
+
+ AFD_DbgPrint(MID_TRACE,("Called, status %x, %d bytes used\n",
+ Irp->IoStatus.Status,
+ Irp->IoStatus.Information));
+
+ /* It's ok if the FCB already died */
+ if( !SocketAcquireStateLock( FCB ) ) return STATUS_SUCCESS;
+
+ FCB->SendIrp.InFlightRequest = NULL;
+ /* Request is not in flight any longer */
+
+ if( FCB->State == SOCKET_STATE_CLOSED ) {
+ SocketStateUnlock( FCB );
+ DestroySocket( FCB );
+ return STATUS_SUCCESS;
+ }
+
+ SocketStateUnlock( FCB );
+
+ return STATUS_SUCCESS;
+}
+
NTSTATUS STDCALL
AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
PIO_STACK_LOCATION IrpSp, BOOLEAN Short) {
@@ -168,6 +195,47 @@
FCB->EventsFired &= ~AFD_EVENT_SEND;
+ if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS )
+ {
+ PAFD_SEND_INFO_UDP SendReq;
+ PTDI_CONNECTION_INFORMATION TargetAddress;
+
+ /* Check that the socket is bound */
+ if( FCB->State != SOCKET_STATE_BOUND )
+ return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp,
+ 0, NULL, FALSE );
+
+ if( !(SendReq = LockRequest( Irp, IrpSp )) )
+ return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0,
+ NULL, FALSE );
+
+ TdiBuildConnectionInfo( &TargetAddress, FCB->RemoteAddress );
+
+ SocketCalloutEnter( FCB );
+
+ Status = TdiSendDatagram
+ ( &FCB->SendIrp.InFlightRequest,
+ FCB->AddressFile.Object,
+ SendReq->BufferArray[0].buf,
+ SendReq->BufferArray[0].len,
+ TargetAddress,
+ &FCB->SendIrp.Iosb,
+ PacketSocketSendComplete,
+ FCB );
+
+ SocketCalloutLeave( FCB );
+
+ ExFreePool( TargetAddress );
+
+ if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
+
+ AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status));
+
+ return UnlockAndMaybeComplete( FCB, Status, Irp,
+ SendReq->BufferArray[0].len,
+ NULL, TRUE );
+ }
+
if( !(SendReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete
( FCB, STATUS_NO_MEMORY, Irp, TotalBytesCopied, NULL, FALSE );
@@ -273,33 +341,6 @@
}
}
-NTSTATUS DDKAPI PacketSocketSendComplete
-( PDEVICE_OBJECT DeviceObject,
- PIRP Irp,
- PVOID Context ) {
- PAFD_FCB FCB = (PAFD_FCB)Context;
-
- AFD_DbgPrint(MID_TRACE,("Called, status %x, %d bytes used\n",
- Irp->IoStatus.Status,
- Irp->IoStatus.Information));
-
- /* It's ok if the FCB already died */
- if( !SocketAcquireStateLock( FCB ) ) return STATUS_SUCCESS;
-
- FCB->SendIrp.InFlightRequest = NULL;
- /* Request is not in flight any longer */
-
- if( FCB->State == SOCKET_STATE_CLOSED ) {
- SocketStateUnlock( FCB );
- DestroySocket( FCB );
- return STATUS_SUCCESS;
- }
-
- SocketStateUnlock( FCB );
-
- return STATUS_SUCCESS;
-}
-
NTSTATUS STDCALL
AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp,
PIO_STACK_LOCATION IrpSp) {