]>
Commit | Line | Data |
---|---|---|
83cbd279 | 1 | /** @file\r |
0c323d07 | 2 | EFI Address Resolution Protocol (ARP) Protocol interface header file.\r |
83cbd279 | 3 | \r |
e5eed7d3 HT |
4 | Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials\r | |
83cbd279 | 6 | are licensed and made available under the terms and conditions of the BSD License\r |
c6d0ee4b | 7 | which accompanies this distribution. The full text of the license may be found at<BR>\r |
83cbd279 | 8 | http://opensource.org/licenses/bsd-license.php\r |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
83cbd279 | 13 | **/\r |
14 | \r | |
15 | #ifndef _ARP_IMPL_H_\r | |
16 | #define _ARP_IMPL_H_\r | |
17 | \r | |
772db4bb | 18 | \r |
0c323d07 | 19 | #include <Uefi.h>\r |
772db4bb | 20 | \r |
21 | #include <Protocol/Arp.h>\r | |
83cbd279 | 22 | #include <Protocol/ManagedNetwork.h>\r |
772db4bb | 23 | #include <Protocol/ServiceBinding.h>\r |
24 | \r | |
25 | #include <Library/DebugLib.h>\r | |
26 | #include <Library/UefiDriverEntryPoint.h>\r | |
27 | #include <Library/UefiBootServicesTableLib.h>\r | |
83cbd279 | 28 | #include <Library/UefiLib.h>\r |
29 | #include <Library/NetLib.h>\r | |
30 | #include <Library/BaseLib.h>\r | |
31 | #include <Library/BaseMemoryLib.h>\r | |
32 | #include <Library/MemoryAllocationLib.h>\r | |
d8d26fb2 | 33 | #include <Library/DpcLib.h>\r |
83cbd279 | 34 | \r |
0c323d07 | 35 | //\r |
36 | // Ethernet protocol type definitions.\r | |
37 | //\r | |
83cbd279 | 38 | #define ARP_ETHER_PROTO_TYPE 0x0806\r |
7bce0c5a | 39 | #define IPV4_ETHER_PROTO_TYPE 0x0800\r |
40 | #define IPV6_ETHER_PROTO_TYPE 0x86DD\r | |
83cbd279 | 41 | \r |
0c323d07 | 42 | //\r |
43 | // ARP opcode definitions.\r | |
44 | //\r | |
83cbd279 | 45 | #define ARP_OPCODE_REQUEST 0x0001\r |
46 | #define ARP_OPCODE_REPLY 0x0002\r | |
47 | \r | |
0c323d07 | 48 | //\r |
49 | // ARP timeout, retry count and interval definitions.\r | |
50 | //\r | |
83cbd279 | 51 | #define ARP_DEFAULT_TIMEOUT_VALUE (400 * TICKS_PER_SECOND)\r |
52 | #define ARP_DEFAULT_RETRY_COUNT 2\r | |
53 | #define ARP_DEFAULT_RETRY_INTERVAL (5 * TICKS_PER_MS)\r | |
54 | #define ARP_PERIODIC_TIMER_INTERVAL (500 * TICKS_PER_MS)\r | |
55 | \r | |
0c323d07 | 56 | //\r |
57 | // ARP packet head definition.\r | |
58 | //\r | |
83cbd279 | 59 | #pragma pack(1)\r |
c6d0ee4b | 60 | typedef struct {\r |
83cbd279 | 61 | UINT16 HwType;\r |
62 | UINT16 ProtoType;\r | |
63 | UINT8 HwAddrLen;\r | |
64 | UINT8 ProtoAddrLen;\r | |
65 | UINT16 OpCode;\r | |
66 | } ARP_HEAD;\r | |
67 | #pragma pack()\r | |
68 | \r | |
0c323d07 | 69 | //\r |
70 | // ARP Address definition for internal use.\r | |
71 | //\r | |
c6d0ee4b | 72 | typedef struct {\r |
83cbd279 | 73 | UINT8 *SenderHwAddr;\r |
74 | UINT8 *SenderProtoAddr;\r | |
75 | UINT8 *TargetHwAddr;\r | |
76 | UINT8 *TargetProtoAddr;\r | |
77 | } ARP_ADDRESS;\r | |
78 | \r | |
79 | #define MATCH_SW_ADDRESS 0x1\r | |
80 | #define MATCH_HW_ADDRESS 0x2\r | |
81 | \r | |
0c323d07 | 82 | //\r |
83 | // Enumeration for the search type. A search type is specified as the keyword to find\r | |
84 | // a cache entry in the cache table.\r | |
85 | //\r | |
83cbd279 | 86 | typedef enum {\r |
87 | ByNone = 0,\r | |
88 | ByProtoAddress = MATCH_SW_ADDRESS,\r | |
89 | ByHwAddress = MATCH_HW_ADDRESS,\r | |
90 | ByBoth = MATCH_SW_ADDRESS | MATCH_HW_ADDRESS\r | |
91 | } FIND_OPTYPE;\r | |
92 | \r | |
f3f2e05d | 93 | #define ARP_INSTANCE_DATA_SIGNATURE SIGNATURE_32('A', 'R', 'P', 'I')\r |
83cbd279 | 94 | \r |
0c323d07 | 95 | /**\r |
96 | Returns a pointer to the ARP_INSTANCE_DATA structure from the input a.\r | |
97 | \r | |
98 | If the signatures matches, then a pointer to the data structure that contains \r | |
99 | a specified field of that data structure is returned.\r | |
100 | \r | |
101 | @param a Pointer to the field specified by ArpProto within a data \r | |
102 | structure of type ARP_INSTANCE_DATA.\r | |
103 | \r | |
104 | **/\r | |
83cbd279 | 105 | #define ARP_INSTANCE_DATA_FROM_THIS(a) \\r |
106 | CR ( \\r | |
107 | (a), \\r | |
108 | ARP_INSTANCE_DATA, \\r | |
109 | ArpProto, \\r | |
110 | ARP_INSTANCE_DATA_SIGNATURE \\r | |
111 | )\r | |
112 | \r | |
113 | typedef struct _ARP_SERVICE_DATA ARP_SERVICE_DATA;\r | |
114 | \r | |
0c323d07 | 115 | //\r |
116 | // ARP instance context data structure.\r | |
117 | //\r | |
c6d0ee4b | 118 | typedef struct {\r |
83cbd279 | 119 | UINT32 Signature;\r |
120 | ARP_SERVICE_DATA *ArpService;\r | |
121 | EFI_HANDLE Handle;\r | |
122 | EFI_ARP_PROTOCOL ArpProto;\r | |
e48e37fc | 123 | LIST_ENTRY List;\r |
83cbd279 | 124 | EFI_ARP_CONFIG_DATA ConfigData;\r |
125 | BOOLEAN Configured;\r | |
126 | BOOLEAN Destroyed;\r | |
127 | } ARP_INSTANCE_DATA;\r | |
128 | \r | |
f3f2e05d | 129 | #define ARP_SERVICE_DATA_SIGNATURE SIGNATURE_32('A', 'R', 'P', 'S')\r |
83cbd279 | 130 | \r |
0c323d07 | 131 | /**\r |
132 | Returns a pointer to the ARP_SERVICE_DATA structure from the input a.\r | |
133 | \r | |
134 | If the signatures matches, then a pointer to the data structure that contains \r | |
135 | a specified field of that data structure is returned.\r | |
136 | \r | |
137 | @param a Pointer to the field specified by ServiceBinding within \r | |
138 | a data structure of type ARP_SERVICE_DATA.\r | |
139 | \r | |
140 | **/\r | |
83cbd279 | 141 | #define ARP_SERVICE_DATA_FROM_THIS(a) \\r |
142 | CR ( \\r | |
143 | (a), \\r | |
144 | ARP_SERVICE_DATA, \\r | |
145 | ServiceBinding, \\r | |
146 | ARP_SERVICE_DATA_SIGNATURE \\r | |
147 | )\r | |
148 | \r | |
0c323d07 | 149 | //\r |
150 | // ARP service data structure.\r | |
151 | //\r | |
83cbd279 | 152 | struct _ARP_SERVICE_DATA {\r |
153 | UINT32 Signature;\r | |
154 | EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r | |
155 | \r | |
156 | EFI_HANDLE MnpChildHandle;\r | |
157 | EFI_HANDLE ImageHandle;\r | |
158 | EFI_HANDLE ControllerHandle;\r | |
159 | \r | |
160 | EFI_MANAGED_NETWORK_PROTOCOL *Mnp;\r | |
161 | EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;\r | |
162 | EFI_MANAGED_NETWORK_COMPLETION_TOKEN RxToken;\r | |
163 | \r | |
164 | EFI_SIMPLE_NETWORK_MODE SnpMode;\r | |
165 | \r | |
83cbd279 | 166 | UINTN ChildrenNumber;\r |
e48e37fc | 167 | LIST_ENTRY ChildrenList;\r |
83cbd279 | 168 | \r |
e48e37fc | 169 | LIST_ENTRY PendingRequestTable;\r |
170 | LIST_ENTRY DeniedCacheTable;\r | |
171 | LIST_ENTRY ResolvedCacheTable;\r | |
83cbd279 | 172 | \r |
173 | EFI_EVENT PeriodicTimer;\r | |
174 | };\r | |
175 | \r | |
0c323d07 | 176 | //\r |
177 | // User request context structure.\r | |
178 | //\r | |
c6d0ee4b | 179 | typedef struct {\r |
e48e37fc | 180 | LIST_ENTRY List;\r |
83cbd279 | 181 | ARP_INSTANCE_DATA *Instance;\r |
182 | EFI_EVENT UserRequestEvent;\r | |
183 | VOID *UserHwAddrBuffer;\r | |
184 | } USER_REQUEST_CONTEXT;\r | |
185 | \r | |
186 | #define ARP_MAX_PROTOCOL_ADDRESS_LEN sizeof(EFI_IP_ADDRESS)\r | |
187 | #define ARP_MAX_HARDWARE_ADDRESS_LEN sizeof(EFI_MAC_ADDRESS)\r | |
188 | \r | |
f6b7393c | 189 | typedef union {\r |
190 | UINT8 ProtoAddress[ARP_MAX_PROTOCOL_ADDRESS_LEN];\r | |
191 | UINT8 HwAddress[ARP_MAX_HARDWARE_ADDRESS_LEN];\r | |
192 | } NET_ARP_ADDRESS_UNION;\r | |
193 | \r | |
0c323d07 | 194 | //\r |
195 | // ARP address structure in an ARP packet.\r | |
196 | //\r | |
c6d0ee4b | 197 | typedef struct {\r |
f6b7393c | 198 | UINT16 Type;\r |
199 | UINT8 Length;\r | |
200 | UINT8 *AddressPtr;\r | |
201 | NET_ARP_ADDRESS_UNION Buffer;\r | |
83cbd279 | 202 | } NET_ARP_ADDRESS;\r |
203 | \r | |
0c323d07 | 204 | //\r |
205 | // Enumeration for ARP address type.\r | |
206 | //\r | |
83cbd279 | 207 | typedef enum {\r |
208 | Hardware,\r | |
209 | Protocol\r | |
210 | } ARP_ADDRESS_TYPE;\r | |
211 | \r | |
0c323d07 | 212 | //\r |
213 | // ARP cache entry definition.\r | |
214 | //\r | |
c6d0ee4b | 215 | typedef struct {\r |
e48e37fc | 216 | LIST_ENTRY List;\r |
83cbd279 | 217 | \r |
218 | UINT32 RetryCount;\r | |
219 | UINT32 DefaultDecayTime;\r | |
220 | UINT32 DecayTime;\r | |
221 | UINT32 NextRetryTime;\r | |
222 | \r | |
223 | NET_ARP_ADDRESS Addresses[2];\r | |
224 | \r | |
e48e37fc | 225 | LIST_ENTRY UserRequestList;\r |
83cbd279 | 226 | } ARP_CACHE_ENTRY;\r |
227 | \r | |
7bce0c5a | 228 | /**\r |
229 | This function is used to assign a station address to the ARP cache for this instance\r | |
0c323d07 | 230 | of the ARP driver.\r |
231 | \r | |
232 | Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will \r | |
233 | respond to ARP requests that match this registered station address. A call to \r | |
234 | this function with the ConfigData field set to NULL will reset this ARP instance.\r | |
c6d0ee4b | 235 | \r |
236 | Once a protocol type and station address have been assigned to this ARP instance, \r | |
237 | all the following ARP functions will use this information. Attempting to change \r | |
238 | the protocol type or station address to a configured ARP instance will result in errors.\r | |
239 | \r | |
0c323d07 | 240 | @param This Pointer to the EFI_ARP_PROTOCOL instance.\r |
241 | @param ConfigData Pointer to the EFI_ARP_CONFIG_DATA structure.\r | |
7bce0c5a | 242 | \r |
243 | @retval EFI_SUCCESS The new station address was successfully\r | |
244 | registered.\r | |
245 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
246 | This is NULL. SwAddressLength is zero when\r | |
247 | ConfigData is not NULL. StationAddress is NULL\r | |
248 | when ConfigData is not NULL.\r | |
249 | @retval EFI_ACCESS_DENIED The SwAddressType, SwAddressLength, or\r | |
250 | StationAddress is different from the one that is\r | |
251 | already registered.\r | |
252 | @retval EFI_OUT_OF_RESOURCES Storage for the new StationAddress could not be\r | |
253 | allocated.\r | |
254 | \r | |
255 | **/\r | |
83cbd279 | 256 | EFI_STATUS\r |
257 | EFIAPI\r | |
258 | ArpConfigure (\r | |
259 | IN EFI_ARP_PROTOCOL *This,\r | |
260 | IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL\r | |
261 | );\r | |
262 | \r | |
7bce0c5a | 263 | /**\r |
264 | This function is used to insert entries into the ARP cache.\r | |
265 | \r | |
c6d0ee4b | 266 | ARP cache entries are typically inserted and updated by network protocol drivers \r |
267 | as network traffic is processed. Most ARP cache entries will time out and be \r | |
268 | deleted if the network traffic stops. ARP cache entries that were inserted \r | |
269 | by the Add() function may be static (will not time out) or dynamic (will time out).\r | |
270 | Default ARP cache timeout values are not covered in most network protocol \r | |
271 | specifications (although RFC 1122 comes pretty close) and will only be \r | |
272 | discussed in general in this specification. The timeout values that are \r | |
273 | used in the EFI Sample Implementation should be used only as a guideline. \r | |
274 | Final product implementations of the EFI network stack should be tuned for \r | |
275 | their expected network environments.\r | |
276 | \r | |
0c323d07 | 277 | @param This Pointer to the EFI_ARP_PROTOCOL instance.\r |
278 | @param DenyFlag Set to TRUE if this entry is a deny entry. Set to\r | |
7bce0c5a | 279 | FALSE if this entry is a normal entry.\r |
0c323d07 | 280 | @param TargetSwAddress Pointer to a protocol address to add (or deny).\r |
7bce0c5a | 281 | May be set to NULL if DenyFlag is TRUE.\r |
0c323d07 | 282 | @param TargetHwAddress Pointer to a hardware address to add (or deny).\r |
7bce0c5a | 283 | May be set to NULL if DenyFlag is TRUE.\r |
0c323d07 | 284 | @param TimeoutValue Time in 100-ns units that this entry will remain\r |
7bce0c5a | 285 | in the ARP cache. A value of zero means that the\r |
286 | entry is permanent. A nonzero value will override\r | |
287 | the one given by Configure() if the entry to be\r | |
288 | added is a dynamic entry.\r | |
0c323d07 | 289 | @param Overwrite If TRUE, the matching cache entry will be\r |
7bce0c5a | 290 | overwritten with the supplied parameters. If\r |
291 | FALSE, EFI_ACCESS_DENIED is returned if the\r | |
292 | corresponding cache entry already exists.\r | |
293 | \r | |
294 | @retval EFI_SUCCESS The entry has been added or updated.\r | |
295 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
296 | This is NULL. DenyFlag is FALSE and\r | |
297 | TargetHwAddress is NULL. DenyFlag is FALSE and\r | |
298 | TargetSwAddress is NULL. TargetHwAddress is NULL\r | |
299 | and TargetSwAddress is NULL. Both TargetSwAddress\r | |
300 | and TargetHwAddress are not NULL when DenyFlag is\r | |
301 | TRUE.\r | |
302 | @retval EFI_OUT_OF_RESOURCES The new ARP cache entry could not be allocated.\r | |
303 | @retval EFI_ACCESS_DENIED The ARP cache entry already exists and Overwrite\r | |
304 | is not true.\r | |
305 | @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r | |
306 | \r | |
307 | **/\r | |
83cbd279 | 308 | EFI_STATUS\r |
309 | EFIAPI\r | |
310 | ArpAdd (\r | |
311 | IN EFI_ARP_PROTOCOL *This,\r | |
312 | IN BOOLEAN DenyFlag,\r | |
313 | IN VOID *TargetSwAddress OPTIONAL,\r | |
314 | IN VOID *TargetHwAddress OPTIONAL,\r | |
315 | IN UINT32 TimeoutValue,\r | |
316 | IN BOOLEAN Overwrite\r | |
317 | );\r | |
318 | \r | |
7bce0c5a | 319 | /**\r |
320 | This function searches the ARP cache for matching entries and allocates a buffer into\r | |
321 | which those entries are copied.\r | |
c6d0ee4b | 322 | \r |
323 | The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which \r | |
324 | are protocol address pairs and hardware address pairs.\r | |
325 | When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer \r | |
326 | is not NULL), the ARP cache timeout for the found entry is reset if Refresh is \r | |
327 | set to TRUE. If the found ARP cache entry is a permanent entry, it is not \r | |
328 | affected by Refresh.\r | |
329 | \r | |
0c323d07 | 330 | @param This Pointer to the EFI_ARP_PROTOCOL instance.\r |
331 | @param BySwAddress Set to TRUE to look for matching software protocol\r | |
7bce0c5a | 332 | addresses. Set to FALSE to look for matching\r |
333 | hardware protocol addresses.\r | |
0c323d07 | 334 | @param AddressBuffer Pointer to address buffer. Set to NULL to match\r |
7bce0c5a | 335 | all addresses.\r |
0c323d07 | 336 | @param EntryLength The size of an entry in the entries buffer.\r |
337 | @param EntryCount The number of ARP cache entries that are found by\r | |
7bce0c5a | 338 | the specified criteria.\r |
0c323d07 | 339 | @param Entries Pointer to the buffer that will receive the ARP\r |
7bce0c5a | 340 | cache entries.\r |
0c323d07 | 341 | @param Refresh Set to TRUE to refresh the timeout value of the\r |
7bce0c5a | 342 | matching ARP cache entry.\r |
343 | \r | |
344 | @retval EFI_SUCCESS The requested ARP cache entries were copied into\r | |
345 | the buffer.\r | |
346 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
347 | This is NULL. Both EntryCount and EntryLength are\r | |
348 | NULL, when Refresh is FALSE.\r | |
349 | @retval EFI_NOT_FOUND No matching entries were found.\r | |
350 | @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r | |
351 | \r | |
352 | **/\r | |
83cbd279 | 353 | EFI_STATUS\r |
354 | EFIAPI\r | |
355 | ArpFind (\r | |
356 | IN EFI_ARP_PROTOCOL *This,\r | |
357 | IN BOOLEAN BySwAddress,\r | |
358 | IN VOID *AddressBuffer OPTIONAL,\r | |
359 | OUT UINT32 *EntryLength OPTIONAL,\r | |
360 | OUT UINT32 *EntryCount OPTIONAL,\r | |
361 | OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,\r | |
362 | IN BOOLEAN Refresh\r | |
363 | );\r | |
364 | \r | |
7bce0c5a | 365 | /**\r |
366 | This function removes specified ARP cache entries.\r | |
367 | \r | |
0c323d07 | 368 | @param This Pointer to the EFI_ARP_PROTOCOL instance.\r |
369 | @param BySwAddress Set to TRUE to delete matching protocol addresses.\r | |
7bce0c5a | 370 | Set to FALSE to delete matching hardware\r |
371 | addresses.\r | |
0c323d07 | 372 | @param AddressBuffer Pointer to the address buffer that is used as a\r |
7bce0c5a | 373 | key to look for the cache entry. Set to NULL to\r |
374 | delete all entries.\r | |
375 | \r | |
376 | @retval EFI_SUCCESS The entry was removed from the ARP cache.\r | |
377 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
378 | @retval EFI_NOT_FOUND The specified deletion key was not found.\r | |
379 | @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r | |
380 | \r | |
381 | **/\r | |
83cbd279 | 382 | EFI_STATUS\r |
383 | EFIAPI\r | |
384 | ArpDelete (\r | |
385 | IN EFI_ARP_PROTOCOL *This,\r | |
386 | IN BOOLEAN BySwAddress,\r | |
387 | IN VOID *AddressBuffer OPTIONAL\r | |
388 | );\r | |
389 | \r | |
7bce0c5a | 390 | /**\r |
391 | This function delete all dynamic entries from the ARP cache that match the specified\r | |
392 | software protocol type.\r | |
393 | \r | |
0c323d07 | 394 | @param This Pointer to the EFI_ARP_PROTOCOL instance.\r |
7bce0c5a | 395 | \r |
396 | @retval EFI_SUCCESS The cache has been flushed.\r | |
397 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
398 | @retval EFI_NOT_FOUND There are no matching dynamic cache entries.\r | |
399 | @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r | |
400 | \r | |
401 | **/\r | |
83cbd279 | 402 | EFI_STATUS\r |
403 | EFIAPI\r | |
404 | ArpFlush (\r | |
405 | IN EFI_ARP_PROTOCOL *This\r | |
406 | );\r | |
407 | \r | |
7bce0c5a | 408 | /**\r |
409 | This function tries to resolve the TargetSwAddress and optionally returns a\r | |
410 | TargetHwAddress if it already exists in the ARP cache.\r | |
411 | \r | |
0c323d07 | 412 | @param This Pointer to the EFI_ARP_PROTOCOL instance.\r |
413 | @param TargetSwAddress Pointer to the protocol address to resolve.\r | |
414 | @param ResolvedEvent Pointer to the event that will be signaled when\r | |
7bce0c5a | 415 | the address is resolved or some error occurs.\r |
0c323d07 | 416 | @param TargetHwAddress Pointer to the buffer for the resolved hardware\r |
7bce0c5a | 417 | address in network byte order.\r |
418 | \r | |
419 | @retval EFI_SUCCESS The data is copied from the ARP cache into the\r | |
420 | TargetHwAddress buffer.\r | |
421 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
422 | This is NULL. TargetHwAddress is NULL.\r | |
423 | @retval EFI_ACCESS_DENIED The requested address is not present in the normal\r | |
424 | ARP cache but is present in the deny address list.\r | |
425 | Outgoing traffic to that address is forbidden.\r | |
426 | @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r | |
427 | @retval EFI_NOT_READY The request has been started and is not finished.\r | |
428 | \r | |
429 | **/\r | |
83cbd279 | 430 | EFI_STATUS\r |
431 | EFIAPI\r | |
432 | ArpRequest (\r | |
433 | IN EFI_ARP_PROTOCOL *This,\r | |
434 | IN VOID *TargetSwAddress OPTIONAL,\r | |
435 | IN EFI_EVENT ResolvedEvent OPTIONAL,\r | |
436 | OUT VOID *TargetHwAddress\r | |
437 | );\r | |
438 | \r | |
7bce0c5a | 439 | /**\r |
440 | This function aborts the previous ARP request (identified by This, TargetSwAddress\r | |
441 | and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().\r | |
c6d0ee4b | 442 | \r |
443 | If the request is in the internal ARP request queue, the request is aborted \r | |
444 | immediately and its ResolvedEvent is signaled. Only an asynchronous address \r | |
445 | request needs to be canceled. If TargeSwAddress and ResolveEvent are both \r | |
446 | NULL, all the pending asynchronous requests that have been issued by This \r | |
447 | instance will be cancelled and their corresponding events will be signaled.\r | |
448 | \r | |
0c323d07 | 449 | @param This Pointer to the EFI_ARP_PROTOCOL instance.\r |
450 | @param TargetSwAddress Pointer to the protocol address in previous\r | |
7bce0c5a | 451 | request session.\r |
0c323d07 | 452 | @param ResolvedEvent Pointer to the event that is used as the\r |
7bce0c5a | 453 | notification event in previous request session.\r |
454 | \r | |
455 | @retval EFI_SUCCESS The pending request session(s) is/are aborted and\r | |
456 | corresponding event(s) is/are signaled.\r | |
457 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
458 | This is NULL. TargetSwAddress is not NULL and\r | |
459 | ResolvedEvent is NULL. TargetSwAddress is NULL and\r | |
460 | ResolvedEvent is not NULL.\r | |
461 | @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r | |
462 | @retval EFI_NOT_FOUND The request is not issued by\r | |
463 | EFI_ARP_PROTOCOL.Request().\r | |
464 | \r | |
465 | **/\r | |
83cbd279 | 466 | EFI_STATUS\r |
467 | EFIAPI\r | |
468 | ArpCancel (\r | |
469 | IN EFI_ARP_PROTOCOL *This,\r | |
470 | IN VOID *TargetSwAddress OPTIONAL,\r | |
471 | IN EFI_EVENT ResolvedEvent OPTIONAL\r | |
472 | );\r | |
473 | \r | |
7bce0c5a | 474 | /**\r |
475 | Configure the instance using the ConfigData. ConfigData is already validated.\r | |
476 | \r | |
c6d0ee4b | 477 | @param[in] Instance Pointer to the instance context data to be\r |
7bce0c5a | 478 | configured.\r |
c6d0ee4b | 479 | @param[in] ConfigData Pointer to the configuration data used to\r |
7bce0c5a | 480 | configure the instance.\r |
481 | \r | |
482 | @retval EFI_SUCCESS The instance is configured with the ConfigData.\r | |
483 | @retval EFI_ACCESS_DENIED The instance is already configured and the\r | |
484 | ConfigData tries to reset some unchangeable\r | |
485 | fields.\r | |
486 | @retval EFI_INVALID_PARAMETER The ConfigData provides a non-unicast IPv4 address\r | |
487 | when the SwAddressType is IPv4.\r | |
488 | @retval EFI_OUT_OF_RESOURCES The instance fails to configure due to memory\r | |
489 | limitation.\r | |
490 | \r | |
491 | **/\r | |
83cbd279 | 492 | EFI_STATUS\r |
493 | ArpConfigureInstance (\r | |
494 | IN ARP_INSTANCE_DATA *Instance,\r | |
495 | IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL\r | |
496 | );\r | |
497 | \r | |
7bce0c5a | 498 | /**\r |
499 | Find the CacheEntry, using ProtocolAddress or HardwareAddress or both, as the keyword,\r | |
500 | in the DeniedCacheTable.\r | |
501 | \r | |
c6d0ee4b | 502 | @param[in] ArpService Pointer to the arp service context data.\r |
503 | @param[in] ProtocolAddress Pointer to the protocol address.\r | |
504 | @param[in] HardwareAddress Pointer to the hardware address.\r | |
7bce0c5a | 505 | \r |
506 | @return Pointer to the matched cache entry, if NULL no match is found.\r | |
507 | \r | |
508 | **/\r | |
83cbd279 | 509 | ARP_CACHE_ENTRY *\r |
510 | ArpFindDeniedCacheEntry (\r | |
511 | IN ARP_SERVICE_DATA *ArpService,\r | |
512 | IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,\r | |
513 | IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL\r | |
514 | );\r | |
515 | \r | |
7bce0c5a | 516 | /**\r |
517 | Find the CacheEntry which matches the requirements in the specified CacheTable.\r | |
518 | \r | |
c6d0ee4b | 519 | @param[in] CacheTable Pointer to the arp cache table.\r |
520 | @param[in] StartEntry Pointer to the start entry this search begins with\r | |
521 | in the cache table.\r | |
522 | @param[in] FindOpType The search type.\r | |
523 | @param[in] ProtocolAddress Pointer to the protocol address to match.\r | |
524 | @param[in] HardwareAddress Pointer to the hardware address to match.\r | |
7bce0c5a | 525 | \r |
526 | @return Pointer to the matched arp cache entry, if NULL, no match is found.\r | |
527 | \r | |
528 | **/\r | |
83cbd279 | 529 | ARP_CACHE_ENTRY *\r |
530 | ArpFindNextCacheEntryInTable (\r | |
e48e37fc | 531 | IN LIST_ENTRY *CacheTable,\r |
532 | IN LIST_ENTRY *StartEntry,\r | |
83cbd279 | 533 | IN FIND_OPTYPE FindOpType,\r |
534 | IN NET_ARP_ADDRESS *ProtocolAddress OPTIONAL,\r | |
535 | IN NET_ARP_ADDRESS *HardwareAddress OPTIONAL\r | |
536 | );\r | |
537 | \r | |
7bce0c5a | 538 | /**\r |
539 | Allocate a cache entry and initialize it.\r | |
540 | \r | |
c6d0ee4b | 541 | @param[in] Instance Pointer to the instance context data.\r |
7bce0c5a | 542 | \r |
543 | @return Pointer to the new created cache entry.\r | |
544 | \r | |
545 | **/\r | |
83cbd279 | 546 | ARP_CACHE_ENTRY *\r |
547 | ArpAllocCacheEntry (\r | |
548 | IN ARP_INSTANCE_DATA *Instance\r | |
549 | );\r | |
550 | \r | |
7bce0c5a | 551 | /**\r |
552 | Fill the addresses in the CacheEntry using the information passed in by\r | |
553 | HwAddr and SwAddr.\r | |
554 | \r | |
c6d0ee4b | 555 | @param[in] CacheEntry Pointer to the cache entry.\r |
556 | @param[in] HwAddr Pointer to the software address.\r | |
557 | @param[in] SwAddr Pointer to the hardware address.\r | |
7bce0c5a | 558 | \r |
559 | @return None.\r | |
560 | \r | |
561 | **/\r | |
83cbd279 | 562 | VOID\r |
563 | ArpFillAddressInCacheEntry (\r | |
564 | IN ARP_CACHE_ENTRY *CacheEntry,\r | |
565 | IN NET_ARP_ADDRESS *HwAddr OPTIONAL,\r | |
566 | IN NET_ARP_ADDRESS *SwAddr OPTIONAL\r | |
567 | );\r | |
568 | \r | |
7bce0c5a | 569 | /**\r |
570 | Turn the CacheEntry into the resolved status.\r | |
571 | \r | |
c6d0ee4b | 572 | @param[in] CacheEntry Pointer to the resolved cache entry.\r |
573 | @param[in] Instance Pointer to the instance context data.\r | |
574 | @param[in] UserEvent Pointer to the UserEvent to notify.\r | |
7bce0c5a | 575 | \r |
576 | @return The count of notifications sent to the instance.\r | |
577 | \r | |
578 | **/\r | |
83cbd279 | 579 | UINTN\r |
580 | ArpAddressResolved (\r | |
581 | IN ARP_CACHE_ENTRY *CacheEntry,\r | |
582 | IN ARP_INSTANCE_DATA *Instance OPTIONAL,\r | |
583 | IN EFI_EVENT UserEvent OPTIONAL\r | |
584 | );\r | |
585 | \r | |
7bce0c5a | 586 | /**\r |
587 | Delete cache entries in all the cache tables.\r | |
588 | \r | |
c6d0ee4b | 589 | @param[in] Instance Pointer to the instance context data.\r |
590 | @param[in] BySwAddress Delete the cache entry by software address or by\r | |
591 | hardware address.\r | |
592 | @param[in] AddressBuffer Pointer to the buffer containing the address to\r | |
593 | match for the deletion.\r | |
594 | @param[in] Force This deletion is forced or not.\r | |
7bce0c5a | 595 | \r |
596 | @return The count of the deleted cache entries.\r | |
597 | \r | |
598 | **/\r | |
83cbd279 | 599 | UINTN\r |
600 | ArpDeleteCacheEntry (\r | |
601 | IN ARP_INSTANCE_DATA *Instance,\r | |
602 | IN BOOLEAN BySwAddress,\r | |
603 | IN UINT8 *AddressBuffer OPTIONAL,\r | |
604 | IN BOOLEAN Force\r | |
605 | );\r | |
606 | \r | |
7bce0c5a | 607 | /**\r |
608 | Send out an arp frame using the CachEntry and the ArpOpCode.\r | |
609 | \r | |
c6d0ee4b | 610 | @param[in] Instance Pointer to the instance context data.\r |
611 | @param[in] CacheEntry Pointer to the configuration data used to\r | |
612 | configure the instance.\r | |
613 | @param[in] ArpOpCode The opcode used to send out this Arp frame, either\r | |
614 | request or reply.\r | |
7bce0c5a | 615 | \r |
616 | @return None.\r | |
617 | \r | |
618 | **/\r | |
83cbd279 | 619 | VOID\r |
620 | ArpSendFrame (\r | |
621 | IN ARP_INSTANCE_DATA *Instance,\r | |
622 | IN ARP_CACHE_ENTRY *CacheEntry,\r | |
623 | IN UINT16 ArpOpCode\r | |
624 | );\r | |
625 | \r | |
7bce0c5a | 626 | /**\r |
627 | Initialize the instance context data.\r | |
628 | \r | |
0c323d07 | 629 | @param[in] ArpService Pointer to the arp service context data this\r |
630 | instance belongs to.\r | |
631 | @param[out] Instance Pointer to the instance context data.\r | |
7bce0c5a | 632 | \r |
633 | @return None.\r | |
634 | \r | |
635 | **/\r | |
83cbd279 | 636 | VOID\r |
637 | ArpInitInstance (\r | |
0c323d07 | 638 | IN ARP_SERVICE_DATA *ArpService,\r |
639 | OUT ARP_INSTANCE_DATA *Instance\r | |
83cbd279 | 640 | );\r |
641 | \r | |
7bce0c5a | 642 | /**\r |
643 | Process the Arp packets received from Mnp, the procedure conforms to RFC826.\r | |
644 | \r | |
c6d0ee4b | 645 | @param[in] Context Pointer to the context data registerd to the\r |
7bce0c5a | 646 | Event.\r |
647 | \r | |
648 | @return None.\r | |
649 | \r | |
650 | **/\r | |
36ee91ca | 651 | VOID\r |
652 | EFIAPI\r | |
653 | ArpOnFrameRcvdDpc (\r | |
654 | IN VOID *Context\r | |
655 | );\r | |
656 | \r | |
7bce0c5a | 657 | /**\r |
658 | Queue ArpOnFrameRcvdDpc as a DPC at TPL_CALLBACK.\r | |
659 | \r | |
c6d0ee4b | 660 | @param[in] Event The Event this notify function registered to.\r |
661 | @param[in] Context Pointer to the context data registerd to the\r | |
662 | Event.\r | |
7bce0c5a | 663 | \r |
664 | @return None.\r | |
665 | \r | |
666 | **/\r | |
83cbd279 | 667 | VOID\r |
668 | EFIAPI\r | |
669 | ArpOnFrameRcvd (\r | |
670 | IN EFI_EVENT Event,\r | |
671 | IN VOID *Context\r | |
672 | );\r | |
673 | \r | |
7bce0c5a | 674 | /**\r |
675 | Process the already sent arp packets.\r | |
0c323d07 | 676 | \r |
c6d0ee4b | 677 | @param[in] Context Pointer to the context data registerd to the\r |
678 | Event.\r | |
7bce0c5a | 679 | \r |
680 | @return None.\r | |
681 | \r | |
682 | **/\r | |
36ee91ca | 683 | VOID\r |
684 | EFIAPI\r | |
685 | ArpOnFrameSentDpc (\r | |
686 | IN VOID *Context\r | |
687 | );\r | |
688 | \r | |
7bce0c5a | 689 | /**\r |
0c323d07 | 690 | Request ArpOnFrameSentDpc as a DPC at TPL_CALLBACK.\r |
7bce0c5a | 691 | \r |
c6d0ee4b | 692 | @param[in] Event The Event this notify function registered to.\r |
693 | @param[in] Context Pointer to the context data registerd to the\r | |
694 | Event.\r | |
7bce0c5a | 695 | \r |
696 | @return None.\r | |
697 | \r | |
698 | **/\r | |
83cbd279 | 699 | VOID\r |
700 | EFIAPI\r | |
701 | ArpOnFrameSent (\r | |
702 | IN EFI_EVENT Event,\r | |
703 | IN VOID *Context\r | |
704 | );\r | |
705 | \r | |
7bce0c5a | 706 | /**\r |
707 | Process the arp cache olding and drive the retrying arp requests.\r | |
708 | \r | |
c6d0ee4b | 709 | @param[in] Event The Event this notify function registered to.\r |
710 | @param[in] Context Pointer to the context data registerd to the\r | |
711 | Event.\r | |
7bce0c5a | 712 | \r |
713 | @return None.\r | |
714 | \r | |
715 | **/\r | |
83cbd279 | 716 | VOID\r |
717 | EFIAPI\r | |
718 | ArpTimerHandler (\r | |
719 | IN EFI_EVENT Event,\r | |
720 | IN VOID *Context\r | |
721 | );\r | |
722 | \r | |
7bce0c5a | 723 | /**\r |
724 | Cancel the arp request.\r | |
725 | \r | |
c6d0ee4b | 726 | @param[in] Instance Pointer to the instance context data.\r |
727 | @param[in] TargetSwAddress Pointer to the buffer containing the target\r | |
728 | software address to match the arp request.\r | |
729 | @param[in] UserEvent The user event used to notify this request\r | |
730 | cancellation.\r | |
7bce0c5a | 731 | \r |
732 | @return The count of the cancelled requests.\r | |
733 | \r | |
734 | **/\r | |
83cbd279 | 735 | UINTN\r |
736 | ArpCancelRequest (\r | |
737 | IN ARP_INSTANCE_DATA *Instance,\r | |
738 | IN VOID *TargetSwAddress OPTIONAL,\r | |
739 | IN EFI_EVENT UserEvent OPTIONAL\r | |
740 | );\r | |
741 | \r | |
7bce0c5a | 742 | /**\r |
743 | Find the cache entry in the cache table.\r | |
744 | \r | |
c6d0ee4b | 745 | @param[in] Instance Pointer to the instance context data.\r |
746 | @param[in] BySwAddress Set to TRUE to look for matching software protocol\r | |
7bce0c5a | 747 | addresses. Set to FALSE to look for matching\r |
748 | hardware protocol addresses.\r | |
c6d0ee4b | 749 | @param[in] AddressBuffer Pointer to address buffer. Set to NULL to match\r |
7bce0c5a | 750 | all addresses.\r |
c6d0ee4b | 751 | @param[out] EntryLength The size of an entry in the entries buffer.\r |
752 | @param[out] EntryCount The number of ARP cache entries that are found by\r | |
7bce0c5a | 753 | the specified criteria.\r |
c6d0ee4b | 754 | @param[out] Entries Pointer to the buffer that will receive the ARP\r |
7bce0c5a | 755 | cache entries.\r |
c6d0ee4b | 756 | @param[in] Refresh Set to TRUE to refresh the timeout value of the\r |
7bce0c5a | 757 | matching ARP cache entry.\r |
758 | \r | |
759 | @retval EFI_SUCCESS The requested ARP cache entries are copied into\r | |
760 | the buffer.\r | |
761 | @retval EFI_NOT_FOUND No matching entries found.\r | |
762 | @retval EFI_OUT_OF_RESOURCE There is a memory allocation failure.\r | |
763 | \r | |
764 | **/\r | |
83cbd279 | 765 | EFI_STATUS\r |
766 | ArpFindCacheEntry (\r | |
767 | IN ARP_INSTANCE_DATA *Instance,\r | |
768 | IN BOOLEAN BySwAddress,\r | |
769 | IN VOID *AddressBuffer OPTIONAL,\r | |
770 | OUT UINT32 *EntryLength OPTIONAL,\r | |
771 | OUT UINT32 *EntryCount OPTIONAL,\r | |
772 | OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,\r | |
773 | IN BOOLEAN Refresh\r | |
774 | );\r | |
775 | \r | |
776 | #endif\r |