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