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