d2c827c8d76129b17257e5fb8d87b9fa4ecb486b
[reactos.git] / reactos / drivers / net / tcpip / include / route.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TCP/IP protocol driver
4 * FILE: include/route.h
5 * PURPOSE: Routing cache definitions
6 */
7 #ifndef __ROUTE_H
8 #define __ROUTE_H
9
10 #include <neighbor.h>
11 #include <address.h>
12 #include <router.h>
13 #include <pool.h>
14 #include <arp.h>
15
16
17 /* Route Cache Node structure.
18 * The primary purpose of the RCN is to cache selected source and
19 * next-hop addresses. The routing cache is implemented as a binary
20 * search tree to provide fast lookups when many RCNs are in the cache.
21 */
22 typedef struct ROUTE_CACHE_NODE {
23 struct ROUTE_CACHE_NODE *Parent; /* Pointer to parent */
24 struct ROUTE_CACHE_NODE *Left; /* Pointer to left child */
25 struct ROUTE_CACHE_NODE *Right; /* Pointer to right child */
26 /* Memebers above this line must not be moved */
27 ULONG RefCount; /* Reference count */
28 UCHAR State; /* RCN state (RCN_STATE_*) */
29 IP_ADDRESS Destination; /* Destination address */
30 PNET_TABLE_ENTRY NTE; /* Preferred NTE */
31 PNEIGHBOR_CACHE_ENTRY NCE; /* Pointer to NCE for first hop (NULL if none) */
32 UINT PathMTU; /* Path MTU to destination */
33 } ROUTE_CACHE_NODE, *PROUTE_CACHE_NODE;
34
35 /* RCN states */
36 #define RCN_STATE_PERMANENT 0x00 /* RCN is permanent (properly local) */
37 #define RCN_STATE_COMPUTED 0x01 /* RCN is computed */
38
39
40 #define IsExternalRCN(RCN) \
41 (RCN == ExternalRCN)
42
43 #define IsInternalRCN(RCN) \
44 (RCN != ExternalRCN)
45
46
47 NTSTATUS RouteStartup(
48 VOID);
49
50 NTSTATUS RouteShutdown(
51 VOID);
52
53 UINT RouteGetRouteToDestination(
54 PIP_ADDRESS Destination,
55 PNET_TABLE_ENTRY NTE,
56 PROUTE_CACHE_NODE *RCN);
57
58 PROUTE_CACHE_NODE RouteAddRouteToDestination(
59 PIP_ADDRESS Destination,
60 PNET_TABLE_ENTRY NTE,
61 PIP_INTERFACE IF,
62 PNEIGHBOR_CACHE_ENTRY NCE);
63
64 VOID RouteRemoveRouteToDestination(
65 PROUTE_CACHE_NODE RCN);
66
67 VOID RouteInvalidateNTE(
68 PNET_TABLE_ENTRY NTE);
69
70 VOID RouteInvalidateNCE(
71 PNEIGHBOR_CACHE_ENTRY NCE);
72
73 #endif /* __ROUTE_H */
74
75 /* EOF */