3 Copyright (c) 2005 - 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 EFI IP4 route table and route cache table defintions.
24 #ifndef __EFI_IP4_ROUTE_H__
25 #define __EFI_IP4_ROUTE_H__
27 #include "IP4Common.h"
30 IP4_DIRECT_ROUTE
= 0x00000001,
32 IP4_ROUTE_CACHE_HASH
= 31,
33 IP4_ROUTE_CACHE_MAX
= 64 // Max NO. of cache entry per hash bucket
36 #define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)
39 // The route entry in the route table. Dest/Netmask is the destion
40 // network. The nexthop is the gateway to send the packet to in
41 // order to reach the Dest/Netmask. If the Flag has IP4_DIRECT_ROUTE
42 // on, the gateway is the destination of the IP packet itself. Route
43 // enties of the connected network have the flag on.
55 // The route cache entry. The route cache entry is optional.
56 // But it is necessary to support the ICMP redirect message.
57 // Check Ip4ProcessIcmpRedirect for information.
59 // The cache entry field Tag is used to tag all the route
60 // cache entry spawned from a route table entry. This makes
61 // it simple to delete all the route cache entries from a
62 // to-be-deleted route entry.
71 } IP4_ROUTE_CACHE_ENTRY
;
74 // The route cache table is organized as a hash table. Each
75 // IP4 route table has a embedded route cache. For now the
76 // route cache and route table are binded togehter. But keep
77 // the route cache a seperated structure in case we want to
81 NET_LIST_ENTRY CacheBucket
[IP4_ROUTE_CACHE_HASH
];
85 // Each IP4 instance has its own route table. Each ServiceBinding
86 // instance has a default route table and default address.
88 // All the route table entries with the same mask are linked
89 // together in one route area. For example, RouteArea[0] contains
90 // the default routes. A route table also contains a route cache.
92 typedef struct _IP4_ROUTE_TABLE IP4_ROUTE_TABLE
;
94 struct _IP4_ROUTE_TABLE
{
97 NET_LIST_ENTRY RouteArea
[IP4_MASK_NUM
];
98 IP4_ROUTE_TABLE
*Next
;
99 IP4_ROUTE_CACHE Cache
;
103 Ip4CreateRouteTable (
109 IN IP4_ROUTE_TABLE
*RouteTable
114 IN IP4_ROUTE_TABLE
*RtTable
,
122 IN IP4_ROUTE_TABLE
*RtTable
,
128 IP4_ROUTE_CACHE_ENTRY
*
130 IN IP4_ROUTE_TABLE
*RtTable
,
136 Ip4FreeRouteCacheEntry (
137 IN IP4_ROUTE_CACHE_ENTRY
*RtCacheEntry
140 IP4_ROUTE_CACHE_ENTRY
*
142 IN IP4_ROUTE_TABLE
*RtTable
,
148 Ip4BuildEfiRouteTable (
149 IN IP4_PROTOCOL
*IpInstance