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