TianoCore EDK2 master
|
#include "Ip4Common.h"
Go to the source code of this file.
Data Structures | |
struct | IP4_ROUTE_ENTRY |
struct | IP4_ROUTE_CACHE_ENTRY |
struct | IP4_ROUTE_CACHE |
struct | _IP4_ROUTE_TABLE |
Macros | |
#define | IP4_DIRECT_ROUTE 0x00000001 |
#define | IP4_ROUTE_CACHE_HASH_VALUE 31 |
#define | IP4_ROUTE_CACHE_MAX 64 |
#define | IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH_VALUE) |
Typedefs | |
typedef struct _IP4_ROUTE_TABLE | IP4_ROUTE_TABLE |
Functions | |
IP4_ROUTE_TABLE * | Ip4CreateRouteTable (VOID) |
VOID | Ip4FreeRouteTable (IN IP4_ROUTE_TABLE *RtTable) |
EFI_STATUS | Ip4AddRoute (IN OUT IP4_ROUTE_TABLE *RtTable, IN IP4_ADDR Dest, IN IP4_ADDR Netmask, IN IP4_ADDR Gateway) |
EFI_STATUS | Ip4DelRoute (IN OUT 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, IN IP4_ADDR SubnetMask, IN BOOLEAN AlwaysTryDestAddr) |
EFI_STATUS | Ip4BuildEfiRouteTable (IN IP4_PROTOCOL *IpInstance) |
EFI IP4 route table and route cache table definitions.
Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Ip4Route.h.
#define IP4_DIRECT_ROUTE 0x00000001 |
Definition at line 14 of file Ip4Route.h.
#define IP4_ROUTE_CACHE_HASH | ( | Dst, | |
Src | |||
) | (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH_VALUE) |
Definition at line 19 of file Ip4Route.h.
#define IP4_ROUTE_CACHE_HASH_VALUE 31 |
Definition at line 16 of file Ip4Route.h.
#define IP4_ROUTE_CACHE_MAX 64 |
Definition at line 17 of file Ip4Route.h.
typedef struct _IP4_ROUTE_TABLE IP4_ROUTE_TABLE |
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.
Definition at line 75 of file Ip4Route.h.
EFI_STATUS Ip4AddRoute | ( | IN OUT IP4_ROUTE_TABLE * | RtTable, |
IN IP4_ADDR | Dest, | ||
IN IP4_ADDR | Netmask, | ||
IN IP4_ADDR | Gateway | ||
) |
Add a route entry to the route table. All the IP4_ADDRs are in host byte order.
[in,out] | RtTable | Route table to add route to |
[in] | Dest | The destination of the network |
[in] | Netmask | The netmask of the destination |
[in] | Gateway | The next hop address |
EFI_ACCESS_DENIED | The same route already exists |
EFI_OUT_OF_RESOURCES | Failed to allocate memory for the entry |
EFI_SUCCESS | The route is added successfully. |
Definition at line 291 of file Ip4Route.c.
EFI_STATUS Ip4BuildEfiRouteTable | ( | IN IP4_PROTOCOL * | IpInstance | ) |
Build a EFI_IP4_ROUTE_TABLE to be returned to the caller of GetModeData. The EFI_IP4_ROUTE_TABLE is clumsy to use in the internal operation of the IP4 driver.
[in] | IpInstance | The IP4 child that requests the route table. |
EFI_SUCCESS | The route table is successfully build |
EFI_OUT_OF_RESOURCES | Failed to allocate the memory for the route table. |
Definition at line 593 of file Ip4Route.c.
IP4_ROUTE_TABLE * Ip4CreateRouteTable | ( | VOID | ) |
Create an empty route table, includes its internal route cache
Definition at line 177 of file Ip4Route.c.
EFI_STATUS Ip4DelRoute | ( | IN OUT IP4_ROUTE_TABLE * | RtTable, |
IN IP4_ADDR | Dest, | ||
IN IP4_ADDR | Netmask, | ||
IN IP4_ADDR | Gateway | ||
) |
Remove a route entry and all the route caches spawn from it.
RtTable | The route table to remove the route from |
Dest | The destination network |
Netmask | The netmask of the Dest |
Gateway | The next hop address |
EFI_SUCCESS | The route entry is successfully removed |
EFI_NOT_FOUND | There is no route entry in the table with that property. |
Definition at line 352 of file Ip4Route.c.
IP4_ROUTE_CACHE_ENTRY * Ip4FindRouteCache | ( | IN IP4_ROUTE_TABLE * | RtTable, |
IN IP4_ADDR | Dest, | ||
IN IP4_ADDR | Src | ||
) |
Find a route cache with the dst and src. This is used by ICMP redirect message process. All kinds of redirect is treated as host redirect according to RFC1122. So, only route cache entries are modified according to the ICMP redirect message.
[in] | RtTable | The route table to search the cache for |
[in] | Dest | The destination address |
[in] | Src | The source address |
Definition at line 397 of file Ip4Route.c.
VOID Ip4FreeRouteCacheEntry | ( | IN IP4_ROUTE_CACHE_ENTRY * | RtCacheEntry | ) |
Free the route cache entry. It is reference counted.
RtCacheEntry | The route cache entry to free. |
Definition at line 113 of file Ip4Route.c.
VOID Ip4FreeRouteTable | ( | IN IP4_ROUTE_TABLE * | RtTable | ) |
Free the route table and its associated route cache. Route table is reference counted.
[in] | RtTable | The route table to free. |
Definition at line 211 of file Ip4Route.c.
IP4_ROUTE_CACHE_ENTRY * Ip4Route | ( | IN IP4_ROUTE_TABLE * | RtTable, |
IN IP4_ADDR | Dest, | ||
IN IP4_ADDR | Src, | ||
IN IP4_ADDR | SubnetMask, | ||
IN BOOLEAN | AlwaysTryDestAddr | ||
) |
Search the route table to route the packet. Return/create a route cache if there is a route to the destination.
[in] | RtTable | The route table to search from |
[in] | Dest | The destination address to search for |
[in] | Src | The source address to search for |
[in] | SubnetMask | The subnet mask of the Src address, this field is used to check if the station is using /32 subnet. |
[in] | AlwaysTryDestAddr | Always try to use the dest address as next hop even though we can't find a matching route entry. This field is only valid when using /32 subnet. |
Definition at line 484 of file Ip4Route.c.