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 struct NEIGHBOR_CACHE_TABLE
*Table
; /* Pointer to table */
33 UCHAR State
; /* State of NCE */
34 UINT EventTimer
; /* Ticks since last event */
35 UINT EventCount
; /* Number of events */
36 PIP_INTERFACE Interface
; /* Pointer to interface */
37 UINT LinkAddressLength
; /* Length of link address */
38 PVOID LinkAddress
; /* Pointer to link address */
39 IP_ADDRESS Address
; /* IP address of neighbor */
40 LIST_ENTRY PacketQueue
; /* Packet queue */
41 } NEIGHBOR_CACHE_ENTRY
, *PNEIGHBOR_CACHE_ENTRY
;
45 #define NUD_INCOMPLETE 0x01
46 #define NUD_REACHABLE 0x02
47 #define NUD_STALE 0x04
48 #define NUD_DELAY 0x08
49 #define NUD_PROBE 0x10
50 #define NUD_FAILED 0x20
51 #define NUD_NOARP 0x40
52 #define NUD_PERMANENT 0x80
54 #define NUD_IN_TIMER (NUD_INCOMPLETE | NUD_DELAY | NUD_PROBE)
55 #define NUD_VALID (NUD_REACHABLE | NUD_NOARP | NUD_STALE | NUD_DELAY | \
56 NUD_PROBE | NUD_PERMANENT)
57 #define NUD_CONNECTED (NUD_PERMANENT | NUD_NOARP | NUD_REACHABLE)
60 /* Maximum number of retransmissions of multicast solicits */
61 #define MAX_MULTICAST_SOLICIT 3 /* 3 transmissions */
63 /* Number of ticks between address resolution messages */
64 #define RETRANS_TIMER IP_TICKS_SECOND /* One second */
67 extern NEIGHBOR_CACHE_TABLE NeighborCache
[NB_HASHMASK
+ 1];
80 PNEIGHBOR_CACHE_ENTRY NCE
);
82 PNEIGHBOR_CACHE_ENTRY
NBAddNeighbor(
83 PIP_INTERFACE Interface
,
86 UINT LinkAddressLength
,
89 VOID
NBUpdateNeighbor(
90 PNEIGHBOR_CACHE_ENTRY NCE
,
94 PNEIGHBOR_CACHE_ENTRY
NBLocateNeighbor(
97 PNEIGHBOR_CACHE_ENTRY
NBFindOrCreateNeighbor(
98 PIP_INTERFACE Interface
,
101 BOOLEAN
NBQueuePacket(
102 PNEIGHBOR_CACHE_ENTRY NCE
,
103 PNDIS_PACKET NdisPacket
,
104 PNEIGHBOR_PACKET_COMPLETE PacketComplete
,
105 PVOID PacketContext
);
107 VOID
NBRemoveNeighbor(
108 PNEIGHBOR_CACHE_ENTRY NCE
);
110 #endif /* __NEIGHBOR_H */