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 /* Timeout for incomplete NCE ARP requests */
46 #define ARP_INCOMPLETE_TIMEOUT 5
48 /* Number of seconds between ARP transmissions */
51 /* Number of seconds before the NCE times out */
52 #define ARP_COMPLETE_TIMEOUT (ARP_RATE + 15)
54 /* Number of seconds before retransmission */
55 #define ARP_TIMEOUT_RETRANSMISSION 5
57 extern NEIGHBOR_CACHE_TABLE NeighborCache
[NB_HASHMASK
+ 1];
70 PNEIGHBOR_CACHE_ENTRY NCE
);
72 PNEIGHBOR_CACHE_ENTRY
NBAddNeighbor(
73 PIP_INTERFACE Interface
,
76 UINT LinkAddressLength
,
80 VOID
NBUpdateNeighbor(
81 PNEIGHBOR_CACHE_ENTRY NCE
,
85 PNEIGHBOR_CACHE_ENTRY
NBLocateNeighbor(
88 PNEIGHBOR_CACHE_ENTRY
NBFindOrCreateNeighbor(
89 PIP_INTERFACE Interface
,
92 BOOLEAN
NBQueuePacket(
93 PNEIGHBOR_CACHE_ENTRY NCE
,
94 PNDIS_PACKET NdisPacket
,
95 PNEIGHBOR_PACKET_COMPLETE PacketComplete
,
98 VOID
NBRemoveNeighbor(
99 PNEIGHBOR_CACHE_ENTRY NCE
);
101 ULONG
NBCopyNeighbors(
102 PIP_INTERFACE Interface
,
103 PIPARP_ENTRY ArpTable
);
105 VOID
NBResetNeighborTimeout(
106 PIP_ADDRESS Address
);