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