mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Changes to the interface to componentized ip library. This commit is where
the ambiguously linked library starts being used in km. There are further cleanups i need to do, but hopefully having this checked in will help others who are eager to help work on it. svn path=/trunk/; revision=11126
This commit is contained in:
parent
03a9fe5219
commit
4ec1a851b9
7 changed files with 147 additions and 114 deletions
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
|
||||||
WORK_QUEUE_ITEM LoopWorkItem;
|
WORK_QUEUE_ITEM LoopWorkItem;
|
||||||
PIP_INTERFACE Loopback = NULL;
|
PIP_INTERFACE Loopback = NULL;
|
||||||
/* Indicates wether the loopback interface is currently transmitting */
|
/* Indicates wether the loopback interface is currently transmitting */
|
||||||
|
|
|
@ -9,10 +9,8 @@
|
||||||
|
|
||||||
#include <lan.h>
|
#include <lan.h>
|
||||||
|
|
||||||
|
|
||||||
extern PIP_INTERFACE Loopback;
|
extern PIP_INTERFACE Loopback;
|
||||||
|
|
||||||
|
|
||||||
NDIS_STATUS LoopRegisterAdapter(
|
NDIS_STATUS LoopRegisterAdapter(
|
||||||
PNDIS_STRING AdapterName,
|
PNDIS_STRING AdapterName,
|
||||||
PLAN_ADAPTER *Adapter);
|
PLAN_ADAPTER *Adapter);
|
||||||
|
|
|
@ -14,20 +14,6 @@
|
||||||
|
|
||||||
#ifdef MEMTRACK
|
#ifdef MEMTRACK
|
||||||
#define MTMARK() TrackDumpFL(__FILE__, __LINE__)
|
#define MTMARK() TrackDumpFL(__FILE__, __LINE__)
|
||||||
#define NdisAllocateBuffer(x,y,z,a,b) { \
|
|
||||||
NdisAllocateBuffer(x,y,z,a,b); \
|
|
||||||
if( *x == NDIS_STATUS_SUCCESS ) { \
|
|
||||||
Track(NDIS_BUFFER_TAG, *y); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#define NdisAllocatePacket(x,y,z) { \
|
|
||||||
NdisAllocatePacket(x,y,z); \
|
|
||||||
if( *x == NDIS_STATUS_SUCCESS ) { \
|
|
||||||
Track(NDIS_PACKET_TAG, *y); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#define NdisFreePacket(x) { Untrack(x); NdisFreePacket(x); }
|
|
||||||
#define NdisFreeBuffer(x) { Untrack(x); NdisFreeBuffer(x); }
|
|
||||||
#define exAllocatePool(x,y) ExAllocatePoolX(x,y,__FILE__,__LINE__)
|
#define exAllocatePool(x,y) ExAllocatePoolX(x,y,__FILE__,__LINE__)
|
||||||
#define exAllocatePoolWithTag(x,y,z) ExAllocatePoolX(x,y,__FILE__,__LINE__)
|
#define exAllocatePoolWithTag(x,y,z) ExAllocatePoolX(x,y,__FILE__,__LINE__)
|
||||||
#define exFreePool(x) ExFreePoolX(x,__FILE__,__LINE__)
|
#define exFreePool(x) ExFreePoolX(x,__FILE__,__LINE__)
|
||||||
|
|
|
@ -81,6 +81,12 @@ typedef struct _SLEEPING_THREAD {
|
||||||
#define SRF_SYN TCP_SYN
|
#define SRF_SYN TCP_SYN
|
||||||
#define SRF_FIN TCP_FIN
|
#define SRF_FIN TCP_FIN
|
||||||
|
|
||||||
|
PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext );
|
||||||
|
VOID TCPFreeConnectionEndpoint( PCONNECTION_ENDPOINT Connection );
|
||||||
|
|
||||||
|
NTSTATUS TCPSocket( PCONNECTION_ENDPOINT Connection,
|
||||||
|
UINT Family, UINT Type, UINT Proto );
|
||||||
|
|
||||||
PTCP_SEGMENT TCPCreateSegment(
|
PTCP_SEGMENT TCPCreateSegment(
|
||||||
PIP_PACKET IPPacket,
|
PIP_PACKET IPPacket,
|
||||||
PTCPv4_HEADER TCPHeader,
|
PTCPv4_HEADER TCPHeader,
|
||||||
|
@ -95,30 +101,35 @@ VOID TCPAddSegment(
|
||||||
PULONG Acknowledged);
|
PULONG Acknowledged);
|
||||||
|
|
||||||
NTSTATUS TCPConnect(
|
NTSTATUS TCPConnect(
|
||||||
PTDI_REQUEST Request,
|
PCONNECTION_ENDPOINT Connection,
|
||||||
PTDI_CONNECTION_INFORMATION ConnInfo,
|
PTDI_CONNECTION_INFORMATION ConnInfo,
|
||||||
PTDI_CONNECTION_INFORMATION ReturnInfo);
|
PTDI_CONNECTION_INFORMATION ReturnInfo,
|
||||||
|
PTCP_COMPLETION_ROUTINE Complete,
|
||||||
|
PVOID Context);
|
||||||
|
|
||||||
NTSTATUS TCPListen(
|
NTSTATUS TCPListen(
|
||||||
PTDI_REQUEST Request,
|
PCONNECTION_ENDPOINT Connection,
|
||||||
UINT Backlog );
|
UINT Backlog,
|
||||||
|
PTCP_COMPLETION_ROUTINE Complete,
|
||||||
|
PVOID Context);
|
||||||
|
|
||||||
NTSTATUS TCPReceiveData(
|
NTSTATUS TCPReceiveData(
|
||||||
PTDI_REQUEST Request,
|
PCONNECTION_ENDPOINT Connection,
|
||||||
PNDIS_BUFFER Buffer,
|
PNDIS_BUFFER Buffer,
|
||||||
ULONG ReceiveLength,
|
ULONG ReceiveLength,
|
||||||
|
PULONG BytesReceived,
|
||||||
ULONG ReceiveFlags,
|
ULONG ReceiveFlags,
|
||||||
PULONG BytesReceived);
|
PTCP_COMPLETION_ROUTINE Complete,
|
||||||
|
PVOID Context);
|
||||||
|
|
||||||
NTSTATUS TCPSendData(
|
NTSTATUS TCPSendData(
|
||||||
PTDI_REQUEST Request,
|
PCONNECTION_ENDPOINT Connection,
|
||||||
PNDIS_BUFFER Buffer,
|
PCHAR Buffer,
|
||||||
ULONG DataSize,
|
ULONG DataSize,
|
||||||
ULONG Flags,
|
PULONG DataUsed,
|
||||||
PULONG DataUsed);
|
ULONG Flags);
|
||||||
|
|
||||||
NTSTATUS TCPClose
|
NTSTATUS TCPClose( PCONNECTION_ENDPOINT Connection );
|
||||||
( PTDI_REQUEST Request );
|
|
||||||
|
|
||||||
PVOID TCPPrepareInterface( PIP_INTERFACE IF );
|
PVOID TCPPrepareInterface( PIP_INTERFACE IF );
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.22 2004/09/25 21:32:56 arty Exp $
|
# $Id: makefile,v 1.23 2004/09/30 05:44:10 arty Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../../..
|
PATH_TO_TOP = ../../..
|
||||||
|
|
||||||
|
@ -20,46 +20,31 @@ TARGET_CFLAGS = \
|
||||||
-I$(PATH_TO_TOP)/w32api/include \
|
-I$(PATH_TO_TOP)/w32api/include \
|
||||||
-I$(PATH_TO_TOP)/include
|
-I$(PATH_TO_TOP)/include
|
||||||
|
|
||||||
TARGET_DDKLIBS = ndis.a \
|
TARGET_DDKLIBS = \
|
||||||
$(PATH_TO_TOP)/dk/w32/lib/oskittcp.a \
|
$(PATH_TO_TOP)/dk/w32/lib/oskittcp.a \
|
||||||
$(PATH_TO_TOP)/dk/w32/lib/rosrtl.a
|
$(PATH_TO_TOP)/dk/w32/lib/ip.a \
|
||||||
|
$(PATH_TO_TOP)/dk/w32/lib/rosrtl.a \
|
||||||
|
ndis.a
|
||||||
|
|
||||||
TARGET_CLEAN = \
|
TARGET_CLEAN = tcpip/*.o datalink/*.o
|
||||||
tcpip/*.o \
|
|
||||||
datalink/*.o \
|
|
||||||
network/*.o \
|
|
||||||
transport/datagram/*.o \
|
|
||||||
transport/rawip/*.o \
|
|
||||||
transport/tcp/*.o \
|
|
||||||
transport/udp/*.o
|
|
||||||
|
|
||||||
TCPIP_OBJECTS = tcpip/main.o tcpip/address.o tcpip/checksum.o \
|
TCPIP_OBJECTS = tcpip/main.o \
|
||||||
tcpip/dispatch.o tcpip/fileobjs.o \
|
tcpip/dispatch.o \
|
||||||
tcpip/pool.o tcpip/routines.o tcpip/interface.o \
|
tcpip/fileobjs.o \
|
||||||
tcpip/memtrack.o tcpip/irp.o
|
tcpip/pool.o \
|
||||||
|
tcpip/irp.o
|
||||||
INFO_OBJECTS = tcpip/info.o tcpip/ninfo.o tcpip/tinfo.o tcpip/iinfo.o
|
INFO_OBJECTS = tcpip/info.o tcpip/ninfo.o tcpip/tinfo.o tcpip/iinfo.o
|
||||||
DATALINK_OBJECTS = datalink/arp.o datalink/lan.o datalink/loopback.o
|
DATALINK_OBJECTS = datalink/lan.o datalink/loopback.o
|
||||||
NETWORK_OBJECTS = network/icmp.o network/ip.o network/neighbor.o \
|
|
||||||
network/receive.o network/route.o network/router.o \
|
|
||||||
network/transmit.o network/prefix.o
|
|
||||||
DATAGRAM_OBJECTS = transport/datagram/datagram.o
|
|
||||||
RAWIP_OBJECTS = transport/rawip/rawip.o
|
|
||||||
TCP_OBJECTS = transport/tcp/tcp.o transport/tcp/event.o transport/tcp/if.o
|
|
||||||
UDP_OBJECTS = transport/udp/udp.o
|
|
||||||
ARCH_OBJECTS = tcpip/i386/checksum.o
|
|
||||||
|
|
||||||
TARGET_OBJECTS = \
|
TARGET_OBJECTS = \
|
||||||
$(TCPIP_OBJECTS) \
|
$(TCPIP_OBJECTS) \
|
||||||
$(INFO_OBJECTS) \
|
$(INFO_OBJECTS) \
|
||||||
$(DATALINK_OBJECTS) \
|
$(DATALINK_OBJECTS)
|
||||||
$(NETWORK_OBJECTS) \
|
|
||||||
$(DATAGRAM_OBJECTS) \
|
preall: all
|
||||||
$(RAWIP_OBJECTS) \
|
|
||||||
$(TCP_OBJECTS) \
|
$(PATH_TO_TOP)/dk/w32/lib/ipkernel.a:
|
||||||
$(FREEBSD_OBJECTS) \
|
$(MAKE) -C $(PATH_TO_TOP)/drivers/lib/ip
|
||||||
$(REACTOS_OBJECTS) \
|
|
||||||
$(UDP_OBJECTS) \
|
|
||||||
$(ARCH_OBJECTS) \
|
|
||||||
|
|
||||||
include $(PATH_TO_TOP)/rules.mak
|
include $(PATH_TO_TOP)/rules.mak
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,6 @@ NTSTATUS DispTdiConnect(
|
||||||
PTDI_REQUEST_KERNEL Parameters;
|
PTDI_REQUEST_KERNEL Parameters;
|
||||||
PTRANSPORT_CONTEXT TranContext;
|
PTRANSPORT_CONTEXT TranContext;
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
TDI_REQUEST Request;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
|
TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
|
||||||
|
@ -368,11 +367,6 @@ NTSTATUS DispTdiConnect(
|
||||||
|
|
||||||
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
|
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
|
||||||
|
|
||||||
/* Initialize a connect request */
|
|
||||||
Request.Handle.ConnectionContext = TranContext->Handle.ConnectionContext;
|
|
||||||
Request.RequestNotifyObject = DispDataRequestComplete;
|
|
||||||
Request.RequestContext = Irp;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
Status = TCPBind( Connection,
|
Status = TCPBind( Connection,
|
||||||
&Connection->SocketContext,
|
&Connection->SocketContext,
|
||||||
|
@ -384,9 +378,11 @@ NTSTATUS DispTdiConnect(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Status = TCPConnect(
|
Status = TCPConnect(
|
||||||
&Request,
|
TranContext->Handle.ConnectionContext,
|
||||||
Parameters->RequestConnectionInformation,
|
Parameters->RequestConnectionInformation,
|
||||||
Parameters->ReturnConnectionInformation);
|
Parameters->ReturnConnectionInformation,
|
||||||
|
DispDataRequestComplete,
|
||||||
|
Irp );
|
||||||
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("TCP Connect returned %08x\n", Status));
|
TI_DbgPrint(MAX_TRACE, ("TCP Connect returned %08x\n", Status));
|
||||||
|
|
||||||
|
@ -561,7 +557,9 @@ NTSTATUS DispTdiListen(
|
||||||
|
|
||||||
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
|
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
|
||||||
|
|
||||||
Status = TCPListen( Request, 1024 /* BACKLOG */ );
|
Status = TCPListen( Request->Handle.ConnectionContext, 1024 /* BACKLOG */,
|
||||||
|
DispDataRequestComplete,
|
||||||
|
Irp );
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -663,7 +661,6 @@ NTSTATUS DispTdiReceive(
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
PTDI_REQUEST_KERNEL_RECEIVE ReceiveInfo;
|
PTDI_REQUEST_KERNEL_RECEIVE ReceiveInfo;
|
||||||
PTRANSPORT_CONTEXT TranContext;
|
PTRANSPORT_CONTEXT TranContext;
|
||||||
TDI_REQUEST Request;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG BytesReceived;
|
ULONG BytesReceived;
|
||||||
|
|
||||||
|
@ -686,9 +683,6 @@ NTSTATUS DispTdiReceive(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize a receive request */
|
/* Initialize a receive request */
|
||||||
Request.Handle.ConnectionContext = TranContext->Handle.ConnectionContext;
|
|
||||||
Request.RequestNotifyObject = DispDataRequestComplete;
|
|
||||||
Request.RequestContext = Irp;
|
|
||||||
Status = DispPrepareIrpForCancel(
|
Status = DispPrepareIrpForCancel(
|
||||||
IrpSp->FileObject->FsContext,
|
IrpSp->FileObject->FsContext,
|
||||||
Irp,
|
Irp,
|
||||||
|
@ -697,11 +691,13 @@ NTSTATUS DispTdiReceive(
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Status = TCPReceiveData(
|
Status = TCPReceiveData(
|
||||||
&Request,
|
TranContext->Handle.ConnectionContext,
|
||||||
(PNDIS_BUFFER)Irp->MdlAddress,
|
(PNDIS_BUFFER)Irp->MdlAddress,
|
||||||
ReceiveInfo->ReceiveLength,
|
ReceiveInfo->ReceiveLength,
|
||||||
ReceiveInfo->ReceiveFlags,
|
&BytesReceived,
|
||||||
&BytesReceived);
|
ReceiveInfo->ReceiveFlags,
|
||||||
|
DispDataRequestComplete,
|
||||||
|
Irp);
|
||||||
if (Status != STATUS_PENDING)
|
if (Status != STATUS_PENDING)
|
||||||
{
|
{
|
||||||
DispDataRequestComplete(Irp, Status, BytesReceived);
|
DispDataRequestComplete(Irp, Status, BytesReceived);
|
||||||
|
@ -796,7 +792,6 @@ NTSTATUS DispTdiSend(
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
PTDI_REQUEST_KERNEL_RECEIVE ReceiveInfo;
|
PTDI_REQUEST_KERNEL_RECEIVE ReceiveInfo;
|
||||||
PTRANSPORT_CONTEXT TranContext;
|
PTRANSPORT_CONTEXT TranContext;
|
||||||
TDI_REQUEST Request;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG BytesReceived;
|
ULONG BytesReceived;
|
||||||
|
|
||||||
|
@ -818,10 +813,6 @@ NTSTATUS DispTdiSend(
|
||||||
return STATUS_INVALID_CONNECTION;
|
return STATUS_INVALID_CONNECTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize a receive request */
|
|
||||||
Request.Handle.ConnectionContext = TranContext->Handle.ConnectionContext;
|
|
||||||
Request.RequestNotifyObject = DispDataRequestComplete;
|
|
||||||
Request.RequestContext = Irp;
|
|
||||||
Status = DispPrepareIrpForCancel(
|
Status = DispPrepareIrpForCancel(
|
||||||
IrpSp->FileObject->FsContext,
|
IrpSp->FileObject->FsContext,
|
||||||
Irp,
|
Irp,
|
||||||
|
@ -829,13 +820,18 @@ NTSTATUS DispTdiSend(
|
||||||
TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n", Irp->MdlAddress));
|
TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n", Irp->MdlAddress));
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
PCHAR Data;
|
||||||
|
UINT Len;
|
||||||
|
|
||||||
|
NdisQueryBuffer( Irp->MdlAddress, &Data, &Len );
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE,("About to TCPSendData\n"));
|
TI_DbgPrint(MID_TRACE,("About to TCPSendData\n"));
|
||||||
Status = TCPSendData(
|
Status = TCPSendData(
|
||||||
&Request,
|
TranContext->Handle.ConnectionContext,
|
||||||
(PNDIS_BUFFER)Irp->MdlAddress,
|
Data,
|
||||||
ReceiveInfo->ReceiveLength,
|
ReceiveInfo->ReceiveLength,
|
||||||
ReceiveInfo->ReceiveFlags,
|
&BytesReceived,
|
||||||
&BytesReceived);
|
ReceiveInfo->ReceiveFlags);
|
||||||
if (Status != STATUS_PENDING)
|
if (Status != STATUS_PENDING)
|
||||||
{
|
{
|
||||||
DispDataRequestComplete(Irp, Status, BytesReceived);
|
DispDataRequestComplete(Irp, Status, BytesReceived);
|
||||||
|
|
|
@ -19,6 +19,86 @@ KSPIN_LOCK AddressFileListLock;
|
||||||
LIST_ENTRY ConnectionEndpointListHead;
|
LIST_ENTRY ConnectionEndpointListHead;
|
||||||
KSPIN_LOCK ConnectionEndpointListLock;
|
KSPIN_LOCK ConnectionEndpointListLock;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FUNCTION: Searches through address file entries to find the first match
|
||||||
|
* ARGUMENTS:
|
||||||
|
* Address = IP address
|
||||||
|
* Port = Port number
|
||||||
|
* Protocol = Protocol number
|
||||||
|
* SearchContext = Pointer to search context
|
||||||
|
* RETURNS:
|
||||||
|
* Pointer to address file, NULL if none was found
|
||||||
|
*/
|
||||||
|
PADDRESS_FILE AddrSearchFirst(
|
||||||
|
PIP_ADDRESS Address,
|
||||||
|
USHORT Port,
|
||||||
|
USHORT Protocol,
|
||||||
|
PAF_SEARCH SearchContext)
|
||||||
|
{
|
||||||
|
SearchContext->Address = Address;
|
||||||
|
SearchContext->Port = Port;
|
||||||
|
SearchContext->Next = AddressFileListHead.Flink;
|
||||||
|
SearchContext->Protocol = Protocol;
|
||||||
|
|
||||||
|
return AddrSearchNext(SearchContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FUNCTION: Searches through address file entries to find next match
|
||||||
|
* ARGUMENTS:
|
||||||
|
* SearchContext = Pointer to search context
|
||||||
|
* RETURNS:
|
||||||
|
* Pointer to address file, NULL if none was found
|
||||||
|
*/
|
||||||
|
PADDRESS_FILE AddrSearchNext(
|
||||||
|
PAF_SEARCH SearchContext)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY CurrentEntry;
|
||||||
|
PIP_ADDRESS IPAddress;
|
||||||
|
KIRQL OldIrql;
|
||||||
|
PADDRESS_FILE Current = NULL;
|
||||||
|
BOOLEAN Found = FALSE;
|
||||||
|
|
||||||
|
if (IsListEmpty(SearchContext->Next))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CurrentEntry = SearchContext->Next;
|
||||||
|
|
||||||
|
KeAcquireSpinLock(&AddressFileListLock, &OldIrql);
|
||||||
|
|
||||||
|
while (CurrentEntry != &AddressFileListHead) {
|
||||||
|
Current = CONTAINING_RECORD(CurrentEntry, ADDRESS_FILE, ListEntry);
|
||||||
|
|
||||||
|
IPAddress = Current->ADE->Address;
|
||||||
|
|
||||||
|
TI_DbgPrint(DEBUG_ADDRFILE, ("Comparing: ((%d, %d, %s), (%d, %d, %s)).\n",
|
||||||
|
WN2H(Current->Port),
|
||||||
|
Current->Protocol,
|
||||||
|
A2S(IPAddress),
|
||||||
|
WN2H(SearchContext->Port),
|
||||||
|
SearchContext->Protocol,
|
||||||
|
A2S(SearchContext->Address)));
|
||||||
|
|
||||||
|
/* See if this address matches the search criteria */
|
||||||
|
if (((Current->Port == SearchContext->Port) &&
|
||||||
|
(Current->Protocol == SearchContext->Protocol) &&
|
||||||
|
(AddrIsEqual(IPAddress, SearchContext->Address))) ||
|
||||||
|
(AddrIsUnspecified(IPAddress))) {
|
||||||
|
/* We've found a match */
|
||||||
|
Found = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CurrentEntry = CurrentEntry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
KeReleaseSpinLock(&AddressFileListLock, OldIrql);
|
||||||
|
|
||||||
|
if (Found) {
|
||||||
|
SearchContext->Next = CurrentEntry->Flink;
|
||||||
|
return Current;
|
||||||
|
} else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
VOID AddrFileFree(
|
VOID AddrFileFree(
|
||||||
PVOID Object)
|
PVOID Object)
|
||||||
|
@ -435,30 +515,8 @@ NTSTATUS FileOpenConnection(
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Called.\n"));
|
TI_DbgPrint(MID_TRACE, ("Called.\n"));
|
||||||
|
|
||||||
Connection = ExAllocatePool(NonPagedPool, sizeof(CONNECTION_ENDPOINT));
|
|
||||||
if (!Connection)
|
Status = TCPSocket( Connection, AF_INET, SOCK_STREAM, IPPROTO_TCP );
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_CPOINT, ("Connection point file object allocated at (0x%X).\n", Connection));
|
|
||||||
|
|
||||||
RtlZeroMemory(Connection, sizeof(CONNECTION_ENDPOINT));
|
|
||||||
|
|
||||||
/* Initialize spin lock that protects the connection endpoint file object */
|
|
||||||
KeInitializeSpinLock(&Connection->Lock);
|
|
||||||
InitializeListHead(&Connection->ConnectRequest);
|
|
||||||
InitializeListHead(&Connection->ListenRequest);
|
|
||||||
InitializeListHead(&Connection->ReceiveRequest);
|
|
||||||
|
|
||||||
/* Reference the object */
|
|
||||||
Connection->RefCount = 1;
|
|
||||||
|
|
||||||
/* Save client context pointer */
|
|
||||||
Connection->ClientContext = ClientContext;
|
|
||||||
Status = OskitTCPSocket( Connection,
|
|
||||||
&Connection->SocketContext,
|
|
||||||
AF_INET,
|
|
||||||
SOCK_STREAM,
|
|
||||||
IPPROTO_TCP );
|
|
||||||
DbgPrint("STATUS from OSKITTCP was %08x\n", Status);
|
DbgPrint("STATUS from OSKITTCP was %08x\n", Status);
|
||||||
|
|
||||||
/* Initialize received segments queue */
|
/* Initialize received segments queue */
|
||||||
|
@ -501,7 +559,7 @@ NTSTATUS FileCloseConnection(
|
||||||
|
|
||||||
Connection = Request->Handle.ConnectionContext;
|
Connection = Request->Handle.ConnectionContext;
|
||||||
|
|
||||||
TCPClose(Request);
|
TCPClose(Connection);
|
||||||
DeleteConnectionEndpoint(Connection);
|
DeleteConnectionEndpoint(Connection);
|
||||||
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
||||||
|
|
Loading…
Reference in a new issue