2000-08-02 00:24:26 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS TCP/IP protocol driver
|
|
|
|
* FILE: include/titypes.h
|
|
|
|
* PURPOSE: TCP/IP protocol driver types
|
|
|
|
*/
|
2010-02-26 11:43:19 +00:00
|
|
|
|
|
|
|
#pragma once
|
2000-08-02 00:24:26 +00:00
|
|
|
|
2001-07-04 20:40:24 +00:00
|
|
|
/*
|
|
|
|
* VOID ReferenceObject(
|
|
|
|
* PVOID Object)
|
|
|
|
*/
|
2009-12-31 23:33:24 +00:00
|
|
|
#define ReferenceObject(Object) \
|
|
|
|
{ \
|
2013-07-03 08:52:17 +00:00
|
|
|
ASSERT((Object)->RefCount); \
|
2009-12-31 23:33:24 +00:00
|
|
|
InterlockedIncrement(&((Object)->RefCount)); \
|
2001-07-04 20:40:24 +00:00
|
|
|
}
|
2000-08-02 00:24:26 +00:00
|
|
|
|
2009-12-31 23:33:24 +00:00
|
|
|
/*
|
2001-07-04 20:40:24 +00:00
|
|
|
* VOID DereferenceObject(
|
|
|
|
* PVOID Object)
|
|
|
|
*/
|
2009-12-31 23:33:24 +00:00
|
|
|
#define DereferenceObject(Object) \
|
|
|
|
{ \
|
2013-07-03 08:52:17 +00:00
|
|
|
ASSERT((Object)->RefCount); \
|
2009-12-31 23:33:24 +00:00
|
|
|
if (InterlockedDecrement(&((Object)->RefCount)) == 0) \
|
|
|
|
(((Object)->Free)(Object)); \
|
2001-07-04 20:40:24 +00:00
|
|
|
}
|
2000-08-02 00:24:26 +00:00
|
|
|
|
2009-12-31 23:33:24 +00:00
|
|
|
/*
|
|
|
|
* VOID LockObject(PVOID Object, PKIRQL OldIrql)
|
|
|
|
*/
|
|
|
|
#define LockObject(Object, Irql) \
|
|
|
|
{ \
|
|
|
|
ReferenceObject(Object); \
|
|
|
|
KeAcquireSpinLock(&((Object)->Lock), Irql); \
|
|
|
|
memcpy(&(Object)->OldIrql, Irql, sizeof(KIRQL)); \
|
|
|
|
}
|
2000-08-02 00:24:26 +00:00
|
|
|
|
|
|
|
/*
|
2009-12-31 23:33:24 +00:00
|
|
|
* VOID LockObjectAtDpcLevel(PVOID Object)
|
2000-08-02 00:24:26 +00:00
|
|
|
*/
|
2009-12-31 23:33:24 +00:00
|
|
|
#define LockObjectAtDpcLevel(Object) \
|
|
|
|
{ \
|
|
|
|
ReferenceObject(Object); \
|
|
|
|
KeAcquireSpinLockAtDpcLevel(&((Object)->Lock)); \
|
|
|
|
(Object)->OldIrql = DISPATCH_LEVEL; \
|
2000-08-02 00:24:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2009-12-31 23:33:24 +00:00
|
|
|
* VOID UnlockObject(PVOID Object, KIRQL OldIrql)
|
2000-08-02 00:24:26 +00:00
|
|
|
*/
|
2009-12-31 23:33:24 +00:00
|
|
|
#define UnlockObject(Object, OldIrql) \
|
|
|
|
{ \
|
|
|
|
KeReleaseSpinLock(&((Object)->Lock), OldIrql); \
|
|
|
|
DereferenceObject(Object); \
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* VOID UnlockObjectFromDpcLevel(PVOID Object)
|
|
|
|
*/
|
|
|
|
#define UnlockObjectFromDpcLevel(Object) \
|
|
|
|
{ \
|
|
|
|
KeReleaseSpinLockFromDpcLevel(&((Object)->Lock)); \
|
|
|
|
DereferenceObject(Object); \
|
2000-08-02 00:24:26 +00:00
|
|
|
}
|
|
|
|
|
2001-07-04 20:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include <ip.h>
|
|
|
|
|
2004-10-03 20:38:48 +00:00
|
|
|
struct _ADDRESS_FILE;
|
2001-07-04 20:40:24 +00:00
|
|
|
|
|
|
|
/***************************************************
|
|
|
|
* Connection-less communication support structures *
|
|
|
|
***************************************************/
|
2000-08-02 00:24:26 +00:00
|
|
|
|
|
|
|
typedef NTSTATUS (*DATAGRAM_SEND_ROUTINE)(
|
2004-10-03 20:38:48 +00:00
|
|
|
struct _ADDRESS_FILE *AddrFile,
|
2000-08-02 00:24:26 +00:00
|
|
|
PTDI_CONNECTION_INFORMATION ConnInfo,
|
2004-10-03 20:38:48 +00:00
|
|
|
PCHAR Buffer,
|
2004-07-08 06:36:04 +00:00
|
|
|
ULONG DataSize,
|
|
|
|
PULONG DataUsed);
|
2000-08-02 00:24:26 +00:00
|
|
|
|
|
|
|
/* Datagram completion handler prototype */
|
|
|
|
typedef VOID (*DATAGRAM_COMPLETION_ROUTINE)(
|
|
|
|
PVOID Context,
|
|
|
|
NDIS_STATUS Status,
|
|
|
|
ULONG Count);
|
|
|
|
|
2004-11-14 19:45:16 +00:00
|
|
|
typedef DATAGRAM_COMPLETION_ROUTINE PDATAGRAM_COMPLETION_ROUTINE;
|
|
|
|
|
2000-08-02 00:24:26 +00:00
|
|
|
typedef struct _DATAGRAM_RECEIVE_REQUEST {
|
2007-11-23 13:52:56 +00:00
|
|
|
struct _ADDRESS_FILE *AddressFile; /* AddressFile on behalf of */
|
2004-11-15 18:24:57 +00:00
|
|
|
LIST_ENTRY ListEntry; /* Entry on list */
|
2004-08-19 21:39:00 +00:00
|
|
|
IP_ADDRESS RemoteAddress; /* Remote address we receive from (NULL means any) */
|
2004-11-15 18:24:57 +00:00
|
|
|
USHORT RemotePort; /* Remote port we receive from (0 means any) */
|
|
|
|
PTDI_CONNECTION_INFORMATION ReturnInfo;/* Return information */
|
|
|
|
PCHAR Buffer; /* Pointer to receive buffer */
|
|
|
|
ULONG BufferSize; /* Size of Buffer */
|
|
|
|
DATAGRAM_COMPLETION_ROUTINE Complete; /* Completion routine */
|
|
|
|
PVOID Context; /* Pointer to context information */
|
|
|
|
DATAGRAM_COMPLETION_ROUTINE UserComplete; /* Completion routine */
|
|
|
|
PVOID UserContext; /* Pointer to context information */
|
2007-11-23 13:52:56 +00:00
|
|
|
PIRP Irp; /* IRP on behalf of */
|
2000-08-02 00:24:26 +00:00
|
|
|
} DATAGRAM_RECEIVE_REQUEST, *PDATAGRAM_RECEIVE_REQUEST;
|
|
|
|
|
|
|
|
/* Datagram build routine prototype */
|
|
|
|
typedef NTSTATUS (*DATAGRAM_BUILD_ROUTINE)(
|
|
|
|
PVOID Context,
|
|
|
|
PIP_ADDRESS LocalAddress,
|
|
|
|
USHORT LocalPort,
|
|
|
|
PIP_PACKET *IPPacket);
|
|
|
|
|
|
|
|
typedef struct _DATAGRAM_SEND_REQUEST {
|
2004-06-09 18:11:39 +00:00
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
PNDIS_PACKET PacketToSend;
|
2000-08-02 00:24:26 +00:00
|
|
|
DATAGRAM_COMPLETION_ROUTINE Complete; /* Completion routine */
|
|
|
|
PVOID Context; /* Pointer to context information */
|
2004-06-09 18:11:39 +00:00
|
|
|
IP_PACKET Packet;
|
|
|
|
UINT BufferSize;
|
|
|
|
IP_ADDRESS RemoteAddress;
|
|
|
|
USHORT RemotePort;
|
2001-07-04 20:40:24 +00:00
|
|
|
ULONG Flags; /* Protocol specific flags */
|
2000-08-02 00:24:26 +00:00
|
|
|
} DATAGRAM_SEND_REQUEST, *PDATAGRAM_SEND_REQUEST;
|
|
|
|
|
2001-07-04 20:40:24 +00:00
|
|
|
/* Transport address file context structure. The FileObject->FsContext2
|
2000-08-02 00:24:26 +00:00
|
|
|
field holds a pointer to this structure */
|
|
|
|
typedef struct _ADDRESS_FILE {
|
|
|
|
LIST_ENTRY ListEntry; /* Entry on list */
|
2009-12-31 23:33:24 +00:00
|
|
|
LONG RefCount; /* Reference count */
|
2001-07-04 20:40:24 +00:00
|
|
|
OBJECT_FREE_ROUTINE Free; /* Routine to use to free resources for the object */
|
2009-12-31 23:33:24 +00:00
|
|
|
KSPIN_LOCK Lock; /* Spin lock to manipulate this structure */
|
|
|
|
KIRQL OldIrql; /* Currently not used */
|
2004-11-25 23:56:59 +00:00
|
|
|
IP_ADDRESS Address; /* Address of this address file */
|
2004-12-25 21:30:20 +00:00
|
|
|
USHORT Family; /* Address family */
|
2000-08-02 00:24:26 +00:00
|
|
|
USHORT Protocol; /* Protocol number */
|
|
|
|
USHORT Port; /* Network port (network byte order) */
|
2012-08-20 07:26:12 +00:00
|
|
|
LONG Sharers; /* Number of file objects with this addr file */
|
2009-10-26 03:11:44 +00:00
|
|
|
UCHAR TTL; /* Time to live stored in packets sent from this address file */
|
2010-01-16 00:05:15 +00:00
|
|
|
UINT DF; /* Don't fragment */
|
|
|
|
UINT BCast; /* Receive broadcast packets */
|
|
|
|
UINT HeaderIncl; /* Include header in RawIP packets */
|
2000-08-02 00:24:26 +00:00
|
|
|
WORK_QUEUE_ITEM WorkItem; /* Work queue item handle */
|
|
|
|
DATAGRAM_COMPLETION_ROUTINE Complete; /* Completion routine for delete request */
|
|
|
|
PVOID Context; /* Delete request context */
|
|
|
|
DATAGRAM_SEND_ROUTINE Send; /* Routine to send a datagram */
|
|
|
|
LIST_ENTRY ReceiveQueue; /* List of outstanding receive requests */
|
|
|
|
LIST_ENTRY TransmitQueue; /* List of outstanding transmit requests */
|
2003-12-25 Casper S. Hornstrup <chorns@users.sourceforge.net>
* apps/utils/net/roshttpd/error.cpp (ReportErrorStr): Cast to wchar_t*,
not __wchar_t*.
* apps/utils/net/roshttpd/makefile (TARGET_CPPFLAGS): Add -Wno-deprecated.
(TARGET_GCCLIBS): Add stdc++.
* apps/utils/net/roshttpd/common/socket.cpp: Include <string.h>.
* apps/utils/net/roshttpd/common/thread.cpp (CThread::CThread): Fix
warning.
* drivers/net/afd/afd/afd.c (ListenRequestLookasideList): New variable.
(DriverEntry): Initialize ListenRequestLookasideList.
* drivers/net/afd/afd/dispatch.c (AfdDispCompleteListen): New function.
(AfdDispListen): Partial implement.
* drivers/net/afd/afd/opnclose.c (AfdInitializeFCB): Initialize
NewFCB->ListenRequestQueue.
(AfdKillListenRequests): New function.
(AfdClose): Call AfdKillListenRequests.
* drivers/net/afd/afd/routines.c (DumpName): New function.
* drivers/net/afd/afd/tdi.c (TdiAddressSizeFromType): New function.
(TdiBuildConnectionInfo): Initialize ConnInfo->OptionsLength.
(TdiBuildNullConnectionInfo): New function.
(TdiOpenAddressFileIPv4, TdiOpenConnectionEndpointFile): EaName is
0-terminated.
(TdiListen): New function.
* drivers/net/afd/include/afd.h (AFDFCB): Add ListenRequestQueue.
(AFD_LISTEN_REQUEST): New structure.
(ListenRequestLookasideList): Declare.
(DumpName, TdiListen): Add prototypes.
* drivers/net/tcpip/datalink/lan.c (BindAdapter): Initialize
AnsiAddress.Length and AnsiAddress.MaximumLength.
* drivers/net/tcpip/include/debug.h: Define DEBUG_TCP.
* drivers/net/tcpip/include/routines.h (DisplayTCPPacket): Add
prototype.
(DISPLAY_TCP_PACKET): Define.
* drivers/net/tcpip/include/tcp.h (TCPListen): Add prototype.
* drivers/net/tcpip/include/titypes.h (ADDRESS_FILE): Add Connection.
* drivers/net/tcpip/network/ip.c (IPLocateNTEOnInterface): Cleanup.
* drivers/net/tcpip/tcpip/address.c (AddrSearchNext): Port is in
network byte order.
* drivers/net/tcpip/tcpip/dispatch.c (DispTdiAssociateAddress):
Initialize AddrFile->Connection.
(DispTdiListen): Implement.
* drivers/net/tcpip/tcpip/fileobjs.c (FileOpenAddress): Don't
initialize AddrFile->Connections.
* drivers/net/tcpip/tcpip/routines.c: Include <tcp.h>.
(DisplayIPPacket): Enable.
(DisplayTCPHeader, DisplayTCPPacket): New functions.
* drivers/net/tcpip/transport/tcp/tcp.c: Include <routines.h>.
(TCPListen, TCPiReceive): New functions.
(TCPReceive): Partial implement.
* lib/msafd/misc/helpers.c (CreateHelperDLLDatabase): Add
{SOCK_STREAM,IPPROTO_TCP,0} and {SOCK_DGRAM,IPPROTO_UDP,0} mappings.
* lib/ntdll/ldr/utils.c (LdrLoadDll): Print name of DLL if not found.
* lib/ws2_32/include/ws2_32.h (Initialized): Declare.
(WINSOCK_THREAD_BLOCK): Remove Initialized member.
* (WSAINITIALIZED, WSASETINITIALIZED): Update.
* lib/ws2_32/misc/catalog.c (CreateCatalog): Add
{SOCK_STREAM,IPPROTO_TCP,0} and {SOCK_DGRAM,IPPROTO_UDP,0} mappings.
(Initialized): New variable.
(DllMain): Don't initialize p->Initialized.
* ntoskrnl/dbg/kdb.c: Include <ctype.h>.
* subsys/win32k/ntuser/message.c (NtUserDispatchMessage): Kill noisy
message.
svn path=/trunk/; revision=7232
2003-12-25 14:06:15 +00:00
|
|
|
struct _CONNECTION_ENDPOINT *Connection;
|
2004-12-25 21:30:20 +00:00
|
|
|
/* Associated connection or NULL if no associated connection exist */
|
|
|
|
struct _CONNECTION_ENDPOINT *Listener;
|
|
|
|
/* Associated listener (see transport/tcp/accept.c) */
|
2004-11-09 09:39:38 +00:00
|
|
|
IP_ADDRESS AddrCache; /* One entry address cache (destination
|
2000-08-02 00:24:26 +00:00
|
|
|
address of last packet transmitted) */
|
|
|
|
|
|
|
|
/* The following members are used to control event notification */
|
|
|
|
|
|
|
|
/* Connection indication handler */
|
2001-07-04 20:40:24 +00:00
|
|
|
PTDI_IND_CONNECT ConnectHandler;
|
|
|
|
PVOID ConnectHandlerContext;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN RegisteredConnectHandler;
|
2000-08-02 00:24:26 +00:00
|
|
|
/* Disconnect indication handler */
|
|
|
|
PTDI_IND_DISCONNECT DisconnectHandler;
|
|
|
|
PVOID DisconnectHandlerContext;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN RegisteredDisconnectHandler;
|
2001-07-04 20:40:24 +00:00
|
|
|
/* Error indication handler */
|
|
|
|
PTDI_IND_ERROR ErrorHandler;
|
|
|
|
PVOID ErrorHandlerContext;
|
|
|
|
PVOID ErrorHandlerOwner;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN RegisteredErrorHandler;
|
2000-08-02 00:24:26 +00:00
|
|
|
/* Receive indication handler */
|
|
|
|
PTDI_IND_RECEIVE ReceiveHandler;
|
|
|
|
PVOID ReceiveHandlerContext;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN RegisteredReceiveHandler;
|
2000-08-02 00:24:26 +00:00
|
|
|
/* Receive datagram indication handler */
|
|
|
|
PTDI_IND_RECEIVE_DATAGRAM ReceiveDatagramHandler;
|
|
|
|
PVOID ReceiveDatagramHandlerContext;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN RegisteredReceiveDatagramHandler;
|
2001-07-04 20:40:24 +00:00
|
|
|
/* Expedited receive indication handler */
|
|
|
|
PTDI_IND_RECEIVE_EXPEDITED ExpeditedReceiveHandler;
|
|
|
|
PVOID ExpeditedReceiveHandlerContext;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN RegisteredExpeditedReceiveHandler;
|
2001-07-04 20:40:24 +00:00
|
|
|
/* Chained receive indication handler */
|
|
|
|
PTDI_IND_CHAINED_RECEIVE ChainedReceiveHandler;
|
|
|
|
PVOID ChainedReceiveHandlerContext;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN RegisteredChainedReceiveHandler;
|
2001-07-04 20:40:24 +00:00
|
|
|
/* Chained receive datagram indication handler */
|
|
|
|
PTDI_IND_CHAINED_RECEIVE_DATAGRAM ChainedReceiveDatagramHandler;
|
|
|
|
PVOID ChainedReceiveDatagramHandlerContext;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN RegisteredChainedReceiveDatagramHandler;
|
2001-07-04 20:40:24 +00:00
|
|
|
/* Chained expedited receive indication handler */
|
|
|
|
PTDI_IND_CHAINED_RECEIVE_EXPEDITED ChainedReceiveExpeditedHandler;
|
|
|
|
PVOID ChainedReceiveExpeditedHandlerContext;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN RegisteredChainedReceiveExpeditedHandler;
|
2000-08-02 00:24:26 +00:00
|
|
|
} ADDRESS_FILE, *PADDRESS_FILE;
|
|
|
|
|
|
|
|
/* Structure used to search through Address Files */
|
|
|
|
typedef struct _AF_SEARCH {
|
|
|
|
PLIST_ENTRY Next; /* Next address file to check */
|
|
|
|
PIP_ADDRESS Address; /* Pointer to address to be found */
|
|
|
|
USHORT Port; /* Network port */
|
|
|
|
USHORT Protocol; /* Protocol number */
|
|
|
|
} AF_SEARCH, *PAF_SEARCH;
|
|
|
|
|
2001-07-04 20:40:24 +00:00
|
|
|
/*******************************************************
|
|
|
|
* Connection-oriented communication support structures *
|
|
|
|
*******************************************************/
|
|
|
|
|
2004-06-09 18:11:39 +00:00
|
|
|
typedef struct _TCP_RECEIVE_REQUEST {
|
2001-07-04 20:40:24 +00:00
|
|
|
LIST_ENTRY ListEntry; /* Entry on list */
|
2004-06-09 18:11:39 +00:00
|
|
|
PNDIS_BUFFER Buffer; /* Pointer to receive buffer */
|
|
|
|
ULONG BufferSize; /* Size of Buffer */
|
2001-07-04 20:40:24 +00:00
|
|
|
DATAGRAM_COMPLETION_ROUTINE Complete; /* Completion routine */
|
|
|
|
PVOID Context; /* Pointer to context information */
|
2004-06-09 18:11:39 +00:00
|
|
|
} TCP_RECEIVE_REQUEST, *PTCP_RECEIVE_REQUEST;
|
2001-07-04 20:40:24 +00:00
|
|
|
|
|
|
|
/* Connection states */
|
|
|
|
typedef enum {
|
|
|
|
ctListen = 0, /* Waiting for incoming connection requests */
|
|
|
|
ctSynSent, /* Waiting for matching connection request */
|
|
|
|
ctSynReceived, /* Waiting for connection request acknowledgment */
|
|
|
|
ctEstablished, /* Connection is open for data transfer */
|
|
|
|
ctFinWait1, /* Waiting for termination request or ack. for same */
|
|
|
|
ctFinWait2, /* Waiting for termination request from remote TCP */
|
|
|
|
ctCloseWait, /* Waiting for termination request from local user */
|
|
|
|
ctClosing, /* Waiting for termination ack. from remote TCP */
|
|
|
|
ctLastAck, /* Waiting for termination request ack. from remote TCP */
|
|
|
|
ctTimeWait, /* Waiting for enough time to pass to be sure the remote TCP
|
|
|
|
received the ack. of its connection termination request */
|
|
|
|
ctClosed /* Represents a closed connection */
|
|
|
|
} CONNECTION_STATE, *PCONNECTION_STATE;
|
|
|
|
|
|
|
|
|
2004-03-04 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/net/tcpip/tcpip/i386: New directory.
* drivers/net/tcpip/tcpip/i386/checksum.S: New file.
* drivers/net/tcpip/notes.txt: New file.
* drivers/net/afd/afd/dispatch.c (AfdDispCompleteListen): Signal ACCEPT
network event.
(AfdDispEventSelect): Reference event handle.
* drivers/net/afd/afd/tdi.c (TdiListen): Remove unused event.
Move Iosb and RequestConnectionInfo to AFD_LISTEN_REQUEST structure.
* drivers/net/afd/include/afd.h (AFDFCB): Replace EventObjects with
EventObject of type PKEVENT.
* drivers/net/tcpip/makefile (ARCH_OBJECTS): New variable.
(TARGET_OBJECTS): Add ARCH_OBJECTS.
* drivers/net/tcpip/include/address.h (AddrCloneAddress): New prototype.
* drivers/net/tcpip/include/checksum.h (ChecksumFold, csum_partial): New
prototype.
(TCPv4Checksum): New macro.
(CorrectChecksum): Rename to IPv4CorrectChecksum.
(TCPv4CorrectChecksum): New macro.
* drivers/net/tcpip/include/ip.h (IPv4_DF_MASK): New constant.
* drivers/net/tcpip/include/tcp.h (TCP_XXX): Correct constants.
(TCPCreateSegment, TCPFreeSegment, TCPAddSegment): Prototype.
* drivers/net/tcpip/include/titypes.h (TCP_SEND_REQUEST): Add SequenceNumber
and AckNumber.
(TCP_SEGMENT): New structure.
(CONNECTION_ENDPOINT): Add ListenRequest and ReceivedSegments.
* drivers/net/tcpip/network/transmit.c (SendFragments): Release memory
for Data on failure.
* drivers/net/tcpip/tcpip/address.c (AddrCloneAddress): New function.
* drivers/net/tcpip/tcpip/checksum.c (ChecksumFold): Factor out folding
from ChecksumCompute.
* drivers/net/tcpip/tcpip/dispatch.c (DispTdiListen): Support asynchronous
operation.
* drivers/net/tcpip/tcpip/fileobjs.c (FileOpenAddress): Don't cast to
PTDI_ADDRESS_IP.
Initialize ReceivedSegments.
* drivers/net/tcpip/tcpip/routines.c (DisplayIPHeader): New function.
(DisplayIPPacket): Call DisplayIPHeader().
(DisplayTCPHeader): Change format strings.
* drivers/net/tcpip/transport/tcp/tcp.c (IPIdentification,
TCPSegmentList): Add.
(TCPCreateSegment, TCPFreeSegment, TCPAddSegment,
TCPBuildAndTransmitSendRequest2, TCPiSelectISS, TCPiReceiveListen,
TCPiReceiveSynSent, TCPiReceiveSynReceived, TCPiReceiveData): New
function.
(TCPiBuildPacket): Build segment.
(TCPStartup): Initialize TCPSegmentList.
(TCPShutdown): Cleanup TCPSegmentList.
svn path=/trunk/; revision=8537
2004-03-04 20:45:39 +00:00
|
|
|
/* Structure for an TCP segment */
|
|
|
|
typedef struct _TCP_SEGMENT {
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
PIP_PACKET IPPacket; /* Pointer to IP packet */
|
2004-06-09 18:11:39 +00:00
|
|
|
PVOID SegmentData; /* Pointer to segment data */
|
2004-03-04 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/net/tcpip/tcpip/i386: New directory.
* drivers/net/tcpip/tcpip/i386/checksum.S: New file.
* drivers/net/tcpip/notes.txt: New file.
* drivers/net/afd/afd/dispatch.c (AfdDispCompleteListen): Signal ACCEPT
network event.
(AfdDispEventSelect): Reference event handle.
* drivers/net/afd/afd/tdi.c (TdiListen): Remove unused event.
Move Iosb and RequestConnectionInfo to AFD_LISTEN_REQUEST structure.
* drivers/net/afd/include/afd.h (AFDFCB): Replace EventObjects with
EventObject of type PKEVENT.
* drivers/net/tcpip/makefile (ARCH_OBJECTS): New variable.
(TARGET_OBJECTS): Add ARCH_OBJECTS.
* drivers/net/tcpip/include/address.h (AddrCloneAddress): New prototype.
* drivers/net/tcpip/include/checksum.h (ChecksumFold, csum_partial): New
prototype.
(TCPv4Checksum): New macro.
(CorrectChecksum): Rename to IPv4CorrectChecksum.
(TCPv4CorrectChecksum): New macro.
* drivers/net/tcpip/include/ip.h (IPv4_DF_MASK): New constant.
* drivers/net/tcpip/include/tcp.h (TCP_XXX): Correct constants.
(TCPCreateSegment, TCPFreeSegment, TCPAddSegment): Prototype.
* drivers/net/tcpip/include/titypes.h (TCP_SEND_REQUEST): Add SequenceNumber
and AckNumber.
(TCP_SEGMENT): New structure.
(CONNECTION_ENDPOINT): Add ListenRequest and ReceivedSegments.
* drivers/net/tcpip/network/transmit.c (SendFragments): Release memory
for Data on failure.
* drivers/net/tcpip/tcpip/address.c (AddrCloneAddress): New function.
* drivers/net/tcpip/tcpip/checksum.c (ChecksumFold): Factor out folding
from ChecksumCompute.
* drivers/net/tcpip/tcpip/dispatch.c (DispTdiListen): Support asynchronous
operation.
* drivers/net/tcpip/tcpip/fileobjs.c (FileOpenAddress): Don't cast to
PTDI_ADDRESS_IP.
Initialize ReceivedSegments.
* drivers/net/tcpip/tcpip/routines.c (DisplayIPHeader): New function.
(DisplayIPPacket): Call DisplayIPHeader().
(DisplayTCPHeader): Change format strings.
* drivers/net/tcpip/transport/tcp/tcp.c (IPIdentification,
TCPSegmentList): Add.
(TCPCreateSegment, TCPFreeSegment, TCPAddSegment,
TCPBuildAndTransmitSendRequest2, TCPiSelectISS, TCPiReceiveListen,
TCPiReceiveSynSent, TCPiReceiveSynReceived, TCPiReceiveData): New
function.
(TCPiBuildPacket): Build segment.
(TCPStartup): Initialize TCPSegmentList.
(TCPShutdown): Cleanup TCPSegmentList.
svn path=/trunk/; revision=8537
2004-03-04 20:45:39 +00:00
|
|
|
ULONG SequenceNumber; /* Sequence number of first byte in segment */
|
|
|
|
ULONG Length; /* Number of bytes in segment */
|
2004-06-09 18:11:39 +00:00
|
|
|
ULONG BytesDelivered; /* Number of bytes already delivered to the client */
|
2004-03-04 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/net/tcpip/tcpip/i386: New directory.
* drivers/net/tcpip/tcpip/i386/checksum.S: New file.
* drivers/net/tcpip/notes.txt: New file.
* drivers/net/afd/afd/dispatch.c (AfdDispCompleteListen): Signal ACCEPT
network event.
(AfdDispEventSelect): Reference event handle.
* drivers/net/afd/afd/tdi.c (TdiListen): Remove unused event.
Move Iosb and RequestConnectionInfo to AFD_LISTEN_REQUEST structure.
* drivers/net/afd/include/afd.h (AFDFCB): Replace EventObjects with
EventObject of type PKEVENT.
* drivers/net/tcpip/makefile (ARCH_OBJECTS): New variable.
(TARGET_OBJECTS): Add ARCH_OBJECTS.
* drivers/net/tcpip/include/address.h (AddrCloneAddress): New prototype.
* drivers/net/tcpip/include/checksum.h (ChecksumFold, csum_partial): New
prototype.
(TCPv4Checksum): New macro.
(CorrectChecksum): Rename to IPv4CorrectChecksum.
(TCPv4CorrectChecksum): New macro.
* drivers/net/tcpip/include/ip.h (IPv4_DF_MASK): New constant.
* drivers/net/tcpip/include/tcp.h (TCP_XXX): Correct constants.
(TCPCreateSegment, TCPFreeSegment, TCPAddSegment): Prototype.
* drivers/net/tcpip/include/titypes.h (TCP_SEND_REQUEST): Add SequenceNumber
and AckNumber.
(TCP_SEGMENT): New structure.
(CONNECTION_ENDPOINT): Add ListenRequest and ReceivedSegments.
* drivers/net/tcpip/network/transmit.c (SendFragments): Release memory
for Data on failure.
* drivers/net/tcpip/tcpip/address.c (AddrCloneAddress): New function.
* drivers/net/tcpip/tcpip/checksum.c (ChecksumFold): Factor out folding
from ChecksumCompute.
* drivers/net/tcpip/tcpip/dispatch.c (DispTdiListen): Support asynchronous
operation.
* drivers/net/tcpip/tcpip/fileobjs.c (FileOpenAddress): Don't cast to
PTDI_ADDRESS_IP.
Initialize ReceivedSegments.
* drivers/net/tcpip/tcpip/routines.c (DisplayIPHeader): New function.
(DisplayIPPacket): Call DisplayIPHeader().
(DisplayTCPHeader): Change format strings.
* drivers/net/tcpip/transport/tcp/tcp.c (IPIdentification,
TCPSegmentList): Add.
(TCPCreateSegment, TCPFreeSegment, TCPAddSegment,
TCPBuildAndTransmitSendRequest2, TCPiSelectISS, TCPiReceiveListen,
TCPiReceiveSynSent, TCPiReceiveSynReceived, TCPiReceiveData): New
function.
(TCPiBuildPacket): Build segment.
(TCPStartup): Initialize TCPSegmentList.
(TCPShutdown): Cleanup TCPSegmentList.
svn path=/trunk/; revision=8537
2004-03-04 20:45:39 +00:00
|
|
|
} TCP_SEGMENT, *PTCP_SEGMENT;
|
|
|
|
|
2004-07-08 06:36:04 +00:00
|
|
|
typedef struct _TDI_BUCKET {
|
|
|
|
LIST_ENTRY Entry;
|
2004-12-25 21:30:20 +00:00
|
|
|
struct _CONNECTION_ENDPOINT *AssociatedEndpoint;
|
2004-07-08 06:36:04 +00:00
|
|
|
TDI_REQUEST Request;
|
2009-11-21 13:00:37 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
ULONG Information;
|
2004-07-08 06:36:04 +00:00
|
|
|
} TDI_BUCKET, *PTDI_BUCKET;
|
2004-03-04 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/net/tcpip/tcpip/i386: New directory.
* drivers/net/tcpip/tcpip/i386/checksum.S: New file.
* drivers/net/tcpip/notes.txt: New file.
* drivers/net/afd/afd/dispatch.c (AfdDispCompleteListen): Signal ACCEPT
network event.
(AfdDispEventSelect): Reference event handle.
* drivers/net/afd/afd/tdi.c (TdiListen): Remove unused event.
Move Iosb and RequestConnectionInfo to AFD_LISTEN_REQUEST structure.
* drivers/net/afd/include/afd.h (AFDFCB): Replace EventObjects with
EventObject of type PKEVENT.
* drivers/net/tcpip/makefile (ARCH_OBJECTS): New variable.
(TARGET_OBJECTS): Add ARCH_OBJECTS.
* drivers/net/tcpip/include/address.h (AddrCloneAddress): New prototype.
* drivers/net/tcpip/include/checksum.h (ChecksumFold, csum_partial): New
prototype.
(TCPv4Checksum): New macro.
(CorrectChecksum): Rename to IPv4CorrectChecksum.
(TCPv4CorrectChecksum): New macro.
* drivers/net/tcpip/include/ip.h (IPv4_DF_MASK): New constant.
* drivers/net/tcpip/include/tcp.h (TCP_XXX): Correct constants.
(TCPCreateSegment, TCPFreeSegment, TCPAddSegment): Prototype.
* drivers/net/tcpip/include/titypes.h (TCP_SEND_REQUEST): Add SequenceNumber
and AckNumber.
(TCP_SEGMENT): New structure.
(CONNECTION_ENDPOINT): Add ListenRequest and ReceivedSegments.
* drivers/net/tcpip/network/transmit.c (SendFragments): Release memory
for Data on failure.
* drivers/net/tcpip/tcpip/address.c (AddrCloneAddress): New function.
* drivers/net/tcpip/tcpip/checksum.c (ChecksumFold): Factor out folding
from ChecksumCompute.
* drivers/net/tcpip/tcpip/dispatch.c (DispTdiListen): Support asynchronous
operation.
* drivers/net/tcpip/tcpip/fileobjs.c (FileOpenAddress): Don't cast to
PTDI_ADDRESS_IP.
Initialize ReceivedSegments.
* drivers/net/tcpip/tcpip/routines.c (DisplayIPHeader): New function.
(DisplayIPPacket): Call DisplayIPHeader().
(DisplayTCPHeader): Change format strings.
* drivers/net/tcpip/transport/tcp/tcp.c (IPIdentification,
TCPSegmentList): Add.
(TCPCreateSegment, TCPFreeSegment, TCPAddSegment,
TCPBuildAndTransmitSendRequest2, TCPiSelectISS, TCPiReceiveListen,
TCPiReceiveSynSent, TCPiReceiveSynReceived, TCPiReceiveData): New
function.
(TCPiBuildPacket): Build segment.
(TCPStartup): Initialize TCPSegmentList.
(TCPShutdown): Cleanup TCPSegmentList.
svn path=/trunk/; revision=8537
2004-03-04 20:45:39 +00:00
|
|
|
|
2001-07-04 20:40:24 +00:00
|
|
|
/* Transport connection context structure A.K.A. Transmission Control Block
|
|
|
|
(TCB) in TCP terminology. The FileObject->FsContext2 field holds a pointer
|
|
|
|
to this structure */
|
2000-08-02 00:24:26 +00:00
|
|
|
typedef struct _CONNECTION_ENDPOINT {
|
2011-07-17 17:37:36 +00:00
|
|
|
PVOID SocketContext; /* Context for lower layer (MUST be first member in struct) */
|
2004-07-08 06:36:04 +00:00
|
|
|
LIST_ENTRY ListEntry; /* Entry on list */
|
2009-12-31 23:33:24 +00:00
|
|
|
LONG RefCount; /* Reference count */
|
|
|
|
OBJECT_FREE_ROUTINE Free; /* Routine to use to free resources for the object */
|
2004-07-08 06:36:04 +00:00
|
|
|
KSPIN_LOCK Lock; /* Spin lock to protect this structure */
|
2009-12-31 23:33:24 +00:00
|
|
|
KIRQL OldIrql; /* The old irql is stored here for use in HandleSignalledConnection */
|
2004-07-08 06:36:04 +00:00
|
|
|
PVOID ClientContext; /* Pointer to client context information */
|
|
|
|
PADDRESS_FILE AddressFile; /* Associated address file object (NULL if none) */
|
2005-05-08 02:16:32 +00:00
|
|
|
|
2004-07-08 06:36:04 +00:00
|
|
|
/* Requests */
|
2016-11-13 15:31:39 +00:00
|
|
|
LIST_ENTRY ConnectRequest; /* Queued connect requests */
|
2004-07-08 06:36:04 +00:00
|
|
|
LIST_ENTRY ListenRequest; /* Queued listen requests */
|
|
|
|
LIST_ENTRY ReceiveRequest; /* Queued receive requests */
|
2006-01-04 22:40:48 +00:00
|
|
|
LIST_ENTRY SendRequest; /* Queued send requests */
|
2011-06-22 00:41:40 +00:00
|
|
|
LIST_ENTRY ShutdownRequest;/* Queued shutdown requests */
|
2004-12-01 08:14:15 +00:00
|
|
|
|
2011-07-25 18:45:59 +00:00
|
|
|
LIST_ENTRY PacketQueue; /* Queued received packets waiting to be processed */
|
2011-07-02 20:36:35 +00:00
|
|
|
|
|
|
|
/* Disconnect Timer */
|
|
|
|
KTIMER DisconnectTimer;
|
|
|
|
KDPC DisconnectDpc;
|
2011-06-05 02:16:45 +00:00
|
|
|
|
2011-08-07 19:13:23 +00:00
|
|
|
/* Socket state */
|
|
|
|
BOOLEAN SendShutdown;
|
|
|
|
BOOLEAN ReceiveShutdown;
|
2012-12-23 09:53:36 +00:00
|
|
|
NTSTATUS ReceiveShutdownStatus;
|
2013-08-12 03:09:28 +00:00
|
|
|
BOOLEAN Closing;
|
2011-08-07 19:13:23 +00:00
|
|
|
|
2011-06-05 02:16:45 +00:00
|
|
|
struct _CONNECTION_ENDPOINT *Next; /* Next connection in address file list */
|
2000-08-02 00:24:26 +00:00
|
|
|
} CONNECTION_ENDPOINT, *PCONNECTION_ENDPOINT;
|
|
|
|
|
2001-07-04 20:40:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*************************
|
|
|
|
* TDI support structures *
|
|
|
|
*************************/
|
|
|
|
|
2000-08-02 00:24:26 +00:00
|
|
|
/* Transport control channel context structure. The FileObject->FsContext2
|
|
|
|
field holds a pointer to this structure */
|
|
|
|
typedef struct _CONTROL_CHANNEL {
|
|
|
|
LIST_ENTRY ListEntry; /* Entry on list */
|
2009-12-31 23:33:24 +00:00
|
|
|
LONG RefCount; /* Reference count */
|
|
|
|
OBJECT_FREE_ROUTINE Free; /* Routine to use to free resources for the object */
|
2000-08-02 00:24:26 +00:00
|
|
|
KSPIN_LOCK Lock; /* Spin lock to protect this structure */
|
|
|
|
} CONTROL_CHANNEL, *PCONTROL_CHANNEL;
|
|
|
|
|
2001-07-04 20:40:24 +00:00
|
|
|
/* Transport (TCP/UDP) endpoint context structure. The FileObject->FsContext
|
|
|
|
field holds a pointer to this structure */
|
|
|
|
typedef struct _TRANSPORT_CONTEXT {
|
|
|
|
union {
|
|
|
|
HANDLE AddressHandle;
|
|
|
|
CONNECTION_CONTEXT ConnectionContext;
|
|
|
|
HANDLE ControlChannel;
|
|
|
|
} Handle;
|
2008-11-27 15:02:47 +00:00
|
|
|
BOOLEAN CancelIrps;
|
2001-07-04 20:40:24 +00:00
|
|
|
KEVENT CleanupEvent;
|
|
|
|
} TRANSPORT_CONTEXT, *PTRANSPORT_CONTEXT;
|
|
|
|
|
2000-08-02 00:24:26 +00:00
|
|
|
typedef struct _TI_QUERY_CONTEXT {
|
|
|
|
PIRP Irp;
|
|
|
|
PMDL InputMdl;
|
|
|
|
PMDL OutputMdl;
|
|
|
|
TCP_REQUEST_QUERY_INFORMATION_EX QueryInfo;
|
|
|
|
} TI_QUERY_CONTEXT, *PTI_QUERY_CONTEXT;
|
|
|
|
|
|
|
|
/* EOF */
|