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