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