ReactOS 0.4.15-dev-5667-ged97270
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
536
537 if (++CurrentIPDR->TimeoutCount == MAX_TIMEOUT_COUNT)
538 {
540 RemoveEntryList(CurrentEntry);
541 FreeIPDR(CurrentIPDR);
542 }
543 else
544 {
545 ASSERT(CurrentIPDR->TimeoutCount < MAX_TIMEOUT_COUNT);
547 }
548
549 CurrentEntry = NextEntry;
550 }
551
553}
VOID TcpipAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock)
Definition: lock.c:22
VOID TcpipReleaseSpinLockFromDpcLevel(PKSPIN_LOCK SpinLock)
Definition: lock.c:30
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define ASSERT(a)
Definition: mode.c:44
LIST_ENTRY ReassemblyListHead
Definition: receive.c:15
VOID FreeIPDR(PIPDATAGRAM_REASSEMBLY IPDR)
Definition: receive.c:53
KSPIN_LOCK ReassemblyListLock
Definition: receive.c:16
#define MAX_TIMEOUT_COUNT
Definition: receive.h:13
KSPIN_LOCK Lock
Definition: receive.h:35
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IPTimeoutDpcFn().

◆ IPFreeReassemblyList()

VOID IPFreeReassemblyList ( VOID  )

Definition at line 485 of file receive.c.

490{
492 PLIST_ENTRY CurrentEntry, NextEntry;
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}
VOID TcpipReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL Irql)
Definition: lock.c:26
VOID TcpipAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL Irql)
Definition: lock.c:18
UCHAR KIRQL
Definition: env_spec_w32.h:591
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:792

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 */
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}
#define MIN_TRACE
Definition: debug.h:14
#define MAX_TRACE
Definition: debug.h:16
UINT CopyPacketToBuffer(PUCHAR DstData, PNDIS_PACKET SrcPacket, UINT SrcOffset, UINT Length)
Definition: buffer.c:172
#define TI_DbgPrint(_t_, _x_)
Definition: debug.h:45
#define IP_ADDRESS_V6
Definition: ip.h:33
#define IP_ADDRESS_V4
Definition: ip.h:32
unsigned int UINT
Definition: ndis.h:50
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT _Out_ PUINT BytesCopied
Definition: ndis.h:3171
VOID IPv4Receive(PIP_INTERFACE IF, PIP_PACKET IPPacket)
Definition: receive.c:555
OBJECT_FREE_ROUTINE Free
Definition: ip.h:78
UCHAR Type
Definition: ip.h:79
UINT Position
Definition: ip.h:87
PNDIS_PACKET NdisPacket
Definition: ip.h:88
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
unsigned char UCHAR
Definition: xmlstorage.h:181

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

Variable Documentation

◆ IPDRList

NPAGED_LOOKASIDE_LIST IPDRList
extern

Definition at line 17 of file receive.c.

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

◆ IPFragmentList

NPAGED_LOOKASIDE_LIST IPFragmentList
extern

Definition at line 18 of file receive.c.

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

◆ IPHoleList

NPAGED_LOOKASIDE_LIST IPHoleList
extern

Definition at line 19 of file receive.c.

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

◆ ReassemblyListHead

LIST_ENTRY ReassemblyListHead
extern

◆ ReassemblyListLock

KSPIN_LOCK ReassemblyListLock
extern