Path: blob/main/sys/contrib/edk2/Include/Protocol/Arp.h
96339 views
/** @file1EFI ARP Protocol Definition23The EFI ARP Service Binding Protocol is used to locate EFI4ARP Protocol drivers to create and destroy child of the5driver to communicate with other host using ARP protocol.6The EFI ARP Protocol provides services to map IP network7address to hardware address used by a data link protocol.89Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>10SPDX-License-Identifier: BSD-2-Clause-Patent1112@par Revision Reference:13This Protocol was introduced in UEFI Specification 2.0.1415**/1617#ifndef __EFI_ARP_PROTOCOL_H__18#define __EFI_ARP_PROTOCOL_H__1920#define EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID \21{ \220xf44c00ee, 0x1f2c, 0x4a00, {0xaa, 0x9, 0x1c, 0x9f, 0x3e, 0x8, 0x0, 0xa3 } \23}2425#define EFI_ARP_PROTOCOL_GUID \26{ \270xf4b427bb, 0xba21, 0x4f16, {0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c } \28}2930typedef struct _EFI_ARP_PROTOCOL EFI_ARP_PROTOCOL;3132typedef struct {33///34/// Length in bytes of this entry.35///36UINT32 Size;3738///39/// Set to TRUE if this entry is a "deny" entry.40/// Set to FALSE if this entry is a "normal" entry.41///42BOOLEAN DenyFlag;4344///45/// Set to TRUE if this entry will not time out.46/// Set to FALSE if this entry will time out.47///48BOOLEAN StaticFlag;4950///51/// 16-bit ARP hardware identifier number.52///53UINT16 HwAddressType;5455///56/// 16-bit protocol type number.57///58UINT16 SwAddressType;5960///61/// The length of the hardware address.62///63UINT8 HwAddressLength;6465///66/// The length of the protocol address.67///68UINT8 SwAddressLength;69} EFI_ARP_FIND_DATA;7071typedef struct {72///73/// 16-bit protocol type number in host byte order.74///75UINT16 SwAddressType;7677///78/// The length in bytes of the station's protocol address to register.79///80UINT8 SwAddressLength;8182///83/// The pointer to the first byte of the protocol address to register. For84/// example, if SwAddressType is 0x0800 (IP), then85/// StationAddress points to the first byte of this station's IP86/// address stored in network byte order.87///88VOID *StationAddress;8990///91/// The timeout value in 100-ns units that is associated with each92/// new dynamic ARP cache entry. If it is set to zero, the value is93/// implementation-specific.94///95UINT32 EntryTimeOut;9697///98/// The number of retries before a MAC address is resolved. If it is99/// set to zero, the value is implementation-specific.100///101UINT32 RetryCount;102103///104/// The timeout value in 100-ns units that is used to wait for the ARP105/// reply packet or the timeout value between two retries. Set to zero106/// to use implementation-specific value.107///108UINT32 RetryTimeOut;109} EFI_ARP_CONFIG_DATA;110111/**112This function is used to assign a station address to the ARP cache for this instance113of the ARP driver.114115Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will116respond to ARP requests that match this registered station address. A call to117this function with the ConfigData field set to NULL will reset this ARP instance.118119Once a protocol type and station address have been assigned to this ARP instance,120all the following ARP functions will use this information. Attempting to change121the protocol type or station address to a configured ARP instance will result in errors.122123@param This The pointer to the EFI_ARP_PROTOCOL instance.124@param ConfigData The pointer to the EFI_ARP_CONFIG_DATA structure.125126@retval EFI_SUCCESS The new station address was successfully127registered.128@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:129* This is NULL.130* SwAddressLength is zero when ConfigData is not NULL.131* StationAddress is NULL when ConfigData is not NULL.132@retval EFI_ACCESS_DENIED The SwAddressType, SwAddressLength, or133StationAddress is different from the one that is134already registered.135@retval EFI_OUT_OF_RESOURCES Storage for the new StationAddress could not be136allocated.137138**/139typedef140EFI_STATUS141(EFIAPI *EFI_ARP_CONFIGURE)(142IN EFI_ARP_PROTOCOL *This,143IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL144);145146/**147This function is used to insert entries into the ARP cache.148149ARP cache entries are typically inserted and updated by network protocol drivers150as network traffic is processed. Most ARP cache entries will time out and be151deleted if the network traffic stops. ARP cache entries that were inserted152by the Add() function may be static (will not time out) or dynamic (will time out).153Default ARP cache timeout values are not covered in most network protocol154specifications (although RFC 1122 comes pretty close) and will only be155discussed in general terms in this specification. The timeout values that are156used in the EFI Sample Implementation should be used only as a guideline.157Final product implementations of the EFI network stack should be tuned for158their expected network environments.159160@param This Pointer to the EFI_ARP_PROTOCOL instance.161@param DenyFlag Set to TRUE if this entry is a deny entry. Set to162FALSE if this entry is a normal entry.163@param TargetSwAddress Pointer to a protocol address to add (or deny).164May be set to NULL if DenyFlag is TRUE.165@param TargetHwAddress Pointer to a hardware address to add (or deny).166May be set to NULL if DenyFlag is TRUE.167@param TimeoutValue Time in 100-ns units that this entry will remain168in the ARP cache. A value of zero means that the169entry is permanent. A nonzero value will override170the one given by Configure() if the entry to be171added is a dynamic entry.172@param Overwrite If TRUE, the matching cache entry will be173overwritten with the supplied parameters. If174FALSE, EFI_ACCESS_DENIED is returned if the175corresponding cache entry already exists.176177@retval EFI_SUCCESS The entry has been added or updated.178@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:179* This is NULL.180* DenyFlag is FALSE and TargetHwAddress is NULL.181* DenyFlag is FALSE and TargetSwAddress is NULL.182* TargetHwAddress is NULL and TargetSwAddress is NULL.183* Neither TargetSwAddress nor TargetHwAddress are NULL when DenyFlag is184TRUE.185@retval EFI_OUT_OF_RESOURCES The new ARP cache entry could not be allocated.186@retval EFI_ACCESS_DENIED The ARP cache entry already exists and Overwrite187is not true.188@retval EFI_NOT_STARTED The ARP driver instance has not been configured.189190**/191typedef192EFI_STATUS193(EFIAPI *EFI_ARP_ADD)(194IN EFI_ARP_PROTOCOL *This,195IN BOOLEAN DenyFlag,196IN VOID *TargetSwAddress OPTIONAL,197IN VOID *TargetHwAddress OPTIONAL,198IN UINT32 TimeoutValue,199IN BOOLEAN Overwrite200);201202/**203This function searches the ARP cache for matching entries and allocates a buffer into204which those entries are copied.205206The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which207are protocol address pairs and hardware address pairs.208When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer209is not NULL), the ARP cache timeout for the found entry is reset if Refresh is210set to TRUE. If the found ARP cache entry is a permanent entry, it is not211affected by Refresh.212213@param This The pointer to the EFI_ARP_PROTOCOL instance.214@param BySwAddress Set to TRUE to look for matching software protocol215addresses. Set to FALSE to look for matching216hardware protocol addresses.217@param AddressBuffer The pointer to the address buffer. Set to NULL218to match all addresses.219@param EntryLength The size of an entry in the entries buffer.220@param EntryCount The number of ARP cache entries that are found by221the specified criteria.222@param Entries The pointer to the buffer that will receive the ARP223cache entries.224@param Refresh Set to TRUE to refresh the timeout value of the225matching ARP cache entry.226227@retval EFI_SUCCESS The requested ARP cache entries were copied into228the buffer.229@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:230This is NULL. Both EntryCount and EntryLength are231NULL, when Refresh is FALSE.232@retval EFI_NOT_FOUND No matching entries were found.233@retval EFI_NOT_STARTED The ARP driver instance has not been configured.234235**/236typedef237EFI_STATUS238(EFIAPI *EFI_ARP_FIND)(239IN EFI_ARP_PROTOCOL *This,240IN BOOLEAN BySwAddress,241IN VOID *AddressBuffer OPTIONAL,242OUT UINT32 *EntryLength OPTIONAL,243OUT UINT32 *EntryCount OPTIONAL,244OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,245IN BOOLEAN Refresh246);247248/**249This function removes specified ARP cache entries.250251@param This The pointer to the EFI_ARP_PROTOCOL instance.252@param BySwAddress Set to TRUE to delete matching protocol addresses.253Set to FALSE to delete matching hardware254addresses.255@param AddressBuffer The pointer to the address buffer that is used as a256key to look for the cache entry. Set to NULL to257delete all entries.258259@retval EFI_SUCCESS The entry was removed from the ARP cache.260@retval EFI_INVALID_PARAMETER This is NULL.261@retval EFI_NOT_FOUND The specified deletion key was not found.262@retval EFI_NOT_STARTED The ARP driver instance has not been configured.263264**/265typedef266EFI_STATUS267(EFIAPI *EFI_ARP_DELETE)(268IN EFI_ARP_PROTOCOL *This,269IN BOOLEAN BySwAddress,270IN VOID *AddressBuffer OPTIONAL271);272273/**274This function delete all dynamic entries from the ARP cache that match the specified275software protocol type.276277@param This The pointer to the EFI_ARP_PROTOCOL instance.278279@retval EFI_SUCCESS The cache has been flushed.280@retval EFI_INVALID_PARAMETER This is NULL.281@retval EFI_NOT_FOUND There are no matching dynamic cache entries.282@retval EFI_NOT_STARTED The ARP driver instance has not been configured.283284**/285typedef286EFI_STATUS287(EFIAPI *EFI_ARP_FLUSH)(288IN EFI_ARP_PROTOCOL *This289);290291/**292This function tries to resolve the TargetSwAddress and optionally returns a293TargetHwAddress if it already exists in the ARP cache.294295@param This The pointer to the EFI_ARP_PROTOCOL instance.296@param TargetSwAddress The pointer to the protocol address to resolve.297@param ResolvedEvent The pointer to the event that will be signaled when298the address is resolved or some error occurs.299@param TargetHwAddress The pointer to the buffer for the resolved hardware300address in network byte order.301302@retval EFI_SUCCESS The data is copied from the ARP cache into the303TargetHwAddress buffer.304@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:305This is NULL. TargetHwAddress is NULL.306@retval EFI_ACCESS_DENIED The requested address is not present in the normal307ARP cache but is present in the deny address list.308Outgoing traffic to that address is forbidden.309@retval EFI_NOT_STARTED The ARP driver instance has not been configured.310@retval EFI_NOT_READY The request has been started and is not finished.311312**/313typedef314EFI_STATUS315(EFIAPI *EFI_ARP_REQUEST)(316IN EFI_ARP_PROTOCOL *This,317IN VOID *TargetSwAddress OPTIONAL,318IN EFI_EVENT ResolvedEvent OPTIONAL,319OUT VOID *TargetHwAddress320);321322/**323This function aborts the previous ARP request (identified by This, TargetSwAddress324and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().325326If the request is in the internal ARP request queue, the request is aborted327immediately and its ResolvedEvent is signaled. Only an asynchronous address328request needs to be canceled. If TargeSwAddress and ResolveEvent are both329NULL, all the pending asynchronous requests that have been issued by This330instance will be cancelled and their corresponding events will be signaled.331332@param This The pointer to the EFI_ARP_PROTOCOL instance.333@param TargetSwAddress The pointer to the protocol address in previous334request session.335@param ResolvedEvent Pointer to the event that is used as the336notification event in previous request session.337338@retval EFI_SUCCESS The pending request session(s) is/are aborted and339corresponding event(s) is/are signaled.340@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:341This is NULL. TargetSwAddress is not NULL and342ResolvedEvent is NULL. TargetSwAddress is NULL and343ResolvedEvent is not NULL.344@retval EFI_NOT_STARTED The ARP driver instance has not been configured.345@retval EFI_NOT_FOUND The request is not issued by346EFI_ARP_PROTOCOL.Request().347348349**/350typedef351EFI_STATUS352(EFIAPI *EFI_ARP_CANCEL)(353IN EFI_ARP_PROTOCOL *This,354IN VOID *TargetSwAddress OPTIONAL,355IN EFI_EVENT ResolvedEvent OPTIONAL356);357358///359/// ARP is used to resolve local network protocol addresses into360/// network hardware addresses.361///362struct _EFI_ARP_PROTOCOL {363EFI_ARP_CONFIGURE Configure;364EFI_ARP_ADD Add;365EFI_ARP_FIND Find;366EFI_ARP_DELETE Delete;367EFI_ARP_FLUSH Flush;368EFI_ARP_REQUEST Request;369EFI_ARP_CANCEL Cancel;370};371372extern EFI_GUID gEfiArpServiceBindingProtocolGuid;373extern EFI_GUID gEfiArpProtocolGuid;374375#endif376377378