Author: cmihail
Date: Mon Jun 20 12:59:27 2011
New Revision: 52381
URL:
http://svn.reactos.org/svn/reactos?rev=52381&view=rev
Log:
[TCPIP]
[FORMATTING]
Backup copy and formatting.
Modified:
branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/bind.c
branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/listen.c
branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/main.c
branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/read.c
branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/select.c
branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/write.c
branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c
branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/fileobjs.c
branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/main.c
branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/accept.c
branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c
branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c
branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/ipv4/ip.c
branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/tcp.c
branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/tcp_in.c
branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c
Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/bind.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/bind.c [iso-8859-1] (original)
+++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/bind.c [iso-8859-1] Mon Jun 20
12:59:27 2011
@@ -69,6 +69,7 @@
if ( !SocketAcquireStateLock( FCB ) )
return LostSocket( Irp );
+
if ( !(BindReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/listen.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/listen.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/listen.c [iso-8859-1] Mon Jun
20 12:59:27 2011
@@ -55,7 +55,7 @@
AFD_DbgPrint(MID_TRACE,("Socket Address (K) %x (U) %x\n",
&ListenReceive->Address,
Qelt->ConnInfo->RemoteAddress));
-
+ DbgPrint("[SatisfyPreAccept] Called\n");
DbgPrint("[SatisfyPreAccept] Giving SEQ %d to userland\n", Qelt->Seq);
DbgPrint("[SatisfyPreAccept] Socket Address (K) %x (U) %x\n",
&ListenReceive->Address,
@@ -97,12 +97,16 @@
DbgPrint("IPAddr->Address[0].Address[0].sin_addr %x\n",
IPAddr->Address[0].Address[0].in_addr);
- if( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
+ if ( Irp->MdlAddress )
+ UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
Irp->IoStatus.Information = ((PCHAR)&IPAddr[1]) - ((PCHAR)ListenReceive);
Irp->IoStatus.Status = STATUS_SUCCESS;
(void)IoSetCancelRoutine(Irp, NULL);
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
+
+ DbgPrint("[SatisfyPreAccept] Leaving\n");
+
return STATUS_SUCCESS;
}
@@ -192,8 +196,7 @@
Status = TdiBuildNullConnectionInfo( &Qelt->ConnInfo, AddressType );
if( NT_SUCCESS(Status) )
{
- TaCopyTransportAddressInPlace
- ( Qelt->ConnInfo->RemoteAddress,
+ TaCopyTransportAddressInPlace( Qelt->ConnInfo->RemoteAddress,
FCB->ListenIrp.ConnectionReturnInfo->RemoteAddress );
InsertTailList( &FCB->PendingConnections, &Qelt->ListEntry );
}
@@ -203,20 +206,22 @@
if ( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_PREACCEPT] ) &&
!IsListEmpty( &FCB->PendingConnections ) )
{
- PLIST_ENTRY PendingIrp =
- RemoveHeadList( &FCB->PendingIrpList[FUNCTION_PREACCEPT] );
+ PLIST_ENTRY PendingIrp = RemoveHeadList(
&FCB->PendingIrpList[FUNCTION_PREACCEPT] );
PLIST_ENTRY PendingConn = FCB->PendingConnections.Flink;
- SatisfyPreAccept( CONTAINING_RECORD( PendingIrp, IRP,
+
+ SatisfyPreAccept( CONTAINING_RECORD( PendingIrp, IRP,
Tail.Overlay.ListEntry ),
CONTAINING_RECORD( PendingConn, AFD_TDI_OBJECT_QELT,
ListEntry ) );
}
/* Launch new accept socket */
+ DbgPrint("[AFD, ListenComplete] Getting warm connection socket\n");
Status = WarmSocketForConnection( FCB );
if (NT_SUCCESS(Status))
{
+ DbgPrint("[AFD, ListenComplete] Done getting warm connection
socket\n");
Status = TdiBuildNullConnectionInfoInPlace(FCB->ListenIrp.ConnectionCallInfo,
FCB->LocalAddress->Address[0].AddressType);
ASSERT(Status == STATUS_SUCCESS);
@@ -225,6 +230,7 @@
FCB->LocalAddress->Address[0].AddressType);
ASSERT(Status == STATUS_SUCCESS);
+ DbgPrint("[AFD, ListenComplete] callings TdiListen\n");
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
FCB->Connection.Object,
&FCB->ListenIrp.ConnectionCallInfo,
@@ -262,8 +268,8 @@
PAFD_FCB FCB = FileObject->FsContext;
PAFD_LISTEN_DATA ListenReq;
- AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- DbgPrint("[AfdListenSocket] Called on %x\n", FCB);
+ AFD_DbgPrint(MID_TRACE,("Called on 0x%x\n", FCB));
+ DbgPrint("[AfdListenSocket] Called on 0x%x\n", FCB);
if( !SocketAcquireStateLock( FCB ) )
return LostSocket( Irp );
@@ -282,12 +288,11 @@
FCB->DelayedAccept = ListenReq->UseDelayedAcceptance;
AFD_DbgPrint(MID_TRACE,("ADDRESSFILE: %x\n", FCB->AddressFile.Handle));
- DbgPrint("[AfdListenSocket] ADDRESSFILE: %x\n",
FCB->AddressFile.Handle);
Status = WarmSocketForConnection( FCB );
AFD_DbgPrint(MID_TRACE,("Status from warmsocket %x\n", Status));
- DbgPrint("[AfdListenSocket] Status from warmsocket %x\n", Status);
+ DbgPrint("[AfdListenSocket] Status from warmsocket 0x%x\n", Status);
if ( !NT_SUCCESS(Status) )
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
@@ -322,7 +327,7 @@
Status = STATUS_SUCCESS;
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- DbgPrint("[AfdListenSocket] Returning %x\n", Status);
+ DbgPrint("[AfdListenSocket] Returning 0x%x\n", Status);
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
}
@@ -380,14 +385,18 @@
PFILE_OBJECT FileObject = IrpSp->FileObject;
PAFD_DEVICE_EXTENSION DeviceExt =
(PAFD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
- PAFD_FCB FCB = FileObject->FsContext;
+ PAFD_FCB FCB = (PAFD_FCB)FileObject->FsContext;
PAFD_ACCEPT_DATA AcceptData = Irp->AssociatedIrp.SystemBuffer;
PLIST_ENTRY PendingConn;
AFD_DbgPrint(MID_TRACE,("Called\n"));
- DbgPrint("[AfdAccept] Called\n");
-
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
+ DbgPrint("[AfdAccept] Called...\n");
+
+ if (!SocketAcquireStateLock(FCB))
+ {
+ DbgPrint("[AfdAccept] Lost socket\n");
+ return LostSocket( Irp );
+ }
for( PendingConn = FCB->PendingConnections.Flink;
PendingConn != &FCB->PendingConnections;
@@ -446,7 +455,7 @@
}
}
- DbgPrint("[AfdAccept] Done");
+ DbgPrint("[AfdAccept] Done\n");
return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp, 0 );
}
Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/main.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/main.c [iso-8859-1] (original)
+++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/main.c [iso-8859-1] Mon Jun 20
12:59:27 2011
@@ -50,7 +50,7 @@
PIO_STACK_LOCATION IrpSp)
{
PFILE_OBJECT FileObject = IrpSp->FileObject;
- PAFD_FCB FCB = FileObject->FsContext;
+ PAFD_FCB FCB = (PAFD_FCB)FileObject->FsContext;
UINT BufferSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
@@ -75,7 +75,7 @@
PIO_STACK_LOCATION IrpSp)
{
PFILE_OBJECT FileObject = IrpSp->FileObject;
- PAFD_FCB FCB = FileObject->FsContext;
+ PAFD_FCB FCB = (PAFD_FCB)FileObject->FsContext;
PVOID DisconnectOptions = LockRequest(Irp, IrpSp);
UINT DisconnectOptionsSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
@@ -93,7 +93,9 @@
}
FCB->DisconnectOptions = ExAllocatePool(PagedPool, DisconnectOptionsSize);
- if (!FCB->DisconnectOptions) return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY,
Irp, 0);
+
+ if (!FCB->DisconnectOptions)
+ return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0);
RtlCopyMemory(FCB->DisconnectOptions,
DisconnectOptions,
@@ -110,8 +112,8 @@
PIO_STACK_LOCATION IrpSp)
{
PFILE_OBJECT FileObject = IrpSp->FileObject;
- PAFD_FCB FCB = FileObject->FsContext;
- PUINT DisconnectOptionsSize = LockRequest(Irp, IrpSp);
+ PAFD_FCB FCB = (PAFD_FCB)FileObject->FsContext;
+ PUINT DisconnectOptionsSize = (PUINT)LockRequest(Irp, IrpSp);
UINT BufferSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
@@ -130,7 +132,9 @@
}
FCB->DisconnectOptions = ExAllocatePool(PagedPool, *DisconnectOptionsSize);
- if (!FCB->DisconnectOptions) return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY,
Irp, 0);
+
+ if (!FCB->DisconnectOptions)
+ return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0);
FCB->DisconnectOptionsSize = *DisconnectOptionsSize;
@@ -142,7 +146,7 @@
PIO_STACK_LOCATION IrpSp)
{
PFILE_OBJECT FileObject = IrpSp->FileObject;
- PAFD_FCB FCB = FileObject->FsContext;
+ PAFD_FCB FCB = (PAFD_FCB)FileObject->FsContext;
UINT BufferSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp);
@@ -185,7 +189,9 @@
}
FCB->DisconnectData = ExAllocatePool(PagedPool, DisconnectDataSize);
- if (!FCB->DisconnectData) return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY,
Irp, 0);
+
+ if (!FCB->DisconnectData)
+ return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0);
RtlCopyMemory(FCB->DisconnectData,
DisconnectData,
@@ -222,7 +228,9 @@
}
FCB->DisconnectData = ExAllocatePool(PagedPool, *DisconnectDataSize);
- if (!FCB->DisconnectData) return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY,
Irp, 0);
+
+ if (!FCB->DisconnectData)
+ return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0);
FCB->DisconnectDataSize = *DisconnectDataSize;
@@ -299,6 +307,8 @@
AFD_DbgPrint(MID_TRACE,("About to allocate the new FCB\n"));
FCB = ExAllocatePool(NonPagedPool, sizeof(AFD_FCB));
+ RtlZeroMemory(FCB, sizeof(AFD_FCB));
+
if( FCB == NULL )
{
Irp->IoStatus.Status = STATUS_NO_MEMORY;
@@ -337,6 +347,7 @@
FCB->TdiDeviceName.MaximumLength = FCB->TdiDeviceName.Length;
FCB->TdiDeviceName.Buffer =
ExAllocatePool( NonPagedPool, FCB->TdiDeviceName.Length );
+ RtlZeroMemory(FCB->TdiDeviceName.Buffer, FCB->TdiDeviceName.Length);
if( !FCB->TdiDeviceName.Buffer )
{
@@ -393,7 +404,7 @@
PIO_STACK_LOCATION IrpSp)
{
PFILE_OBJECT FileObject = IrpSp->FileObject;
- PAFD_FCB FCB = FileObject->FsContext;
+ PAFD_FCB FCB = (PAFD_FCB)FileObject->FsContext;
PLIST_ENTRY CurrentEntry, NextEntry;
UINT Function;
PIRP CurrentIrp;
@@ -431,7 +442,7 @@
PIO_STACK_LOCATION IrpSp)
{
PFILE_OBJECT FileObject = IrpSp->FileObject;
- PAFD_FCB FCB = FileObject->FsContext;
+ PAFD_FCB FCB = (PAFD_FCB)FileObject->FsContext;
UINT i;
PAFD_IN_FLIGHT_REQUEST InFlightRequest[IN_FLIGHT_REQUESTS];
PAFD_TDI_OBJECT_QELT Qelt;
@@ -448,9 +459,6 @@
DbgPrint("[AFD, AfdCloseSocket] Setting closed state\n");
FCB->State = SOCKET_STATE_CLOSED;
- FCB->PollState = AFD_EVENT_CLOSE;
- FCB->PollStatus[FD_CLOSE_BIT] = STATUS_SUCCESS; //I think we can return success
here
- PollReeval( FCB->DeviceExt, FCB->FileObject );
InFlightRequest[0] = &FCB->ListenIrp;
InFlightRequest[1] = &FCB->ReceiveIrp;
@@ -689,173 +697,176 @@
#endif
AFD_DbgPrint(MID_TRACE,("AfdDispatch: %d\n", IrpSp->MajorFunction));
- if( IrpSp->MajorFunction != IRP_MJ_CREATE) {
- AFD_DbgPrint(MID_TRACE,("FO %x, IrpSp->FO %x\n",
- FileObject, IrpSp->FileObject));
- ASSERT(FileObject == IrpSp->FileObject);
+
+ if( IrpSp->MajorFunction != IRP_MJ_CREATE)
+ {
+ AFD_DbgPrint(MID_TRACE,("FO %x, IrpSp->FO %x\n",
+ FileObject, IrpSp->FileObject));
+ ASSERT(FileObject == IrpSp->FileObject);
}
Irp->IoStatus.Information = 0;
switch(IrpSp->MajorFunction)
{
- /* opening and closing handles to the device */
- case IRP_MJ_CREATE:
- /* Mostly borrowed from the named pipe file system */
- return AfdCreateSocket(DeviceObject, Irp, IrpSp);
-
- case IRP_MJ_CLOSE:
- /* Ditto the borrowing */
- return AfdCloseSocket(DeviceObject, Irp, IrpSp);
-
- case IRP_MJ_CLEANUP:
- return AfdCleanupSocket(DeviceObject, Irp, IrpSp);
-
- /* write data */
- case IRP_MJ_WRITE:
- return AfdConnectedSocketWriteData( DeviceObject, Irp, IrpSp, TRUE );
-
- /* read data */
- case IRP_MJ_READ:
- return AfdConnectedSocketReadData( DeviceObject, Irp, IrpSp, TRUE );
-
- case IRP_MJ_DEVICE_CONTROL:
- {
- switch( IrpSp->Parameters.DeviceIoControl.IoControlCode ) {
- case IOCTL_AFD_BIND:
- return AfdBindSocket( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_CONNECT:
- return AfdStreamSocketConnect( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_START_LISTEN:
- return AfdListenSocket( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_RECV:
- return AfdConnectedSocketReadData( DeviceObject, Irp, IrpSp,
- FALSE );
-
- case IOCTL_AFD_SELECT:
- return AfdSelect( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_EVENT_SELECT:
- return AfdEventSelect( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_ENUM_NETWORK_EVENTS:
- return AfdEnumEvents( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_RECV_DATAGRAM:
- return AfdPacketSocketReadData( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_SEND:
- return AfdConnectedSocketWriteData( DeviceObject, Irp, IrpSp,
- FALSE );
-
- case IOCTL_AFD_SEND_DATAGRAM:
- return AfdPacketSocketWriteData( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_GET_INFO:
- return AfdGetInfo( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_SET_INFO:
- return AfdSetInfo( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_GET_CONTEXT_SIZE:
- return AfdGetContextSize( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_GET_CONTEXT:
- return AfdGetContext( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_SET_CONTEXT:
- return AfdSetContext( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_WAIT_FOR_LISTEN:
- return AfdWaitForListen( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_ACCEPT:
- return AfdAccept( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_DISCONNECT:
- return AfdDisconnect( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_GET_SOCK_NAME:
- return AfdGetSockName( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_GET_PEER_NAME:
- return AfdGetPeerName( DeviceObject, Irp, IrpSp );
-
- case IOCTL_AFD_GET_CONNECT_DATA:
- return AfdGetConnectData(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_SET_CONNECT_DATA:
- return AfdSetConnectData(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_SET_DISCONNECT_DATA:
- return AfdSetDisconnectData(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_GET_DISCONNECT_DATA:
- return AfdGetDisconnectData(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_SET_CONNECT_DATA_SIZE:
- return AfdSetConnectDataSize(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_SET_DISCONNECT_DATA_SIZE:
- return AfdSetDisconnectDataSize(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_SET_CONNECT_OPTIONS:
- return AfdSetConnectOptions(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_SET_DISCONNECT_OPTIONS:
- return AfdSetDisconnectOptions(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_GET_CONNECT_OPTIONS:
- return AfdGetConnectOptions(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_GET_DISCONNECT_OPTIONS:
- return AfdGetDisconnectOptions(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_SET_CONNECT_OPTIONS_SIZE:
- return AfdSetConnectOptionsSize(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_SET_DISCONNECT_OPTIONS_SIZE:
- return AfdSetDisconnectOptionsSize(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_GET_TDI_HANDLES:
- return AfdGetTdiHandles(DeviceObject, Irp, IrpSp);
-
- case IOCTL_AFD_DEFER_ACCEPT:
- DbgPrint("IOCTL_AFD_DEFER_ACCEPT is UNIMPLEMENTED!\n");
- break;
-
- case IOCTL_AFD_GET_PENDING_CONNECT_DATA:
- DbgPrint("IOCTL_AFD_GET_PENDING_CONNECT_DATA is UNIMPLEMENTED!\n");
- break;
-
- case IOCTL_AFD_VALIDATE_GROUP:
- DbgPrint("IOCTL_AFD_VALIDATE_GROUP is UNIMPLEMENTED!\n");
- break;
-
- default:
- Status = STATUS_NOT_SUPPORTED;
- DbgPrint("Unknown IOCTL (0x%x)\n",
- IrpSp->Parameters.DeviceIoControl.IoControlCode);
- break;
- }
- break;
- }
-
-/* unsupported operations */
- default:
- {
- Status = STATUS_NOT_IMPLEMENTED;
- AFD_DbgPrint(MIN_TRACE,
- ("Irp: Unknown Major code was %x\n",
- IrpSp->MajorFunction));
- break;
- }
+ /* opening and closing handles to the device */
+ case IRP_MJ_CREATE:
+ /* Mostly borrowed from the named pipe file system */
+ return AfdCreateSocket(DeviceObject, Irp, IrpSp);
+
+ case IRP_MJ_CLOSE:
+ /* Ditto the borrowing */
+ return AfdCloseSocket(DeviceObject, Irp, IrpSp);
+
+ case IRP_MJ_CLEANUP:
+ return AfdCleanupSocket(DeviceObject, Irp, IrpSp);
+
+ /* write data */
+ case IRP_MJ_WRITE:
+ return AfdConnectedSocketWriteData( DeviceObject, Irp, IrpSp, TRUE );
+
+ /* read data */
+ case IRP_MJ_READ:
+ return AfdConnectedSocketReadData( DeviceObject, Irp, IrpSp, TRUE );
+
+ case IRP_MJ_DEVICE_CONTROL:
+ {
+ switch( IrpSp->Parameters.DeviceIoControl.IoControlCode )
+ {
+ case IOCTL_AFD_BIND:
+ return AfdBindSocket( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_CONNECT:
+ return AfdStreamSocketConnect( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_START_LISTEN:
+ return AfdListenSocket( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_RECV:
+ return AfdConnectedSocketReadData( DeviceObject, Irp, IrpSp,
+ FALSE );
+
+ case IOCTL_AFD_SELECT:
+ return AfdSelect( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_EVENT_SELECT:
+ return AfdEventSelect( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_ENUM_NETWORK_EVENTS:
+ return AfdEnumEvents( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_RECV_DATAGRAM:
+ return AfdPacketSocketReadData( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_SEND:
+ return AfdConnectedSocketWriteData( DeviceObject, Irp, IrpSp,
+ FALSE );
+
+ case IOCTL_AFD_SEND_DATAGRAM:
+ return AfdPacketSocketWriteData( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_GET_INFO:
+ return AfdGetInfo( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_SET_INFO:
+ return AfdSetInfo( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_GET_CONTEXT_SIZE:
+ return AfdGetContextSize( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_GET_CONTEXT:
+ return AfdGetContext( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_SET_CONTEXT:
+ return AfdSetContext( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_WAIT_FOR_LISTEN:
+ return AfdWaitForListen( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_ACCEPT:
+ return AfdAccept( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_DISCONNECT:
+ return AfdDisconnect( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_GET_SOCK_NAME:
+ return AfdGetSockName( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_GET_PEER_NAME:
+ return AfdGetPeerName( DeviceObject, Irp, IrpSp );
+
+ case IOCTL_AFD_GET_CONNECT_DATA:
+ return AfdGetConnectData(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_SET_CONNECT_DATA:
+ return AfdSetConnectData(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_SET_DISCONNECT_DATA:
+ return AfdSetDisconnectData(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_GET_DISCONNECT_DATA:
+ return AfdGetDisconnectData(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_SET_CONNECT_DATA_SIZE:
+ return AfdSetConnectDataSize(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_SET_DISCONNECT_DATA_SIZE:
+ return AfdSetDisconnectDataSize(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_SET_CONNECT_OPTIONS:
+ return AfdSetConnectOptions(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_SET_DISCONNECT_OPTIONS:
+ return AfdSetDisconnectOptions(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_GET_CONNECT_OPTIONS:
+ return AfdGetConnectOptions(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_GET_DISCONNECT_OPTIONS:
+ return AfdGetDisconnectOptions(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_SET_CONNECT_OPTIONS_SIZE:
+ return AfdSetConnectOptionsSize(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_SET_DISCONNECT_OPTIONS_SIZE:
+ return AfdSetDisconnectOptionsSize(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_GET_TDI_HANDLES:
+ return AfdGetTdiHandles(DeviceObject, Irp, IrpSp);
+
+ case IOCTL_AFD_DEFER_ACCEPT:
+ DbgPrint("IOCTL_AFD_DEFER_ACCEPT is UNIMPLEMENTED!\n");
+ break;
+
+ case IOCTL_AFD_GET_PENDING_CONNECT_DATA:
+ DbgPrint("IOCTL_AFD_GET_PENDING_CONNECT_DATA is
UNIMPLEMENTED!\n");
+ break;
+
+ case IOCTL_AFD_VALIDATE_GROUP:
+ DbgPrint("IOCTL_AFD_VALIDATE_GROUP is UNIMPLEMENTED!\n");
+ break;
+
+ default:
+ Status = STATUS_NOT_SUPPORTED;
+ DbgPrint("Unknown IOCTL (0x%x)\n",
+ IrpSp->Parameters.DeviceIoControl.IoControlCode);
+ break;
+ }
+ break;
+ }
+
+ /* unsupported operations */
+ default:
+ {
+ Status = STATUS_NOT_IMPLEMENTED;
+ AFD_DbgPrint(MIN_TRACE, ("Irp: Unknown Major code was %x\n",
+ IrpSp->MajorFunction));
+ break;
+ }
}
AFD_DbgPrint(MID_TRACE, ("Returning %x\n", Status));
+
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/read.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/read.c [iso-8859-1] (original)
+++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/read.c [iso-8859-1] Mon Jun 20
12:59:27 2011
@@ -49,7 +49,8 @@
static VOID RefillSocketBuffer( PAFD_FCB FCB ) {
NTSTATUS Status;
- if( !FCB->ReceiveIrp.InFlightRequest ) {
+ if( !FCB->ReceiveIrp.InFlightRequest &&
+ !(FCB->PollState & (AFD_EVENT_CLOSE | AFD_EVENT_ABORT)) ) {
AFD_DbgPrint(MID_TRACE,("Replenishing buffer\n"));
Status = TdiReceive( &FCB->ReceiveIrp.InFlightRequest,
@@ -216,7 +217,8 @@
}
}
- if( FCB->Recv.Content - FCB->Recv.BytesUsed ) {
+ if( FCB->Recv.Content - FCB->Recv.BytesUsed &&
+ IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV]) ) {
FCB->PollState |= AFD_EVENT_RECEIVE;
FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS;
PollReeval( FCB->DeviceExt, FCB->FileObject );
@@ -576,7 +578,7 @@
}
}
- if( !IsListEmpty( &FCB->DatagramList ) ) {
+ if( !IsListEmpty( &FCB->DatagramList ) &&
IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV]) ) {
AFD_DbgPrint(MID_TRACE,("Signalling\n"));
FCB->PollState |= AFD_EVENT_RECEIVE;
FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS;
Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/select.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/select.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/select.c [iso-8859-1] Mon Jun
20 12:59:27 2011
@@ -287,8 +287,8 @@
Status = ObReferenceObjectByHandle( (PVOID)EventSelectInfo->
EventObject,
FILE_ALL_ACCESS,
- NULL,
- KernelMode,
+ ExEventObjectType,
+ UserMode,
(PVOID *)&FCB->EventSelect,
NULL );
Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/write.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/write.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/drivers/network/afd/afd/write.c [iso-8859-1] Mon Jun 20
12:59:27 2011
@@ -328,8 +328,7 @@
if (SpaceAvail < SendReq->BufferArray[i].len)
{
- if (FCB->Send.BytesUsed + TotalBytesCopied +
- SendReq->BufferArray[i].len > FCB->Send.Size)
+ if (TotalBytesCopied + SendReq->BufferArray[i].len >
FCB->Send.Size)
{
UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE
);
Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] Mon
Jun 20 12:59:27 2011
@@ -229,8 +229,7 @@
/* Try canceling the request */
Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
- if (TCPAbortListenForSocket(Connection->AddressFile->Listener,
- Connection))
+ if (TCPAbortListenForSocket(Connection->AddressFile->Listener, Connection))
{
Irp->IoStatus.Information = 0;
IRPFinish(Irp, STATUS_CANCELLED);
@@ -267,16 +266,17 @@
* Status of operation
*/
{
- PTDI_REQUEST_KERNEL_ASSOCIATE Parameters;
- PTRANSPORT_CONTEXT TranContext;
- PIO_STACK_LOCATION IrpSp;
- PCONNECTION_ENDPOINT Connection, LastConnection;
- PFILE_OBJECT FileObject;
- PADDRESS_FILE AddrFile = NULL;
- NTSTATUS Status;
- KIRQL OldIrql;
+ PTDI_REQUEST_KERNEL_ASSOCIATE Parameters;
+ PTRANSPORT_CONTEXT TranContext;
+ PIO_STACK_LOCATION IrpSp;
+ PCONNECTION_ENDPOINT Connection, LastConnection;
+ PFILE_OBJECT FileObject;
+ PADDRESS_FILE AddrFile = NULL;
+ NTSTATUS Status;
+ KIRQL OldIrql;
TI_DbgPrint(DEBUG_IRP, ("[TCPIP, DispTdiAssociateAddress] Called\n"));
+ DbgPrint("[TCPIP, DispTdiAssociateAddress] Called\n");
IrpSp = IoGetCurrentIrpStackLocation(Irp);
@@ -354,17 +354,20 @@
LockObjectAtDpcLevel(AddrFile);
- /* Add connection endpoint to the address file */
- ReferenceObject(Connection);
- if (AddrFile->Connection == NULL)
- AddrFile->Connection = Connection;
- else
- {
- LastConnection = AddrFile->Connection;
- while (LastConnection->Next != NULL)
- LastConnection = LastConnection->Next;
- LastConnection->Next = Connection;
- }
+ DbgPrint("[TCPIP, DispTdiAssociateAddress] Associating AddressFile = 0x%x with
Connection = 0x%x\n",
+ AddrFile, Connection);
+
+ /* Add connection endpoint to the address file */
+ ReferenceObject(Connection);
+ if (AddrFile->Connection == NULL)
+ AddrFile->Connection = Connection;
+ else
+ {
+ LastConnection = AddrFile->Connection;
+ while (LastConnection->Next != NULL)
+ LastConnection = LastConnection->Next;
+ LastConnection->Next = Connection;
+ }
ReferenceObject(AddrFile);
Connection->AddressFile = AddrFile;
@@ -374,7 +377,99 @@
ObDereferenceObject(FileObject);
+ DbgPrint("[TCPIP, DispTdiAssociateAddress] Leaving\n");
+
return STATUS_SUCCESS;
+}
+
+NTSTATUS DispTdiDisassociateAddress(
+ PIRP Irp)
+/*
+ * FUNCTION: TDI_DISASSOCIATE_ADDRESS handler
+ * ARGUMENTS:
+ * Irp = Pointer to an I/O request packet
+ * RETURNS:
+ * Status of operation
+ */
+{
+ PCONNECTION_ENDPOINT Connection, LastConnection;
+ PTRANSPORT_CONTEXT TranContext;
+ PIO_STACK_LOCATION IrpSp;
+ KIRQL OldIrql;
+ NTSTATUS Status;
+
+ TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
+ DbgPrint("[TCPIP, DispTdiDisassociateAddress] Called\n");
+
+ IrpSp = IoGetCurrentIrpStackLocation(Irp);
+
+ /* Get associated connection endpoint file object. Quit if none exists */
+
+ TranContext = IrpSp->FileObject->FsContext;
+ if (!TranContext)
+ {
+ TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
+ if (!Connection)
+ {
+ TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ LockObject(Connection, &OldIrql);
+
+ if (!Connection->AddressFile)
+ {
+ UnlockObject(Connection, OldIrql);
+ TI_DbgPrint(MID_TRACE, ("No address file is asscociated.\n"));
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ LockObjectAtDpcLevel(Connection->AddressFile);
+
+ /* Unlink this connection from the address file */
+ if (Connection->AddressFile->Connection == Connection)
+ {
+ Connection->AddressFile->Connection = Connection->Next;
+ DereferenceObject(Connection);
+ Status = STATUS_SUCCESS;
+ }
+ else
+ {
+ LastConnection = Connection->AddressFile->Connection;
+ while (LastConnection->Next != Connection && LastConnection->Next
!= NULL)
+ LastConnection = LastConnection->Next;
+ if (LastConnection->Next == Connection)
+ {
+ LastConnection->Next = Connection->Next;
+ DereferenceObject(Connection);
+ Status = STATUS_SUCCESS;
+ }
+ else
+ {
+ Status = STATUS_INVALID_PARAMETER;
+ }
+ }
+
+ UnlockObjectFromDpcLevel(Connection->AddressFile);
+
+ if (Status == STATUS_SUCCESS)
+ {
+ DbgPrint("[TCPIP, DispTdiDisassociateAddress] Dissasociating AddressFile =
0x%x from Connection = 0x%x\n",
+ Connection->AddressFile, Connection);
+ /* Remove the address file from this connection */
+ DereferenceObject(Connection->AddressFile);
+ Connection->AddressFile = NULL;
+ }
+
+ UnlockObject(Connection, OldIrql);
+
+ DbgPrint("[TCPIP, DispTdiDisassociateAddress] Leaving. Status = 0x%x\n",
Status);
+
+ return Status;
}
@@ -441,90 +536,6 @@
return Status;
}
-
-NTSTATUS DispTdiDisassociateAddress(
- PIRP Irp)
-/*
- * FUNCTION: TDI_DISASSOCIATE_ADDRESS handler
- * ARGUMENTS:
- * Irp = Pointer to an I/O request packet
- * RETURNS:
- * Status of operation
- */
-{
- PCONNECTION_ENDPOINT Connection, LastConnection;
- PTRANSPORT_CONTEXT TranContext;
- PIO_STACK_LOCATION IrpSp;
- KIRQL OldIrql;
- NTSTATUS Status;
-
- TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
-
- /* Get associated connection endpoint file object. Quit if none exists */
-
- TranContext = IrpSp->FileObject->FsContext;
- if (!TranContext) {
- TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
- return STATUS_INVALID_PARAMETER;
- }
-
- Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext;
- if (!Connection) {
- TI_DbgPrint(MID_TRACE, ("No connection endpoint file object.\n"));
- return STATUS_INVALID_PARAMETER;
- }
-
- LockObject(Connection, &OldIrql);
-
- if (!Connection->AddressFile) {
- UnlockObject(Connection, OldIrql);
- TI_DbgPrint(MID_TRACE, ("No address file is asscociated.\n"));
- return STATUS_INVALID_PARAMETER;
- }
-
- LockObjectAtDpcLevel(Connection->AddressFile);
-
- /* Unlink this connection from the address file */
- if (Connection->AddressFile->Connection == Connection)
- {
- Connection->AddressFile->Connection = Connection->Next;
- DereferenceObject(Connection);
- Status = STATUS_SUCCESS;
- }
- else
- {
- LastConnection = Connection->AddressFile->Connection;
- while (LastConnection->Next != Connection && LastConnection->Next !=
NULL)
- LastConnection = LastConnection->Next;
- if (LastConnection->Next == Connection)
- {
- LastConnection->Next = Connection->Next;
- DereferenceObject(Connection);
- Status = STATUS_SUCCESS;
- }
- else
- {
- Status = STATUS_INVALID_PARAMETER;
- }
- }
-
- UnlockObjectFromDpcLevel(Connection->AddressFile);
-
- if (Status == STATUS_SUCCESS)
- {
- /* Remove the address file from this connection */
- DereferenceObject(Connection->AddressFile);
- Connection->AddressFile = NULL;
- }
-
- UnlockObject(Connection, OldIrql);
-
- return Status;
-}
-
-
NTSTATUS DispTdiDisconnect(
PIRP Irp)
/*
@@ -650,6 +661,8 @@
if ( NT_SUCCESS(Status) && !Connection->AddressFile->Listener )
{
Connection->AddressFile->Listener = TCPAllocateConnectionEndpoint( NULL );
+ DbgPrint("[TCPIP, DispTdiListen] Connection = 0x%x,
Connection->AddressFile->Listener = 0x%x\n",
+ Connection, Connection->AddressFile->Listener);
if ( !Connection->AddressFile->Listener )
Status = STATUS_NO_MEMORY;
@@ -657,7 +670,7 @@
if ( NT_SUCCESS(Status) )
{
Connection->AddressFile->Listener->AddressFile =
- Connection->AddressFile;
+ Connection->AddressFile;
Status = TCPSocket( Connection->AddressFile->Listener,
Connection->AddressFile->Family,
Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/fileobjs.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] Mon
Jun 20 12:59:27 2011
@@ -256,6 +256,8 @@
}
RtlZeroMemory(AddrFile, sizeof(ADDRESS_FILE));
+ DbgPrint("[TCPIP, FileOpenAddress] Allocated AddressFile = 0x%x,
sizeof(ADDRESS_FILE) = %d\n",
+ AddrFile, sizeof(ADDRESS_FILE));
AddrFile->RefCount = 1;
AddrFile->Free = AddrFileFree;
@@ -395,18 +397,22 @@
LockObject(AddrFile, &OldIrql);
+ DbgPrint("[TCPIP, FileCloseAddress] AddrFile->RefCount = %d before
TCPClose\n", AddrFile->RefCount);
+
/* We have to close this listener because we started it */
if ( AddrFile->Listener )
{
AddrFile->Listener->AddressFile = NULL;
+
+ //DbgPrint("[TCPIP, FileCloseAddress] Calling TCPClose( 0x%x )\n",
AddrFile->Listener);
TCPClose( AddrFile->Listener );
}
- DbgPrint("[TCPIP, FileCloseAddress] AddrFile->RefCount = %d\n",
AddrFile->RefCount);
-
UnlockObject(AddrFile, OldIrql);
DereferenceObject(AddrFile);
+
+ DbgPrint("[TCPIP, FileCloseAddress] AddrFile->RefCount = %d after
TCPClose\n", AddrFile->RefCount);
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
DbgPrint("[TCPIP, FileCloseAddress] Leaving\n");
@@ -439,6 +445,7 @@
return STATUS_NO_MEMORY;
Status = TCPSocket( Connection, AF_INET, SOCK_STREAM, IPPROTO_TCP );
+
if (!NT_SUCCESS(Status))
{
Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/main.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/main.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Mon Jun
20 12:59:27 2011
@@ -105,144 +105,161 @@
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- PFILE_FULL_EA_INFORMATION EaInfo;
- PTRANSPORT_CONTEXT Context;
- PIO_STACK_LOCATION IrpSp;
- PTA_IP_ADDRESS Address;
- TDI_REQUEST Request;
- PVOID ClientContext;
- NTSTATUS Status;
- ULONG Protocol;
-
- TI_DbgPrint(DEBUG_IRP, ("Called. DeviceObject is at (0x%X), IRP is at
(0x%X).\n", DeviceObject, Irp));
-
- EaInfo = Irp->AssociatedIrp.SystemBuffer;
-
- /* Parameter check */
- /* No EA information means that we're opening for SET/QUERY_INFORMATION
- * style calls. */
-
- /* Allocate resources here. We release them again if something failed */
- Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(TRANSPORT_CONTEXT),
- TRANS_CONTEXT_TAG);
- if (!Context) {
- TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- Context->CancelIrps = FALSE;
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
- IrpSp->FileObject->FsContext = Context;
- Request.RequestContext = Irp;
-
- /* Branch to the right handler */
- if (EaInfo &&
- (EaInfo->EaNameLength == TDI_TRANSPORT_ADDRESS_LENGTH) &&
- (RtlCompareMemory
- (&EaInfo->EaName, TdiTransportAddress,
- TDI_TRANSPORT_ADDRESS_LENGTH) == TDI_TRANSPORT_ADDRESS_LENGTH)) {
- /* This is a request to open an address */
-
-
- /* XXX This should probably be done in IoCreateFile() */
- /* Parameter checks */
-
- Address = (PTA_IP_ADDRESS)(EaInfo->EaName + EaInfo->EaNameLength + 1);
//0-term
-
- if ((EaInfo->EaValueLength < sizeof(TA_IP_ADDRESS)) ||
- (Address->TAAddressCount != 1) ||
- (Address->Address[0].AddressLength < TDI_ADDRESS_LENGTH_IP) ||
- (Address->Address[0].AddressType != TDI_ADDRESS_TYPE_IP)) {
- TI_DbgPrint(MIN_TRACE, ("Parameters are invalid:\n"));
- TI_DbgPrint(MIN_TRACE, ("AddressCount: %d\n",
Address->TAAddressCount));
- if( Address->TAAddressCount == 1 ) {
- TI_DbgPrint(MIN_TRACE, ("AddressLength: %\n",
- Address->Address[0].AddressLength));
- TI_DbgPrint(MIN_TRACE, ("AddressType: %\n",
- Address->Address[0].AddressType));
- }
- ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
- return STATUS_INVALID_PARAMETER;
+ PFILE_FULL_EA_INFORMATION EaInfo;
+ PTRANSPORT_CONTEXT Context;
+ PIO_STACK_LOCATION IrpSp;
+ PTA_IP_ADDRESS Address;
+ TDI_REQUEST Request;
+ PVOID ClientContext;
+ NTSTATUS Status;
+ ULONG Protocol;
+
+ TI_DbgPrint(DEBUG_IRP, ("Called. DeviceObject is at (0x%X), IRP is at
(0x%X).\n", DeviceObject, Irp));
+
+ EaInfo = Irp->AssociatedIrp.SystemBuffer;
+
+ /* Parameter check */
+ /* No EA information means that we're opening for SET/QUERY_INFORMATION
+ * style calls. */
+
+ /* Allocate resources here. We release them again if something failed */
+ Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(TRANSPORT_CONTEXT),
+ TRANS_CONTEXT_TAG);
+ if (!Context)
+ {
+ TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
+ return STATUS_INSUFFICIENT_RESOURCES;
}
- /* Open address file object */
-
- /* Protocol depends on device object so find the protocol */
- if (DeviceObject == TCPDeviceObject)
- Protocol = IPPROTO_TCP;
- else if (DeviceObject == UDPDeviceObject)
- Protocol = IPPROTO_UDP;
- else if (DeviceObject == IPDeviceObject)
- Protocol = IPPROTO_RAW;
- else if (DeviceObject == RawIPDeviceObject) {
- Status = TiGetProtocolNumber(&IrpSp->FileObject->FileName,
&Protocol);
- if (!NT_SUCCESS(Status)) {
- TI_DbgPrint(MIN_TRACE, ("Raw IP protocol number is invalid.\n"));
+ Context->CancelIrps = FALSE;
+
+ IrpSp = IoGetCurrentIrpStackLocation(Irp);
+ IrpSp->FileObject->FsContext = Context;
+ Request.RequestContext = Irp;
+
+ /* Branch to the right handler */
+ if (EaInfo &&
+ (EaInfo->EaNameLength == TDI_TRANSPORT_ADDRESS_LENGTH) &&
+ (RtlCompareMemory(&EaInfo->EaName, TdiTransportAddress,
+ TDI_TRANSPORT_ADDRESS_LENGTH) == TDI_TRANSPORT_ADDRESS_LENGTH))
+ {
+ /* This is a request to open an address */
+
+
+ /* XXX This should probably be done in IoCreateFile() */
+ /* Parameter checks */
+
+ Address = (PTA_IP_ADDRESS)(EaInfo->EaName + EaInfo->EaNameLength + 1);
//0-term
+
+ if ((EaInfo->EaValueLength < sizeof(TA_IP_ADDRESS)) ||
+ (Address->TAAddressCount != 1) ||
+ (Address->Address[0].AddressLength < TDI_ADDRESS_LENGTH_IP) ||
+ (Address->Address[0].AddressType != TDI_ADDRESS_TYPE_IP))
+ {
+ TI_DbgPrint(MIN_TRACE, ("Parameters are invalid:\n"));
+ TI_DbgPrint(MIN_TRACE, ("AddressCount: %d\n",
Address->TAAddressCount));
+ if( Address->TAAddressCount == 1 )
+ {
+ TI_DbgPrint(MIN_TRACE, ("AddressLength: %\n",
+ Address->Address[0].AddressLength));
+ TI_DbgPrint(MIN_TRACE, ("AddressType: %\n",
+ Address->Address[0].AddressType));
+ }
+
+ ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ /* Open address file object */
+
+ /* Protocol depends on device object so find the protocol */
+ if (DeviceObject == TCPDeviceObject)
+ Protocol = IPPROTO_TCP;
+ else if (DeviceObject == UDPDeviceObject)
+ Protocol = IPPROTO_UDP;
+ else if (DeviceObject == IPDeviceObject)
+ Protocol = IPPROTO_RAW;
+ else if (DeviceObject == RawIPDeviceObject)
+ {
+ Status = TiGetProtocolNumber(&IrpSp->FileObject->FileName,
&Protocol);
+ if (!NT_SUCCESS(Status))
+ {
+ TI_DbgPrint(MIN_TRACE, ("Raw IP protocol number is
invalid.\n"));
+ ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
+ return STATUS_INVALID_PARAMETER;
+ }
+ }
+ else
+ {
+ TI_DbgPrint(MIN_TRACE, ("Invalid device object at (0x%X).\n",
DeviceObject));
+ ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ Status = FileOpenAddress(&Request, Address, Protocol, NULL);
+ if (NT_SUCCESS(Status))
+ {
+ IrpSp->FileObject->FsContext2 = (PVOID)TDI_TRANSPORT_ADDRESS_FILE;
+ Context->Handle.AddressHandle = Request.Handle.AddressHandle;
+ }
+
+ }
+ else if (EaInfo &&
+ (EaInfo->EaNameLength == TDI_CONNECTION_CONTEXT_LENGTH) &&
+ (RtlCompareMemory
+ (&EaInfo->EaName, TdiConnectionContext,
+ TDI_CONNECTION_CONTEXT_LENGTH) ==
+ TDI_CONNECTION_CONTEXT_LENGTH))
+ {
+ /* This is a request to open a connection endpoint */
+
+ /* Parameter checks */
+
+ if (EaInfo->EaValueLength < sizeof(PVOID))
+ {
+ TI_DbgPrint(MIN_TRACE, ("Parameters are invalid.\n"));
+ ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ /* Can only do connection oriented communication using TCP */
+
+ if (DeviceObject != TCPDeviceObject)
+ {
+ TI_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
+ ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ ClientContext = *((PVOID*)(EaInfo->EaName + EaInfo->EaNameLength));
+
+ /* Open connection endpoint file object */
+
+ Status = FileOpenConnection(&Request, ClientContext);
+ if (NT_SUCCESS(Status))
+ {
+ IrpSp->FileObject->FsContext2 = (PVOID)TDI_CONNECTION_FILE;
+ Context->Handle.ConnectionContext = Request.Handle.ConnectionContext;
+ }
+ }
+ else
+ {
+ /* This is a request to open a control connection */
+ Status = FileOpenControlChannel(&Request);
+ if (NT_SUCCESS(Status))
+ {
+ IrpSp->FileObject->FsContext2 = (PVOID)TDI_CONTROL_CHANNEL_FILE;
+ Context->Handle.ControlChannel = Request.Handle.ControlChannel;
+ }
+ }
+
+ if (!NT_SUCCESS(Status))
ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
- return STATUS_INVALID_PARAMETER;
- }
- } else {
- TI_DbgPrint(MIN_TRACE, ("Invalid device object at (0x%X).\n",
DeviceObject));
- ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
- return STATUS_INVALID_PARAMETER;
- }
-
- Status = FileOpenAddress(&Request, Address, Protocol, NULL);
- if (NT_SUCCESS(Status)) {
- IrpSp->FileObject->FsContext2 = (PVOID)TDI_TRANSPORT_ADDRESS_FILE;
- Context->Handle.AddressHandle = Request.Handle.AddressHandle;
- }
-
- } else if (EaInfo &&
- (EaInfo->EaNameLength == TDI_CONNECTION_CONTEXT_LENGTH) &&
- (RtlCompareMemory
- (&EaInfo->EaName, TdiConnectionContext,
- TDI_CONNECTION_CONTEXT_LENGTH) ==
- TDI_CONNECTION_CONTEXT_LENGTH)) {
- /* This is a request to open a connection endpoint */
-
- /* Parameter checks */
-
- if (EaInfo->EaValueLength < sizeof(PVOID)) {
- TI_DbgPrint(MIN_TRACE, ("Parameters are invalid.\n"));
- ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
- return STATUS_INVALID_PARAMETER;
- }
-
- /* Can only do connection oriented communication using TCP */
-
- if (DeviceObject != TCPDeviceObject) {
- TI_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
- ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
- return STATUS_INVALID_PARAMETER;
- }
-
- ClientContext = *((PVOID*)(EaInfo->EaName + EaInfo->EaNameLength));
-
- /* Open connection endpoint file object */
-
- Status = FileOpenConnection(&Request, ClientContext);
- if (NT_SUCCESS(Status)) {
- IrpSp->FileObject->FsContext2 = (PVOID)TDI_CONNECTION_FILE;
- Context->Handle.ConnectionContext = Request.Handle.ConnectionContext;
- }
- } else {
- /* This is a request to open a control connection */
- Status = FileOpenControlChannel(&Request);
- if (NT_SUCCESS(Status)) {
- IrpSp->FileObject->FsContext2 = (PVOID)TDI_CONTROL_CHANNEL_FILE;
- Context->Handle.ControlChannel = Request.Handle.ControlChannel;
- }
- }
-
- if (!NT_SUCCESS(Status))
- ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG);
-
- TI_DbgPrint(DEBUG_IRP, ("Leaving. Status = (0x%X).\n", Status));
-
- Irp->IoStatus.Status = Status;
- return Status;
+
+ TI_DbgPrint(DEBUG_IRP, ("Leaving. Status = (0x%X).\n", Status));
+
+ Irp->IoStatus.Status = Status;
+ return Status;
}
Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/accept.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] Mon
Jun 20 12:59:27 2011
@@ -101,7 +101,7 @@
{
Bucket = CONTAINING_RECORD(ListEntry, TDI_BUCKET, Entry);
- if( Bucket->AssociatedEndpoint == Connection )
+ if (Bucket->AssociatedEndpoint == Connection)
{
DereferenceObject(Bucket->AssociatedEndpoint);
RemoveEntryList( &Bucket->Entry );
Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] Mon
Jun 20 12:59:27 2011
@@ -77,7 +77,7 @@
ReferenceObject(Connection);
- DbgPrint("Flushing recv/all with status: 0x%x\n", Status);
+ DbgPrint("[IP, FlushAllQueues] Flushing recv/all with status: 0x%x\n",
Status);
while ((Entry = ExInterlockedRemoveHeadList(&Connection->ReceiveRequest,
&Connection->Lock)))
{
@@ -102,8 +102,10 @@
Bucket->Status = Status;
Bucket->Information = 0;
-
- //DereferenceObject(Bucket->AssociatedEndpoint);
+
+ DbgPrint("[IP, FlushAllQueues] Flushing Listen request for Connection =
0x%x\n", Bucket->AssociatedEndpoint);
+
+ DereferenceObject(Bucket->AssociatedEndpoint);
CompleteBucket(Connection, Bucket, TRUE);
}
@@ -178,9 +180,6 @@
Bucket->Status = Status;
Bucket->Information = 0;
-
- DbgPrint("[IP, TCPAcceptEventHandler] Associated with: 0x%x\n",
- Bucket->AssociatedEndpoint->SocketContext);
DbgPrint("[IP, TCPAcceptEventHandler] Completing accept event %x\n",
Status);
@@ -194,7 +193,6 @@
LockObject(Bucket->AssociatedEndpoint, &OldIrql);
/* free previously created socket context (we don't use it, we use
newpcb) */
- //LibTCPClose(Bucket->AssociatedEndpoint->SocketContext);
OldSocketContext = Bucket->AssociatedEndpoint->SocketContext;
Bucket->AssociatedEndpoint->SocketContext = newpcb;
Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Mon Jun
20 12:59:27 2011
@@ -81,11 +81,11 @@
LockObject(Connection, &OldIrql);
TI_DbgPrint(DEBUG_TCP,("[IP, TCPSocket] Called: Connection %x, Family %d, Type
%d, "
- "Proto %d\n",
- Connection, Family, Type, Proto));
- DbgPrint("[IP, TCPSocket] Called: Connection %x, Family %d, Type %d, "
- "Proto %d\n",
- Connection, Family, Type, Proto);
+ "Proto %d, sizeof(CONNECTION_ENDPOINT) = %d\n",
+ Connection, Family, Type, Proto,
sizeof(CONNECTION_ENDPOINT)));
+ DbgPrint("[IP, TCPSocket] Called: Connection 0x%x, Family %d, Type %d, "
+ "Proto %d, sizeof(CONNECTION_ENDPOINT) = %d\n",
+ Connection, Family, Type, Proto,
sizeof(CONNECTION_ENDPOINT));
Connection->SocketContext = LibTCPSocket(Connection);
if (Connection->SocketContext)
@@ -93,12 +93,45 @@
else
Status = STATUS_INSUFFICIENT_RESOURCES;
+ DbgPrint("[IP, TCPSocket] Connection->SocketContext = 0x%x\n",
Connection->SocketContext);
+
UnlockObject(Connection, OldIrql);
TI_DbgPrint(DEBUG_TCP,("[IP, TCPSocket] Leaving. Status = 0x%x\n",
Status));
DbgPrint("[IP, TCPSocket] Leaving. Status = 0x%x\n", Status);
return Status;
+}
+
+NTSTATUS TCPClose
+( PCONNECTION_ENDPOINT Connection )
+{
+ KIRQL OldIrql;
+ PVOID Socket;
+
+ LockObject(Connection, &OldIrql);
+ Socket = Connection->SocketContext;
+ Connection->SocketContext = NULL;
+
+ DbgPrint("[IP, TCPClose] Called\n");
+
+ /* We should not be associated to an address file at this point */
+ ASSERT(!Connection->AddressFile);
+
+ /* Don't try to close again if the other side closed us already */
+ if (Socket)
+ {
+ FlushAllQueues(Connection, STATUS_CANCELLED);
+ LibTCPClose(Socket);
+ }
+
+ UnlockObject(Connection, OldIrql);
+
+ DereferenceObject(Connection);
+
+ DbgPrint("[IP, TCPClose] Leaving. Connection->RefCount = %d\n",
Connection->RefCount);
+
+ return STATUS_SUCCESS;
}
VOID TCPReceive(PIP_INTERFACE Interface, PIP_PACKET IPPacket)
@@ -333,34 +366,6 @@
return Status;
}
-NTSTATUS TCPClose
-( PCONNECTION_ENDPOINT Connection )
-{
- KIRQL OldIrql;
- PVOID Socket;
-
- LockObject(Connection, &OldIrql);
- Socket = Connection->SocketContext;
- Connection->SocketContext = NULL;
-
- /* We should not be associated to an address file at this point */
- ASSERT(!Connection->AddressFile);
-
- /* Don't try to close again if the other side closed us already */
- if (Socket)
- {
- FlushAllQueues(Connection, STATUS_CANCELLED);
-
- LibTCPClose(Socket);
- }
-
- UnlockObject(Connection, OldIrql);
-
- DereferenceObject(Connection);
-
- return STATUS_SUCCESS;
-}
-
NTSTATUS TCPReceiveData
( PCONNECTION_ENDPOINT Connection,
PNDIS_BUFFER Buffer,
Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/ipv4/ip.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/ipv4/ip.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/ipv4/ip.c [iso-8859-1] Mon
Jun 20 12:59:27 2011
@@ -251,6 +251,8 @@
IP_STATS_INC(ip.recv);
snmp_inc_ipinreceives();
+
+ DbgPrint("ip_input: called\n");
/* identify the IP header */
iphdr = (struct ip_hdr *)p->payload;
@@ -488,7 +490,7 @@
if (raw_input(p, inp) == 0)
#endif /* LWIP_RAW */
{
-
+ DbgPrint("ip_input: choosing protocol\n");
switch (IPH_PROTO(iphdr)) {
#if LWIP_UDP
case IP_PROTO_UDP:
@@ -502,6 +504,7 @@
#if LWIP_TCP
case IP_PROTO_TCP:
snmp_inc_ipindelivers();
+ DbgPrint("ip_input: sending data to tcp_input\n");
tcp_input(p, inp);
break;
#endif /* LWIP_TCP */
Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/tcp.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/tcp.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/tcp.c [iso-8859-1] Mon Jun 20
12:59:27 2011
@@ -139,7 +139,7 @@
{
err_t err;
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_close_shutdown: called on pcb %x\n", pcb));
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_close_shutdown: called on pcb 0x%x\n", pcb));
if (rst_on_unacked_data && (pcb->state != LISTEN)) {
if ((pcb->refused_data != NULL) || (pcb->rcv_wnd != TCP_WND)) {
@@ -181,6 +181,7 @@
break;
case LISTEN:
err = ERR_OK;
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_close_shutdown: Remove pcb from listen list and
free\n"));
tcp_pcb_remove(&tcp_listen_pcbs.pcbs, pcb);
memp_free(MEMP_TCP_PCB_LISTEN, pcb);
pcb = NULL;
@@ -487,6 +488,8 @@
LWIP_UNUSED_ARG(backlog);
LWIP_ERROR("tcp_listen: pcb already connected", pcb->state == CLOSED,
return NULL);
+ DbgPrint("tcp_listen_with_backlog: sizeof(tcp_pcb_listen) = %d, %d\n",
+ sizeof(struct tcp_pcb_listen), (((sizeof(struct tcp_pcb_listen)) + MEM_ALIGNMENT -
1) & ~(MEM_ALIGNMENT-1)));
/* already listening? */
if (pcb->state == LISTEN) {
Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/tcp_in.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/tcp_in.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/core/tcp_in.c [iso-8859-1] Mon Jun
20 12:59:27 2011
@@ -107,8 +107,6 @@
iphdr = (struct ip_hdr *)p->payload;
tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4);
-
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_input: called\n"));
#if TCP_INPUT_DEBUG
tcp_debug_print(tcphdr);
@@ -177,22 +175,25 @@
flags = TCPH_FLAGS(tcphdr);
tcplen = p->tot_len + ((flags & (TCP_FIN | TCP_SYN)) ? 1 : 0);
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_input: called %"U16_F" ->
%"U16_F"\n", tcphdr->src, tcphdr->dest));
+
/* Demultiplex an incoming segment. First, we check if it is destined
for an active connection. */
prev = NULL;
-
for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next)
{
LWIP_ASSERT("tcp_input: active pcb->state != CLOSED", pcb->state !=
CLOSED);
LWIP_ASSERT("tcp_input: active pcb->state != TIME-WAIT", pcb->state
!= TIME_WAIT);
LWIP_ASSERT("tcp_input: active pcb->state != LISTEN", pcb->state !=
LISTEN);
+
if (pcb->remote_port == tcphdr->src &&
pcb->local_port == tcphdr->dest &&
ip_addr_cmp(&(pcb->remote_ip), ¤t_iphdr_src) &&
ip_addr_cmp(&(pcb->local_ip), ¤t_iphdr_dest))
{
-
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_input: active pcb -> (localport, remoteport)
= %"U16_F" -> %"U16_F"\n", pcb->local_port,
pcb->remote_port));
+ DbgPrint("tcp_input: pcb = 0x%x\n", pcb);
/* Move this PCB to the front of the list so that subsequent
lookups will be faster (we exploit locality in TCP segment
arrivals). */
@@ -908,6 +909,8 @@
u32_t right_wnd_edge;
u16_t new_tot_len;
int found_dupack = 0;
+
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_receive: called\n"));
if (flags & TCP_ACK) {
right_wnd_edge = pcb->snd_wnd + pcb->snd_wl2;
@@ -1534,6 +1537,8 @@
tcp_ack_now(pcb);
}
}
+
+ LWIP_DEBUGF(TCP_DEBUG, ("tcp_receive: done\n"));
}
/**
Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
==============================================================================
--- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c [iso-8859-1] (original)
+++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c [iso-8859-1] Mon Jun 20
12:59:27 2011
@@ -128,7 +128,7 @@
err_t
InternalAcceptEventHandler(void *arg, struct tcp_pcb *newpcb, err_t err)
{
- DbgPrint("[lwIP, InternalAcceptEventHandler] AcceptEvent (0x%x, 0x%x,
%d)\n",
+ DbgPrint("[lwIP, InternalAcceptEventHandler] AcceptEvent arg = 0x%x, newpcb =
0x%x, err = %d\n",
arg, newpcb, (unsigned int)err);
/* Make sure the socket didn't get closed */
@@ -197,8 +197,12 @@
struct socket_callback_msg *msg = arg;
ASSERT(msg);
+
+ DbgPrint("[lwIP, LibTCPSocketCallback] Called\n");
msg->NewPcb = tcp_new();
+
+ DbgPrint("[lwIP, LibTCPSocketCallback] Assigned new pcb = 0x%x\n",
msg->NewPcb);
if (msg->NewPcb)
{
@@ -214,6 +218,8 @@
{
struct socket_callback_msg *msg = ExAllocatePool(NonPagedPool, sizeof(struct
socket_callback_msg));
void *ret;
+
+ DbgPrint("[lwIP, LibTCPSocket] Called\n");
if (msg)
{
@@ -227,12 +233,16 @@
else
ret = NULL;
- DbgPrint("[lwIP, LibTCPSocket] (0x%x) = 0x%x\n", arg, ret);
+ DbgPrint("[lwIP, LibTCPSocket] Connection( 0x%x )->SocketContext = pcb(
0x%x )\n", arg, ret);
+
+ DbgPrint("[lwIP, LibTCPSocket] Done\n");
ExFreePool(msg);
return (struct tcp_pcb*)ret;
}
+
+ DbgPrint("[lwIP, LibTCPSocket] Done\n");
return NULL;
}
@@ -347,7 +357,7 @@
struct listen_callback_msg *msg;
void *ret;
- DbgPrint("[lwIP, LibTCPListen] Called\n");
+ DbgPrint("[lwIP, LibTCPListen] Called on pcb = 0x%x\n", pcb);
if (!pcb)
return NULL;
@@ -366,7 +376,8 @@
else
ret = NULL;
- DbgPrint("[lwIP, LibTCPListen] pcb = 0x%x \n", pcb);
+ DbgPrint("[lwIP, LibTCPListen] pcb = 0x%x, newpcb = 0x%x, sizeof(pcb) = %d
\n",
+ pcb, ret, sizeof(struct tcp_pcb));
DbgPrint("[lwIP, LibTCPListen] Done\n");
@@ -617,7 +628,7 @@
struct close_callback_msg *msg;
err_t ret;
- DbgPrint("[lwIP, LibTCPClose] Called\n");
+ DbgPrint("[lwIP, LibTCPClose] Called on pcb = 0x%x\n", pcb);
if (!pcb)
{
@@ -626,7 +637,9 @@
}
DbgPrint("[lwIP, LibTCPClose] Removing pcb callbacks\n");
-
+
+ DbgPrint("[lwIP, LibTCPClose] pcb->state = %s\n",
tcp_state_str[pcb->state]);
+
tcp_arg(pcb, NULL);
tcp_recv(pcb, NULL);
tcp_sent(pcb, NULL);