VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Nd.h

Last change on this file was 105670, checked in by vboxsync, 8 months ago

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette