2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TCP/IP protocol driver
4 * FILE: include/neighbor.h
5 * PURPOSE: Neighbor definitions
10 #define NB_HASHMASK 0xF /* Hash mask for neighbor cache */
12 typedef VOID (*PNEIGHBOR_PACKET_COMPLETE
)
13 ( PVOID Context
, PNDIS_PACKET Packet
, NDIS_STATUS Status
);
15 typedef struct _NEIGHBOR_PACKET
{
18 PNEIGHBOR_PACKET_COMPLETE Complete
;
20 } NEIGHBOR_PACKET
, *PNEIGHBOR_PACKET
;
22 typedef struct NEIGHBOR_CACHE_TABLE
{
23 struct NEIGHBOR_CACHE_ENTRY
*Cache
; /* Pointer to cache */
24 KSPIN_LOCK Lock
; /* Protecting lock */
25 } NEIGHBOR_CACHE_TABLE
, *PNEIGHBOR_CACHE_TABLE
;
27 /* Information about a neighbor */
28 typedef struct NEIGHBOR_CACHE_ENTRY
{
29 struct NEIGHBOR_CACHE_ENTRY
*Next
; /* Pointer to next entry */
30 UCHAR State
; /* State of NCE */
31 UINT EventTimer
; /* Ticks since last event */
32 UINT EventCount
; /* Number of events */
33 PIP_INTERFACE Interface
; /* Pointer to interface */
34 UINT LinkAddressLength
; /* Length of link address */
35 PVOID LinkAddress
; /* Pointer to link address */
36 IP_ADDRESS Address
; /* IP address of neighbor */
37 LIST_ENTRY PacketQueue
; /* Packet queue */
38 } NEIGHBOR_CACHE_ENTRY
, *PNEIGHBOR_CACHE_ENTRY
;
41 #define NUD_INCOMPLETE 0x01
42 #define NUD_PERMANENT 0x02
43 #define NUD_STALE 0x04
45 /* Number of seconds between ARP transmissions */
48 /* Number of seconds before the NCE times out */
49 #define ARP_TIMEOUT ARP_RATE + 15
51 /* Number of seconds before retransmission */
52 #define ARP_TIMEOUT_RETRANSMISSION 5
54 extern NEIGHBOR_CACHE_TABLE NeighborCache
[NB_HASHMASK
+ 1];
67 PNEIGHBOR_CACHE_ENTRY NCE
);
69 PNEIGHBOR_CACHE_ENTRY
NBAddNeighbor(
70 PIP_INTERFACE Interface
,
73 UINT LinkAddressLength
,
77 VOID
NBUpdateNeighbor(
78 PNEIGHBOR_CACHE_ENTRY NCE
,
82 PNEIGHBOR_CACHE_ENTRY
NBLocateNeighbor(
85 PNEIGHBOR_CACHE_ENTRY
NBFindOrCreateNeighbor(
86 PIP_INTERFACE Interface
,
89 BOOLEAN
NBQueuePacket(
90 PNEIGHBOR_CACHE_ENTRY NCE
,
91 PNDIS_PACKET NdisPacket
,
92 PNEIGHBOR_PACKET_COMPLETE PacketComplete
,
95 VOID
NBRemoveNeighbor(
96 PNEIGHBOR_CACHE_ENTRY NCE
);
98 ULONG
NBCopyNeighbors(
99 PIP_INTERFACE Interface
,
100 PIPARP_ENTRY ArpTable
);
102 VOID
NBResetNeighborTimeout(
103 PIP_ADDRESS Address
);