183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang/** @file
20c323d071d8951fe0c8f41fad08939722d436b12jgong  EFI Address Resolution Protocol (ARP) Protocol interface header file.
383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
4216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfuCopyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5e5eed7d3641d71d7ea539e5379ea9c6a5cd97004hhtianThis program and the accompanying materials
683cbd279b64f3081af5c06d50fa26e15a99fc066qhuangare licensed and made available under the terms and conditions of the BSD License
7c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgongwhich accompanies this distribution.  The full text of the license may be found at<BR>
883cbd279b64f3081af5c06d50fa26e15a99fc066qhuanghttp://opensource.org/licenses/bsd-license.php
983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
1083cbd279b64f3081af5c06d50fa26e15a99fc066qhuangTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
1183cbd279b64f3081af5c06d50fa26e15a99fc066qhuangWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
1283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
1383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang**/
1483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
1583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#ifndef _ARP_IMPL_H_
1683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define _ARP_IMPL_H_
1783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
18772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff
190c323d071d8951fe0c8f41fad08939722d436b12jgong#include <Uefi.h>
20772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff
21772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff#include <Protocol/Arp.h>
2283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#include <Protocol/ManagedNetwork.h>
23772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff#include <Protocol/ServiceBinding.h>
24772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff
25772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff#include <Library/DebugLib.h>
26772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff#include <Library/UefiDriverEntryPoint.h>
27772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff#include <Library/UefiBootServicesTableLib.h>
2883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#include <Library/UefiLib.h>
2983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#include <Library/NetLib.h>
3083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#include <Library/BaseLib.h>
3183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#include <Library/BaseMemoryLib.h>
3283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#include <Library/MemoryAllocationLib.h>
33d8d26fb207e02aa5ef57e2bcb213f9dda16166ccmdkinney#include <Library/DpcLib.h>
3483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
350c323d071d8951fe0c8f41fad08939722d436b12jgong//
360c323d071d8951fe0c8f41fad08939722d436b12jgong// Ethernet protocol type definitions.
370c323d071d8951fe0c8f41fad08939722d436b12jgong//
3883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_ETHER_PROTO_TYPE         0x0806
397bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff#define IPV4_ETHER_PROTO_TYPE        0x0800
407bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff#define IPV6_ETHER_PROTO_TYPE        0x86DD
4183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
420c323d071d8951fe0c8f41fad08939722d436b12jgong//
430c323d071d8951fe0c8f41fad08939722d436b12jgong// ARP opcode definitions.
440c323d071d8951fe0c8f41fad08939722d436b12jgong//
4583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_OPCODE_REQUEST           0x0001
4683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_OPCODE_REPLY             0x0002
4783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
480c323d071d8951fe0c8f41fad08939722d436b12jgong//
490c323d071d8951fe0c8f41fad08939722d436b12jgong// ARP timeout, retry count and interval definitions.
500c323d071d8951fe0c8f41fad08939722d436b12jgong//
5183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_DEFAULT_TIMEOUT_VALUE    (400 * TICKS_PER_SECOND)
5283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_DEFAULT_RETRY_COUNT      2
5383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_DEFAULT_RETRY_INTERVAL   (5   * TICKS_PER_MS)
5483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_PERIODIC_TIMER_INTERVAL  (500 * TICKS_PER_MS)
5583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
560c323d071d8951fe0c8f41fad08939722d436b12jgong//
570c323d071d8951fe0c8f41fad08939722d436b12jgong// ARP packet head definition.
580c323d071d8951fe0c8f41fad08939722d436b12jgong//
5983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#pragma pack(1)
60c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgongtypedef struct {
6183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT16  HwType;
6283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT16  ProtoType;
6383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT8   HwAddrLen;
6483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT8   ProtoAddrLen;
6583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT16  OpCode;
6683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang} ARP_HEAD;
6783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#pragma pack()
6883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
690c323d071d8951fe0c8f41fad08939722d436b12jgong//
700c323d071d8951fe0c8f41fad08939722d436b12jgong// ARP Address definition for internal use.
710c323d071d8951fe0c8f41fad08939722d436b12jgong//
72c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgongtypedef struct {
7383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT8  *SenderHwAddr;
7483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT8  *SenderProtoAddr;
7583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT8  *TargetHwAddr;
7683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT8  *TargetProtoAddr;
7783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang} ARP_ADDRESS;
7883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
7983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define MATCH_SW_ADDRESS  0x1
8083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define MATCH_HW_ADDRESS  0x2
8183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
820c323d071d8951fe0c8f41fad08939722d436b12jgong//
830c323d071d8951fe0c8f41fad08939722d436b12jgong// Enumeration for the search type. A search type is specified as the keyword to find
840c323d071d8951fe0c8f41fad08939722d436b12jgong// a cache entry in the cache table.
850c323d071d8951fe0c8f41fad08939722d436b12jgong//
8683cbd279b64f3081af5c06d50fa26e15a99fc066qhuangtypedef enum {
8783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ByNone         = 0,
8883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ByProtoAddress = MATCH_SW_ADDRESS,
8983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ByHwAddress    = MATCH_HW_ADDRESS,
9083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ByBoth         = MATCH_SW_ADDRESS | MATCH_HW_ADDRESS
9183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang} FIND_OPTYPE;
9283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
93f3f2e05db8c89628498ec4efdb16184747824c63qhuang#define ARP_INSTANCE_DATA_SIGNATURE  SIGNATURE_32('A', 'R', 'P', 'I')
9483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
950c323d071d8951fe0c8f41fad08939722d436b12jgong/**
960c323d071d8951fe0c8f41fad08939722d436b12jgong  Returns a pointer to the ARP_INSTANCE_DATA structure from the input a.
970c323d071d8951fe0c8f41fad08939722d436b12jgong
980c323d071d8951fe0c8f41fad08939722d436b12jgong  If the signatures matches, then a pointer to the data structure that contains
990c323d071d8951fe0c8f41fad08939722d436b12jgong  a specified field of that data structure is returned.
1000c323d071d8951fe0c8f41fad08939722d436b12jgong
1010c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  a              Pointer to the field specified by ArpProto within a data
1020c323d071d8951fe0c8f41fad08939722d436b12jgong                         structure of type ARP_INSTANCE_DATA.
1030c323d071d8951fe0c8f41fad08939722d436b12jgong
1040c323d071d8951fe0c8f41fad08939722d436b12jgong**/
10583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_INSTANCE_DATA_FROM_THIS(a) \
10683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  CR ( \
10783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  (a), \
10883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ARP_INSTANCE_DATA, \
10983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ArpProto, \
11083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ARP_INSTANCE_DATA_SIGNATURE \
11183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  )
11283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
11383cbd279b64f3081af5c06d50fa26e15a99fc066qhuangtypedef struct _ARP_SERVICE_DATA  ARP_SERVICE_DATA;
11483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
1150c323d071d8951fe0c8f41fad08939722d436b12jgong//
1160c323d071d8951fe0c8f41fad08939722d436b12jgong// ARP instance context data structure.
1170c323d071d8951fe0c8f41fad08939722d436b12jgong//
118c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgongtypedef struct {
11983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT32               Signature;
12083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ARP_SERVICE_DATA     *ArpService;
12183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_HANDLE           Handle;
12283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_ARP_PROTOCOL     ArpProto;
123e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  LIST_ENTRY           List;
12483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_ARP_CONFIG_DATA  ConfigData;
12583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  BOOLEAN              Configured;
126216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu  BOOLEAN              InDestroy;
12783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang} ARP_INSTANCE_DATA;
12883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
129f3f2e05db8c89628498ec4efdb16184747824c63qhuang#define ARP_SERVICE_DATA_SIGNATURE  SIGNATURE_32('A', 'R', 'P', 'S')
13083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
1310c323d071d8951fe0c8f41fad08939722d436b12jgong/**
1320c323d071d8951fe0c8f41fad08939722d436b12jgong  Returns a pointer to the ARP_SERVICE_DATA structure from the input a.
1330c323d071d8951fe0c8f41fad08939722d436b12jgong
1340c323d071d8951fe0c8f41fad08939722d436b12jgong  If the signatures matches, then a pointer to the data structure that contains
1350c323d071d8951fe0c8f41fad08939722d436b12jgong  a specified field of that data structure is returned.
1360c323d071d8951fe0c8f41fad08939722d436b12jgong
1370c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  a              Pointer to the field specified by ServiceBinding within
1380c323d071d8951fe0c8f41fad08939722d436b12jgong                         a data structure of type ARP_SERVICE_DATA.
1390c323d071d8951fe0c8f41fad08939722d436b12jgong
1400c323d071d8951fe0c8f41fad08939722d436b12jgong**/
14183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_SERVICE_DATA_FROM_THIS(a) \
14283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  CR ( \
14383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  (a), \
14483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ARP_SERVICE_DATA, \
14583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ServiceBinding, \
14683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ARP_SERVICE_DATA_SIGNATURE \
14783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  )
14883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
1490c323d071d8951fe0c8f41fad08939722d436b12jgong//
1500c323d071d8951fe0c8f41fad08939722d436b12jgong// ARP service data structure.
1510c323d071d8951fe0c8f41fad08939722d436b12jgong//
15283cbd279b64f3081af5c06d50fa26e15a99fc066qhuangstruct _ARP_SERVICE_DATA {
15383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT32                           Signature;
15483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_SERVICE_BINDING_PROTOCOL     ServiceBinding;
15583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
15683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_HANDLE                       MnpChildHandle;
15783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_HANDLE                       ImageHandle;
15883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_HANDLE                       ControllerHandle;
15983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
16083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_MANAGED_NETWORK_PROTOCOL          *Mnp;
16183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_MANAGED_NETWORK_CONFIG_DATA       MnpConfigData;
16283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_MANAGED_NETWORK_COMPLETION_TOKEN  RxToken;
16383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
16483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_SIMPLE_NETWORK_MODE          SnpMode;
16583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
16683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINTN                            ChildrenNumber;
167e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  LIST_ENTRY                       ChildrenList;
16883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
169e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  LIST_ENTRY                       PendingRequestTable;
170e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  LIST_ENTRY                       DeniedCacheTable;
171e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  LIST_ENTRY                       ResolvedCacheTable;
17283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
17383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_EVENT                        PeriodicTimer;
17483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang};
17583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
1760c323d071d8951fe0c8f41fad08939722d436b12jgong//
1770c323d071d8951fe0c8f41fad08939722d436b12jgong// User request context structure.
1780c323d071d8951fe0c8f41fad08939722d436b12jgong//
179c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgongtypedef struct {
180e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  LIST_ENTRY         List;
18183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  ARP_INSTANCE_DATA  *Instance;
18283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  EFI_EVENT          UserRequestEvent;
18383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  VOID               *UserHwAddrBuffer;
18483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang} USER_REQUEST_CONTEXT;
18583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
18683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_MAX_PROTOCOL_ADDRESS_LEN  sizeof(EFI_IP_ADDRESS)
18783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#define ARP_MAX_HARDWARE_ADDRESS_LEN  sizeof(EFI_MAC_ADDRESS)
18883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
189f6b7393ceb34c9b3a27434268bf2ce517047641ftyetypedef union {
190f6b7393ceb34c9b3a27434268bf2ce517047641ftye  UINT8  ProtoAddress[ARP_MAX_PROTOCOL_ADDRESS_LEN];
191f6b7393ceb34c9b3a27434268bf2ce517047641ftye  UINT8  HwAddress[ARP_MAX_HARDWARE_ADDRESS_LEN];
192f6b7393ceb34c9b3a27434268bf2ce517047641ftye} NET_ARP_ADDRESS_UNION;
193f6b7393ceb34c9b3a27434268bf2ce517047641ftye
1940c323d071d8951fe0c8f41fad08939722d436b12jgong//
1950c323d071d8951fe0c8f41fad08939722d436b12jgong// ARP address structure in an ARP packet.
1960c323d071d8951fe0c8f41fad08939722d436b12jgong//
197c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgongtypedef struct {
198f6b7393ceb34c9b3a27434268bf2ce517047641ftye  UINT16                Type;
199f6b7393ceb34c9b3a27434268bf2ce517047641ftye  UINT8                 Length;
200f6b7393ceb34c9b3a27434268bf2ce517047641ftye  UINT8                 *AddressPtr;
201f6b7393ceb34c9b3a27434268bf2ce517047641ftye  NET_ARP_ADDRESS_UNION Buffer;
20283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang} NET_ARP_ADDRESS;
20383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
2040c323d071d8951fe0c8f41fad08939722d436b12jgong//
2050c323d071d8951fe0c8f41fad08939722d436b12jgong// Enumeration for ARP address type.
2060c323d071d8951fe0c8f41fad08939722d436b12jgong//
20783cbd279b64f3081af5c06d50fa26e15a99fc066qhuangtypedef enum {
20883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  Hardware,
20983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  Protocol
21083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang} ARP_ADDRESS_TYPE;
21183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
2120c323d071d8951fe0c8f41fad08939722d436b12jgong//
2130c323d071d8951fe0c8f41fad08939722d436b12jgong// ARP cache entry definition.
2140c323d071d8951fe0c8f41fad08939722d436b12jgong//
215c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgongtypedef struct {
216e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  LIST_ENTRY      List;
21783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
21883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT32          RetryCount;
21983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT32          DefaultDecayTime;
22083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT32          DecayTime;
22183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  UINT32          NextRetryTime;
22283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
22383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  NET_ARP_ADDRESS  Addresses[2];
22483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
225e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  LIST_ENTRY      UserRequestList;
22683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang} ARP_CACHE_ENTRY;
22783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
2287bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
2297bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  This function is used to assign a station address to the ARP cache for this instance
2300c323d071d8951fe0c8f41fad08939722d436b12jgong  of the ARP driver.
2310c323d071d8951fe0c8f41fad08939722d436b12jgong
2320c323d071d8951fe0c8f41fad08939722d436b12jgong  Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will
2330c323d071d8951fe0c8f41fad08939722d436b12jgong  respond to ARP requests that match this registered station address. A call to
2340c323d071d8951fe0c8f41fad08939722d436b12jgong  this function with the ConfigData field set to NULL will reset this ARP instance.
235c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong
236c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  Once a protocol type and station address have been assigned to this ARP instance,
237c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  all the following ARP functions will use this information. Attempting to change
238c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  the protocol type or station address to a configured ARP instance will result in errors.
239c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong
2400c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.
2410c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  ConfigData             Pointer to the EFI_ARP_CONFIG_DATA structure.
2427bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
2437bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_SUCCESS            The new station address was successfully
2447bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 registered.
2457bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:
2467bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 This is NULL. SwAddressLength is zero when
2477bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 ConfigData is not NULL. StationAddress is NULL
2487bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 when ConfigData is not NULL.
2497bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_ACCESS_DENIED      The SwAddressType, SwAddressLength, or
2507bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 StationAddress is different from the one that is
2517bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 already registered.
2527bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_OUT_OF_RESOURCES   Storage for the new StationAddress could not be
2537bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 allocated.
2547bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
2557bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
25683cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFI_STATUS
25783cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
25883cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpConfigure (
25983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_ARP_PROTOCOL     *This,
26083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL
26183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
26283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
2637bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
2647bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  This function is used to insert entries into the ARP cache.
2657bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
266c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  ARP cache entries are typically inserted and updated by network protocol drivers
267c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  as network traffic is processed. Most ARP cache entries will time out and be
268c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  deleted if the network traffic stops. ARP cache entries that were inserted
269c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  by the Add() function may be static (will not time out) or dynamic (will time out).
270c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  Default ARP cache timeout values are not covered in most network protocol
271c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  specifications (although RFC 1122 comes pretty close) and will only be
272c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  discussed in general in this specification. The timeout values that are
273c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  used in the EFI Sample Implementation should be used only as a guideline.
274c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  Final product implementations of the EFI network stack should be tuned for
275c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  their expected network environments.
276c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong
2770c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.
2780c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  DenyFlag               Set to TRUE if this entry is a deny entry. Set to
2797bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 FALSE if this  entry is a normal entry.
2800c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  TargetSwAddress        Pointer to a protocol address to add (or deny).
2817bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 May be set to NULL if DenyFlag is TRUE.
2820c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  TargetHwAddress        Pointer to a hardware address to add (or deny).
2837bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 May be set to NULL if DenyFlag is TRUE.
2840c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  TimeoutValue           Time in 100-ns units that this entry will remain
2857bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 in the ARP cache. A value of zero means that the
2867bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 entry is permanent. A nonzero value will override
2877bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 the one given by Configure() if the entry to be
2887bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 added is a dynamic entry.
2890c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  Overwrite              If TRUE, the matching cache entry will be
2907bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 overwritten with the supplied parameters. If
2917bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 FALSE, EFI_ACCESS_DENIED is returned if the
2927bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 corresponding cache entry already exists.
2937bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
2947bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_SUCCESS            The entry has been added or updated.
2957bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:
2967bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 This is NULL. DenyFlag is FALSE and
2977bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 TargetHwAddress is NULL. DenyFlag is FALSE and
2987bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 TargetSwAddress is NULL. TargetHwAddress is NULL
2997bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 and TargetSwAddress is NULL. Both TargetSwAddress
3007bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 and TargetHwAddress are not NULL when DenyFlag is
3017bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 TRUE.
3027bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_OUT_OF_RESOURCES   The new ARP cache entry could not be allocated.
3037bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_ACCESS_DENIED      The ARP cache entry already exists and Overwrite
3047bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 is not true.
3057bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.
3067bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
3077bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
30883cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFI_STATUS
30983cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
31083cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpAdd (
31183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_ARP_PROTOCOL  *This,
31283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN BOOLEAN           DenyFlag,
31383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID              *TargetSwAddress OPTIONAL,
31483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID              *TargetHwAddress OPTIONAL,
31583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN UINT32            TimeoutValue,
31683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN BOOLEAN           Overwrite
31783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
31883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
3197bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
3207bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  This function searches the ARP cache for matching entries and allocates a buffer into
3217bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  which those entries are copied.
322c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong
323c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which
324c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  are protocol address pairs and hardware address pairs.
325c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer
326c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  is not NULL), the ARP cache timeout for the found entry is reset if Refresh is
327c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  set to TRUE. If the found ARP cache entry is a permanent entry, it is not
328c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  affected by Refresh.
329c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong
3300c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.
3310c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  BySwAddress            Set to TRUE to look for matching software protocol
3327bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 addresses. Set to FALSE to look for matching
3337bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 hardware protocol addresses.
3340c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  AddressBuffer          Pointer to address buffer. Set to NULL to match
3357bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 all addresses.
3360c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  EntryLength            The size of an entry in the entries buffer.
3370c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  EntryCount             The number of ARP cache entries that are found by
3387bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 the specified criteria.
3390c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  Entries                Pointer to the buffer that will receive the ARP
3407bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 cache entries.
3410c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  Refresh                Set to TRUE to refresh the timeout value of the
3427bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 matching ARP cache entry.
3437bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
3447bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_SUCCESS            The requested ARP cache entries were copied into
3457bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 the buffer.
3467bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:
3477bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 This is NULL. Both EntryCount and EntryLength are
3487bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 NULL, when Refresh is FALSE.
3497bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_FOUND          No matching entries were found.
3507bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.
3517bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
3527bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
35383cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFI_STATUS
35483cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
35583cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpFind (
35683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_ARP_PROTOCOL    *This,
35783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN BOOLEAN             BySwAddress,
35883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID                *AddressBuffer OPTIONAL,
35983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  OUT UINT32             *EntryLength   OPTIONAL,
36083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  OUT UINT32             *EntryCount    OPTIONAL,
36183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  OUT EFI_ARP_FIND_DATA  **Entries      OPTIONAL,
36283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN BOOLEAN             Refresh
36383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
36483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
3657bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
3667bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  This function removes specified ARP cache entries.
3677bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
3680c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.
3690c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  BySwAddress            Set to TRUE to delete matching protocol addresses.
3707bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 Set to FALSE to delete matching hardware
3717bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 addresses.
3720c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  AddressBuffer          Pointer to the address buffer that is used as a
3737bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 key to look for the cache entry. Set to NULL to
3747bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 delete all entries.
3757bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
3767bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_SUCCESS            The entry was removed from the ARP cache.
3777bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_INVALID_PARAMETER  This is NULL.
3787bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_FOUND          The specified deletion key was not found.
3797bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.
3807bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
3817bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
38283cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFI_STATUS
38383cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
38483cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpDelete (
38583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_ARP_PROTOCOL  *This,
38683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN BOOLEAN           BySwAddress,
38783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID              *AddressBuffer OPTIONAL
38883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
38983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
3907bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
3917bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  This function delete all dynamic entries from the ARP cache that match the specified
3927bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  software protocol type.
3937bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
3940c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.
3957bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
3967bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_SUCCESS            The cache has been flushed.
3977bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_INVALID_PARAMETER  This is NULL.
3987bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_FOUND          There are no matching dynamic cache entries.
3997bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.
4007bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
4017bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
40283cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFI_STATUS
40383cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
40483cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpFlush (
40583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_ARP_PROTOCOL  *This
40683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
40783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
4087bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
4097bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  This function tries to resolve the TargetSwAddress and optionally returns a
4107bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  TargetHwAddress if it already exists in the ARP cache.
4117bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
4120c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.
4130c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  TargetSwAddress        Pointer to the protocol address to resolve.
4140c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  ResolvedEvent          Pointer to the event that will be signaled when
4157bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 the address is resolved or some error occurs.
4160c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  TargetHwAddress        Pointer to the buffer for the resolved hardware
4177bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 address in network byte order.
4187bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
4197bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_SUCCESS            The data is copied from the ARP cache into the
4207bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 TargetHwAddress buffer.
4217bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:
4227bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 This is NULL. TargetHwAddress is NULL.
4237bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_ACCESS_DENIED      The requested address is not present in the normal
4247bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 ARP cache but is present in the deny address list.
4257bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 Outgoing traffic to that address is forbidden.
4267bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.
4277bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_READY          The request has been started and is not finished.
4287bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
4297bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
43083cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFI_STATUS
43183cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
43283cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpRequest (
43383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_ARP_PROTOCOL  *This,
43483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID              *TargetSwAddress OPTIONAL,
43583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_EVENT         ResolvedEvent    OPTIONAL,
43683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  OUT VOID             *TargetHwAddress
43783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
43883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
4397bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
4407bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  This function aborts the previous ARP request (identified by This,  TargetSwAddress
4417bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().
442c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong
443c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  If the request is in the internal ARP request queue, the request is aborted
444c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  immediately and its ResolvedEvent is signaled. Only an asynchronous address
445c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  request needs to be canceled. If TargeSwAddress and ResolveEvent are both
446c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  NULL, all the pending asynchronous requests that have been issued by This
447c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  instance will be cancelled and their corresponding events will be signaled.
448c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong
4490c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  This                   Pointer to the EFI_ARP_PROTOCOL instance.
4500c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  TargetSwAddress        Pointer to the protocol address in previous
4517bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 request session.
4520c323d071d8951fe0c8f41fad08939722d436b12jgong  @param  ResolvedEvent          Pointer to the event that is used as the
4537bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 notification event in previous request session.
4547bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
4557bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_SUCCESS            The pending request session(s) is/are aborted and
4567bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 corresponding event(s) is/are signaled.
4577bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:
4587bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 This is NULL. TargetSwAddress is not NULL and
4597bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 ResolvedEvent is NULL. TargetSwAddress is NULL and
4607bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 ResolvedEvent is not NULL.
4617bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_STARTED        The ARP driver instance has not been configured.
4627bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_FOUND          The request is not issued by
4637bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 EFI_ARP_PROTOCOL.Request().
4647bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
4657bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
46683cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFI_STATUS
46783cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
46883cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpCancel (
46983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_ARP_PROTOCOL  *This,
47083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID              *TargetSwAddress OPTIONAL,
47183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_EVENT         ResolvedEvent    OPTIONAL
47283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
47383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
4747bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
4757bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Configure the instance using the ConfigData. ConfigData is already validated.
4767bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
477c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Instance           Pointer to the instance context data to be
4787bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 configured.
479c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  ConfigData         Pointer to the configuration data used to
4807bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 configure the instance.
4817bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
4827bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_SUCCESS            The instance is configured with the ConfigData.
4837bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_ACCESS_DENIED      The instance is already configured and the
4847bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 ConfigData tries to reset some unchangeable
4857bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 fields.
4867bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_INVALID_PARAMETER  The ConfigData provides a non-unicast IPv4 address
4877bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 when the SwAddressType is IPv4.
4887bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_OUT_OF_RESOURCES   The instance fails to configure due to memory
4897bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 limitation.
4907bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
4917bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
49283cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFI_STATUS
49383cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpConfigureInstance (
49483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_INSTANCE_DATA    *Instance,
49583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_ARP_CONFIG_DATA  *ConfigData OPTIONAL
49683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
49783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
4987bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
4997bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Find the CacheEntry, using ProtocolAddress or HardwareAddress or both, as the keyword,
5007bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  in the DeniedCacheTable.
5017bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
502c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  ArpService             Pointer to the arp service context data.
503c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  ProtocolAddress        Pointer to the protocol address.
504c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  HardwareAddress        Pointer to the hardware address.
5057bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5067bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return Pointer to the matched cache entry, if NULL no match is found.
5077bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5087bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
50983cbd279b64f3081af5c06d50fa26e15a99fc066qhuangARP_CACHE_ENTRY *
51083cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpFindDeniedCacheEntry (
51183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_SERVICE_DATA  *ArpService,
51283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN NET_ARP_ADDRESS   *ProtocolAddress OPTIONAL,
51383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL
51483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
51583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
5167bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
5177bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Find the CacheEntry which matches the requirements in the specified CacheTable.
5187bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
519c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  CacheTable             Pointer to the arp cache table.
520c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  StartEntry             Pointer to the start entry this search begins with
521c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     in the cache table.
522c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  FindOpType             The search type.
523c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  ProtocolAddress        Pointer to the protocol address to match.
524c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  HardwareAddress        Pointer to the hardware address to match.
5257bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5267bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return Pointer to the matched arp cache entry, if NULL, no match is found.
5277bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5287bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
52983cbd279b64f3081af5c06d50fa26e15a99fc066qhuangARP_CACHE_ENTRY *
53083cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpFindNextCacheEntryInTable (
531e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  IN LIST_ENTRY        *CacheTable,
532e48e37fce2611df7a52aff271835ff72ee396d9bvanjeff  IN LIST_ENTRY        *StartEntry,
53383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN FIND_OPTYPE       FindOpType,
53483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN NET_ARP_ADDRESS   *ProtocolAddress OPTIONAL,
53583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN NET_ARP_ADDRESS   *HardwareAddress OPTIONAL
53683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
53783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
5387bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
5397bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Allocate a cache entry and initialize it.
5407bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
541c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Instance               Pointer to the instance context data.
5427bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5437bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return Pointer to the new created cache entry.
5447bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5457bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
54683cbd279b64f3081af5c06d50fa26e15a99fc066qhuangARP_CACHE_ENTRY *
54783cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpAllocCacheEntry (
54883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_INSTANCE_DATA  *Instance
54983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
55083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
5517bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
5527bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Fill the addresses in the CacheEntry using the information passed in by
5537bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  HwAddr and SwAddr.
5547bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
555c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  CacheEntry             Pointer to the cache entry.
556c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  HwAddr                 Pointer to the software address.
557c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  SwAddr                 Pointer to the hardware address.
5587bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5597bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return None.
5607bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5617bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
56283cbd279b64f3081af5c06d50fa26e15a99fc066qhuangVOID
56383cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpFillAddressInCacheEntry (
56483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_CACHE_ENTRY  *CacheEntry,
56583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN NET_ARP_ADDRESS  *HwAddr OPTIONAL,
56683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN NET_ARP_ADDRESS  *SwAddr OPTIONAL
56783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
56883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
5697bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
5707bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Turn the CacheEntry into the resolved status.
5717bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
572c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  CacheEntry             Pointer to the resolved cache entry.
573c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Instance               Pointer to the instance context data.
574c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  UserEvent              Pointer to the UserEvent to notify.
5757bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5767bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return The count of notifications sent to the instance.
5777bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5787bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
57983cbd279b64f3081af5c06d50fa26e15a99fc066qhuangUINTN
58083cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpAddressResolved (
58183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_CACHE_ENTRY    *CacheEntry,
58283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_INSTANCE_DATA  *Instance OPTIONAL,
58383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_EVENT          UserEvent OPTIONAL
58483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
58583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
5867bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
5877bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Delete cache entries in all the cache tables.
5887bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
589c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Instance               Pointer to the instance context data.
590c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  BySwAddress            Delete the cache entry by software address or by
591c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     hardware address.
592c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  AddressBuffer          Pointer to the buffer containing the address to
593c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     match for the deletion.
594c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Force                  This deletion is forced or not.
5957bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5967bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return The count of the deleted cache entries.
5977bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
5987bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
59983cbd279b64f3081af5c06d50fa26e15a99fc066qhuangUINTN
60083cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpDeleteCacheEntry (
60183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_INSTANCE_DATA  *Instance,
60283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN BOOLEAN            BySwAddress,
60383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN UINT8              *AddressBuffer OPTIONAL,
60483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN BOOLEAN            Force
60583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
60683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
6077bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
6087bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Send out an arp frame using the CachEntry and the ArpOpCode.
6097bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
610c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Instance               Pointer to the instance context data.
611c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  CacheEntry             Pointer to the configuration data used to
612c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     configure the instance.
613c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  ArpOpCode              The opcode used to send out this Arp frame, either
614c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     request or reply.
6157bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6167bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return None.
6177bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6187bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
61983cbd279b64f3081af5c06d50fa26e15a99fc066qhuangVOID
62083cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpSendFrame (
62183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_INSTANCE_DATA  *Instance,
62283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_CACHE_ENTRY    *CacheEntry,
62383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN UINT16             ArpOpCode
62483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
62583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
6267bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
6277bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Initialize the instance context data.
6287bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6290c323d071d8951fe0c8f41fad08939722d436b12jgong  @param[in]   ArpService        Pointer to the arp service context data this
6300c323d071d8951fe0c8f41fad08939722d436b12jgong                                 instance belongs to.
6310c323d071d8951fe0c8f41fad08939722d436b12jgong  @param[out]  Instance          Pointer to the instance context data.
6327bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6337bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return None.
6347bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6357bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
63683cbd279b64f3081af5c06d50fa26e15a99fc066qhuangVOID
63783cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpInitInstance (
6380c323d071d8951fe0c8f41fad08939722d436b12jgong  IN  ARP_SERVICE_DATA   *ArpService,
6390c323d071d8951fe0c8f41fad08939722d436b12jgong  OUT ARP_INSTANCE_DATA  *Instance
64083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
64183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
6427bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
6437bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Process the Arp packets received from Mnp, the procedure conforms to RFC826.
6447bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
645c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Context            Pointer to the context data registerd to the
6467bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 Event.
6477bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6487bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return None.
6497bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6507bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
65183cbd279b64f3081af5c06d50fa26e15a99fc066qhuangVOID
65283cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
65336ee91ca3661d3d020a7841aacbf858d885c4728vanjeffArpOnFrameRcvdDpc (
65436ee91ca3661d3d020a7841aacbf858d885c4728vanjeff  IN VOID       *Context
65536ee91ca3661d3d020a7841aacbf858d885c4728vanjeff  );
65636ee91ca3661d3d020a7841aacbf858d885c4728vanjeff
6577bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
6587bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Queue ArpOnFrameRcvdDpc as a DPC at TPL_CALLBACK.
6597bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
660c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Event                  The Event this notify function registered to.
661c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Context                Pointer to the context data registerd to the
662c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     Event.
6637bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6647bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return None.
6657bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6667bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
66736ee91ca3661d3d020a7841aacbf858d885c4728vanjeffVOID
66836ee91ca3661d3d020a7841aacbf858d885c4728vanjeffEFIAPI
66983cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpOnFrameRcvd (
67083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_EVENT  Event,
67183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID       *Context
67283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
67383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
6747bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
6757bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Process the already sent arp packets.
6760c323d071d8951fe0c8f41fad08939722d436b12jgong
677c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Context                Pointer to the context data registerd to the
678c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     Event.
6797bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6807bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return None.
6817bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6827bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
68383cbd279b64f3081af5c06d50fa26e15a99fc066qhuangVOID
68483cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
68536ee91ca3661d3d020a7841aacbf858d885c4728vanjeffArpOnFrameSentDpc (
68636ee91ca3661d3d020a7841aacbf858d885c4728vanjeff  IN VOID       *Context
68736ee91ca3661d3d020a7841aacbf858d885c4728vanjeff  );
68836ee91ca3661d3d020a7841aacbf858d885c4728vanjeff
6897bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
6900c323d071d8951fe0c8f41fad08939722d436b12jgong  Request ArpOnFrameSentDpc as a DPC at TPL_CALLBACK.
6917bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
692c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Event                  The Event this notify function registered to.
693c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Context                Pointer to the context data registerd to the
694c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     Event.
6957bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6967bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return None.
6977bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
6987bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
69936ee91ca3661d3d020a7841aacbf858d885c4728vanjeffVOID
70036ee91ca3661d3d020a7841aacbf858d885c4728vanjeffEFIAPI
70183cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpOnFrameSent (
70283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_EVENT  Event,
70383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID       *Context
70483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
70583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
7067bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
7077bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Process the arp cache olding and drive the retrying arp requests.
7087bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
709c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Event                  The Event this notify function registered to.
710c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Context                Pointer to the context data registerd to the
711c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     Event.
7127bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
7137bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return None.
7147bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
7157bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
71683cbd279b64f3081af5c06d50fa26e15a99fc066qhuangVOID
71783cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFIAPI
71883cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpTimerHandler (
71983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_EVENT  Event,
72083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID       *Context
72183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
72283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
7237bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
7247bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Cancel the arp request.
7257bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
726c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Instance               Pointer to the instance context data.
727c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  TargetSwAddress        Pointer to the buffer containing the target
728c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     software address to match the arp request.
729c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  UserEvent              The user event used to notify this request
730c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong                                     cancellation.
7317bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
7327bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @return The count of the cancelled requests.
7337bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
7347bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
73583cbd279b64f3081af5c06d50fa26e15a99fc066qhuangUINTN
73683cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpCancelRequest (
73783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_INSTANCE_DATA  *Instance,
73883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID               *TargetSwAddress OPTIONAL,
73983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN EFI_EVENT          UserEvent        OPTIONAL
74083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
74183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
7427bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff/**
7437bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  Find the cache entry in the cache table.
7447bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
745c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Instance           Pointer to the instance context data.
746c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  BySwAddress        Set to TRUE to look for matching software protocol
7477bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 addresses. Set to FALSE to look for matching
7487bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 hardware protocol addresses.
749c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  AddressBuffer      Pointer to address buffer. Set to NULL to match
7507bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 all addresses.
751c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[out] EntryLength        The size of an entry in the entries buffer.
752c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[out] EntryCount         The number of ARP cache entries that are found by
7537bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 the specified criteria.
754c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[out] Entries            Pointer to the buffer that will receive the ARP
7557bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 cache entries.
756c6d0ee4b41589bcf5806b457bb3de596d455d4a1jgong  @param[in]  Refresh            Set to TRUE to refresh the timeout value of the
7577bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 matching ARP cache entry.
7587bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
7597bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_SUCCESS            The requested ARP cache entries are copied into
7607bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff                                 the buffer.
7617bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_NOT_FOUND          No matching entries found.
7627bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff  @retval EFI_OUT_OF_RESOURCE    There is a memory allocation failure.
7637bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff
7647bce0c5a0eb806a55d7231b05769d0efc71cdc59vanjeff**/
76583cbd279b64f3081af5c06d50fa26e15a99fc066qhuangEFI_STATUS
76683cbd279b64f3081af5c06d50fa26e15a99fc066qhuangArpFindCacheEntry (
76783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN ARP_INSTANCE_DATA   *Instance,
76883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN BOOLEAN             BySwAddress,
76983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN VOID                *AddressBuffer OPTIONAL,
77083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  OUT UINT32             *EntryLength   OPTIONAL,
77183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  OUT UINT32             *EntryCount    OPTIONAL,
77283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  OUT EFI_ARP_FIND_DATA  **Entries      OPTIONAL,
77383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  IN BOOLEAN             Refresh
77483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang  );
77583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang
77683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang#endif
777