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
11 #define NB_HASHMASK 0xF /* Hash mask for neighbor cache */
13 typedef VOID (*PNEIGHBOR_PACKET_COMPLETE
)
14 ( PVOID Context
, PNDIS_PACKET Packet
, NDIS_STATUS Status
);
16 typedef struct _NEIGHBOR_PACKET
{
19 PNEIGHBOR_PACKET_COMPLETE Complete
;
21 } NEIGHBOR_PACKET
, *PNEIGHBOR_PACKET
;
23 typedef struct NEIGHBOR_CACHE_TABLE
{
24 struct NEIGHBOR_CACHE_ENTRY
*Cache
; /* Pointer to cache */
25 KSPIN_LOCK Lock
; /* Protecting lock */
26 } NEIGHBOR_CACHE_TABLE
, *PNEIGHBOR_CACHE_TABLE
;
28 /* Information about a neighbor */
29 typedef struct NEIGHBOR_CACHE_ENTRY
{
31 struct NEIGHBOR_CACHE_ENTRY
*Next
; /* Pointer to next entry */
32 UCHAR State
; /* State of NCE */
33 UINT EventTimer
; /* Ticks since last event */
34 UINT EventCount
; /* Number of events */
35 PIP_INTERFACE Interface
; /* Pointer to interface */
36 UINT LinkAddressLength
; /* Length of link address */
37 PVOID LinkAddress
; /* Pointer to link address */
38 IP_ADDRESS Address
; /* IP address of neighbor */
39 LIST_ENTRY PacketQueue
; /* Packet queue */
40 } NEIGHBOR_CACHE_ENTRY
, *PNEIGHBOR_CACHE_ENTRY
;
43 #define NUD_INCOMPLETE 0x01
44 #define NUD_PERMANENT 0x02
45 #define NUD_STALE 0x04
47 /* Number of seconds between ARP transmissions */
50 /* Number of seconds before the NCE times out */
51 #define ARP_TIMEOUT ARP_RATE + 15
53 /* Number of seconds before retransmission */
54 #define ARP_TIMEOUT_RETRANSMISSION 5
56 extern NEIGHBOR_CACHE_TABLE NeighborCache
[NB_HASHMASK
+ 1];
69 PNEIGHBOR_CACHE_ENTRY NCE
);
71 PNEIGHBOR_CACHE_ENTRY
NBAddNeighbor(
72 PIP_INTERFACE Interface
,
75 UINT LinkAddressLength
,
79 VOID
NBUpdateNeighbor(
80 PNEIGHBOR_CACHE_ENTRY NCE
,
84 PNEIGHBOR_CACHE_ENTRY
NBLocateNeighbor(
87 PNEIGHBOR_CACHE_ENTRY
NBFindOrCreateNeighbor(
88 PIP_INTERFACE Interface
,
91 BOOLEAN
NBQueuePacket(
92 PNEIGHBOR_CACHE_ENTRY NCE
,
93 PNDIS_PACKET NdisPacket
,
94 PNEIGHBOR_PACKET_COMPLETE PacketComplete
,
97 VOID
NBRemoveNeighbor(
98 PNEIGHBOR_CACHE_ENTRY NCE
);
100 ULONG
NBCopyNeighbors(
101 PIP_INTERFACE Interface
,
102 PIPARP_ENTRY ArpTable
);
104 VOID
NBResetNeighborTimeout(
105 PIP_ADDRESS Address
);
107 #endif /* __NEIGHBOR_H */