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