/** @file\r
- Abstract:\r
+ EFI Address Resolution Protocol (ARP) Protocol interface header file.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
All rights reserved. This program and the accompanying materials\r
#define _ARP_IMPL_H_\r
\r
\r
-#include <PiDxe.h>\r
+#include <Uefi.h>\r
\r
#include <Protocol/Arp.h>\r
#include <Protocol/ManagedNetwork.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
\r
-\r
+//\r
+// Ethernet protocol type definitions.\r
+//\r
#define ARP_ETHER_PROTO_TYPE 0x0806\r
#define IPV4_ETHER_PROTO_TYPE 0x0800\r
#define IPV6_ETHER_PROTO_TYPE 0x86DD\r
\r
+//\r
+// ARP opcode definitions.\r
+//\r
#define ARP_OPCODE_REQUEST 0x0001\r
#define ARP_OPCODE_REPLY 0x0002\r
\r
+//\r
+// ARP timeout, retry count and interval definitions.\r
+//\r
#define ARP_DEFAULT_TIMEOUT_VALUE (400 * TICKS_PER_SECOND)\r
#define ARP_DEFAULT_RETRY_COUNT 2\r
#define ARP_DEFAULT_RETRY_INTERVAL (5 * TICKS_PER_MS)\r
#define ARP_PERIODIC_TIMER_INTERVAL (500 * TICKS_PER_MS)\r
\r
+//\r
+// ARP packet head definition.\r
+//\r
#pragma pack(1)\r
typedef struct {\r
UINT16 HwType;\r
} ARP_HEAD;\r
#pragma pack()\r
\r
+//\r
+// ARP Address definition for internal use.\r
+//\r
typedef struct {\r
UINT8 *SenderHwAddr;\r
UINT8 *SenderProtoAddr;\r
#define MATCH_SW_ADDRESS 0x1\r
#define MATCH_HW_ADDRESS 0x2\r
\r
+//\r
+// Enumeration for the search type. A search type is specified as the keyword to find\r
+// a cache entry in the cache table.\r
+//\r
typedef enum {\r
ByNone = 0,\r
ByProtoAddress = MATCH_SW_ADDRESS,\r
\r
#define ARP_INSTANCE_DATA_SIGNATURE SIGNATURE_32('A', 'R', 'P', 'I')\r
\r
-//\r
-//comment for macro\r
-//\r
+/**\r
+ Returns a pointer to the ARP_INSTANCE_DATA structure from the input a.\r
+ \r
+ If the signatures matches, then a pointer to the data structure that contains \r
+ a specified field of that data structure is returned.\r
+ \r
+ @param a Pointer to the field specified by ArpProto within a data \r
+ structure of type ARP_INSTANCE_DATA.\r
+ \r
+**/\r
#define ARP_INSTANCE_DATA_FROM_THIS(a) \\r
CR ( \\r
(a), \\r
\r
typedef struct _ARP_SERVICE_DATA ARP_SERVICE_DATA;\r
\r
+//\r
+// ARP instance context data structure.\r
+//\r
typedef struct {\r
UINT32 Signature;\r
ARP_SERVICE_DATA *ArpService;\r
\r
#define ARP_SERVICE_DATA_SIGNATURE SIGNATURE_32('A', 'R', 'P', 'S')\r
\r
-//\r
-//comment for macro\r
-//\r
+/**\r
+ Returns a pointer to the ARP_SERVICE_DATA structure from the input a.\r
+ \r
+ If the signatures matches, then a pointer to the data structure that contains \r
+ a specified field of that data structure is returned.\r
+ \r
+ @param a Pointer to the field specified by ServiceBinding within \r
+ a data structure of type ARP_SERVICE_DATA.\r
+ \r
+**/\r
#define ARP_SERVICE_DATA_FROM_THIS(a) \\r
CR ( \\r
(a), \\r
ARP_SERVICE_DATA_SIGNATURE \\r
)\r
\r
+//\r
+// ARP service data structure.\r
+//\r
struct _ARP_SERVICE_DATA {\r
UINT32 Signature;\r
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
EFI_EVENT PeriodicTimer;\r
};\r
\r
+//\r
+// User request context structure.\r
+//\r
typedef struct {\r
LIST_ENTRY List;\r
ARP_INSTANCE_DATA *Instance;\r
#define ARP_MAX_PROTOCOL_ADDRESS_LEN sizeof(EFI_IP_ADDRESS)\r
#define ARP_MAX_HARDWARE_ADDRESS_LEN sizeof(EFI_MAC_ADDRESS)\r
\r
+//\r
+// ARP address structure in an ARP packet.\r
+//\r
typedef struct {\r
UINT16 Type;\r
UINT8 Length;\r
} Buffer;\r
} NET_ARP_ADDRESS;\r
\r
+//\r
+// Enumeration for ARP address type.\r
+//\r
typedef enum {\r
Hardware,\r
Protocol\r
} ARP_ADDRESS_TYPE;\r
\r
+//\r
+// ARP cache entry definition.\r
+//\r
typedef struct {\r
LIST_ENTRY List;\r
\r
\r
/**\r
This function is used to assign a station address to the ARP cache for this instance\r
- of the ARP driver. Each ARP instance has one station address. The EFI_ARP_PROTOCOL \r
- driver will respond to ARP requests that match this registered station address. \r
- A call to this function with the ConfigData field set to NULL will reset this \r
- ARP instance.\r
+ of the ARP driver.\r
+ \r
+ Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will \r
+ respond to ARP requests that match this registered station address. A call to \r
+ this function with the ConfigData field set to NULL will reset this ARP instance.\r
\r
Once a protocol type and station address have been assigned to this ARP instance, \r
all the following ARP functions will use this information. Attempting to change \r
the protocol type or station address to a configured ARP instance will result in errors.\r
\r
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.\r
- @param[in] ConfigData Pointer to the EFI_ARP_CONFIG_DATA structure.\r
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.\r
+ @param ConfigData Pointer to the EFI_ARP_CONFIG_DATA structure.\r
\r
@retval EFI_SUCCESS The new station address was successfully\r
registered.\r
Final product implementations of the EFI network stack should be tuned for \r
their expected network environments.\r
\r
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.\r
- @param[in] DenyFlag Set to TRUE if this entry is a deny entry. Set to\r
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.\r
+ @param DenyFlag Set to TRUE if this entry is a deny entry. Set to\r
FALSE if this entry is a normal entry.\r
- @param[in] TargetSwAddress Pointer to a protocol address to add (or deny).\r
+ @param TargetSwAddress Pointer to a protocol address to add (or deny).\r
May be set to NULL if DenyFlag is TRUE.\r
- @param[in] TargetHwAddress Pointer to a hardware address to add (or deny).\r
+ @param TargetHwAddress Pointer to a hardware address to add (or deny).\r
May be set to NULL if DenyFlag is TRUE.\r
- @param[in] TimeoutValue Time in 100-ns units that this entry will remain\r
+ @param TimeoutValue Time in 100-ns units that this entry will remain\r
in the ARP cache. A value of zero means that the\r
entry is permanent. A nonzero value will override\r
the one given by Configure() if the entry to be\r
added is a dynamic entry.\r
- @param[in] Overwrite If TRUE, the matching cache entry will be\r
+ @param Overwrite If TRUE, the matching cache entry will be\r
overwritten with the supplied parameters. If\r
FALSE, EFI_ACCESS_DENIED is returned if the\r
corresponding cache entry already exists.\r
set to TRUE. If the found ARP cache entry is a permanent entry, it is not \r
affected by Refresh.\r
\r
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.\r
- @param[in] BySwAddress Set to TRUE to look for matching software protocol\r
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.\r
+ @param BySwAddress Set to TRUE to look for matching software protocol\r
addresses. Set to FALSE to look for matching\r
hardware protocol addresses.\r
- @param[in] AddressBuffer Pointer to address buffer. Set to NULL to match\r
+ @param AddressBuffer Pointer to address buffer. Set to NULL to match\r
all addresses.\r
- @param[out] EntryLength The size of an entry in the entries buffer.\r
- @param[out] EntryCount The number of ARP cache entries that are found by\r
+ @param EntryLength The size of an entry in the entries buffer.\r
+ @param EntryCount The number of ARP cache entries that are found by\r
the specified criteria.\r
- @param[out] Entries Pointer to the buffer that will receive the ARP\r
+ @param Entries Pointer to the buffer that will receive the ARP\r
cache entries.\r
- @param[in] Refresh Set to TRUE to refresh the timeout value of the\r
+ @param Refresh Set to TRUE to refresh the timeout value of the\r
matching ARP cache entry.\r
\r
@retval EFI_SUCCESS The requested ARP cache entries were copied into\r
/**\r
This function removes specified ARP cache entries.\r
\r
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.\r
- @param[in] BySwAddress Set to TRUE to delete matching protocol addresses.\r
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.\r
+ @param BySwAddress Set to TRUE to delete matching protocol addresses.\r
Set to FALSE to delete matching hardware\r
addresses.\r
- @param[in] AddressBuffer Pointer to the address buffer that is used as a\r
+ @param AddressBuffer Pointer to the address buffer that is used as a\r
key to look for the cache entry. Set to NULL to\r
delete all entries.\r
\r
This function delete all dynamic entries from the ARP cache that match the specified\r
software protocol type.\r
\r
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.\r
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.\r
\r
@retval EFI_SUCCESS The cache has been flushed.\r
@retval EFI_INVALID_PARAMETER This is NULL.\r
This function tries to resolve the TargetSwAddress and optionally returns a\r
TargetHwAddress if it already exists in the ARP cache.\r
\r
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.\r
- @param[in] TargetSwAddress Pointer to the protocol address to resolve.\r
- @param[in] ResolvedEvent Pointer to the event that will be signaled when\r
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.\r
+ @param TargetSwAddress Pointer to the protocol address to resolve.\r
+ @param ResolvedEvent Pointer to the event that will be signaled when\r
the address is resolved or some error occurs.\r
- @param[out] TargetHwAddress Pointer to the buffer for the resolved hardware\r
+ @param TargetHwAddress Pointer to the buffer for the resolved hardware\r
address in network byte order.\r
\r
@retval EFI_SUCCESS The data is copied from the ARP cache into the\r
NULL, all the pending asynchronous requests that have been issued by This \r
instance will be cancelled and their corresponding events will be signaled.\r
\r
- @param[in] This Pointer to the EFI_ARP_PROTOCOL instance.\r
- @param[in] TargetSwAddress Pointer to the protocol address in previous\r
+ @param This Pointer to the EFI_ARP_PROTOCOL instance.\r
+ @param TargetSwAddress Pointer to the protocol address in previous\r
request session.\r
- @param[in] ResolvedEvent Pointer to the event that is used as the\r
+ @param ResolvedEvent Pointer to the event that is used as the\r
notification event in previous request session.\r
\r
@retval EFI_SUCCESS The pending request session(s) is/are aborted and\r
/**\r
Initialize the instance context data.\r
\r
- @param[in] ArpService Pointer to the arp service context data this\r
- instance belongs to.\r
- @param[in] Instance Pointer to the instance context data.\r
+ @param[in] ArpService Pointer to the arp service context data this\r
+ instance belongs to.\r
+ @param[out] Instance Pointer to the instance context data.\r
\r
@return None.\r
\r
**/\r
VOID\r
ArpInitInstance (\r
- IN ARP_SERVICE_DATA *ArpService,\r
- IN ARP_INSTANCE_DATA *Instance\r
+ IN ARP_SERVICE_DATA *ArpService,\r
+ OUT ARP_INSTANCE_DATA *Instance\r
);\r
\r
/**\r
\r
/**\r
Process the already sent arp packets.\r
-\r
+ \r
@param[in] Context Pointer to the context data registerd to the\r
Event.\r
\r
);\r
\r
/**\r
- Queue ArpOnFrameRcvdDpc as a DPC at TPL_CALLBACK.\r
+ Request ArpOnFrameSentDpc as a DPC at TPL_CALLBACK.\r
\r
@param[in] Event The Event this notify function registered to.\r
@param[in] Context Pointer to the context data registerd to the\r