ReactOS  0.4.14-dev-606-g14ebc0b
receive.h File Reference
#include <ip.h>
Include dependency graph for receive.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  IP_FRAGMENT
 
struct  IPDATAGRAM_HOLE
 
struct  IPDATAGRAM_REASSEMBLY
 

Macros

#define MAX_TIMEOUT_COUNT   3
 

Typedefs

typedef struct IP_FRAGMENT IP_FRAGMENT
 
typedef struct IP_FRAGMENTPIP_FRAGMENT
 
typedef struct IPDATAGRAM_HOLE IPDATAGRAM_HOLE
 
typedef struct IPDATAGRAM_HOLEPIPDATAGRAM_HOLE
 
typedef struct IPDATAGRAM_REASSEMBLY IPDATAGRAM_REASSEMBLY
 
typedef struct IPDATAGRAM_REASSEMBLYPIPDATAGRAM_REASSEMBLY
 

Functions

VOID IPFreeReassemblyList (VOID)
 
VOID IPDatagramReassemblyTimeout (VOID)
 
VOID IPReceive (PIP_INTERFACE IF, PIP_PACKET IPPacket)
 

Variables

LIST_ENTRY ReassemblyListHead
 
KSPIN_LOCK ReassemblyListLock
 
NPAGED_LOOKASIDE_LIST IPDRList
 
NPAGED_LOOKASIDE_LIST IPFragmentList
 
NPAGED_LOOKASIDE_LIST IPHoleList
 

Macro Definition Documentation

◆ MAX_TIMEOUT_COUNT

#define MAX_TIMEOUT_COUNT   3

Definition at line 13 of file receive.h.

Typedef Documentation

◆ IP_FRAGMENT

◆ IPDATAGRAM_HOLE

◆ IPDATAGRAM_REASSEMBLY

◆ PIP_FRAGMENT

◆ PIPDATAGRAM_HOLE

◆ PIPDATAGRAM_REASSEMBLY

Function Documentation

◆ IPDatagramReassemblyTimeout()

VOID IPDatagramReassemblyTimeout ( VOID  )

Definition at line 515 of file receive.c.

523 {
524  PLIST_ENTRY CurrentEntry, NextEntry;
525  PIPDATAGRAM_REASSEMBLY CurrentIPDR;
526 
528 
529  CurrentEntry = ReassemblyListHead.Flink;
530  while (CurrentEntry != &ReassemblyListHead)
531  {
532  NextEntry = CurrentEntry->Flink;
533  CurrentIPDR = CONTAINING_RECORD(CurrentEntry, IPDATAGRAM_REASSEMBLY, ListEntry);
534 
535  TcpipAcquireSpinLockAtDpcLevel(&CurrentIPDR->Lock);
536 
537  if (++CurrentIPDR->TimeoutCount == MAX_TIMEOUT_COUNT)
538  {
539  TcpipReleaseSpinLockFromDpcLevel(&CurrentIPDR->Lock);
540  RemoveEntryList(CurrentEntry);
541  FreeIPDR(CurrentIPDR);
542  }
543  else
544  {
545  ASSERT(CurrentIPDR->TimeoutCount < MAX_TIMEOUT_COUNT);
546  TcpipReleaseSpinLockFromDpcLevel(&CurrentIPDR->Lock);
547  }
548 
549  CurrentEntry = NextEntry;
550  }
551 
553 }
LIST_ENTRY ReassemblyListHead
Definition: receive.c:15
#define MAX_TIMEOUT_COUNT
Definition: receive.h:13
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
KSPIN_LOCK ReassemblyListLock
Definition: receive.c:16
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID TcpipReleaseSpinLockFromDpcLevel(PKSPIN_LOCK SpinLock)
Definition: lock.c:30
Definition: typedefs.h:117
VOID FreeIPDR(PIPDATAGRAM_REASSEMBLY IPDR)
Definition: receive.c:53
VOID TcpipAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock)
Definition: lock.c:22
KSPIN_LOCK Lock
Definition: receive.h:35

Referenced by IPTimeoutDpcFn().

◆ IPFreeReassemblyList()

VOID IPFreeReassemblyList ( VOID  )

Definition at line 485 of file receive.c.

490 {
491  KIRQL OldIrql;
492  PLIST_ENTRY CurrentEntry, NextEntry;
493  PIPDATAGRAM_REASSEMBLY Current;
494 
496 
497  CurrentEntry = ReassemblyListHead.Flink;
498  while (CurrentEntry != &ReassemblyListHead) {
499  NextEntry = CurrentEntry->Flink;
500  Current = CONTAINING_RECORD(CurrentEntry, IPDATAGRAM_REASSEMBLY, ListEntry);
501 
502  /* Unlink it from the list */
503  RemoveEntryList(CurrentEntry);
504 
505  /* And free the descriptor */
506  FreeIPDR(Current);
507 
508  CurrentEntry = NextEntry;
509  }
510 
512 }
LIST_ENTRY ReassemblyListHead
Definition: receive.c:15
VOID TcpipReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL Irql)
Definition: lock.c:26
VOID TcpipAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL Irql)
Definition: lock.c:18
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
KSPIN_LOCK ReassemblyListLock
Definition: receive.c:16
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: typedefs.h:117
VOID FreeIPDR(PIPDATAGRAM_REASSEMBLY IPDR)
Definition: receive.c:53

Referenced by IPShutdown().

◆ IPReceive()

VOID IPReceive ( PIP_INTERFACE  IF,
PIP_PACKET  IPPacket 
)

Definition at line 638 of file receive.c.

645 {
646  UCHAR FirstByte;
648 
649  /* Read in the first IP header byte for version information */
650  BytesCopied = CopyPacketToBuffer((PCHAR)&FirstByte,
651  IPPacket->NdisPacket,
652  IPPacket->Position,
653  sizeof(UCHAR));
654  if (BytesCopied != sizeof(UCHAR))
655  {
656  TI_DbgPrint(MIN_TRACE, ("Failed to copy in first byte\n"));
657  IPPacket->Free(IPPacket);
658  return;
659  }
660 
661  /* Check that IP header has a supported version */
662  Version = (FirstByte >> 4);
663 
664  switch (Version) {
665  case 4:
666  IPPacket->Type = IP_ADDRESS_V4;
667  IPv4Receive(IF, IPPacket);
668  break;
669  case 6:
670  IPPacket->Type = IP_ADDRESS_V6;
671  TI_DbgPrint(MAX_TRACE, ("Datagram of type IPv6 discarded.\n"));
672  break;
673  default:
674  TI_DbgPrint(MIN_TRACE, ("Datagram has an unsupported IP version %d.\n", Version));
675  break;
676  }
677 
678  IPPacket->Free(IPPacket);
679 }
signed char * PCHAR
Definition: retypes.h:7
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
OBJECT_FREE_ROUTINE Free
Definition: ip.h:78
#define IP_ADDRESS_V4
Definition: ip.h:32
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT _Out_ PUINT BytesCopied
Definition: ndis.h:3167
VOID IPv4Receive(PIP_INTERFACE IF, PIP_PACKET IPPacket)
Definition: receive.c:555
#define IP_ADDRESS_V6
Definition: ip.h:33
UINT Position
Definition: ip.h:87
UCHAR Type
Definition: ip.h:79
unsigned char UCHAR
Definition: xmlstorage.h:181
#define MAX_TRACE
Definition: debug.h:16
UINT CopyPacketToBuffer(PUCHAR DstData, PNDIS_PACKET SrcPacket, UINT SrcOffset, UINT Length)
Definition: buffer.c:170
unsigned int UINT
Definition: ndis.h:50
PNDIS_PACKET NdisPacket
Definition: ip.h:88
#define MIN_TRACE
Definition: debug.h:14

Referenced by LanReceiveWorker(), LoopPassiveWorker(), main(), and RunTest().

Variable Documentation

◆ IPDRList

Definition at line 17 of file receive.c.

Referenced by FreeIPDR(), IPShutdown(), IPStartup(), and ProcessFragment().

◆ IPFragmentList

NPAGED_LOOKASIDE_LIST IPFragmentList

Definition at line 18 of file receive.c.

Referenced by FreeIPDR(), IPShutdown(), IPStartup(), and ProcessFragment().

◆ IPHoleList

Definition at line 19 of file receive.c.

Referenced by CreateHoleDescriptor(), FreeIPDR(), IPShutdown(), IPStartup(), and ProcessFragment().

◆ ReassemblyListHead

◆ ReassemblyListLock