-/** @file
-
-Copyright (c) 2005 - 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name:
-
- Ip4Route.h
-
-Abstract:
-
- EFI IP4 route table and route cache table defintions.
-
-
-**/
-
-#ifndef __EFI_IP4_ROUTE_H__
-#define __EFI_IP4_ROUTE_H__
-
-#include "IP4Common.h"
-
-enum {
- IP4_DIRECT_ROUTE = 0x00000001,
-
- IP4_ROUTE_CACHE_HASH = 31,
- IP4_ROUTE_CACHE_MAX = 64 // Max NO. of cache entry per hash bucket
-};
-
-#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)
-
-//
-// The route entry in the route table. Dest/Netmask is the destion
-// network. The nexthop is the gateway to send the packet to in
-// order to reach the Dest/Netmask. If the Flag has IP4_DIRECT_ROUTE
-// on, the gateway is the destination of the IP packet itself. Route
-// enties of the connected network have the flag on.
-//
-typedef struct {
- NET_LIST_ENTRY Link;
- INTN RefCnt;
- IP4_ADDR Dest;
- IP4_ADDR Netmask;
- IP4_ADDR NextHop;
- UINT32 Flag;
-} IP4_ROUTE_ENTRY;
-
-//
-// The route cache entry. The route cache entry is optional.
-// But it is necessary to support the ICMP redirect message.
-// Check Ip4ProcessIcmpRedirect for information.
-//
-// The cache entry field Tag is used to tag all the route
-// cache entry spawned from a route table entry. This makes
-// it simple to delete all the route cache entries from a
-// to-be-deleted route entry.
-//
-typedef struct {
- NET_LIST_ENTRY Link;
- INTN RefCnt;
- IP4_ADDR Dest;
- IP4_ADDR Src;
- IP4_ADDR NextHop;
- UINTN Tag;
-} IP4_ROUTE_CACHE_ENTRY;
-
-//
-// The route cache table is organized as a hash table. Each
-// IP4 route table has a embedded route cache. For now the
-// route cache and route table are binded togehter. But keep
-// the route cache a seperated structure in case we want to
-// detach them later.
-//
-typedef struct {
- NET_LIST_ENTRY CacheBucket[IP4_ROUTE_CACHE_HASH];
-} IP4_ROUTE_CACHE;
-
-//
-// Each IP4 instance has its own route table. Each ServiceBinding
-// instance has a default route table and default address.
-//
-// All the route table entries with the same mask are linked
-// together in one route area. For example, RouteArea[0] contains
-// the default routes. A route table also contains a route cache.
-//
-typedef struct _IP4_ROUTE_TABLE IP4_ROUTE_TABLE;
-
-struct _IP4_ROUTE_TABLE {
- INTN RefCnt;
- UINT32 TotalNum;
- NET_LIST_ENTRY RouteArea[IP4_MASK_NUM];
- IP4_ROUTE_TABLE *Next;
- IP4_ROUTE_CACHE Cache;
-};
-
-IP4_ROUTE_TABLE*
-Ip4CreateRouteTable (
- VOID
- );
-
-VOID
-Ip4FreeRouteTable (
- IN IP4_ROUTE_TABLE *RouteTable
- );
-
-EFI_STATUS
-Ip4AddRoute (
- IN IP4_ROUTE_TABLE *RtTable,
- IN IP4_ADDR Dest,
- IN IP4_ADDR Netmask,
- IN IP4_ADDR Gateway
- );
-
-EFI_STATUS
-Ip4DelRoute (
- IN IP4_ROUTE_TABLE *RtTable,
- IN IP4_ADDR Dest,
- IN IP4_ADDR Netmask,
- IN IP4_ADDR Gateway
- );
-
-IP4_ROUTE_CACHE_ENTRY *
-Ip4FindRouteCache (
- IN IP4_ROUTE_TABLE *RtTable,
- IN IP4_ADDR Dest,
- IN IP4_ADDR Src
- );
-
-VOID
-Ip4FreeRouteCacheEntry (
- IN IP4_ROUTE_CACHE_ENTRY *RtCacheEntry
- );
-
-IP4_ROUTE_CACHE_ENTRY *
-Ip4Route (
- IN IP4_ROUTE_TABLE *RtTable,
- IN IP4_ADDR Dest,
- IN IP4_ADDR Src
- );
-
-EFI_STATUS
-Ip4BuildEfiRouteTable (
- IN IP4_PROTOCOL *IpInstance
- );
-#endif
+/** @file\r
+\r
+Copyright (c) 2005 - 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+\r
+Module Name:\r
+\r
+ Ip4Route.h\r
+\r
+Abstract:\r
+\r
+ EFI IP4 route table and route cache table defintions.\r
+\r
+\r
+**/\r
+\r
+#ifndef __EFI_IP4_ROUTE_H__\r
+#define __EFI_IP4_ROUTE_H__\r
+\r
+#include "Ip4Common.h"\r
+\r
+typedef enum {\r
+ IP4_DIRECT_ROUTE = 0x00000001,\r
+\r
+ IP4_ROUTE_CACHE_HASH = 31,\r
+ IP4_ROUTE_CACHE_MAX = 64 // Max NO. of cache entry per hash bucket\r
+} IP4_ROUTE_ENUM_TYPES;\r
+\r
+#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)\r
+\r
+///\r
+/// The route entry in the route table. Dest/Netmask is the destion\r
+/// network. The nexthop is the gateway to send the packet to in\r
+/// order to reach the Dest/Netmask. If the Flag has IP4_DIRECT_ROUTE\r
+/// on, the gateway is the destination of the IP packet itself. Route\r
+/// enties of the connected network have the flag on.\r
+///\r
+typedef struct {\r
+ LIST_ENTRY Link;\r
+ INTN RefCnt;\r
+ IP4_ADDR Dest;\r
+ IP4_ADDR Netmask;\r
+ IP4_ADDR NextHop;\r
+ UINT32 Flag;\r
+} IP4_ROUTE_ENTRY;\r
+\r
+///\r
+/// The route cache entry. The route cache entry is optional.\r
+/// But it is necessary to support the ICMP redirect message.\r
+/// Check Ip4ProcessIcmpRedirect for information.\r
+///\r
+/// The cache entry field Tag is used to tag all the route\r
+/// cache entry spawned from a route table entry. This makes\r
+/// it simple to delete all the route cache entries from a\r
+/// to-be-deleted route entry.\r
+///\r
+typedef struct {\r
+ LIST_ENTRY Link;\r
+ INTN RefCnt;\r
+ IP4_ADDR Dest;\r
+ IP4_ADDR Src;\r
+ IP4_ADDR NextHop;\r
+ UINTN Tag;\r
+} IP4_ROUTE_CACHE_ENTRY;\r
+\r
+///\r
+/// The route cache table is organized as a hash table. Each\r
+/// IP4 route table has a embedded route cache. For now the\r
+/// route cache and route table are binded togehter. But keep\r
+/// the route cache a seperated structure in case we want to\r
+/// detach them later.\r
+///\r
+typedef struct {\r
+ LIST_ENTRY CacheBucket[IP4_ROUTE_CACHE_HASH];\r
+} IP4_ROUTE_CACHE;\r
+\r
+///\r
+/// Each IP4 instance has its own route table. Each ServiceBinding\r
+/// instance has a default route table and default address.\r
+///\r
+/// All the route table entries with the same mask are linked\r
+/// together in one route area. For example, RouteArea[0] contains\r
+/// the default routes. A route table also contains a route cache.\r
+///\r
+typedef struct _IP4_ROUTE_TABLE IP4_ROUTE_TABLE;\r
+\r
+struct _IP4_ROUTE_TABLE {\r
+ INTN RefCnt;\r
+ UINT32 TotalNum;\r
+ LIST_ENTRY RouteArea[IP4_MASK_NUM];\r
+ IP4_ROUTE_TABLE *Next;\r
+ IP4_ROUTE_CACHE Cache;\r
+};\r
+\r
+IP4_ROUTE_TABLE*\r
+Ip4CreateRouteTable (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+Ip4FreeRouteTable (\r
+ IN IP4_ROUTE_TABLE *RouteTable\r
+ );\r
+\r
+EFI_STATUS\r
+Ip4AddRoute (\r
+ IN IP4_ROUTE_TABLE *RtTable,\r
+ IN IP4_ADDR Dest,\r
+ IN IP4_ADDR Netmask,\r
+ IN IP4_ADDR Gateway\r
+ );\r
+\r
+EFI_STATUS\r
+Ip4DelRoute (\r
+ IN IP4_ROUTE_TABLE *RtTable,\r
+ IN IP4_ADDR Dest,\r
+ IN IP4_ADDR Netmask,\r
+ IN IP4_ADDR Gateway\r
+ );\r
+\r
+IP4_ROUTE_CACHE_ENTRY *\r
+Ip4FindRouteCache (\r
+ IN IP4_ROUTE_TABLE *RtTable,\r
+ IN IP4_ADDR Dest,\r
+ IN IP4_ADDR Src\r
+ );\r
+\r
+VOID\r
+Ip4FreeRouteCacheEntry (\r
+ IN IP4_ROUTE_CACHE_ENTRY *RtCacheEntry\r
+ );\r
+\r
+IP4_ROUTE_CACHE_ENTRY *\r
+Ip4Route (\r
+ IN IP4_ROUTE_TABLE *RtTable,\r
+ IN IP4_ADDR Dest,\r
+ IN IP4_ADDR Src\r
+ );\r
+\r
+EFI_STATUS\r
+Ip4BuildEfiRouteTable (\r
+ IN IP4_PROTOCOL *IpInstance\r
+ );\r
+#endif\r