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 struct NEIGHBOR_CACHE_TABLE {
14 struct NEIGHBOR_CACHE_ENTRY *Cache; /* Pointer to cache */
15 KSPIN_LOCK Lock; /* Protecting lock */
16 } NEIGHBOR_CACHE_TABLE, *PNEIGHBOR_CACHE_TABLE;
18 /* Information about a neighbor */
19 typedef struct NEIGHBOR_CACHE_ENTRY {
21 struct NEIGHBOR_CACHE_ENTRY *Next; /* Pointer to next entry */
22 struct NEIGHBOR_CACHE_TABLE *Table; /* Pointer to table */
23 ULONG RefCount; /* Number of references */
24 OBJECT_FREE_ROUTINE Free; /* Routine to free resources for the object */
25 UCHAR State; /* State of NCE */
26 UINT EventTimer; /* Ticks since last event */
27 UINT EventCount; /* Number of events */
28 PIP_INTERFACE Interface; /* Pointer to interface */
29 PIP_ADDRESS Address; /* IP address of neighbor */
30 UINT LinkAddressLength; /* Length of link address */
31 PVOID LinkAddress; /* Pointer to link address */
32 PNDIS_PACKET WaitQueue; /* Pointer to NDIS packets
34 } NEIGHBOR_CACHE_ENTRY, *PNEIGHBOR_CACHE_ENTRY;
38 #define NUD_INCOMPLETE 0x01
39 #define NUD_REACHABLE 0x02
40 #define NUD_STALE 0x04
41 #define NUD_DELAY 0x08
42 #define NUD_PROBE 0x10
43 #define NUD_FAILED 0x20
44 #define NUD_NOARP 0x40
45 #define NUD_PERMANENT 0x80
47 #define NUD_IN_TIMER (NUD_INCOMPLETE | NUD_DELAY | NUD_PROBE)
48 #define NUD_VALID (NUD_REACHABLE | NUD_NOARP | NUD_STALE | NUD_DELAY | \
49 NUD_PROBE | NUD_PERMANENT)
50 #define NUD_CONNECTED (NUD_PERMANENT | NUD_NOARP | NUD_REACHABLE)
53 /* Maximum number of retransmissions of multicast solicits */
54 #define MAX_MULTICAST_SOLICIT 3 /* 3 transmissions */
56 /* Number of ticks between address resolution messages */
57 #define RETRANS_TIMER IP_TICKS_SECOND /* One second */
60 extern NEIGHBOR_CACHE_TABLE NeighborCache[NB_HASHMASK + 1];
73 PNEIGHBOR_CACHE_ENTRY NCE);
75 PNEIGHBOR_CACHE_ENTRY NBAddNeighbor(
76 PIP_INTERFACE Interface,
79 UINT LinkAddressLength,
82 VOID NBUpdateNeighbor(
83 PNEIGHBOR_CACHE_ENTRY NCE,
87 PNEIGHBOR_CACHE_ENTRY NBLocateNeighbor(
90 PNEIGHBOR_CACHE_ENTRY NBFindOrCreateNeighbor(
91 PIP_INTERFACE Interface,
94 BOOLEAN NBQueuePacket(
95 PNEIGHBOR_CACHE_ENTRY NCE,
96 PNDIS_PACKET NdisPacket);
98 VOID NBRemoveNeighbor(
99 PNEIGHBOR_CACHE_ENTRY NCE);
101 #endif /* __NEIGHBOR_H */