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