]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/Ip6Dxe/Ip6Nd.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / Ip6Nd.h
CommitLineData
a3bcde70
HT
1/** @file\r
2 Definition of Neighbor Discovery support routines.\r
3\r
75dce340 4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
a3bcde70 5\r
ecf98fbc 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
a3bcde70
HT
7\r
8**/\r
9\r
10#ifndef __EFI_IP6_ND_H__\r
11#define __EFI_IP6_ND_H__\r
12\r
13#define IP6_GET_TICKS(Ms) (((Ms) + IP6_TIMER_INTERVAL_IN_MS - 1) / IP6_TIMER_INTERVAL_IN_MS)\r
14\r
15enum {\r
d1050b9d 16 IP6_INF_ROUTER_LIFETIME = 0xFFFF,\r
a3bcde70
HT
17\r
18 IP6_MAX_RTR_SOLICITATION_DELAY = 1000, ///< 1000 milliseconds\r
19 IP6_MAX_RTR_SOLICITATIONS = 3,\r
20 IP6_RTR_SOLICITATION_INTERVAL = 4000,\r
21\r
d1050b9d
MK
22 IP6_MIN_RANDOM_FACTOR_SCALED = 1,\r
23 IP6_MAX_RANDOM_FACTOR_SCALED = 3,\r
24 IP6_RANDOM_FACTOR_SCALE = 2,\r
a3bcde70 25\r
d1050b9d
MK
26 IP6_MAX_MULTICAST_SOLICIT = 3,\r
27 IP6_MAX_UNICAST_SOLICIT = 3,\r
28 IP6_MAX_ANYCAST_DELAY_TIME = 1,\r
29 IP6_MAX_NEIGHBOR_ADV = 3,\r
30 IP6_REACHABLE_TIME = 30000,\r
31 IP6_RETRANS_TIMER = 1000,\r
32 IP6_DELAY_FIRST_PROBE_TIME = 5000,\r
a3bcde70 33\r
d1050b9d
MK
34 IP6_MIN_LINK_MTU = 1280,\r
35 IP6_MAX_LINK_MTU = 1500,\r
a3bcde70 36\r
d1050b9d
MK
37 IP6_IS_ROUTER_FLAG = 0x80,\r
38 IP6_SOLICITED_FLAG = 0x40,\r
39 IP6_OVERRIDE_FLAG = 0x20,\r
a3bcde70 40\r
d1050b9d
MK
41 IP6_M_ADDR_CONFIG_FLAG = 0x80,\r
42 IP6_O_CONFIG_FLAG = 0x40,\r
a3bcde70 43\r
d1050b9d
MK
44 IP6_ON_LINK_FLAG = 0x80,\r
45 IP6_AUTO_CONFIG_FLAG = 0x40,\r
a3bcde70 46\r
d1050b9d
MK
47 IP6_ND_LENGTH = 24,\r
48 IP6_RA_LENGTH = 16,\r
49 IP6_REDITECT_LENGTH = 40,\r
50 IP6_DAD_ENTRY_SIGNATURE = SIGNATURE_32 ('I', 'P', 'D', 'E')\r
a3bcde70
HT
51};\r
52\r
53typedef\r
54VOID\r
55(*IP6_ARP_CALLBACK) (\r
d1050b9d 56 VOID *Context\r
a3bcde70
HT
57 );\r
58\r
9c20342e 59typedef struct _IP6_OPTION_HEADER {\r
d1050b9d
MK
60 UINT8 Type;\r
61 UINT8 Length;\r
9c20342e
MR
62} IP6_OPTION_HEADER;\r
63\r
64STATIC_ASSERT (sizeof (IP6_OPTION_HEADER) == 2, "IP6_OPTION_HEADER is expected to be exactly 2 bytes long.");\r
65\r
a3bcde70 66typedef struct _IP6_ETHE_ADDR_OPTION {\r
d1050b9d
MK
67 UINT8 Type;\r
68 UINT8 Length;\r
69 UINT8 EtherAddr[6];\r
a3bcde70
HT
70} IP6_ETHER_ADDR_OPTION;\r
71\r
9c20342e
MR
72STATIC_ASSERT (sizeof (IP6_ETHER_ADDR_OPTION) == 8, "IP6_ETHER_ADDR_OPTION is expected to be exactly 8 bytes long.");\r
73\r
a3bcde70 74typedef struct _IP6_MTU_OPTION {\r
d1050b9d
MK
75 UINT8 Type;\r
76 UINT8 Length;\r
77 UINT16 Reserved;\r
78 UINT32 Mtu;\r
a3bcde70
HT
79} IP6_MTU_OPTION;\r
80\r
9c20342e
MR
81STATIC_ASSERT (sizeof (IP6_MTU_OPTION) == 8, "IP6_MTU_OPTION is expected to be exactly 8 bytes long.");\r
82\r
a3bcde70 83typedef struct _IP6_PREFIX_INFO_OPTION {\r
d1050b9d
MK
84 UINT8 Type;\r
85 UINT8 Length;\r
86 UINT8 PrefixLength;\r
87 UINT8 Reserved1;\r
88 UINT32 ValidLifetime;\r
89 UINT32 PreferredLifetime;\r
90 UINT32 Reserved2;\r
91 EFI_IPv6_ADDRESS Prefix;\r
a3bcde70
HT
92} IP6_PREFIX_INFO_OPTION;\r
93\r
9c20342e
MR
94STATIC_ASSERT (sizeof (IP6_PREFIX_INFO_OPTION) == 32, "IP6_PREFIX_INFO_OPTION is expected to be exactly 32 bytes long.");\r
95\r
a3bcde70
HT
96typedef\r
97VOID\r
98(*IP6_DAD_CALLBACK) (\r
99 IN BOOLEAN IsDadPassed,\r
100 IN EFI_IPv6_ADDRESS *TargetAddress,\r
101 IN VOID *Context\r
102 );\r
103\r
104typedef struct _IP6_DAD_ENTRY {\r
d1050b9d
MK
105 UINT32 Signature;\r
106 LIST_ENTRY Link;\r
107 UINT32 MaxTransmit;\r
108 UINT32 Transmit;\r
109 UINT32 Receive;\r
110 UINT32 RetransTick;\r
111 IP6_ADDRESS_INFO *AddressInfo;\r
112 EFI_IPv6_ADDRESS Destination;\r
113 IP6_DAD_CALLBACK Callback;\r
114 VOID *Context;\r
a3bcde70
HT
115} IP6_DAD_ENTRY;\r
116\r
117typedef struct _IP6_DELAY_JOIN_LIST {\r
d1050b9d
MK
118 LIST_ENTRY Link;\r
119 UINT32 DelayTime; ///< in tick per 50 milliseconds\r
120 IP6_INTERFACE *Interface;\r
121 IP6_ADDRESS_INFO *AddressInfo;\r
122 IP6_DAD_CALLBACK DadCallback;\r
123 VOID *Context;\r
a3bcde70
HT
124} IP6_DELAY_JOIN_LIST;\r
125\r
126typedef struct _IP6_NEIGHBOR_ENTRY {\r
127 LIST_ENTRY Link;\r
128 LIST_ENTRY ArpList;\r
129 INTN RefCnt;\r
130 BOOLEAN IsRouter;\r
131 BOOLEAN ArpFree;\r
132 BOOLEAN Dynamic;\r
133 EFI_IPv6_ADDRESS Neighbor;\r
134 EFI_MAC_ADDRESS LinkAddress;\r
135 EFI_IP6_NEIGHBOR_STATE State;\r
136 UINT32 Transmit;\r
137 UINT32 Ticks;\r
138\r
139 LIST_ENTRY Frames;\r
140 IP6_INTERFACE *Interface;\r
141 IP6_ARP_CALLBACK CallBack;\r
142} IP6_NEIGHBOR_ENTRY;\r
143\r
144typedef struct _IP6_DEFAULT_ROUTER {\r
d1050b9d
MK
145 LIST_ENTRY Link;\r
146 INTN RefCnt;\r
147 UINT16 Lifetime;\r
148 EFI_IPv6_ADDRESS Router;\r
149 IP6_NEIGHBOR_ENTRY *NeighborCache;\r
a3bcde70
HT
150} IP6_DEFAULT_ROUTER;\r
151\r
152typedef struct _IP6_PREFIX_LIST_ENTRY {\r
d1050b9d
MK
153 LIST_ENTRY Link;\r
154 INTN RefCnt;\r
155 UINT32 ValidLifetime;\r
156 UINT32 PreferredLifetime;\r
157 UINT8 PrefixLength;\r
158 EFI_IPv6_ADDRESS Prefix;\r
a3bcde70
HT
159} IP6_PREFIX_LIST_ENTRY;\r
160\r
161/**\r
162 Build a array of EFI_IP6_NEIGHBOR_CACHE to be returned to the caller. The number\r
163 of EFI_IP6_NEIGHBOR_CACHE is also returned.\r
164\r
165 @param[in] IpInstance The pointer to IP6_PROTOCOL instance.\r
166 @param[out] NeighborCount The number of returned neighbor cache entries.\r
167 @param[out] NeighborCache The pointer to the array of EFI_IP6_NEIGHBOR_CACHE.\r
168\r
169 @retval EFI_SUCCESS The EFI_IP6_NEIGHBOR_CACHE successfully built.\r
170 @retval EFI_OUT_OF_RESOURCES Failed to allocate the memory for the route table.\r
171\r
172**/\r
173EFI_STATUS\r
174Ip6BuildEfiNeighborCache (\r
d1050b9d
MK
175 IN IP6_PROTOCOL *IpInstance,\r
176 OUT UINT32 *NeighborCount,\r
177 OUT EFI_IP6_NEIGHBOR_CACHE **NeighborCache\r
a3bcde70
HT
178 );\r
179\r
180/**\r
181 Build a array of EFI_IP6_ADDRESS_INFO to be returned to the caller. The number\r
182 of prefix entries is also returned.\r
183\r
184 @param[in] IpInstance The pointer to IP6_PROTOCOL instance.\r
185 @param[out] PrefixCount The number of returned prefix entries.\r
186 @param[out] PrefixTable The pointer to the array of PrefixTable.\r
187\r
188 @retval EFI_SUCCESS The prefix table successfully built.\r
189 @retval EFI_OUT_OF_RESOURCES Failed to allocate the memory for the prefix table.\r
190\r
191**/\r
192EFI_STATUS\r
193Ip6BuildPrefixTable (\r
194 IN IP6_PROTOCOL *IpInstance,\r
195 OUT UINT32 *PrefixCount,\r
196 OUT EFI_IP6_ADDRESS_INFO **PrefixTable\r
197 );\r
198\r
199/**\r
200 Allocate and initialize an IP6 default router entry.\r
201\r
202 @param[in] IpSb The pointer to the IP6_SERVICE instance.\r
203 @param[in] Ip6Address The IPv6 address of the default router.\r
204 @param[in] RouterLifetime The lifetime associated with the default\r
205 router, in units of seconds.\r
206\r
207 @return NULL if it failed to allocate memory for the default router node.\r
208 Otherwise, point to the created default router node.\r
209\r
210**/\r
211IP6_DEFAULT_ROUTER *\r
212Ip6CreateDefaultRouter (\r
d1050b9d
MK
213 IN IP6_SERVICE *IpSb,\r
214 IN EFI_IPv6_ADDRESS *Ip6Address,\r
215 IN UINT16 RouterLifetime\r
a3bcde70
HT
216 );\r
217\r
218/**\r
219 Destroy an IP6 default router entry.\r
220\r
221 @param[in] IpSb The pointer to the IP6_SERVICE instance.\r
222 @param[in] DefaultRouter The to be destroyed IP6_DEFAULT_ROUTER.\r
223\r
224**/\r
225VOID\r
226Ip6DestroyDefaultRouter (\r
d1050b9d
MK
227 IN IP6_SERVICE *IpSb,\r
228 IN IP6_DEFAULT_ROUTER *DefaultRouter\r
a3bcde70
HT
229 );\r
230\r
231/**\r
232 Clean an IP6 default router list.\r
233\r
234 @param[in] IpSb The pointer to the IP6_SERVICE instance.\r
a3bcde70
HT
235\r
236**/\r
237VOID\r
238Ip6CleanDefaultRouterList (\r
d1050b9d 239 IN IP6_SERVICE *IpSb\r
a3bcde70
HT
240 );\r
241\r
242/**\r
243 Search a default router node from an IP6 default router list.\r
244\r
245 @param[in] IpSb The pointer to the IP6_SERVICE instance.\r
246 @param[in] Ip6Address The IPv6 address of the to be searched default router node.\r
247\r
248 @return NULL if it failed to find the matching default router node.\r
249 Otherwise, point to the found default router node.\r
250\r
251**/\r
252IP6_DEFAULT_ROUTER *\r
253Ip6FindDefaultRouter (\r
d1050b9d
MK
254 IN IP6_SERVICE *IpSb,\r
255 IN EFI_IPv6_ADDRESS *Ip6Address\r
a3bcde70
HT
256 );\r
257\r
258/**\r
259 The function to be called after DAD (Duplicate Address Detection) is performed.\r
260\r
261 @param[in] IsDadPassed If TRUE, the DAD operation succeed. Otherwise, the DAD operation failed.\r
262 @param[in] IpIf Points to the IP6_INTERFACE.\r
263 @param[in] DadEntry The DAD entry which already performed DAD.\r
264\r
265**/\r
266VOID\r
267Ip6OnDADFinished (\r
268 IN BOOLEAN IsDadPassed,\r
269 IN IP6_INTERFACE *IpIf,\r
270 IN IP6_DAD_ENTRY *DadEntry\r
271 );\r
272\r
273/**\r
274 Create a DAD (Duplicate Address Detection) entry and queue it to be performed.\r
275\r
276 @param[in] IpIf Points to the IP6_INTERFACE.\r
277 @param[in] AddressInfo The address information which needs DAD performed.\r
278 @param[in] Callback The callback routine that will be called after DAD\r
279 is performed. This is an optional parameter that\r
280 may be NULL.\r
281 @param[in] Context The opaque parameter for a DAD callback routine.\r
282 This is an optional parameter that may be NULL.\r
283\r
284 @retval EFI_SUCCESS The DAD entry was created and queued.\r
285 @retval EFI_OUT_OF_RESOURCES Failed to allocate the memory to complete the\r
286 operation.\r
287\r
288\r
289**/\r
290EFI_STATUS\r
291Ip6InitDADProcess (\r
d1050b9d
MK
292 IN IP6_INTERFACE *IpIf,\r
293 IN IP6_ADDRESS_INFO *AddressInfo,\r
294 IN IP6_DAD_CALLBACK Callback OPTIONAL,\r
295 IN VOID *Context OPTIONAL\r
a3bcde70
HT
296 );\r
297\r
298/**\r
299 Search IP6_DAD_ENTRY from the Duplicate Address Detection List.\r
300\r
301 @param[in] IpSb The pointer to the IP6_SERVICE instance.\r
302 @param[in] Target The address information which needs DAD performed .\r
303 @param[out] Interface If not NULL, output the IP6 interface that configures\r
304 the tentative address.\r
305\r
306 @return NULL if failed to find the matching DAD entry.\r
307 Otherwise, point to the found DAD entry.\r
308\r
309**/\r
310IP6_DAD_ENTRY *\r
311Ip6FindDADEntry (\r
d1050b9d
MK
312 IN IP6_SERVICE *IpSb,\r
313 IN EFI_IPv6_ADDRESS *Target,\r
314 OUT IP6_INTERFACE **Interface OPTIONAL\r
a3bcde70
HT
315 );\r
316\r
317/**\r
318 Allocate and initialize a IP6 prefix list entry.\r
319\r
320 @param[in] IpSb The pointer to IP6_SERVICE instance.\r
321 @param[in] OnLinkOrAuto If TRUE, the entry is created for the on link prefix list.\r
322 Otherwise, it is created for the autoconfiguration prefix list.\r
323 @param[in] ValidLifetime The length of time in seconds that the prefix\r
324 is valid for the purpose of on-link determination.\r
325 @param[in] PreferredLifetime The length of time in seconds that addresses\r
326 generated from the prefix via stateless address\r
327 autoconfiguration remain preferred.\r
328 @param[in] PrefixLength The prefix length of the Prefix.\r
329 @param[in] Prefix The prefix address.\r
330\r
331 @return NULL if it failed to allocate memory for the prefix node. Otherwise, point\r
332 to the created or existing prefix list entry.\r
333\r
334**/\r
335IP6_PREFIX_LIST_ENTRY *\r
336Ip6CreatePrefixListEntry (\r
d1050b9d
MK
337 IN IP6_SERVICE *IpSb,\r
338 IN BOOLEAN OnLinkOrAuto,\r
339 IN UINT32 ValidLifetime,\r
340 IN UINT32 PreferredLifetime,\r
341 IN UINT8 PrefixLength,\r
342 IN EFI_IPv6_ADDRESS *Prefix\r
a3bcde70
HT
343 );\r
344\r
345/**\r
75dce340 346 Destroy a IP6 prefix list entry.\r
a3bcde70
HT
347\r
348 @param[in] IpSb The pointer to IP6_SERVICE instance.\r
349 @param[in] PrefixEntry The to be destroyed prefix list entry.\r
350 @param[in] OnLinkOrAuto If TRUE, the entry is removed from on link prefix list.\r
351 Otherwise remove from autoconfiguration prefix list.\r
352 @param[in] ImmediateDelete If TRUE, remove the entry directly.\r
353 Otherwise, check the reference count to see whether\r
354 it should be removed.\r
355\r
356**/\r
357VOID\r
358Ip6DestroyPrefixListEntry (\r
359 IN IP6_SERVICE *IpSb,\r
360 IN IP6_PREFIX_LIST_ENTRY *PrefixEntry,\r
361 IN BOOLEAN OnLinkOrAuto,\r
362 IN BOOLEAN ImmediateDelete\r
363 );\r
364\r
365/**\r
366 Search the list array to find an IP6 prefix list entry.\r
367\r
368 @param[in] IpSb The pointer to IP6_SERVICE instance.\r
369 @param[in] OnLinkOrAuto If TRUE, the search the link prefix list,\r
370 Otherwise search the autoconfiguration prefix list.\r
371 @param[in] PrefixLength The prefix length of the Prefix\r
372 @param[in] Prefix The prefix address.\r
373\r
374 @return NULL if cannot find the IP6 prefix list entry. Otherwise, return the\r
375 pointer to the IP6 prefix list entry.\r
376\r
377**/\r
378IP6_PREFIX_LIST_ENTRY *\r
379Ip6FindPrefixListEntry (\r
d1050b9d
MK
380 IN IP6_SERVICE *IpSb,\r
381 IN BOOLEAN OnLinkOrAuto,\r
382 IN UINT8 PrefixLength,\r
383 IN EFI_IPv6_ADDRESS *Prefix\r
a3bcde70
HT
384 );\r
385\r
386/**\r
387 Release the resource in prefix list table, and destroy the list entry and\r
388 corresponding addresses or route entries.\r
389\r
390 @param[in] IpSb The pointer to the IP6_SERVICE instance.\r
391 @param[in] ListHead The list entry head of the prefix list table.\r
392\r
393**/\r
394VOID\r
395Ip6CleanPrefixListTable (\r
d1050b9d
MK
396 IN IP6_SERVICE *IpSb,\r
397 IN LIST_ENTRY *ListHead\r
a3bcde70
HT
398 );\r
399\r
400/**\r
401 Allocate and initialize an IP6 neighbor cache entry.\r
402\r
403 @param[in] IpSb The pointer to the IP6_SERVICE instance.\r
404 @param[in] CallBack The callback function to be called when\r
405 address resolution is finished.\r
406 @param[in] Ip6Address Points to the IPv6 address of the neighbor.\r
407 @param[in] LinkAddress Points to the MAC address of the neighbor.\r
408 Ignored if NULL.\r
409\r
410 @return NULL if failed to allocate memory for the neighbor cache entry.\r
411 Otherwise, point to the created neighbor cache entry.\r
412\r
413**/\r
414IP6_NEIGHBOR_ENTRY *\r
415Ip6CreateNeighborEntry (\r
d1050b9d
MK
416 IN IP6_SERVICE *IpSb,\r
417 IN IP6_ARP_CALLBACK CallBack,\r
418 IN EFI_IPv6_ADDRESS *Ip6Address,\r
419 IN EFI_MAC_ADDRESS *LinkAddress OPTIONAL\r
a3bcde70
HT
420 );\r
421\r
422/**\r
423 Search a IP6 neighbor cache entry.\r
424\r
425 @param[in] IpSb The pointer to the IP6_SERVICE instance.\r
426 @param[in] Ip6Address Points to the IPv6 address of the neighbor.\r
427\r
428 @return NULL if it failed to find the matching neighbor cache entry.\r
429 Otherwise, point to the found neighbor cache entry.\r
430\r
431**/\r
432IP6_NEIGHBOR_ENTRY *\r
433Ip6FindNeighborEntry (\r
d1050b9d
MK
434 IN IP6_SERVICE *IpSb,\r
435 IN EFI_IPv6_ADDRESS *Ip6Address\r
a3bcde70
HT
436 );\r
437\r
438/**\r
439 Free a IP6 neighbor cache entry and remove all the frames on the address\r
440 resolution queue that pass the FrameToCancel. That is, either FrameToCancel\r
441 is NULL, or it returns true for the frame.\r
442\r
443 @param[in] IpSb The pointer to the IP6_SERVICE instance.\r
444 @param[in] NeighborCache The to be free neighbor cache entry.\r
445 @param[in] SendIcmpError If TRUE, send out ICMP error.\r
446 @param[in] FullFree If TRUE, remove the neighbor cache entry.\r
447 Otherwise remove the pending frames.\r
448 @param[in] IoStatus The status returned to the cancelled frames'\r
449 callback function.\r
450 @param[in] FrameToCancel Function to select which frame to cancel.\r
451 This is an optional parameter that may be NULL.\r
452 @param[in] Context Opaque parameter to the FrameToCancel.\r
453 Ignored if FrameToCancel is NULL.\r
454\r
455 @retval EFI_INVALID_PARAMETER The input parameter is invalid.\r
456 @retval EFI_SUCCESS The operation finished successfully.\r
457\r
458**/\r
459EFI_STATUS\r
460Ip6FreeNeighborEntry (\r
d1050b9d
MK
461 IN IP6_SERVICE *IpSb,\r
462 IN IP6_NEIGHBOR_ENTRY *NeighborCache,\r
463 IN BOOLEAN SendIcmpError,\r
464 IN BOOLEAN FullFree,\r
465 IN EFI_STATUS IoStatus,\r
466 IN IP6_FRAME_TO_CANCEL FrameToCancel OPTIONAL,\r
467 IN VOID *Context OPTIONAL\r
a3bcde70
HT
468 );\r
469\r
470/**\r
471 Add Neighbor cache entries. It is a work function for EfiIp6Neighbors().\r
472\r
473 @param[in] IpSb The IP6 service binding instance.\r
474 @param[in] TargetIp6Address Pointer to Target IPv6 address.\r
475 @param[in] TargetLinkAddress Pointer to link-layer address of the target. Ignored if NULL.\r
476 @param[in] Timeout Time in 100-ns units that this entry will remain in the neighbor\r
477 cache. It will be deleted after Timeout. A value of zero means that\r
478 the entry is permanent. A non-zero value means that the entry is\r
479 dynamic.\r
480 @param[in] Override If TRUE, the cached link-layer address of the matching entry will\r
481 be overridden and updated; if FALSE, and if a\r
482 corresponding cache entry already existed, EFI_ACCESS_DENIED\r
483 will be returned.\r
484\r
485 @retval EFI_SUCCESS The neighbor cache entry has been added.\r
486 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the neighbor cache\r
487 due to insufficient resources.\r
488 @retval EFI_NOT_FOUND TargetLinkAddress is NULL.\r
489 @retval EFI_ACCESS_DENIED The to-be-added entry is already defined in the neighbor cache,\r
490 and that entry is tagged as un-overridden (when DeleteFlag\r
491 is FALSE).\r
492\r
493**/\r
494EFI_STATUS\r
495Ip6AddNeighbor (\r
d1050b9d
MK
496 IN IP6_SERVICE *IpSb,\r
497 IN EFI_IPv6_ADDRESS *TargetIp6Address,\r
498 IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,\r
499 IN UINT32 Timeout,\r
500 IN BOOLEAN Override\r
a3bcde70
HT
501 );\r
502\r
503/**\r
504 Delete or update Neighbor cache entries. It is a work function for EfiIp6Neighbors().\r
505\r
506 @param[in] IpSb The IP6 service binding instance.\r
507 @param[in] TargetIp6Address Pointer to Target IPv6 address.\r
508 @param[in] TargetLinkAddress Pointer to link-layer address of the target. Ignored if NULL.\r
509 @param[in] Timeout Time in 100-ns units that this entry will remain in the neighbor\r
510 cache. It will be deleted after Timeout. A value of zero means that\r
511 the entry is permanent. A non-zero value means that the entry is\r
512 dynamic.\r
513 @param[in] Override If TRUE, the cached link-layer address of the matching entry will\r
514 be overridden and updated; if FALSE, and if a\r
515 corresponding cache entry already existed, EFI_ACCESS_DENIED\r
516 will be returned.\r
517\r
518 @retval EFI_SUCCESS The neighbor cache entry has been updated or deleted.\r
519 @retval EFI_NOT_FOUND This entry is not in the neighbor cache.\r
520\r
521**/\r
522EFI_STATUS\r
523Ip6DelNeighbor (\r
d1050b9d
MK
524 IN IP6_SERVICE *IpSb,\r
525 IN EFI_IPv6_ADDRESS *TargetIp6Address,\r
526 IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,\r
527 IN UINT32 Timeout,\r
528 IN BOOLEAN Override\r
a3bcde70
HT
529 );\r
530\r
531/**\r
532 Process the Neighbor Solicitation message. The message may be sent for Duplicate\r
533 Address Detection or Address Resolution.\r
534\r
535 @param[in] IpSb The IP service that received the packet.\r
536 @param[in] Head The IP head of the message.\r
537 @param[in] Packet The content of the message with IP head removed.\r
538\r
539 @retval EFI_SUCCESS The packet processed successfully.\r
540 @retval EFI_INVALID_PARAMETER The packet is invalid.\r
541 @retval EFI_ICMP_ERROR The packet indicates that DAD is failed.\r
542 @retval Others Failed to process the packet.\r
543\r
544**/\r
545EFI_STATUS\r
546Ip6ProcessNeighborSolicit (\r
d1050b9d
MK
547 IN IP6_SERVICE *IpSb,\r
548 IN EFI_IP6_HEADER *Head,\r
549 IN NET_BUF *Packet\r
a3bcde70
HT
550 );\r
551\r
552/**\r
553 Process the Neighbor Advertisement message.\r
554\r
555 @param[in] IpSb The IP service that received the packet.\r
556 @param[in] Head The IP head of the message.\r
557 @param[in] Packet The content of the message with IP head removed.\r
558\r
559 @retval EFI_SUCCESS The packet processed successfully.\r
560 @retval EFI_INVALID_PARAMETER The packet is invalid.\r
561 @retval EFI_ICMP_ERROR The packet indicates that DAD is failed.\r
562 @retval Others Failed to process the packet.\r
563\r
564**/\r
565EFI_STATUS\r
566Ip6ProcessNeighborAdvertise (\r
d1050b9d
MK
567 IN IP6_SERVICE *IpSb,\r
568 IN EFI_IP6_HEADER *Head,\r
569 IN NET_BUF *Packet\r
a3bcde70
HT
570 );\r
571\r
572/**\r
573 Process the Router Advertisement message according to RFC4861.\r
574\r
575 @param[in] IpSb The IP service that received the packet.\r
576 @param[in] Head The IP head of the message.\r
577 @param[in] Packet The content of the message with the IP head removed.\r
578\r
579 @retval EFI_SUCCESS The packet processed successfully.\r
580 @retval EFI_INVALID_PARAMETER The packet is invalid.\r
581 @retval EFI_OUT_OF_RESOURCES Insufficient resources to complete the operation.\r
582 @retval Others Failed to process the packet.\r
583\r
584**/\r
585EFI_STATUS\r
586Ip6ProcessRouterAdvertise (\r
d1050b9d
MK
587 IN IP6_SERVICE *IpSb,\r
588 IN EFI_IP6_HEADER *Head,\r
589 IN NET_BUF *Packet\r
a3bcde70
HT
590 );\r
591\r
592/**\r
593 Process the ICMPv6 redirect message. Find the instance, then update\r
594 its route cache.\r
595\r
596 @param[in] IpSb The IP6 service binding instance that received\r
597 the packet.\r
598 @param[in] Head The IP head of the received ICMPv6 packet.\r
599 @param[in] Packet The content of the ICMPv6 redirect packet with\r
600 the IP head removed.\r
601\r
602 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
7de8045a 603 @retval EFI_OUT_OF_RESOURCES Insufficient resources to complete the\r
a3bcde70
HT
604 operation.\r
605 @retval EFI_SUCCESS Successfully updated the route caches.\r
606\r
607**/\r
608EFI_STATUS\r
609Ip6ProcessRedirect (\r
d1050b9d
MK
610 IN IP6_SERVICE *IpSb,\r
611 IN EFI_IP6_HEADER *Head,\r
612 IN NET_BUF *Packet\r
a3bcde70
HT
613 );\r
614\r
615/**\r
616 Generate router solicit message and send it out to Destination Address or\r
617 All Router Link Local scope multicast address.\r
618\r
619 @param[in] IpSb The IP service to send the packet.\r
620 @param[in] Interface If not NULL, points to the IP6 interface to send\r
621 the packet.\r
622 @param[in] SourceAddress If not NULL, the source address of the message.\r
623 @param[in] DestinationAddress If not NULL, the destination address of the message.\r
624 @param[in] SourceLinkAddress If not NULL, the MAC address of the source.\r
625 A source link-layer address option will be appended\r
626 to the message.\r
627\r
628 @retval EFI_OUT_OF_RESOURCES Insufficient resources to complete the operation.\r
629 @retval EFI_SUCCESS The router solicit message was successfully sent.\r
630\r
631**/\r
632EFI_STATUS\r
633Ip6SendRouterSolicit (\r
d1050b9d
MK
634 IN IP6_SERVICE *IpSb,\r
635 IN IP6_INTERFACE *Interface OPTIONAL,\r
636 IN EFI_IPv6_ADDRESS *SourceAddress OPTIONAL,\r
637 IN EFI_IPv6_ADDRESS *DestinationAddress OPTIONAL,\r
638 IN EFI_MAC_ADDRESS *SourceLinkAddress OPTIONAL\r
a3bcde70
HT
639 );\r
640\r
641/**\r
642 Generate the Neighbor Solicitation message and send it to the Destination Address.\r
643\r
644 @param[in] IpSb The IP service to send the packet\r
645 @param[in] SourceAddress The source address of the message.\r
646 @param[in] DestinationAddress The destination address of the message.\r
647 @param[in] TargetIp6Address The IP address of the target of the solicitation.\r
648 It must not be a multicast address.\r
649 @param[in] SourceLinkAddress The MAC address for the sender. If not NULL,\r
650 a source link-layer address option will be appended\r
651 to the message.\r
652\r
653 @retval EFI_INVALID_PARAMETER Any input parameter is invalid.\r
654 @retval EFI_OUT_OF_RESOURCES Insufficient resources to complete the\r
655 operation.\r
656 @retval EFI_SUCCESS The Neighbor Advertise message was successfully sent.\r
657\r
658**/\r
659EFI_STATUS\r
660Ip6SendNeighborSolicit (\r
d1050b9d
MK
661 IN IP6_SERVICE *IpSb,\r
662 IN EFI_IPv6_ADDRESS *SourceAddress,\r
663 IN EFI_IPv6_ADDRESS *DestinationAddress,\r
664 IN EFI_IPv6_ADDRESS *TargetIp6Address,\r
665 IN EFI_MAC_ADDRESS *SourceLinkAddress OPTIONAL\r
a3bcde70
HT
666 );\r
667\r
668/**\r
669 Set the interface's address. This will trigger the DAD process for the\r
670 address to set. To set an already set address, the lifetimes wil be\r
671 updated to the new value passed in.\r
672\r
673 @param[in] Interface The interface to set the address.\r
674 @param[in] Ip6Addr The interface's to be assigned IPv6 address.\r
675 @param[in] IsAnycast If TRUE, the unicast IPv6 address is anycast.\r
676 Otherwise, it is not anycast.\r
677 @param[in] PrefixLength The prefix length of the Ip6Addr.\r
678 @param[in] ValidLifetime The valid lifetime for this address.\r
679 @param[in] PreferredLifetime The preferred lifetime for this address.\r
680 @param[in] DadCallback The caller's callback to trigger when DAD finishes.\r
681 This is an optional parameter that may be NULL.\r
682 @param[in] Context The context that will be passed to DadCallback.\r
683 This is an optional parameter that may be NULL.\r
684\r
685 @retval EFI_SUCCESS The interface is scheduled to be configured with\r
686 the specified address.\r
687 @retval EFI_OUT_OF_RESOURCES Failed to set the interface's address due to\r
688 lack of resources.\r
689\r
690**/\r
691EFI_STATUS\r
692Ip6SetAddress (\r
d1050b9d
MK
693 IN IP6_INTERFACE *Interface,\r
694 IN EFI_IPv6_ADDRESS *Ip6Addr,\r
695 IN BOOLEAN IsAnycast,\r
696 IN UINT8 PrefixLength,\r
697 IN UINT32 ValidLifetime,\r
698 IN UINT32 PreferredLifetime,\r
699 IN IP6_DAD_CALLBACK DadCallback OPTIONAL,\r
700 IN VOID *Context OPTIONAL\r
a3bcde70
HT
701 );\r
702\r
703/**\r
704 The heartbeat timer of ND module in IP6_TIMER_INTERVAL_IN_MS milliseconds.\r
705 This time routine handles DAD module and neighbor state transition.\r
706 It is also responsible for sending out router solicitations.\r
707\r
708 @param[in] Event The IP6 service instance's heartbeat timer.\r
709 @param[in] Context The IP6 service instance.\r
710\r
711**/\r
712VOID\r
713EFIAPI\r
714Ip6NdFasterTimerTicking (\r
d1050b9d
MK
715 IN EFI_EVENT Event,\r
716 IN VOID *Context\r
a3bcde70
HT
717 );\r
718\r
719/**\r
720 The heartbeat timer of ND module in 1 second. This time routine handles following\r
7de8045a 721 things: 1) maintain default router list; 2) maintain prefix options;\r
a3bcde70
HT
722 3) maintain route caches.\r
723\r
724 @param[in] IpSb The IP6 service binding instance.\r
725\r
726**/\r
727VOID\r
728Ip6NdTimerTicking (\r
d1050b9d 729 IN IP6_SERVICE *IpSb\r
a3bcde70
HT
730 );\r
731\r
732/**\r
733 Callback function when address resolution is finished. It will cancel\r
734 all the queued frames if the address resolution failed, or transmit them\r
735 if the request succeeded.\r
736\r
737 @param[in] Context The context of the callback, a pointer to IP6_NEIGHBOR_ENTRY.\r
738\r
739**/\r
740VOID\r
741Ip6OnArpResolved (\r
d1050b9d 742 IN VOID *Context\r
a3bcde70
HT
743 );\r
744\r
745/**\r
746 Update the ReachableTime in IP6 service binding instance data, in milliseconds.\r
747\r
748 @param[in, out] IpSb Points to the IP6_SERVICE.\r
749\r
750**/\r
751VOID\r
752Ip6UpdateReachableTime (\r
753 IN OUT IP6_SERVICE *IpSb\r
754 );\r
755\r
756#endif\r