Author: cgutman
Date: Mon Jul 4 18:07:55 2011
New Revision: 52538
URL:
http://svn.reactos.org/svn/reactos?rev=52538&view=rev
Log:
[AFD]
- Add support for AFD_INFO_INLINING_MODE
- Add support for setting AFD_INFO_RECEIVE_WINDOW_SIZE and AFD_INFO_SEND_WINDOW_SIZE
- None of this is used by our current msafd but mswsock_new uses it
Modified:
trunk/reactos/drivers/network/afd/afd/connect.c
trunk/reactos/drivers/network/afd/afd/info.c
trunk/reactos/drivers/network/afd/include/afd.h
Modified: trunk/reactos/drivers/network/afd/afd/connect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] Mon Jul 4 18:07:55 2011
@@ -223,26 +223,33 @@
ASSERT(!FCB->Recv.Window);
ASSERT(!FCB->Send.Window);
- Status = TdiQueryMaxDatagramLength(FCB->Connection.Object,
- &FCB->Send.Size);
- if (!NT_SUCCESS(Status))
- return Status;
-
- FCB->Recv.Size = FCB->Send.Size;
+ if (!FCB->Recv.Size)
+ {
+ Status = TdiQueryMaxDatagramLength(FCB->Connection.Object,
+ &FCB->Recv.Size);
+ if (!NT_SUCCESS(Status))
+ return Status;
+ }
+
+ if (!FCB->Send.Size)
+ {
+ Status = TdiQueryMaxDatagramLength(FCB->Connection.Object,
+ &FCB->Send.Size);
+ if (!NT_SUCCESS(Status))
+ return Status;
+ }
/* Allocate the receive area and start receiving */
- FCB->Recv.Window =
- ExAllocatePool( PagedPool, FCB->Recv.Size );
-
- if( !FCB->Recv.Window ) return STATUS_NO_MEMORY;
-
- FCB->Send.Window =
- ExAllocatePool( PagedPool, FCB->Send.Size );
-
- if( !FCB->Send.Window ) {
- ExFreePool( FCB->Recv.Window );
- FCB->Recv.Window = NULL;
- return STATUS_NO_MEMORY;
+ if (!FCB->Recv.Window)
+ {
+ FCB->Recv.Window = ExAllocatePool( PagedPool, FCB->Recv.Size );
+ if( !FCB->Recv.Window ) return STATUS_NO_MEMORY;
+ }
+
+ if (!FCB->Send.Window)
+ {
+ FCB->Send.Window = ExAllocatePool( PagedPool, FCB->Send.Size );
+ if( !FCB->Send.Window ) return STATUS_NO_MEMORY;
}
FCB->State = SOCKET_STATE_CONNECTED;
Modified: trunk/reactos/drivers/network/afd/afd/info.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/in…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] Mon Jul 4 18:07:55 2011
@@ -50,6 +50,10 @@
case AFD_INFO_BLOCKING_MODE:
InfoReq->Information.Boolean = FCB->NonBlocking;
break;
+
+ case AFD_INFO_INLINING_MODE:
+ InfoReq->Information.Boolean = FCB->OobInline;
+ break;
case AFD_INFO_RECEIVE_CONTENT_SIZE:
/* Only touch InfoReq if a socket has been set up.
@@ -106,6 +110,7 @@
PAFD_INFO InfoReq = LockRequest(Irp, IrpSp);
PFILE_OBJECT FileObject = IrpSp->FileObject;
PAFD_FCB FCB = FileObject->FsContext;
+ PCHAR NewBuffer;
if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
@@ -117,6 +122,61 @@
case AFD_INFO_BLOCKING_MODE:
AFD_DbgPrint(MID_TRACE,("Blocking mode set to %d\n",
InfoReq->Information.Boolean));
FCB->NonBlocking = InfoReq->Information.Boolean;
+ break;
+ case AFD_INFO_INLINING_MODE:
+ FCB->OobInline = InfoReq->Information.Boolean;
+ break;
+ case AFD_INFO_RECEIVE_WINDOW_SIZE:
+ NewBuffer = ExAllocatePool(PagedPool, InfoReq->Information.Ulong);
+ if (NewBuffer)
+ {
+ if (FCB->Recv.Content > InfoReq->Information.Ulong)
+ FCB->Recv.Content = InfoReq->Information.Ulong;
+
+ if (FCB->Recv.Window)
+ {
+ RtlCopyMemory(NewBuffer,
+ FCB->Recv.Window,
+ FCB->Recv.Content);
+
+ ExFreePool(FCB->Recv.Window);
+ }
+
+ FCB->Recv.Size = InfoReq->Information.Ulong;
+ FCB->Recv.Window = NewBuffer;
+
+ Status = STATUS_SUCCESS;
+ }
+ else
+ {
+ Status = STATUS_NO_MEMORY;
+ }
+ break;
+ case AFD_INFO_SEND_WINDOW_SIZE:
+ NewBuffer = ExAllocatePool(PagedPool, InfoReq->Information.Ulong);
+ if (NewBuffer)
+ {
+ if (FCB->Send.BytesUsed > InfoReq->Information.Ulong)
+ FCB->Send.BytesUsed = InfoReq->Information.Ulong;
+
+ if (FCB->Send.Window)
+ {
+ RtlCopyMemory(NewBuffer,
+ FCB->Send.Window,
+ FCB->Send.BytesUsed);
+
+ ExFreePool(FCB->Send.Window);
+ }
+
+ FCB->Send.Size = InfoReq->Information.Ulong;
+ FCB->Send.Window = NewBuffer;
+
+ Status = STATUS_SUCCESS;
+ }
+ else
+ {
+ Status = STATUS_NO_MEMORY;
+ }
break;
default:
AFD_DbgPrint(MIN_TRACE,("Unknown request %d\n",
InfoReq->InformationClass));
Modified: trunk/reactos/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Mon Jul 4 18:07:55 2011
@@ -173,7 +173,7 @@
} AFD_STORED_DATAGRAM, *PAFD_STORED_DATAGRAM;
typedef struct _AFD_FCB {
- BOOLEAN Locked, Critical, Overread, NonBlocking;
+ BOOLEAN Locked, Critical, Overread, NonBlocking, OobInline;
UINT State, Flags, GroupID, GroupType;
KIRQL OldIrql;
UINT LockCount;