code scrub ArpDxe

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7113 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jgong5
2008-12-24 05:26:57 +00:00
parent 49a049e6d2
commit 0c323d071d
6 changed files with 488 additions and 305 deletions

View File

@@ -1,22 +1,20 @@
/** @file
/** @file
EFI ARP Protocol Definition
The EFI ARP Service Binding Protocol is used to locate EFI
ARP Protocol drivers to create and destroy child of the
driver to communicate with other host using ARP protocol.
The EFI ARP Protocol provides services to map IP network
address to hardware address used by a data link protocol.
Copyright (c) 2006 - 2008, 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
Copyright (c) 2006 - 2008, Intel Corporation.<BR>
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<BR>
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.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -116,20 +114,31 @@ typedef struct {
/**
Assigns a station address (protocol type and network address) to this instance of the ARP cache.
This function is used to assign a station address to the ARP cache for this instance
of the ARP driver.
Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will
respond to ARP requests that match this registered station address. A call to
this function with the ConfigData field set to NULL will reset this ARP instance.
Once a protocol type and station address have been assigned to this ARP instance,
all the following ARP functions will use this information. Attempting to change
the protocol type or station address to a configured ARP instance will result in errors.
@param This A pointer to the EFI_ARP_PROTOCOL instance.
@param ConfigData A pointer to the EFI_ARP_CONFIG_DATA structure.Buffer
@param This Pointer to the EFI_ARP_PROTOCOL instance.
@param ConfigData Pointer to the EFI_ARP_CONFIG_DATA structure.
@retval EFI_SUCCESS The new station address was successfully registered.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
SwAddressLength is zero when ConfigData is not NULL.
StationAddress is NULL when ConfigData is not NULL.
@retval EFI_ACCESS_DENIED The SwAddressType, SwAddressLength, or
StationAddress is different from the one that is already
registered.
@retval EFI_OUT_OF_RESOURCES Storage for the new StationAddress could not be allocated.
@retval EFI_SUCCESS The new station address was successfully
registered.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. SwAddressLength is zero when
ConfigData is not NULL. StationAddress is NULL
when ConfigData is not NULL.
@retval EFI_ACCESS_DENIED The SwAddressType, SwAddressLength, or
StationAddress is different from the one that is
already registered.
@retval EFI_OUT_OF_RESOURCES Storage for the new StationAddress could not be
allocated.
**/
typedef
@@ -140,31 +149,48 @@ EFI_STATUS
);
/**
Inserts an entry to the ARP cache.
This function is used to insert entries into the ARP cache.
@param This A pointer to the EFI_ARP_PROTOCOL instance.
@param DenyFlag Set to TRUE if this entry is a "deny" entry. Set to FALSE if this
entry is a "normal" entry.
@param TargetSwAddress Pointer to a protocol address to add (or deny). May be set to
NULL if DenyFlag is TRUE.
@param TargetHwAddress Pointer to a hardware address to add (or deny). May be set to
NULL if DenyFlag is TRUE.
@param TimeoutValue Time in 100-ns units that this entry will remain in the ARP
cache. A value of zero means that the entry is permanent. A
nonzero value will override the one given by Configure() if
the entry to be added is dynamic entry.
@param Overwrite If TRUE, the matching cache entry will be overwritten with the
supplied parameters. If FALSE, EFI_ACCESS_DENIED is returned
if the corresponding cache entry already exists.
ARP cache entries are typically inserted and updated by network protocol drivers
as network traffic is processed. Most ARP cache entries will time out and be
deleted if the network traffic stops. ARP cache entries that were inserted
by the Add() function may be static (will not time out) or dynamic (will time out).
Default ARP cache timeout values are not covered in most network protocol
specifications (although RFC 1122 comes pretty close) and will only be
discussed in general in this specification. The timeout values that are
used in the EFI Sample Implementation should be used only as a guideline.
Final product implementations of the EFI network stack should be tuned for
their expected network environments.
@param This Pointer to the EFI_ARP_PROTOCOL instance.
@param DenyFlag Set to TRUE if this entry is a deny entry. Set to
FALSE if this entry is a normal entry.
@param TargetSwAddress Pointer to a protocol address to add (or deny).
May be set to NULL if DenyFlag is TRUE.
@param TargetHwAddress Pointer to a hardware address to add (or deny).
May be set to NULL if DenyFlag is TRUE.
@param TimeoutValue Time in 100-ns units that this entry will remain
in the ARP cache. A value of zero means that the
entry is permanent. A nonzero value will override
the one given by Configure() if the entry to be
added is a dynamic entry.
@param Overwrite If TRUE, the matching cache entry will be
overwritten with the supplied parameters. If
FALSE, EFI_ACCESS_DENIED is returned if the
corresponding cache entry already exists.
@retval EFI_SUCCESS The entry has been added or updated.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. DenyFlag is FALSE and TargetHwAddress is NULL.
DenyFlag is FALSE and TargetSwAddress is NULL. TargetHwAddress is NULL and TargetSwAddress is NULL.
Both TargetSwAddress and TargetHwAddress are not NULL when DenyFlag is TRUE.
@retval EFI_OUT_OF_RESOURCES The new ARP cache entry could not be allocated.
@retval EFI_ACCESS_DENIED The ARP cache entry already exists and Overwrite is not true.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
@retval EFI_SUCCESS The entry has been added or updated.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. DenyFlag is FALSE and
TargetHwAddress is NULL. DenyFlag is FALSE and
TargetSwAddress is NULL. TargetHwAddress is NULL
and TargetSwAddress is NULL. Both TargetSwAddress
and TargetHwAddress are not NULL when DenyFlag is
TRUE.
@retval EFI_OUT_OF_RESOURCES The new ARP cache entry could not be allocated.
@retval EFI_ACCESS_DENIED The ARP cache entry already exists and Overwrite
is not true.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
**/
typedef
@@ -179,27 +205,37 @@ EFI_STATUS
);
/**
Locates one or more entries in the ARP cache.
This function searches the ARP cache for matching entries and allocates a buffer into
which those entries are copied.
The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which
are protocol address pairs and hardware address pairs.
When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer
is not NULL), the ARP cache timeout for the found entry is reset if Refresh is
set to TRUE. If the found ARP cache entry is a permanent entry, it is not
affected by Refresh.
@param This Pointer to the EFI_ARP_PROTOCOL instance.
@param BySwAddress Set to TRUE to look for matching software protocol
addresses. Set to FALSE to look for matching
hardware protocol addresses.
@param AddressBuffer Pointer to address buffer. Set to NULL to match
all addresses.
@param EntryLength The size of an entry in the entries buffer.
@param EntryCount The number of ARP cache entries that are found by
the specified criteria.
@param Entries Pointer to the buffer that will receive the ARP
cache entries.
@param Refresh Set to TRUE to refresh the timeout value of the
matching ARP cache entry.
@param This A pointer to the EFI_ARP_PROTOCOL instance.
@param BySwAddress Set to TRUE to look for matching software protocol addresses.
Set to FALSE to look for matching hardware protocol addresses.
@param AddressBuffer Pointer to address buffer. Set to NULL to match all addresses.
@param EntryLength The size of an entry in the entries buffer. To keep the
EFI_ARP_FIND_DATA structure properly aligned, this field
may be longer than sizeof(EFI_ARP_FIND_DATA) plus
the length of the software and hardware addresses.
@param EntryCount The number of ARP cache entries that are found by the specified criteria.
@param Entries Pointer to the buffer that will receive the ARP cache entries.
@param Refresh Set to TRUE to refresh the timeout value of the matching ARP
cache entry.
@retval EFI_SUCCESS The requested ARP cache entries were copied into the buffer.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. Both EntryCount and EntryLength are NULL,
when Refresh is FALSE.
@retval EFI_NOT_FOUND No matching entries were found.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
@retval EFI_SUCCESS The requested ARP cache entries were copied into
the buffer.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. Both EntryCount and EntryLength are
NULL, when Refresh is FALSE.
@retval EFI_NOT_FOUND No matching entries were found.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
**/
typedef
@@ -216,18 +252,20 @@ EFI_STATUS
/**
Removes entries from the ARP cache.
This function removes specified ARP cache entries.
@param This A pointer to the EFI_ARP_PROTOCOL instance.
@param BySwAddress Set to TRUE to delete matching protocol addresses.
Set to FALSE to delete matching hardware addresses.
@param AddressBuffer Pointer to the address buffer that is used as a key to look for the
cache entry. Set to NULL to delete all entries.
@param This Pointer to the EFI_ARP_PROTOCOL instance.
@param BySwAddress Set to TRUE to delete matching protocol addresses.
Set to FALSE to delete matching hardware
addresses.
@param AddressBuffer Pointer to the address buffer that is used as a
key to look for the cache entry. Set to NULL to
delete all entries.
@retval EFI_SUCCESS The entry was removed from the ARP cache.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NOT_FOUND The specified deletion key was not found.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
@retval EFI_SUCCESS The entry was removed from the ARP cache.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NOT_FOUND The specified deletion key was not found.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
**/
typedef
@@ -239,14 +277,15 @@ EFI_STATUS
);
/**
Removes all dynamic ARP cache entries that were added by this interface.
This function delete all dynamic entries from the ARP cache that match the specified
software protocol type.
@param This A pointer to the EFI_ARP_PROTOCOL instance.
@retval EFI_SUCCESS The cache has been flushed.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NOT_FOUND There are no matching dynamic cache entries.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
@param This Pointer to the EFI_ARP_PROTOCOL instance.
@retval EFI_SUCCESS The cache has been flushed.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_NOT_FOUND There are no matching dynamic cache entries.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
**/
typedef
@@ -256,27 +295,25 @@ EFI_STATUS
);
/**
Starts an ARP request session.
This function tries to resolve the TargetSwAddress and optionally returns a
TargetHwAddress if it already exists in the ARP cache.
@param This A pointer to the EFI_ARP_PROTOCOL instance.
@param TargetSwAddress Pointer to the protocol address to resolve.
@param ResolvedEvent Pointer to the event that will be signaled when the address is
resolved or some error occurs.
@param TargetHwAddress Pointer to the buffer for the resolved hardware address in
network byte order. The buffer must be large enough to hold the
resulting hardware address. TargetHwAddress must not be
NULL.
@param This Pointer to the EFI_ARP_PROTOCOL instance.
@param TargetSwAddress Pointer to the protocol address to resolve.
@param ResolvedEvent Pointer to the event that will be signaled when
the address is resolved or some error occurs.
@param TargetHwAddress Pointer to the buffer for the resolved hardware
address in network byte order.
@retval EFI_SUCCESS The data was copied from the ARP cache into the
TargetHwAddress buffer.
@retval EFI_INVALID_PARAMETER This or TargetHwAddress is NULL.
@retval EFI_ACCESS_DENIED The requested address is not present in the normal ARP cache but
is present in the deny address list. Outgoing traffic to that address is
forbidden.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
@retval EFI_NOT_READY The request has been started and is not finished.
@retval EFI_UNSUPPORTED The requested conversion is not supported in this implementation or
configuration.
@retval EFI_SUCCESS The data is copied from the ARP cache into the
TargetHwAddress buffer.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. TargetHwAddress is NULL.
@retval EFI_ACCESS_DENIED The requested address is not present in the normal
ARP cache but is present in the deny address list.
Outgoing traffic to that address is forbidden.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
@retval EFI_NOT_READY The request has been started and is not finished.
**/
typedef
@@ -289,22 +326,31 @@ EFI_STATUS
);
/**
Cancels an ARP request session.
This function aborts the previous ARP request (identified by This, TargetSwAddress
and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().
If the request is in the internal ARP request queue, the request is aborted
immediately and its ResolvedEvent is signaled. Only an asynchronous address
request needs to be canceled. If TargeSwAddress and ResolveEvent are both
NULL, all the pending asynchronous requests that have been issued by This
instance will be cancelled and their corresponding events will be signaled.
@param This Pointer to the EFI_ARP_PROTOCOL instance.
@param TargetSwAddress Pointer to the protocol address in previous
request session.
@param ResolvedEvent Pointer to the event that is used as the
notification event in previous request session.
@param This A pointer to the EFI_ARP_PROTOCOL instance.
@param TargetSwAddress Pointer to the protocol address in previous request session.
@param ResolvedEvent Pointer to the event that is used as the notification event in
previous request session.
@retval EFI_SUCCESS The pending request session(s) is/are aborted and
corresponding event(s) is/are signaled.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL. TargetSwAddress is not NULL and
ResolvedEvent is NULL. TargetSwAddress is NULL and
ResolvedEvent is not NULL.
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
@retval EFI_NOT_FOUND The request is not issued by
EFI_ARP_PROTOCOL.Request().
@retval EFI_SUCCESS The pending request session(s) is/are aborted and corresponding
event(s) is/are signaled.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
This is NULL.
TargetSwAddress is not NULL and ResolvedEvent is NULL.
TargetSwAddress is NULL and ResolvedEvent is not NULL
@retval EFI_NOT_STARTED The ARP driver instance has not been configured.
@retval EFI_NOT_FOUND The request is not issued by
EFI_ARP_PROTOCOL.Request().
**/
typedef