TianoCore EDK2 master
Loading...
Searching...
No Matches
ArpImpl.c File Reference
#include "ArpImpl.h"

Go to the source code of this file.

Functions

VOID ArpInitInstance (IN ARP_SERVICE_DATA *ArpService, OUT ARP_INSTANCE_DATA *Instance)
 
VOID EFIAPI ArpOnFrameRcvdDpc (IN VOID *Context)
 
VOID EFIAPI ArpOnFrameRcvd (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI ArpOnFrameSentDpc (IN VOID *Context)
 
VOID EFIAPI ArpOnFrameSent (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI ArpTimerHandler (IN EFI_EVENT Event, IN VOID *Context)
 
BOOLEAN ArpMatchAddress (IN NET_ARP_ADDRESS *AddressOne, IN NET_ARP_ADDRESS *AddressTwo)
 
ARP_CACHE_ENTRYArpFindNextCacheEntryInTable (IN LIST_ENTRY *CacheTable, IN LIST_ENTRY *StartEntry, IN FIND_OPTYPE FindOpType, IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL, IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL)
 
ARP_CACHE_ENTRYArpFindDeniedCacheEntry (IN ARP_SERVICE_DATA *ArpService, IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL, IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL)
 
ARP_CACHE_ENTRYArpAllocCacheEntry (IN ARP_INSTANCE_DATA *Instance)
 
UINTN ArpAddressResolved (IN ARP_CACHE_ENTRY *CacheEntry, IN ARP_INSTANCE_DATA *Instance OPTIONAL, IN EFI_EVENT UserEvent OPTIONAL)
 
VOID ArpFillAddressInCacheEntry (IN ARP_CACHE_ENTRY *CacheEntry, IN NET_ARP_ADDRESS *HwAddr OPTIONAL, IN NET_ARP_ADDRESS *SwAddr OPTIONAL)
 
EFI_STATUS ArpConfigureInstance (IN ARP_INSTANCE_DATA *Instance, IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL)
 
VOID ArpSendFrame (IN ARP_INSTANCE_DATA *Instance, IN ARP_CACHE_ENTRY *CacheEntry, IN UINT16 ArpOpCode)
 
UINTN ArpDeleteCacheEntryInTable (IN LIST_ENTRY *CacheTable, IN BOOLEAN BySwAddress, IN UINT16 SwAddressType, IN UINT8 *AddressBuffer OPTIONAL, IN BOOLEAN Force)
 
UINTN ArpDeleteCacheEntry (IN ARP_INSTANCE_DATA *Instance, IN BOOLEAN BySwAddress, IN UINT8 *AddressBuffer OPTIONAL, IN BOOLEAN Force)
 
UINTN ArpCancelRequest (IN ARP_INSTANCE_DATA *Instance, IN VOID *TargetSwAddress OPTIONAL, IN EFI_EVENT UserEvent OPTIONAL)
 
EFI_STATUS ArpFindCacheEntry (IN ARP_INSTANCE_DATA *Instance, IN BOOLEAN BySwAddress, IN VOID *AddressBuffer OPTIONAL, OUT UINT32 *EntryLength OPTIONAL, OUT UINT32 *EntryCount OPTIONAL, OUT EFI_ARP_FIND_DATA **Entries OPTIONAL, IN BOOLEAN Refresh)
 

Variables

EFI_ARP_PROTOCOL mEfiArpProtocolTemplate
 

Detailed Description

The implementation of the ARP protocol.

Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ArpImpl.c.

Function Documentation

◆ ArpAddressResolved()

UINTN ArpAddressResolved ( IN ARP_CACHE_ENTRY CacheEntry,
IN ARP_INSTANCE_DATA *Instance  OPTIONAL,
IN EFI_EVENT UserEvent  OPTIONAL 
)

Turn the CacheEntry into the resolved status.

Parameters
[in]CacheEntryPointer to the resolved cache entry.
[in]InstancePointer to the instance context data.
[in]UserEventPointer to the UserEvent to notify.
Returns
The count of notifications sent to the instance.

Definition at line 783 of file ArpImpl.c.

◆ ArpAllocCacheEntry()

ARP_CACHE_ENTRY * ArpAllocCacheEntry ( IN ARP_INSTANCE_DATA Instance)

Allocate a cache entry and initialize it.

Parameters
[in]InstancePointer to the instance context data.
Returns
Pointer to the new created cache entry.

Definition at line 715 of file ArpImpl.c.

◆ ArpCancelRequest()

UINTN ArpCancelRequest ( IN ARP_INSTANCE_DATA Instance,
IN VOID *TargetSwAddress  OPTIONAL,
IN EFI_EVENT UserEvent  OPTIONAL 
)

Cancel the arp request.

Parameters
[in]InstancePointer to the instance context data.
[in]TargetSwAddressPointer to the buffer containing the target software address to match the arp request.
[in]UserEventThe user event used to notify this request cancellation.
Returns
The count of the cancelled requests.

Definition at line 1378 of file ArpImpl.c.

◆ ArpConfigureInstance()

EFI_STATUS ArpConfigureInstance ( IN ARP_INSTANCE_DATA Instance,
IN EFI_ARP_CONFIG_DATA *ConfigData  OPTIONAL 
)

Configure the instance using the ConfigData. ConfigData is already validated.

Parameters
[in]InstancePointer to the instance context data to be configured.
[in]ConfigDataPointer to the configuration data used to configure the instance.
Return values
EFI_SUCCESSThe instance is configured with the ConfigData.
EFI_ACCESS_DENIEDThe instance is already configured and the ConfigData tries to reset some unchangeable fields.
EFI_INVALID_PARAMETERThe ConfigData provides a non-unicast IPv4 address when the SwAddressType is IPv4.
EFI_OUT_OF_RESOURCESThe instance fails to configure due to memory limitation.

Definition at line 906 of file ArpImpl.c.

◆ ArpDeleteCacheEntry()

UINTN ArpDeleteCacheEntry ( IN ARP_INSTANCE_DATA Instance,
IN BOOLEAN  BySwAddress,
IN UINT8 *AddressBuffer  OPTIONAL,
IN BOOLEAN  Force 
)

Delete cache entries in all the cache tables.

Parameters
[in]InstancePointer to the instance context data.
[in]BySwAddressDelete the cache entry by software address or by hardware address.
[in]AddressBufferPointer to the buffer containing the address to match for the deletion.
[in]ForceThis deletion is forced or not.
Returns
The count of the deleted cache entries.

Definition at line 1326 of file ArpImpl.c.

◆ ArpDeleteCacheEntryInTable()

UINTN ArpDeleteCacheEntryInTable ( IN LIST_ENTRY CacheTable,
IN BOOLEAN  BySwAddress,
IN UINT16  SwAddressType,
IN UINT8 *AddressBuffer  OPTIONAL,
IN BOOLEAN  Force 
)

Delete the cache entries in the specified CacheTable, using the BySwAddress, SwAddressType, AddressBuffer combination as the matching key, if Force is TRUE, the cache is deleted event it's a static entry.

Parameters
[in]CacheTablePointer to the cache table to do the deletion.
[in]BySwAddressDelete the cache entry by software address or by hardware address.
[in]SwAddressTypeThe software address used to do the deletion.
[in]AddressBufferPointer to the buffer containing the address to match for the deletion.
[in]ForceThis deletion is forced or not.
Returns
The count of the deleted cache entries.

Definition at line 1237 of file ArpImpl.c.

◆ ArpFillAddressInCacheEntry()

VOID ArpFillAddressInCacheEntry ( IN ARP_CACHE_ENTRY CacheEntry,
IN NET_ARP_ADDRESS *HwAddr  OPTIONAL,
IN NET_ARP_ADDRESS *SwAddr  OPTIONAL 
)

Fill the addresses in the CacheEntry using the information passed in by HwAddr and SwAddr.

Parameters
[in]CacheEntryPointer to the cache entry.
[in]HwAddrPointer to the software address.
[in]SwAddrPointer to the hardware address.
Returns
None.

Definition at line 845 of file ArpImpl.c.

◆ ArpFindCacheEntry()

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 
)

Find the cache entry in the cache table.

Parameters
[in]InstancePointer to the instance context data.
[in]BySwAddressSet to TRUE to look for matching software protocol addresses. Set to FALSE to look for matching hardware protocol addresses.
[in]AddressBufferPointer to address buffer. Set to NULL to match all addresses.
[out]EntryLengthThe size of an entry in the entries buffer.
[out]EntryCountThe number of ARP cache entries that are found by the specified criteria.
[out]EntriesPointer to the buffer that will receive the ARP cache entries.
[in]RefreshSet to TRUE to refresh the timeout value of the matching ARP cache entry.
Return values
EFI_SUCCESSThe requested ARP cache entries are copied into the buffer.
EFI_NOT_FOUNDNo matching entries found.
EFI_OUT_OF_RESOURCEThere is a memory allocation failure.

Definition at line 1448 of file ArpImpl.c.

◆ ArpFindDeniedCacheEntry()

ARP_CACHE_ENTRY * ArpFindDeniedCacheEntry ( IN ARP_SERVICE_DATA ArpService,
IN NET_ARP_ADDRESS *ProtocolAddress  OPTIONAL,
IN NET_ARP_ADDRESS *HardwareAddress  OPTIONAL 
)

Find the CacheEntry, using ProtocolAddress or HardwareAddress or both, as the keyword, in the DeniedCacheTable.

Parameters
[in]ArpServicePointer to the arp service context data.
[in]ProtocolAddressPointer to the protocol address.
[in]HardwareAddressPointer to the hardware address.
Returns
Pointer to the matched cache entry, if NULL no match is found.

Definition at line 658 of file ArpImpl.c.

◆ ArpFindNextCacheEntryInTable()

ARP_CACHE_ENTRY * ArpFindNextCacheEntryInTable ( IN LIST_ENTRY CacheTable,
IN LIST_ENTRY StartEntry,
IN FIND_OPTYPE  FindOpType,
IN NET_ARP_ADDRESS *ProtocolAddress  OPTIONAL,
IN NET_ARP_ADDRESS *HardwareAddress  OPTIONAL 
)

Find the CacheEntry which matches the requirements in the specified CacheTable.

Parameters
[in]CacheTablePointer to the arp cache table.
[in]StartEntryPointer to the start entry this search begins with in the cache table.
[in]FindOpTypeThe search type.
[in]ProtocolAddressPointer to the protocol address to match.
[in]HardwareAddressPointer to the hardware address to match.
Returns
Pointer to the matched arp cache entry, if NULL, no match is found.

Definition at line 589 of file ArpImpl.c.

◆ ArpInitInstance()

VOID ArpInitInstance ( IN ARP_SERVICE_DATA ArpService,
OUT ARP_INSTANCE_DATA Instance 
)

Initialize the instance context data.

Parameters
[in]ArpServicePointer to the arp service context data this instance belongs to.
[out]InstancePointer to the instance context data.
Returns
None.

Definition at line 35 of file ArpImpl.c.

◆ ArpMatchAddress()

BOOLEAN ArpMatchAddress ( IN NET_ARP_ADDRESS AddressOne,
IN NET_ARP_ADDRESS AddressTwo 
)

Match the two NET_ARP_ADDRESSes.

Parameters
[in]AddressOnePointer to the first address to match.
[in]AddressTwoPointer to the second address to match.
Returns
The two addresses match or not.

Definition at line 543 of file ArpImpl.c.

◆ ArpOnFrameRcvd()

VOID EFIAPI ArpOnFrameRcvd ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Queue ArpOnFrameRcvdDpc as a DPC at TPL_CALLBACK.

Parameters
[in]EventThe Event this notify function registered to.
[in]ContextPointer to the context data registered to the Event.
Returns
None.

Definition at line 333 of file ArpImpl.c.

◆ ArpOnFrameRcvdDpc()

VOID EFIAPI ArpOnFrameRcvdDpc ( IN VOID *  Context)

Process the Arp packets received from Mnp, the procedure conforms to RFC826.

Parameters
[in]ContextPointer to the context data registered to the Event.
Returns
None.

Definition at line 64 of file ArpImpl.c.

◆ ArpOnFrameSent()

VOID EFIAPI ArpOnFrameSent ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Request ArpOnFrameSentDpc as a DPC at TPL_CALLBACK.

Parameters
[in]EventThe Event this notify function registered to.
[in]ContextPointer to the context data registered to the Event.
Returns
None.

Definition at line 395 of file ArpImpl.c.

◆ ArpOnFrameSentDpc()

VOID EFIAPI ArpOnFrameSentDpc ( IN VOID *  Context)

Process the already sent arp packets.

Parameters
[in]ContextPointer to the context data registered to the Event.
Returns
None.

Definition at line 355 of file ArpImpl.c.

◆ ArpSendFrame()

VOID ArpSendFrame ( IN ARP_INSTANCE_DATA Instance,
IN ARP_CACHE_ENTRY CacheEntry,
IN UINT16  ArpOpCode 
)

Send out an arp frame using the CacheEntry and the ArpOpCode.

Parameters
[in]InstancePointer to the instance context data.
[in]CacheEntryPointer to the configuration data used to configure the instance.
[in]ArpOpCodeThe opcode used to send out this Arp frame, either request or reply.
Returns
None.

Definition at line 1027 of file ArpImpl.c.

◆ ArpTimerHandler()

VOID EFIAPI ArpTimerHandler ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Process the arp cache olding and drive the retrying arp requests.

Parameters
[in]EventThe Event this notify function registered to.
[in]ContextPointer to the context data registered to the Event.
Returns
None.

Definition at line 418 of file ArpImpl.c.

Variable Documentation

◆ mEfiArpProtocolTemplate

EFI_ARP_PROTOCOL mEfiArpProtocolTemplate
Initial value:
= {
}
EFI_STATUS EFIAPI ArpCancel(IN EFI_ARP_PROTOCOL *This, IN VOID *TargetSwAddress OPTIONAL, IN EFI_EVENT ResolvedEvent OPTIONAL)
Definition: ArpMain.c:698
EFI_STATUS EFIAPI ArpRequest(IN EFI_ARP_PROTOCOL *This, IN VOID *TargetSwAddress OPTIONAL, IN EFI_EVENT ResolvedEvent OPTIONAL, OUT VOID *TargetHwAddress)
Definition: ArpMain.c:476
EFI_STATUS EFIAPI ArpConfigure(IN EFI_ARP_PROTOCOL *This, IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL)
Definition: ArpMain.c:41
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)
Definition: ArpMain.c:310
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)
Definition: ArpMain.c:123
EFI_STATUS EFIAPI ArpDelete(IN EFI_ARP_PROTOCOL *This, IN BOOLEAN BySwAddress, IN VOID *AddressBuffer OPTIONAL)
Definition: ArpMain.c:376
EFI_STATUS EFIAPI ArpFlush(IN EFI_ARP_PROTOCOL *This)
Definition: ArpMain.c:422

Definition at line 14 of file ArpImpl.c.