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