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