]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/ArpDxe/ArpImpl.h
code scrub ArpDxe
[mirror_edk2.git] / MdeModulePkg / Universal / Network / ArpDxe / ArpImpl.h
index 607443a99e262659c4471102435cf7c183d4ac19..77873dc6744b30109b4dcb831cb52bd69135d50f 100644 (file)
-/** @file
-
-Copyright (c) 2006 - 2007, 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:
-
-  ArpImpl.h
-
-Abstract:
-
-
-**/
-
-#ifndef _ARP_IMPL_H_
-#define _ARP_IMPL_H_
-
-\r
-#include <PiDxe.h>\r
+/** @file\r
+  EFI Address Resolution Protocol (ARP) Protocol interface header file.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation.<BR>\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<BR>\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
+\r
+#ifndef _ARP_IMPL_H_\r
+#define _ARP_IMPL_H_\r
+\r
+\r
+#include <Uefi.h>\r
 \r
 #include <Protocol/Arp.h>\r
-#include <Protocol/ManagedNetwork.h>
+#include <Protocol/ManagedNetwork.h>\r
 #include <Protocol/ServiceBinding.h>\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiLib.h>
-#include <Library/NetLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-
-#include "ArpDebug.h"
-
-#define ARP_ETHER_PROTO_TYPE         0x0806
-#define IPv4_ETHER_PROTO_TYPE        0x0800
-#define IPv6_ETHER_PROTO_TYPE        0x86DD
-
-#define ARP_OPCODE_REQUEST           0x0001
-#define ARP_OPCODE_REPLY             0x0002
-
-#define ARP_DEFAULT_TIMEOUT_VALUE    (400 * TICKS_PER_SECOND)
-#define ARP_DEFAULT_RETRY_COUNT      2
-#define ARP_DEFAULT_RETRY_INTERVAL   (5   * TICKS_PER_MS)
-#define ARP_PERIODIC_TIMER_INTERVAL  (500 * TICKS_PER_MS)
-
-#pragma pack(1)
-typedef struct _ARP_HEAD {
-  UINT16  HwType;
-  UINT16  ProtoType;
-  UINT8   HwAddrLen;
-  UINT8   ProtoAddrLen;
-  UINT16  OpCode;
-} ARP_HEAD;
-#pragma pack()
-
-typedef struct _ARP_ADDRESS {
-  UINT8  *SenderHwAddr;
-  UINT8  *SenderProtoAddr;
-  UINT8  *TargetHwAddr;
-  UINT8  *TargetProtoAddr;
-} ARP_ADDRESS;
-
-#define MATCH_SW_ADDRESS  0x1
-#define MATCH_HW_ADDRESS  0x2
-
-typedef enum {
-  ByNone         = 0,
-  ByProtoAddress = MATCH_SW_ADDRESS,
-  ByHwAddress    = MATCH_HW_ADDRESS,
-  ByBoth         = MATCH_SW_ADDRESS | MATCH_HW_ADDRESS
-} FIND_OPTYPE;
-
-#define ARP_INSTANCE_DATA_SIGNATURE  EFI_SIGNATURE_32('A', 'R', 'P', 'I')
-
-#define ARP_INSTANCE_DATA_FROM_THIS(a) \
-  CR ( \
-  (a), \
-  ARP_INSTANCE_DATA, \
-  ArpProto, \
-  ARP_INSTANCE_DATA_SIGNATURE \
-  )
-
-typedef struct _ARP_SERVICE_DATA  ARP_SERVICE_DATA;
-
-typedef struct _ARP_INSTANCE_DATA {
-  UINT32               Signature;
-  ARP_SERVICE_DATA     *ArpService;
-  EFI_HANDLE           Handle;
-  EFI_ARP_PROTOCOL     ArpProto;
-  NET_LIST_ENTRY       List;
-  EFI_ARP_CONFIG_DATA  ConfigData;
-  BOOLEAN              Configured;
-  BOOLEAN              Destroyed;
-} ARP_INSTANCE_DATA;
-
-#define ARP_SERVICE_DATA_SIGNATURE  EFI_SIGNATURE_32('A', 'R', 'P', 'S')
-
-#define ARP_SERVICE_DATA_FROM_THIS(a) \
-  CR ( \
-  (a), \
-  ARP_SERVICE_DATA, \
-  ServiceBinding, \
-  ARP_SERVICE_DATA_SIGNATURE \
-  )
-
-struct _ARP_SERVICE_DATA {
-  UINT32                           Signature;
-  EFI_SERVICE_BINDING_PROTOCOL     ServiceBinding;
-
-  EFI_HANDLE                       MnpChildHandle;
-  EFI_HANDLE                       ImageHandle;
-  EFI_HANDLE                       ControllerHandle;
-
-  EFI_MANAGED_NETWORK_PROTOCOL          *Mnp;
-  EFI_MANAGED_NETWORK_CONFIG_DATA       MnpConfigData;
-  EFI_MANAGED_NETWORK_COMPLETION_TOKEN  RxToken;
-
-  EFI_SIMPLE_NETWORK_MODE          SnpMode;
-
-  NET_LOCK                         Lock;
-
-  UINTN                            ChildrenNumber;
-  NET_LIST_ENTRY                   ChildrenList;
-
-  NET_LIST_ENTRY                   PendingRequestTable;
-  NET_LIST_ENTRY                   DeniedCacheTable;
-  NET_LIST_ENTRY                   ResolvedCacheTable;
-
-  EFI_EVENT                        PeriodicTimer;
-};
-
-typedef struct _USER_REQUEST_CONTEXT {
-  NET_LIST_ENTRY     List;
-  ARP_INSTANCE_DATA  *Instance;
-  EFI_EVENT          UserRequestEvent;
-  VOID               *UserHwAddrBuffer;
-} USER_REQUEST_CONTEXT;
-
-#define ARP_MAX_PROTOCOL_ADDRESS_LEN  sizeof(EFI_IP_ADDRESS)
-#define ARP_MAX_HARDWARE_ADDRESS_LEN  sizeof(EFI_MAC_ADDRESS)
-
-typedef struct _NET_ARP_ADDRESS {
-  UINT16  Type;
-  UINT8   Length;
-  UINT8   *AddressPtr;
-  union {
-    UINT8  ProtoAddress[ARP_MAX_PROTOCOL_ADDRESS_LEN];
-    UINT8  HwAddress[ARP_MAX_HARDWARE_ADDRESS_LEN];
-  } Buffer;
-} NET_ARP_ADDRESS;
-
-typedef enum {
-  Hardware,
-  Protocol
-} ARP_ADDRESS_TYPE;
-
-typedef struct _ARP_CACHE_ENTRY {
-  NET_LIST_ENTRY  List;
-
-  UINT32          RetryCount;
-  UINT32          DefaultDecayTime;
-  UINT32          DecayTime;
-  UINT32          NextRetryTime;
-
-  NET_ARP_ADDRESS  Addresses[2];
-
-  NET_LIST_ENTRY  UserRequestList;
-} ARP_CACHE_ENTRY;
-
-EFI_STATUS
-EFIAPI
-ArpConfigure (
-  IN EFI_ARP_PROTOCOL     *This,
-  IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL
-  );
-
-EFI_STATUS
-EFIAPI
-ArpAdd (
-  IN EFI_ARP_PROTOCOL  *This,
-  IN BOOLEAN           DenyFlag,
-  IN VOID              *TargetSwAddress OPTIONAL,
-  IN VOID              *TargetHwAddress OPTIONAL,
-  IN UINT32            TimeoutValue,
-  IN BOOLEAN           Overwrite
-  );
-
-EFI_STATUS
-EFIAPI
-ArpFind (
-  IN EFI_ARP_PROTOCOL    *This,
-  IN BOOLEAN             BySwAddress,
-  IN VOID                *AddressBuffer OPTIONAL,
-  OUT UINT32             *EntryLength   OPTIONAL,
-  OUT UINT32             *EntryCount    OPTIONAL,
-  OUT EFI_ARP_FIND_DATA  **Entries      OPTIONAL,
-  IN BOOLEAN             Refresh
-  );
-
-EFI_STATUS
-EFIAPI
-ArpDelete (
-  IN EFI_ARP_PROTOCOL  *This,
-  IN BOOLEAN           BySwAddress,
-  IN VOID              *AddressBuffer OPTIONAL
-  );
-
-EFI_STATUS
-EFIAPI
-ArpFlush (
-  IN EFI_ARP_PROTOCOL  *This
-  );
-
-EFI_STATUS
-EFIAPI
-ArpRequest (
-  IN EFI_ARP_PROTOCOL  *This,
-  IN VOID              *TargetSwAddress OPTIONAL,
-  IN EFI_EVENT         ResolvedEvent    OPTIONAL,
-  OUT VOID             *TargetHwAddress
-  );
-
-EFI_STATUS
-EFIAPI
-ArpCancel (
-  IN EFI_ARP_PROTOCOL  *This,
-  IN VOID              *TargetSwAddress OPTIONAL,
-  IN EFI_EVENT         ResolvedEvent    OPTIONAL
-  );
-
-EFI_STATUS
-ArpConfigureInstance (
-  IN ARP_INSTANCE_DATA    *Instance,
-  IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL
-  );
-
-ARP_CACHE_ENTRY *
-ArpFindDeniedCacheEntry (
-  IN ARP_SERVICE_DATA  *ArpService,
-  IN NET_ARP_ADDRESS   *ProtocolAddress OPTIONAL,
-  IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL
-  );
-
-ARP_CACHE_ENTRY *
-ArpFindNextCacheEntryInTable (
-  IN NET_LIST_ENTRY    *CacheTable,
-  IN NET_LIST_ENTRY    *StartEntry,
-  IN FIND_OPTYPE       FindOpType,
-  IN NET_ARP_ADDRESS   *ProtocolAddress OPTIONAL,
-  IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL
-  );
-
-ARP_CACHE_ENTRY *
-ArpAllocCacheEntry (
-  IN ARP_INSTANCE_DATA  *Instance
-  );
-
-VOID
-ArpFillAddressInCacheEntry (
-  IN ARP_CACHE_ENTRY  *CacheEntry,
-  IN NET_ARP_ADDRESS  *HwAddr OPTIONAL,
-  IN NET_ARP_ADDRESS  *SwAddr OPTIONAL
-  );
-
-UINTN
-ArpAddressResolved (
-  IN ARP_CACHE_ENTRY    *CacheEntry,
-  IN ARP_INSTANCE_DATA  *Instance OPTIONAL,
-  IN EFI_EVENT          UserEvent OPTIONAL
-  );
-
-UINTN
-ArpDeleteCacheEntry (
-  IN ARP_INSTANCE_DATA  *Instance,
-  IN BOOLEAN            BySwAddress,
-  IN UINT8              *AddressBuffer OPTIONAL,
-  IN BOOLEAN            Force
-  );
-
-VOID
-ArpSendFrame (
-  IN ARP_INSTANCE_DATA  *Instance,
-  IN ARP_CACHE_ENTRY    *CacheEntry,
-  IN UINT16             ArpOpCode
-  );
-
-VOID
-ArpInitInstance (
-  IN ARP_SERVICE_DATA   *ArpService,
-  IN ARP_INSTANCE_DATA  *Instance
-  );
-
-VOID
-EFIAPI
-ArpOnFrameRcvd (
-  IN EFI_EVENT  Event,
-  IN VOID       *Context
-  );
-
-VOID
-EFIAPI
-ArpOnFrameSent (
-  IN EFI_EVENT  Event,
-  IN VOID       *Context
-  );
-
-VOID
-EFIAPI
-ArpTimerHandler (
-  IN EFI_EVENT  Event,
-  IN VOID       *Context
-  );
-
-UINTN
-ArpCancelRequest (
-  IN ARP_INSTANCE_DATA  *Instance,
-  IN VOID               *TargetSwAddress OPTIONAL,
-  IN EFI_EVENT          UserEvent        OPTIONAL
-  );
-
-EFI_STATUS
-ArpFindCacheEntry (
-  IN ARP_INSTANCE_DATA   *Instance,
-  IN BOOLEAN             BySwAddress,
-  IN VOID                *AddressBuffer OPTIONAL,
-  OUT UINT32             *EntryLength   OPTIONAL,
-  OUT UINT32             *EntryCount    OPTIONAL,
-  OUT EFI_ARP_FIND_DATA  **Entries      OPTIONAL,
-  IN BOOLEAN             Refresh
-  );
-
-#endif
-
+#include <Library/UefiLib.h>\r
+#include <Library/NetLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+\r
+//\r
+// Ethernet protocol type definitions.\r
+//\r
+#define ARP_ETHER_PROTO_TYPE         0x0806\r
+#define IPV4_ETHER_PROTO_TYPE        0x0800\r
+#define IPV6_ETHER_PROTO_TYPE        0x86DD\r
+\r
+//\r
+// ARP opcode definitions.\r
+//\r
+#define ARP_OPCODE_REQUEST           0x0001\r
+#define ARP_OPCODE_REPLY             0x0002\r
+\r
+//\r
+// ARP timeout, retry count and interval definitions.\r
+//\r
+#define ARP_DEFAULT_TIMEOUT_VALUE    (400 * TICKS_PER_SECOND)\r
+#define ARP_DEFAULT_RETRY_COUNT      2\r
+#define ARP_DEFAULT_RETRY_INTERVAL   (5   * TICKS_PER_MS)\r
+#define ARP_PERIODIC_TIMER_INTERVAL  (500 * TICKS_PER_MS)\r
+\r
+//\r
+// ARP packet head definition.\r
+//\r
+#pragma pack(1)\r
+typedef struct {\r
+  UINT16  HwType;\r
+  UINT16  ProtoType;\r
+  UINT8   HwAddrLen;\r
+  UINT8   ProtoAddrLen;\r
+  UINT16  OpCode;\r
+} ARP_HEAD;\r
+#pragma pack()\r
+\r
+//\r
+// ARP Address definition for internal use.\r
+//\r
+typedef struct {\r
+  UINT8  *SenderHwAddr;\r
+  UINT8  *SenderProtoAddr;\r
+  UINT8  *TargetHwAddr;\r
+  UINT8  *TargetProtoAddr;\r
+} ARP_ADDRESS;\r
+\r
+#define MATCH_SW_ADDRESS  0x1\r
+#define MATCH_HW_ADDRESS  0x2\r
+\r
+//\r
+// Enumeration for the search type. A search type is specified as the keyword to find\r
+// a cache entry in the cache table.\r
+//\r
+typedef enum {\r
+  ByNone         = 0,\r
+  ByProtoAddress = MATCH_SW_ADDRESS,\r
+  ByHwAddress    = MATCH_HW_ADDRESS,\r
+  ByBoth         = MATCH_SW_ADDRESS | MATCH_HW_ADDRESS\r
+} FIND_OPTYPE;\r
+\r
+#define ARP_INSTANCE_DATA_SIGNATURE  SIGNATURE_32('A', 'R', 'P', 'I')\r
+\r
+/**\r
+  Returns a pointer to the ARP_INSTANCE_DATA structure from the input a.\r
+  \r
+  If the signatures matches, then a pointer to the data structure that contains \r
+  a specified field of that data structure is returned.\r
+   \r
+  @param  a              Pointer to the field specified by ArpProto within a data \r
+                         structure of type ARP_INSTANCE_DATA.\r
\r
+**/\r
+#define ARP_INSTANCE_DATA_FROM_THIS(a) \\r
+  CR ( \\r
+  (a), \\r
+  ARP_INSTANCE_DATA, \\r
+  ArpProto, \\r
+  ARP_INSTANCE_DATA_SIGNATURE \\r
+  )\r
+\r
+typedef struct _ARP_SERVICE_DATA  ARP_SERVICE_DATA;\r
+\r
+//\r
+// ARP instance context data structure.\r
+//\r
+typedef struct {\r
+  UINT32               Signature;\r
+  ARP_SERVICE_DATA     *ArpService;\r
+  EFI_HANDLE           Handle;\r
+  EFI_ARP_PROTOCOL     ArpProto;\r
+  LIST_ENTRY           List;\r
+  EFI_ARP_CONFIG_DATA  ConfigData;\r
+  BOOLEAN              Configured;\r
+  BOOLEAN              Destroyed;\r
+} ARP_INSTANCE_DATA;\r
+\r
+#define ARP_SERVICE_DATA_SIGNATURE  SIGNATURE_32('A', 'R', 'P', 'S')\r
+\r
+/**\r
+  Returns a pointer to the ARP_SERVICE_DATA structure from the input a.\r
+  \r
+  If the signatures matches, then a pointer to the data structure that contains \r
+  a specified field of that data structure is returned.\r
+   \r
+  @param  a              Pointer to the field specified by ServiceBinding within \r
+                         a data structure of type ARP_SERVICE_DATA.\r
\r
+**/\r
+#define ARP_SERVICE_DATA_FROM_THIS(a) \\r
+  CR ( \\r
+  (a), \\r
+  ARP_SERVICE_DATA, \\r
+  ServiceBinding, \\r
+  ARP_SERVICE_DATA_SIGNATURE \\r
+  )\r
+\r
+//\r
+// ARP service data structure.\r
+//\r
+struct _ARP_SERVICE_DATA {\r
+  UINT32                           Signature;\r
+  EFI_SERVICE_BINDING_PROTOCOL     ServiceBinding;\r
+\r
+  EFI_HANDLE                       MnpChildHandle;\r
+  EFI_HANDLE                       ImageHandle;\r
+  EFI_HANDLE                       ControllerHandle;\r
+\r
+  EFI_MANAGED_NETWORK_PROTOCOL          *Mnp;\r
+  EFI_MANAGED_NETWORK_CONFIG_DATA       MnpConfigData;\r
+  EFI_MANAGED_NETWORK_COMPLETION_TOKEN  RxToken;\r
+\r
+  EFI_SIMPLE_NETWORK_MODE          SnpMode;\r
+\r
+  UINTN                            ChildrenNumber;\r
+  LIST_ENTRY                       ChildrenList;\r
+\r
+  LIST_ENTRY                       PendingRequestTable;\r
+  LIST_ENTRY                       DeniedCacheTable;\r
+  LIST_ENTRY                       ResolvedCacheTable;\r
+\r
+  EFI_EVENT                        PeriodicTimer;\r
+};\r
+\r
+//\r
+// User request context structure.\r
+//\r
+typedef struct {\r
+  LIST_ENTRY         List;\r
+  ARP_INSTANCE_DATA  *Instance;\r
+  EFI_EVENT          UserRequestEvent;\r
+  VOID               *UserHwAddrBuffer;\r
+} USER_REQUEST_CONTEXT;\r
+\r
+#define ARP_MAX_PROTOCOL_ADDRESS_LEN  sizeof(EFI_IP_ADDRESS)\r
+#define ARP_MAX_HARDWARE_ADDRESS_LEN  sizeof(EFI_MAC_ADDRESS)\r
+\r
+//\r
+// ARP address structure in an ARP packet.\r
+//\r
+typedef struct {\r
+  UINT16  Type;\r
+  UINT8   Length;\r
+  UINT8   *AddressPtr;\r
+  union {\r
+    UINT8  ProtoAddress[ARP_MAX_PROTOCOL_ADDRESS_LEN];\r
+    UINT8  HwAddress[ARP_MAX_HARDWARE_ADDRESS_LEN];\r
+  } Buffer;\r
+} NET_ARP_ADDRESS;\r
+\r
+//\r
+// Enumeration for ARP address type.\r
+//\r
+typedef enum {\r
+  Hardware,\r
+  Protocol\r
+} ARP_ADDRESS_TYPE;\r
+\r
+//\r
+// ARP cache entry definition.\r
+//\r
+typedef struct {\r
+  LIST_ENTRY      List;\r
+\r
+  UINT32          RetryCount;\r
+  UINT32          DefaultDecayTime;\r
+  UINT32          DecayTime;\r
+  UINT32          NextRetryTime;\r
+\r
+  NET_ARP_ADDRESS  Addresses[2];\r
+\r
+  LIST_ENTRY      UserRequestList;\r
+} ARP_CACHE_ENTRY;\r
+\r
+/**\r
+  This function is used to assign a station address to the ARP cache for this instance\r
+  of the ARP driver.\r
+  \r
+  Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will \r
+  respond to ARP requests that match this registered station address. A call to \r
+  this function with the ConfigData field set to NULL will reset this ARP instance.\r
+  \r
+  Once a protocol type and station address have been assigned to this ARP instance, \r
+  all the following ARP functions will use this information. Attempting to change \r
+  the protocol type or station address to a configured ARP instance will result in errors.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  ConfigData             Pointer to the EFI_ARP_CONFIG_DATA structure.\r
+\r
+  @retval EFI_SUCCESS            The new station address was successfully\r
+                                 registered.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. SwAddressLength is zero when\r
+                                 ConfigData is not NULL. StationAddress is NULL\r
+                                 when ConfigData is not NULL.\r
+  @retval EFI_ACCESS_DENIED      The SwAddressType, SwAddressLength, or\r
+                                 StationAddress is different from the one that is\r
+                                 already registered.\r
+  @retval EFI_OUT_OF_RESOURCES   Storage for the new StationAddress could not be\r
+                                 allocated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ArpConfigure (\r
+  IN EFI_ARP_PROTOCOL     *This,\r
+  IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL\r
+  );\r
+\r
+/**\r
+  This function is used to insert entries into the ARP cache.\r
+\r
+  ARP cache entries are typically inserted and updated by network protocol drivers \r
+  as network traffic is processed. Most ARP cache entries will time out and be \r
+  deleted if the network traffic stops. ARP cache entries that were inserted \r
+  by the Add() function may be static (will not time out) or dynamic (will time out).\r
+  Default ARP cache timeout values are not covered in most network protocol \r
+  specifications (although RFC 1122 comes pretty close) and will only be \r
+  discussed in general in this specification. The timeout values that are \r
+  used in the EFI Sample Implementation should be used only as a guideline. \r
+  Final product implementations of the EFI network stack should be tuned for \r
+  their expected network environments.\r
+  \r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  DenyFlag               Set to TRUE if this entry is a deny entry. Set to\r
+                                 FALSE if this  entry is a normal entry.\r
+  @param  TargetSwAddress        Pointer to a protocol address to add (or deny).\r
+                                 May be set to NULL if DenyFlag is TRUE.\r
+  @param  TargetHwAddress        Pointer to a hardware address to add (or deny).\r
+                                 May be set to NULL if DenyFlag is TRUE.\r
+  @param  TimeoutValue           Time in 100-ns units that this entry will remain\r
+                                 in the ARP cache. A value of zero means that the\r
+                                 entry is permanent. A nonzero value will override\r
+                                 the one given by Configure() if the entry to be\r
+                                 added is a dynamic entry.\r
+  @param  Overwrite              If TRUE, the matching cache entry will be\r
+                                 overwritten with the supplied parameters. If\r
+                                 FALSE, EFI_ACCESS_DENIED is returned if the\r
+                                 corresponding cache entry already exists.\r
+\r
+  @retval EFI_SUCCESS            The entry has been added or updated.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. DenyFlag is FALSE and\r
+                                 TargetHwAddress is NULL. DenyFlag is FALSE and\r
+                                 TargetSwAddress is NULL. TargetHwAddress is NULL\r
+                                 and TargetSwAddress is NULL. Both TargetSwAddress\r
+                                 and TargetHwAddress are not NULL when DenyFlag is\r
+                                 TRUE.\r
+  @retval EFI_OUT_OF_RESOURCES   The new ARP cache entry could not be allocated.\r
+  @retval EFI_ACCESS_DENIED      The ARP cache entry already exists and Overwrite\r
+                                 is not true.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ArpAdd (\r
+  IN EFI_ARP_PROTOCOL  *This,\r
+  IN BOOLEAN           DenyFlag,\r
+  IN VOID              *TargetSwAddress OPTIONAL,\r
+  IN VOID              *TargetHwAddress OPTIONAL,\r
+  IN UINT32            TimeoutValue,\r
+  IN BOOLEAN           Overwrite\r
+  );\r
+\r
+/**\r
+  This function searches the ARP cache for matching entries and allocates a buffer into\r
+  which those entries are copied.\r
+  \r
+  The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which \r
+  are protocol address pairs and hardware address pairs.\r
+  When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer \r
+  is not NULL), the ARP cache timeout for the found entry is reset if Refresh is \r
+  set to TRUE. If the found ARP cache entry is a permanent entry, it is not \r
+  affected by Refresh.\r
+  \r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  BySwAddress            Set to TRUE to look for matching software protocol\r
+                                 addresses. Set to FALSE to look for matching\r
+                                 hardware protocol addresses.\r
+  @param  AddressBuffer          Pointer to address buffer. Set to NULL to match\r
+                                 all addresses.\r
+  @param  EntryLength            The size of an entry in the entries buffer.\r
+  @param  EntryCount             The number of ARP cache entries that are found by\r
+                                 the specified criteria.\r
+  @param  Entries                Pointer to the buffer that will receive the ARP\r
+                                 cache entries.\r
+  @param  Refresh                Set to TRUE to refresh the timeout value of the\r
+                                 matching ARP cache entry.\r
+\r
+  @retval EFI_SUCCESS            The requested ARP cache entries were copied into\r
+                                 the buffer.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. Both EntryCount and EntryLength are\r
+                                 NULL, when Refresh is FALSE.\r
+  @retval EFI_NOT_FOUND          No matching entries were found.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ArpFind (\r
+  IN EFI_ARP_PROTOCOL    *This,\r
+  IN BOOLEAN             BySwAddress,\r
+  IN VOID                *AddressBuffer OPTIONAL,\r
+  OUT UINT32             *EntryLength   OPTIONAL,\r
+  OUT UINT32             *EntryCount    OPTIONAL,\r
+  OUT EFI_ARP_FIND_DATA  **Entries      OPTIONAL,\r
+  IN BOOLEAN             Refresh\r
+  );\r
+\r
+/**\r
+  This function removes specified ARP cache entries.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  BySwAddress            Set to TRUE to delete matching protocol addresses.\r
+                                 Set to FALSE to delete matching hardware\r
+                                 addresses.\r
+  @param  AddressBuffer          Pointer to the address buffer that is used as a\r
+                                 key to look for the cache entry. Set to NULL to\r
+                                 delete all entries.\r
+\r
+  @retval EFI_SUCCESS            The entry was removed from the ARP cache.\r
+  @retval EFI_INVALID_PARAMETER  This is NULL.\r
+  @retval EFI_NOT_FOUND          The specified deletion key was not found.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ArpDelete (\r
+  IN EFI_ARP_PROTOCOL  *This,\r
+  IN BOOLEAN           BySwAddress,\r
+  IN VOID              *AddressBuffer OPTIONAL\r
+  );\r
+\r
+/**\r
+  This function delete all dynamic entries from the ARP cache that match the specified\r
+  software protocol type.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS            The cache has been flushed.\r
+  @retval EFI_INVALID_PARAMETER  This is NULL.\r
+  @retval EFI_NOT_FOUND          There are no matching dynamic cache entries.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ArpFlush (\r
+  IN EFI_ARP_PROTOCOL  *This\r
+  );\r
+\r
+/**\r
+  This function tries to resolve the TargetSwAddress and optionally returns a\r
+  TargetHwAddress if it already exists in the ARP cache.\r
+\r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  TargetSwAddress        Pointer to the protocol address to resolve.\r
+  @param  ResolvedEvent          Pointer to the event that will be signaled when\r
+                                 the address is resolved or some error occurs.\r
+  @param  TargetHwAddress        Pointer to the buffer for the resolved hardware\r
+                                 address in network byte order.\r
+\r
+  @retval EFI_SUCCESS            The data is copied from the ARP cache into the\r
+                                 TargetHwAddress buffer.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. TargetHwAddress is NULL.\r
+  @retval EFI_ACCESS_DENIED      The requested address is not present in the normal\r
+                                 ARP cache but is present in the deny address list.\r
+                                 Outgoing traffic to that address is forbidden.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+  @retval EFI_NOT_READY          The request has been started and is not finished.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ArpRequest (\r
+  IN EFI_ARP_PROTOCOL  *This,\r
+  IN VOID              *TargetSwAddress OPTIONAL,\r
+  IN EFI_EVENT         ResolvedEvent    OPTIONAL,\r
+  OUT VOID             *TargetHwAddress\r
+  );\r
+\r
+/**\r
+  This function aborts the previous ARP request (identified by This,  TargetSwAddress\r
+  and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().\r
+  \r
+  If the request is in the internal ARP request queue, the request is aborted \r
+  immediately and its ResolvedEvent is signaled. Only an asynchronous address \r
+  request needs to be canceled. If TargeSwAddress and ResolveEvent are both \r
+  NULL, all the pending asynchronous requests that have been issued by This \r
+  instance will be cancelled and their corresponding events will be signaled.\r
+  \r
+  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  TargetSwAddress        Pointer to the protocol address in previous\r
+                                 request session.\r
+  @param  ResolvedEvent          Pointer to the event that is used as the\r
+                                 notification event in previous request session.\r
+\r
+  @retval EFI_SUCCESS            The pending request session(s) is/are aborted and\r
+                                 corresponding event(s) is/are signaled.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 This is NULL. TargetSwAddress is not NULL and\r
+                                 ResolvedEvent is NULL. TargetSwAddress is NULL and\r
+                                 ResolvedEvent is not NULL.\r
+  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.\r
+  @retval EFI_NOT_FOUND          The request is not issued by\r
+                                 EFI_ARP_PROTOCOL.Request().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ArpCancel (\r
+  IN EFI_ARP_PROTOCOL  *This,\r
+  IN VOID              *TargetSwAddress OPTIONAL,\r
+  IN EFI_EVENT         ResolvedEvent    OPTIONAL\r
+  );\r
+\r
+/**\r
+  Configure the instance using the ConfigData. ConfigData is already validated.\r
+\r
+  @param[in]  Instance           Pointer to the instance context data to be\r
+                                 configured.\r
+  @param[in]  ConfigData         Pointer to the configuration data used to\r
+                                 configure the instance.\r
+\r
+  @retval EFI_SUCCESS            The instance is configured with the ConfigData.\r
+  @retval EFI_ACCESS_DENIED      The instance is already configured and the\r
+                                 ConfigData tries to reset some unchangeable\r
+                                 fields.\r
+  @retval EFI_INVALID_PARAMETER  The ConfigData provides a non-unicast IPv4 address\r
+                                 when the SwAddressType is IPv4.\r
+  @retval EFI_OUT_OF_RESOURCES   The instance fails to configure due to memory\r
+                                 limitation.\r
+\r
+**/\r
+EFI_STATUS\r
+ArpConfigureInstance (\r
+  IN ARP_INSTANCE_DATA    *Instance,\r
+  IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL\r
+  );\r
+\r
+/**\r
+  Find the CacheEntry, using ProtocolAddress or HardwareAddress or both, as the keyword,\r
+  in the DeniedCacheTable.\r
+\r
+  @param[in]  ArpService             Pointer to the arp service context data.\r
+  @param[in]  ProtocolAddress        Pointer to the protocol address.\r
+  @param[in]  HardwareAddress        Pointer to the hardware address.\r
+\r
+  @return Pointer to the matched cache entry, if NULL no match is found.\r
+\r
+**/\r
+ARP_CACHE_ENTRY *\r
+ArpFindDeniedCacheEntry (\r
+  IN ARP_SERVICE_DATA  *ArpService,\r
+  IN NET_ARP_ADDRESS   *ProtocolAddress OPTIONAL,\r
+  IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL\r
+  );\r
+\r
+/**\r
+  Find the CacheEntry which matches the requirements in the specified CacheTable.\r
+\r
+  @param[in]  CacheTable             Pointer to the arp cache table.\r
+  @param[in]  StartEntry             Pointer to the start entry this search begins with\r
+                                     in the cache table.\r
+  @param[in]  FindOpType             The search type.\r
+  @param[in]  ProtocolAddress        Pointer to the protocol address to match.\r
+  @param[in]  HardwareAddress        Pointer to the hardware address to match.\r
+\r
+  @return Pointer to the matched arp cache entry, if NULL, no match is found.\r
+\r
+**/\r
+ARP_CACHE_ENTRY *\r
+ArpFindNextCacheEntryInTable (\r
+  IN LIST_ENTRY        *CacheTable,\r
+  IN LIST_ENTRY        *StartEntry,\r
+  IN FIND_OPTYPE       FindOpType,\r
+  IN NET_ARP_ADDRESS   *ProtocolAddress OPTIONAL,\r
+  IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL\r
+  );\r
+\r
+/**\r
+  Allocate a cache entry and initialize it.\r
+\r
+  @param[in]  Instance               Pointer to the instance context data.\r
+\r
+  @return Pointer to the new created cache entry.\r
+\r
+**/\r
+ARP_CACHE_ENTRY *\r
+ArpAllocCacheEntry (\r
+  IN ARP_INSTANCE_DATA  *Instance\r
+  );\r
+\r
+/**\r
+  Fill the addresses in the CacheEntry using the information passed in by\r
+  HwAddr and SwAddr.\r
+\r
+  @param[in]  CacheEntry             Pointer to the cache entry.\r
+  @param[in]  HwAddr                 Pointer to the software address.\r
+  @param[in]  SwAddr                 Pointer to the hardware address.\r
+\r
+  @return None.\r
+\r
+**/\r
+VOID\r
+ArpFillAddressInCacheEntry (\r
+  IN ARP_CACHE_ENTRY  *CacheEntry,\r
+  IN NET_ARP_ADDRESS  *HwAddr OPTIONAL,\r
+  IN NET_ARP_ADDRESS  *SwAddr OPTIONAL\r
+  );\r
+\r
+/**\r
+  Turn the CacheEntry into the resolved status.\r
+\r
+  @param[in]  CacheEntry             Pointer to the resolved cache entry.\r
+  @param[in]  Instance               Pointer to the instance context data.\r
+  @param[in]  UserEvent              Pointer to the UserEvent to notify.\r
+\r
+  @return The count of notifications sent to the instance.\r
+\r
+**/\r
+UINTN\r
+ArpAddressResolved (\r
+  IN ARP_CACHE_ENTRY    *CacheEntry,\r
+  IN ARP_INSTANCE_DATA  *Instance OPTIONAL,\r
+  IN EFI_EVENT          UserEvent OPTIONAL\r
+  );\r
+\r
+/**\r
+  Delete cache entries in all the cache tables.\r
+\r
+  @param[in]  Instance               Pointer to the instance context data.\r
+  @param[in]  BySwAddress            Delete the cache entry by software address or by\r
+                                     hardware address.\r
+  @param[in]  AddressBuffer          Pointer to the buffer containing the address to\r
+                                     match for the deletion.\r
+  @param[in]  Force                  This deletion is forced or not.\r
+\r
+  @return The count of the deleted cache entries.\r
+\r
+**/\r
+UINTN\r
+ArpDeleteCacheEntry (\r
+  IN ARP_INSTANCE_DATA  *Instance,\r
+  IN BOOLEAN            BySwAddress,\r
+  IN UINT8              *AddressBuffer OPTIONAL,\r
+  IN BOOLEAN            Force\r
+  );\r
+\r
+/**\r
+  Send out an arp frame using the CachEntry and the ArpOpCode.\r
+\r
+  @param[in]  Instance               Pointer to the instance context data.\r
+  @param[in]  CacheEntry             Pointer to the configuration data used to\r
+                                     configure the instance.\r
+  @param[in]  ArpOpCode              The opcode used to send out this Arp frame, either\r
+                                     request or reply.\r
+\r
+  @return None.\r
+\r
+**/\r
+VOID\r
+ArpSendFrame (\r
+  IN ARP_INSTANCE_DATA  *Instance,\r
+  IN ARP_CACHE_ENTRY    *CacheEntry,\r
+  IN UINT16             ArpOpCode\r
+  );\r
+\r
+/**\r
+  Initialize the instance context data.\r
+\r
+  @param[in]   ArpService        Pointer to the arp service context data this\r
+                                 instance belongs to.\r
+  @param[out]  Instance          Pointer to the instance context data.\r
+\r
+  @return None.\r
+\r
+**/\r
+VOID\r
+ArpInitInstance (\r
+  IN  ARP_SERVICE_DATA   *ArpService,\r
+  OUT ARP_INSTANCE_DATA  *Instance\r
+  );\r
+\r
+/**\r
+  Process the Arp packets received from Mnp, the procedure conforms to RFC826.\r
+\r
+  @param[in]  Context            Pointer to the context data registerd to the\r
+                                 Event.\r
+\r
+  @return None.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ArpOnFrameRcvdDpc (\r
+  IN VOID       *Context\r
+  );\r
+\r
+/**\r
+  Queue ArpOnFrameRcvdDpc as a DPC at TPL_CALLBACK.\r
+\r
+  @param[in]  Event                  The Event this notify function registered to.\r
+  @param[in]  Context                Pointer to the context data registerd to the\r
+                                     Event.\r
+\r
+  @return None.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ArpOnFrameRcvd (\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
+  );\r
+\r
+/**\r
+  Process the already sent arp packets.\r
+  \r
+  @param[in]  Context                Pointer to the context data registerd to the\r
+                                     Event.\r
+\r
+  @return None.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ArpOnFrameSentDpc (\r
+  IN VOID       *Context\r
+  );\r
+\r
+/**\r
+  Request ArpOnFrameSentDpc as a DPC at TPL_CALLBACK.\r
+\r
+  @param[in]  Event                  The Event this notify function registered to.\r
+  @param[in]  Context                Pointer to the context data registerd to the\r
+                                     Event.\r
+\r
+  @return None.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ArpOnFrameSent (\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
+  );\r
+\r
+/**\r
+  Process the arp cache olding and drive the retrying arp requests.\r
+\r
+  @param[in]  Event                  The Event this notify function registered to.\r
+  @param[in]  Context                Pointer to the context data registerd to the\r
+                                     Event.\r
+\r
+  @return None.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ArpTimerHandler (\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
+  );\r
+\r
+/**\r
+  Cancel the arp request.\r
+\r
+  @param[in]  Instance               Pointer to the instance context data.\r
+  @param[in]  TargetSwAddress        Pointer to the buffer containing the target\r
+                                     software address to match the arp request.\r
+  @param[in]  UserEvent              The user event used to notify this request\r
+                                     cancellation.\r
+\r
+  @return The count of the cancelled requests.\r
+\r
+**/\r
+UINTN\r
+ArpCancelRequest (\r
+  IN ARP_INSTANCE_DATA  *Instance,\r
+  IN VOID               *TargetSwAddress OPTIONAL,\r
+  IN EFI_EVENT          UserEvent        OPTIONAL\r
+  );\r
+\r
+/**\r
+  Find the cache entry in the cache table.\r
+\r
+  @param[in]  Instance           Pointer to the instance context data.\r
+  @param[in]  BySwAddress        Set to TRUE to look for matching software protocol\r
+                                 addresses. Set to FALSE to look for matching\r
+                                 hardware protocol addresses.\r
+  @param[in]  AddressBuffer      Pointer to address buffer. Set to NULL to match\r
+                                 all addresses.\r
+  @param[out] EntryLength        The size of an entry in the entries buffer.\r
+  @param[out] EntryCount         The number of ARP cache entries that are found by\r
+                                 the specified criteria.\r
+  @param[out] Entries            Pointer to the buffer that will receive the ARP\r
+                                 cache entries.\r
+  @param[in]  Refresh            Set to TRUE to refresh the timeout value of the\r
+                                 matching ARP cache entry.\r
+\r
+  @retval EFI_SUCCESS            The requested ARP cache entries are copied into\r
+                                 the buffer.\r
+  @retval EFI_NOT_FOUND          No matching entries found.\r
+  @retval EFI_OUT_OF_RESOURCE    There is a memory allocation failure.\r
+\r
+**/\r
+EFI_STATUS\r
+ArpFindCacheEntry (\r
+  IN ARP_INSTANCE_DATA   *Instance,\r
+  IN BOOLEAN             BySwAddress,\r
+  IN VOID                *AddressBuffer OPTIONAL,\r
+  OUT UINT32             *EntryLength   OPTIONAL,\r
+  OUT UINT32             *EntryCount    OPTIONAL,\r
+  OUT EFI_ARP_FIND_DATA  **Entries      OPTIONAL,\r
+  IN BOOLEAN             Refresh\r
+  );\r
+\r
+#endif\r