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