]>
Commit | Line | Data |
---|---|---|
a3bcde70 HT |
1 | /** @file\r |
2 | Implementation of EFI_IP6_PROTOCOL protocol interfaces and type definitions.\r | |
3 | \r | |
142c00c3 | 4 | Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r |
c79de074 | 5 | (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r |
a3bcde70 HT |
6 | \r |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php.\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #ifndef __EFI_IP6_IMPL_H__\r | |
18 | #define __EFI_IP6_IMPL_H__\r | |
19 | \r | |
20 | #include <Uefi.h>\r | |
21 | \r | |
142c00c3 ZL |
22 | #include <IndustryStandard/Dhcp.h>\r |
23 | \r | |
a3bcde70 HT |
24 | #include <Protocol/ServiceBinding.h>\r |
25 | #include <Protocol/ManagedNetwork.h>\r | |
26 | #include <Protocol/IpSec.h>\r | |
27 | #include <Protocol/Ip6.h>\r | |
28 | #include <Protocol/Ip6Config.h>\r | |
29 | #include <Protocol/Dhcp6.h>\r | |
30 | #include <Protocol/DevicePath.h>\r | |
31 | #include <Protocol/HiiConfigRouting.h>\r | |
32 | #include <Protocol/HiiConfigAccess.h>\r | |
33 | \r | |
34 | #include <Library/DebugLib.h>\r | |
35 | #include <Library/UefiBootServicesTableLib.h>\r | |
36 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
37 | #include <Library/BaseLib.h>\r | |
38 | #include <Library/UefiLib.h>\r | |
39 | #include <Library/NetLib.h>\r | |
40 | #include <Library/BaseMemoryLib.h>\r | |
41 | #include <Library/MemoryAllocationLib.h>\r | |
42 | #include <Library/DpcLib.h>\r | |
43 | #include <Library/HiiLib.h>\r | |
44 | #include <Library/UefiHiiServicesLib.h>\r | |
45 | #include <Library/DevicePathLib.h>\r | |
46 | #include <Library/PrintLib.h>\r | |
47 | \r | |
48 | #include <Guid/MdeModuleHii.h>\r | |
49 | \r | |
50 | #include "Ip6Common.h"\r | |
51 | #include "Ip6Driver.h"\r | |
52 | #include "Ip6Icmp.h"\r | |
53 | #include "Ip6If.h"\r | |
54 | #include "Ip6Input.h"\r | |
55 | #include "Ip6Mld.h"\r | |
56 | #include "Ip6Nd.h"\r | |
57 | #include "Ip6Option.h"\r | |
58 | #include "Ip6Output.h"\r | |
59 | #include "Ip6Route.h"\r | |
60 | #include "Ip6ConfigNv.h"\r | |
61 | #include "Ip6ConfigImpl.h"\r | |
62 | \r | |
63 | #define IP6_PROTOCOL_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'P')\r | |
64 | #define IP6_SERVICE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'S')\r | |
65 | \r | |
66 | //\r | |
67 | // The state of IP6 protocol. It starts from UNCONFIGED. if it is\r | |
68 | // successfully configured, it goes to CONFIGED. if configure NULL\r | |
69 | // is called, it becomes UNCONFIGED again. If (partly) destroyed, it\r | |
70 | // becomes DESTROY.\r | |
71 | //\r | |
72 | #define IP6_STATE_UNCONFIGED 0\r | |
73 | #define IP6_STATE_CONFIGED 1\r | |
a3bcde70 HT |
74 | \r |
75 | //\r | |
76 | // The state of IP6 service. It starts from UNSTARTED. It transits\r | |
77 | // to STARTED if autoconfigure is started. If default address is\r | |
78 | // configured, it becomes CONFIGED. and if partly destroyed, it goes\r | |
79 | // to DESTROY.\r | |
80 | //\r | |
81 | #define IP6_SERVICE_UNSTARTED 0\r | |
82 | #define IP6_SERVICE_STARTED 1\r | |
83 | #define IP6_SERVICE_CONFIGED 2\r | |
84 | #define IP6_SERVICE_DESTROY 3\r | |
85 | \r | |
86 | #define IP6_INSTANCE_FROM_PROTOCOL(Ip6) \\r | |
87 | CR ((Ip6), IP6_PROTOCOL, Ip6Proto, IP6_PROTOCOL_SIGNATURE)\r | |
88 | \r | |
89 | #define IP6_SERVICE_FROM_PROTOCOL(Sb) \\r | |
90 | CR ((Sb), IP6_SERVICE, ServiceBinding, IP6_SERVICE_SIGNATURE)\r | |
91 | \r | |
92 | #define IP6_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)\r | |
93 | \r | |
68d3f2fb | 94 | extern EFI_IPSEC2_PROTOCOL *mIpSec;\r |
c79de074 | 95 | extern BOOLEAN mIpSec2Installed;\r |
a3bcde70 HT |
96 | \r |
97 | //\r | |
98 | // IP6_TXTOKEN_WRAP wraps the upper layer's transmit token.\r | |
99 | // The user's data is kept in the Packet. When fragment is\r | |
100 | // needed, each fragment of the Packet has a reference to the\r | |
101 | // Packet, no data is actually copied. The Packet will be\r | |
102 | // released when all the fragments of it have been recycled by\r | |
103 | // MNP. Upon then, the IP6_TXTOKEN_WRAP will be released, and\r | |
104 | // user's event signalled.\r | |
105 | //\r | |
106 | typedef struct {\r | |
107 | IP6_PROTOCOL *IpInstance;\r | |
108 | EFI_IP6_COMPLETION_TOKEN *Token;\r | |
109 | EFI_EVENT IpSecRecycleSignal;\r | |
110 | NET_BUF *Packet;\r | |
111 | BOOLEAN Sent;\r | |
112 | INTN Life;\r | |
113 | } IP6_TXTOKEN_WRAP;\r | |
114 | \r | |
115 | typedef struct {\r | |
116 | EFI_EVENT IpSecRecycleSignal;\r | |
117 | NET_BUF *Packet;\r | |
118 | } IP6_IPSEC_WRAP;\r | |
119 | \r | |
120 | //\r | |
121 | // IP6_RXDATA_WRAP wraps the data IP6 child delivers to the\r | |
122 | // upper layers. The received packet is kept in the Packet.\r | |
123 | // The Packet itself may be constructured from some fragments.\r | |
124 | // All the fragments of the Packet is organized by a\r | |
125 | // IP6_ASSEMBLE_ENTRY structure. If the Packet is recycled by\r | |
126 | // the upper layer, the assemble entry and its associated\r | |
127 | // fragments will be freed at last.\r | |
128 | //\r | |
129 | typedef struct {\r | |
130 | LIST_ENTRY Link;\r | |
131 | IP6_PROTOCOL *IpInstance;\r | |
132 | NET_BUF *Packet;\r | |
133 | EFI_IP6_RECEIVE_DATA RxData;\r | |
134 | } IP6_RXDATA_WRAP;\r | |
135 | \r | |
136 | struct _IP6_PROTOCOL {\r | |
137 | UINT32 Signature;\r | |
138 | \r | |
139 | EFI_IP6_PROTOCOL Ip6Proto;\r | |
140 | EFI_HANDLE Handle;\r | |
141 | INTN State;\r | |
142 | \r | |
143 | IP6_SERVICE *Service;\r | |
144 | LIST_ENTRY Link; // Link to all the IP protocol from the service\r | |
145 | \r | |
146 | UINT8 PrefixLength; // PrefixLength of the configured station address.\r | |
147 | //\r | |
148 | // User's transmit/receive tokens, and received/deliverd packets\r | |
149 | //\r | |
150 | NET_MAP RxTokens;\r | |
151 | NET_MAP TxTokens; // map between (User's Token, IP6_TXTOKE_WRAP)\r | |
152 | LIST_ENTRY Received; // Received but not delivered packet\r | |
153 | LIST_ENTRY Delivered; // Delivered and to be recycled packets\r | |
154 | EFI_LOCK RecycleLock;\r | |
155 | \r | |
156 | IP6_INTERFACE *Interface;\r | |
157 | LIST_ENTRY AddrLink; // Ip instances with the same IP address.\r | |
158 | \r | |
159 | EFI_IPv6_ADDRESS *GroupList; // stored in network order.\r | |
160 | UINT32 GroupCount;\r | |
161 | \r | |
162 | EFI_IP6_CONFIG_DATA ConfigData;\r | |
216f7970 | 163 | BOOLEAN InDestroy;\r |
a3bcde70 HT |
164 | };\r |
165 | \r | |
166 | struct _IP6_SERVICE {\r | |
167 | UINT32 Signature;\r | |
168 | EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r | |
169 | INTN State;\r | |
a3bcde70 HT |
170 | \r |
171 | //\r | |
172 | // List of all the IP instances and interfaces, and default\r | |
173 | // interface and route table and caches.\r | |
174 | //\r | |
175 | UINTN NumChildren;\r | |
176 | LIST_ENTRY Children;\r | |
177 | \r | |
178 | LIST_ENTRY Interfaces;\r | |
179 | \r | |
180 | IP6_INTERFACE *DefaultInterface;\r | |
181 | IP6_ROUTE_TABLE *RouteTable;\r | |
182 | \r | |
183 | IP6_LINK_RX_TOKEN RecvRequest;\r | |
184 | \r | |
185 | //\r | |
186 | // Ip reassemble utilities and MLD data\r | |
187 | //\r | |
188 | IP6_ASSEMBLE_TABLE Assemble;\r | |
189 | IP6_MLD_SERVICE_DATA MldCtrl;\r | |
190 | \r | |
191 | EFI_IPv6_ADDRESS LinkLocalAddr;\r | |
192 | BOOLEAN LinkLocalOk;\r | |
193 | BOOLEAN LinkLocalDadFail;\r | |
194 | BOOLEAN Dhcp6NeedStart;\r | |
195 | BOOLEAN Dhcp6NeedInfoRequest;\r | |
196 | \r | |
197 | //\r | |
198 | // ND data\r | |
199 | //\r | |
200 | UINT8 CurHopLimit;\r | |
201 | UINT32 LinkMTU;\r | |
202 | UINT32 BaseReachableTime;\r | |
203 | UINT32 ReachableTime;\r | |
204 | UINT32 RetransTimer;\r | |
205 | LIST_ENTRY NeighborTable;\r | |
206 | \r | |
207 | LIST_ENTRY OnlinkPrefix;\r | |
208 | LIST_ENTRY AutonomousPrefix;\r | |
209 | \r | |
210 | LIST_ENTRY DefaultRouterList;\r | |
211 | UINT32 RoundRobin;\r | |
212 | \r | |
213 | UINT8 InterfaceIdLen;\r | |
214 | UINT8 *InterfaceId;\r | |
215 | \r | |
216 | BOOLEAN RouterAdvertiseReceived;\r | |
217 | UINT8 SolicitTimer;\r | |
218 | UINT32 Ticks;\r | |
219 | \r | |
220 | //\r | |
221 | // Low level protocol used by this service instance\r | |
222 | //\r | |
223 | EFI_HANDLE Image;\r | |
224 | EFI_HANDLE Controller;\r | |
225 | \r | |
226 | EFI_HANDLE MnpChildHandle;\r | |
227 | EFI_MANAGED_NETWORK_PROTOCOL *Mnp;\r | |
228 | \r | |
229 | EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;\r | |
230 | EFI_SIMPLE_NETWORK_MODE SnpMode;\r | |
231 | \r | |
232 | EFI_EVENT Timer;\r | |
233 | EFI_EVENT FasterTimer;\r | |
234 | \r | |
235 | //\r | |
236 | // IPv6 Configuration Protocol instance\r | |
237 | //\r | |
238 | IP6_CONFIG_INSTANCE Ip6ConfigInstance;\r | |
239 | \r | |
240 | //\r | |
241 | // The string representation of the current mac address of the\r | |
242 | // NIC this IP6_SERVICE works on.\r | |
243 | //\r | |
244 | CHAR16 *MacString;\r | |
245 | UINT32 MaxPacketSize;\r | |
246 | UINT32 OldMaxPacketSize;\r | |
247 | };\r | |
248 | \r | |
249 | /**\r | |
250 | The callback function for the net buffer which wraps the user's\r | |
251 | transmit token. Although this function seems simple,\r | |
252 | there are some subtle aspects.\r | |
253 | When a user requests the IP to transmit a packet by passing it a\r | |
254 | token, the token is wrapped in an IP6_TXTOKEN_WRAP and the data\r | |
255 | is wrapped in a net buffer. The net buffer's Free function is\r | |
256 | set to Ip6FreeTxToken. The Token and token wrap are added to the\r | |
257 | IP child's TxToken map. Then the buffer is passed to Ip6Output for\r | |
258 | transmission. If an error occurs before that, the buffer\r | |
259 | is freed, which in turn frees the token wrap. The wrap may\r | |
260 | have been added to the TxToken map or not, and the user's event\r | |
261 | shouldn't be signaled because we are still in the EfiIp6Transmit. If\r | |
262 | the buffer has been sent by Ip6Output, it should be removed from\r | |
263 | the TxToken map and the user's event signaled. The token wrap and buffer\r | |
264 | are bound together. Refer to the comments in Ip6Output for information\r | |
265 | about IP fragmentation.\r | |
266 | \r | |
267 | @param[in] Context The token's wrap.\r | |
268 | \r | |
269 | **/\r | |
270 | VOID\r | |
271 | EFIAPI\r | |
272 | Ip6FreeTxToken (\r | |
273 | IN VOID *Context\r | |
274 | );\r | |
275 | \r | |
276 | /**\r | |
277 | Config the MNP parameter used by IP. The IP driver use one MNP\r | |
278 | child to transmit/receive frames. By default, it configures MNP\r | |
279 | to receive unicast/multicast/broadcast. And it will enable/disable\r | |
280 | the promiscuous receive according to whether there is IP child\r | |
281 | enable that or not. If Force is FALSE, it will iterate through\r | |
282 | all the IP children to check whether the promiscuous receive\r | |
283 | setting has been changed. If it hasn't been changed, it won't\r | |
284 | reconfigure the MNP. If Force is TRUE, the MNP is configured\r | |
285 | whether that is changed or not.\r | |
286 | \r | |
287 | @param[in] IpSb The IP6 service instance that is to be changed.\r | |
288 | @param[in] Force Force the configuration or not.\r | |
289 | \r | |
290 | @retval EFI_SUCCESS The MNP successfully configured/reconfigured.\r | |
291 | @retval Others The configuration failed.\r | |
292 | \r | |
293 | **/\r | |
294 | EFI_STATUS\r | |
295 | Ip6ServiceConfigMnp (\r | |
296 | IN IP6_SERVICE *IpSb,\r | |
297 | IN BOOLEAN Force\r | |
298 | );\r | |
299 | \r | |
300 | /**\r | |
301 | Cancel the user's receive/transmit request. It is the worker function of\r | |
302 | EfiIp6Cancel API.\r | |
303 | \r | |
304 | @param[in] IpInstance The IP6 child.\r | |
305 | @param[in] Token The token to cancel. If NULL, all tokens will be\r | |
306 | cancelled.\r | |
307 | \r | |
308 | @retval EFI_SUCCESS The token was cancelled.\r | |
309 | @retval EFI_NOT_FOUND The token isn't found on either the\r | |
310 | transmit or receive queue.\r | |
311 | @retval EFI_DEVICE_ERROR Not all tokens are cancelled when Token is NULL.\r | |
312 | \r | |
313 | **/\r | |
314 | EFI_STATUS\r | |
315 | Ip6Cancel (\r | |
316 | IN IP6_PROTOCOL *IpInstance,\r | |
317 | IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL\r | |
318 | );\r | |
319 | \r | |
320 | /**\r | |
321 | Initialize the IP6_PROTOCOL structure to the unconfigured states.\r | |
322 | \r | |
323 | @param[in] IpSb The IP6 service instance.\r | |
324 | @param[in, out] IpInstance The IP6 child instance.\r | |
325 | \r | |
326 | **/\r | |
327 | VOID\r | |
328 | Ip6InitProtocol (\r | |
329 | IN IP6_SERVICE *IpSb,\r | |
330 | IN OUT IP6_PROTOCOL *IpInstance\r | |
331 | );\r | |
332 | \r | |
333 | /**\r | |
334 | Clean up the IP6 child, release all the resources used by it.\r | |
335 | \r | |
336 | @param[in, out] IpInstance The IP6 child to clean up.\r | |
337 | \r | |
338 | @retval EFI_SUCCESS The IP6 child was cleaned up\r | |
339 | @retval EFI_DEVICE_ERROR Some resources failed to be released.\r | |
340 | \r | |
341 | **/\r | |
342 | EFI_STATUS\r | |
343 | Ip6CleanProtocol (\r | |
344 | IN OUT IP6_PROTOCOL *IpInstance\r | |
345 | );\r | |
346 | \r | |
347 | //\r | |
348 | // EFI_IP6_PROTOCOL interface prototypes\r | |
349 | //\r | |
350 | \r | |
351 | /**\r | |
352 | Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.\r | |
353 | \r | |
354 | The GetModeData() function returns the current operational mode data for this driver instance.\r | |
355 | The data fields in EFI_IP6_MODE_DATA are read only. This function is used optionally to\r | |
356 | retrieve the operational mode data of underlying networks or drivers.\r | |
357 | \r | |
358 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.\r | |
359 | @param[out] Ip6ModeData The pointer to the EFI IPv6 Protocol mode data structure.\r | |
360 | @param[out] MnpConfigData The pointer to the managed network configuration data structure.\r | |
361 | @param[out] SnpModeData The pointer to the simple network mode data structure.\r | |
362 | \r | |
363 | @retval EFI_SUCCESS The operation completed successfully.\r | |
364 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
365 | @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.\r | |
366 | \r | |
367 | **/\r | |
368 | EFI_STATUS\r | |
369 | EFIAPI\r | |
370 | EfiIp6GetModeData (\r | |
371 | IN EFI_IP6_PROTOCOL *This,\r | |
372 | OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,\r | |
373 | OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r | |
374 | OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r | |
375 | );\r | |
376 | \r | |
377 | /**\r | |
378 | Assigns an IPv6 address and subnet mask to this EFI IPv6 Protocol driver instance.\r | |
379 | \r | |
380 | The Configure() function is used to set, change, or reset the operational parameters and filter\r | |
381 | settings for this EFI IPv6 Protocol instance. Until these parameters have been set, no network traffic\r | |
382 | can be sent or received by this instance. Once the parameters have been reset (by calling this\r | |
383 | function with Ip6ConfigData set to NULL), no more traffic can be sent or received until these\r | |
384 | parameters have been set again. Each EFI IPv6 Protocol instance can be started and stopped\r | |
385 | independently of each other by enabling or disabling their receive filter settings with the\r | |
386 | Configure() function.\r | |
387 | \r | |
388 | If Ip6ConfigData.StationAddress is a valid non-zero IPv6 unicast address, it is required\r | |
389 | to be one of the currently configured IPv6 addresses list in the EFI IPv6 drivers, or else\r | |
390 | EFI_INVALID_PARAMETER will be returned. If Ip6ConfigData.StationAddress is\r | |
391 | unspecified, the IPv6 driver will bind a source address according to the source address selection\r | |
392 | algorithm. Clients could frequently call GetModeData() to check get a currently configured IPv6.\r | |
393 | If both Ip6ConfigData.StationAddress and Ip6ConfigData.Destination are unspecified, when\r | |
394 | transmitting the packet afterwards, the source address filled in each outgoing IPv6 packet\r | |
395 | is decided based on the destination of this packet.\r | |
396 | \r | |
397 | If operational parameters are reset or changed, any pending transmit and receive requests will be\r | |
398 | cancelled. Their completion token status will be set to EFI_ABORTED, and their events will be\r | |
399 | signaled.\r | |
400 | \r | |
401 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.\r | |
402 | @param[in] Ip6ConfigData The pointer to the EFI IPv6 Protocol configuration data structure.\r | |
403 | If NULL, reset the configuration data.\r | |
404 | \r | |
405 | @retval EFI_SUCCESS The driver instance was successfully opened.\r | |
406 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
407 | - This is NULL.\r | |
408 | - Ip6ConfigData.StationAddress is neither zero nor\r | |
409 | a unicast IPv6 address.\r | |
410 | - Ip6ConfigData.StationAddress is neither zero nor\r | |
411 | one of the configured IP addresses in the EFI IPv6 driver.\r | |
412 | - Ip6ConfigData.DefaultProtocol is illegal.\r | |
413 | @retval EFI_OUT_OF_RESOURCES The EFI IPv6 Protocol driver instance data could not be allocated.\r | |
414 | @retval EFI_NO_MAPPING The IPv6 driver was responsible for choosing a source address for\r | |
415 | this instance, but no source address was available for use.\r | |
416 | @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the IPv6\r | |
417 | address or prefix length can be changed.\r | |
418 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv6\r | |
419 | Protocol driver instance was not opened.\r | |
420 | @retval EFI_UNSUPPORTED Default protocol specified through\r | |
421 | Ip6ConfigData.DefaulProtocol isn't supported.\r | |
422 | \r | |
423 | **/\r | |
424 | EFI_STATUS\r | |
425 | EFIAPI\r | |
426 | EfiIp6Configure (\r | |
427 | IN EFI_IP6_PROTOCOL *This,\r | |
428 | IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL\r | |
429 | );\r | |
430 | \r | |
431 | /**\r | |
432 | Joins and leaves multicast groups.\r | |
433 | \r | |
434 | The Groups() function is used to join and leave multicast group sessions. Joining a group will\r | |
435 | enable reception of matching multicast packets. Leaving a group will disable reception of matching\r | |
436 | multicast packets. Source-Specific Multicast isn't required to be supported.\r | |
437 | \r | |
438 | If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.\r | |
439 | \r | |
440 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.\r | |
441 | @param[in] JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.\r | |
442 | @param[in] GroupAddress The pointer to the IPv6 multicast address.\r | |
443 | This is an optional parameter that may be NULL.\r | |
444 | \r | |
445 | @retval EFI_SUCCESS The operation completed successfully.\r | |
446 | @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:\r | |
447 | - This is NULL.\r | |
448 | - JoinFlag is TRUE and GroupAddress is NULL.\r | |
449 | - GroupAddress is not NULL and *GroupAddress is\r | |
450 | not a multicast IPv6 address.\r | |
451 | - GroupAddress is not NULL and *GroupAddress is in the\r | |
452 | range of SSM destination address.\r | |
453 | @retval EFI_NOT_STARTED This instance has not been started.\r | |
454 | @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.\r | |
455 | @retval EFI_UNSUPPORTED This EFI IPv6 Protocol implementation does not support multicast groups.\r | |
456 | @retval EFI_ALREADY_STARTED The group address is already in the group table (when\r | |
457 | JoinFlag is TRUE).\r | |
458 | @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).\r | |
459 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
460 | \r | |
461 | **/\r | |
462 | EFI_STATUS\r | |
463 | EFIAPI\r | |
464 | EfiIp6Groups (\r | |
465 | IN EFI_IP6_PROTOCOL *This,\r | |
466 | IN BOOLEAN JoinFlag,\r | |
467 | IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL\r | |
468 | );\r | |
469 | \r | |
470 | /**\r | |
471 | Adds and deletes routing table entries.\r | |
472 | \r | |
473 | The Routes() function adds a route to or deletes a route from the routing table.\r | |
474 | \r | |
475 | Routes are determined by comparing the leftmost PrefixLength bits of Destination with\r | |
476 | the destination IPv6 address arithmetically. The gateway address must be on the same subnet as the\r | |
477 | configured station address.\r | |
478 | \r | |
479 | The default route is added with Destination and PrefixLegth both set to all zeros. The\r | |
480 | default route matches all destination IPv6 addresses that do not match any other routes.\r | |
481 | \r | |
482 | All EFI IPv6 Protocol instances share a routing table.\r | |
483 | \r | |
484 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.\r | |
485 | @param[in] DeleteRoute Set to TRUE to delete this route from the routing table. Set to\r | |
486 | FALSE to add this route to the routing table. Destination,\r | |
487 | PrefixLength and Gateway are used as the key to each\r | |
488 | route entry.\r | |
489 | @param[in] Destination The address prefix of the subnet that needs to be routed.\r | |
490 | This is an optional parameter that may be NULL.\r | |
491 | @param[in] PrefixLength The prefix length of Destination. Ignored if Destination\r | |
492 | is NULL.\r | |
493 | @param[in] GatewayAddress The unicast gateway IPv6 address for this route.\r | |
494 | This is an optional parameter that may be NULL.\r | |
495 | \r | |
496 | @retval EFI_SUCCESS The operation completed successfully.\r | |
497 | @retval EFI_NOT_STARTED The driver instance has not been started.\r | |
498 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
499 | - This is NULL.\r | |
500 | - When DeleteRoute is TRUE, both Destination and\r | |
501 | GatewayAddress are NULL.\r | |
502 | - When DeleteRoute is FALSE, either Destination or\r | |
503 | GatewayAddress is NULL.\r | |
504 | - *GatewayAddress is not a valid unicast IPv6 address.\r | |
505 | - *GatewayAddress is one of the local configured IPv6\r | |
506 | addresses.\r | |
507 | @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.\r | |
508 | @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).\r | |
509 | @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when\r | |
510 | DeleteRoute is FALSE).\r | |
511 | \r | |
512 | **/\r | |
513 | EFI_STATUS\r | |
514 | EFIAPI\r | |
515 | EfiIp6Routes (\r | |
516 | IN EFI_IP6_PROTOCOL *This,\r | |
517 | IN BOOLEAN DeleteRoute,\r | |
518 | IN EFI_IPv6_ADDRESS *Destination OPTIONAL,\r | |
519 | IN UINT8 PrefixLength,\r | |
520 | IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL\r | |
521 | );\r | |
522 | \r | |
523 | /**\r | |
524 | Add or delete Neighbor cache entries.\r | |
525 | \r | |
526 | The Neighbors() function is used to add, update, or delete an entry from a neighbor cache.\r | |
527 | IPv6 neighbor cache entries are typically inserted and updated by the network protocol driver as\r | |
528 | network traffic is processed. Most neighbor cache entries will timeout and be deleted if the network\r | |
529 | traffic stops. Neighbor cache entries that were inserted by Neighbors() may be static (will not\r | |
530 | timeout) or dynamic (will timeout).\r | |
531 | \r | |
532 | The implementation should follow the neighbor cache timeout mechanism defined in\r | |
533 | RFC4861. The default neighbor cache timeout value should be tuned for the expected network\r | |
534 | environment.\r | |
535 | \r | |
536 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.\r | |
537 | @param[in] DeleteFlag Set to TRUE to delete the specified cache entry. Set to FALSE to\r | |
538 | add (or update, if it already exists and Override is TRUE) the\r | |
539 | specified cache entry. TargetIp6Address is used as the key\r | |
540 | to find the requested cache entry.\r | |
541 | @param[in] TargetIp6Address The pointer to the Target IPv6 address.\r | |
542 | @param[in] TargetLinkAddress The pointer to link-layer address of the target. Ignored if NULL.\r | |
543 | @param[in] Timeout Time in 100-ns units that this entry will remain in the neighbor\r | |
544 | cache, it will be deleted after Timeout. A value of zero means that\r | |
545 | the entry is permanent. A non-zero value means that the entry is\r | |
546 | dynamic.\r | |
547 | @param[in] Override If TRUE, the cached link-layer address of the matching entry will\r | |
548 | be overridden and updated; if FALSE, EFI_ACCESS_DENIED\r | |
549 | will be returned if a corresponding cache entry already exists.\r | |
550 | \r | |
551 | @retval EFI_SUCCESS The data has been queued for transmission.\r | |
552 | @retval EFI_NOT_STARTED This instance has not been started.\r | |
553 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
554 | - This is NULL.\r | |
555 | - TargetIpAddress is NULL.\r | |
556 | - *TargetLinkAddress is invalid when not NULL.\r | |
557 | - *TargetIpAddress is not a valid unicast IPv6 address.\r | |
558 | - *TargetIpAddress is one of the local configured IPv6\r | |
559 | addresses.\r | |
560 | @retval EFI_OUT_OF_RESOURCES Could not add the entry to the neighbor cache.\r | |
561 | @retval EFI_NOT_FOUND This entry is not in the neighbor cache (when DeleteFlag is\r | |
562 | TRUE or when DeleteFlag is FALSE while\r | |
563 | TargetLinkAddress is NULL.).\r | |
564 | @retval EFI_ACCESS_DENIED The to-be-added entry is already defined in the neighbor cache,\r | |
565 | and that entry is tagged as un-overridden (when Override\r | |
566 | is FALSE).\r | |
567 | \r | |
568 | **/\r | |
569 | EFI_STATUS\r | |
570 | EFIAPI\r | |
571 | EfiIp6Neighbors (\r | |
572 | IN EFI_IP6_PROTOCOL *This,\r | |
573 | IN BOOLEAN DeleteFlag,\r | |
574 | IN EFI_IPv6_ADDRESS *TargetIp6Address,\r | |
575 | IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,\r | |
576 | IN UINT32 Timeout,\r | |
577 | IN BOOLEAN Override\r | |
578 | );\r | |
579 | \r | |
580 | /**\r | |
581 | Places outgoing data packets into the transmit queue.\r | |
582 | \r | |
583 | The Transmit() function places a sending request in the transmit queue of this\r | |
584 | EFI IPv6 Protocol instance. Whenever the packet in the token is sent out or some\r | |
585 | errors occur, the event in the token will be signaled and the status is updated.\r | |
586 | \r | |
587 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.\r | |
588 | @param[in] Token The pointer to the transmit token.\r | |
589 | \r | |
590 | @retval EFI_SUCCESS The data has been queued for transmission.\r | |
591 | @retval EFI_NOT_STARTED This instance has not been started.\r | |
592 | @retval EFI_NO_MAPPING The IPv6 driver was responsible for choosing\r | |
593 | a source address for this transmission,\r | |
594 | but no source address was available for use.\r | |
595 | @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:\r | |
596 | - This is NULL.\r | |
597 | - Token is NULL.\r | |
598 | - Token.Event is NULL.\r | |
599 | - Token.Packet.TxData is NULL.\r | |
600 | - Token.Packet.ExtHdrsLength is not zero and\r | |
601 | Token.Packet.ExtHdrs is NULL.\r | |
602 | - Token.Packet.FragmentCount is zero.\r | |
603 | - One or more of the Token.Packet.TxData.\r | |
604 | FragmentTable[].FragmentLength fields is zero.\r | |
605 | - One or more of the Token.Packet.TxData.\r | |
606 | FragmentTable[].FragmentBuffer fields is NULL.\r | |
607 | - Token.Packet.TxData.DataLength is zero or not\r | |
608 | equal to the sum of fragment lengths.\r | |
609 | - Token.Packet.TxData.DestinationAddress is non-\r | |
610 | zero when DestinationAddress is configured as\r | |
611 | non-zero when doing Configure() for this\r | |
612 | EFI IPv6 protocol instance.\r | |
613 | - Token.Packet.TxData.DestinationAddress is\r | |
614 | unspecified when DestinationAddress is unspecified\r | |
615 | when doing Configure() for this EFI IPv6 protocol\r | |
616 | instance.\r | |
617 | @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.\r | |
618 | The event was already in the transmit queue.\r | |
619 | @retval EFI_NOT_READY The completion token could not be queued because\r | |
620 | the transmit queue is full.\r | |
621 | @retval EFI_NOT_FOUND Not route is found to the destination address.\r | |
622 | @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.\r | |
623 | @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too\r | |
624 | short to transmit.\r | |
625 | @retval EFI_BAD_BUFFER_SIZE If Token.Packet.TxData.DataLength is beyond the\r | |
626 | maximum that which can be described through the\r | |
627 | Fragment Offset field in Fragment header when\r | |
628 | performing fragmentation.\r | |
629 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
630 | \r | |
631 | **/\r | |
632 | EFI_STATUS\r | |
633 | EFIAPI\r | |
634 | EfiIp6Transmit (\r | |
635 | IN EFI_IP6_PROTOCOL *This,\r | |
636 | IN EFI_IP6_COMPLETION_TOKEN *Token\r | |
637 | );\r | |
638 | \r | |
639 | /**\r | |
640 | Places a receiving request into the receiving queue.\r | |
641 | \r | |
642 | The Receive() function places a completion token into the receive packet queue.\r | |
643 | This function is always asynchronous.\r | |
644 | \r | |
645 | The Token.Event field in the completion token must be filled in by the caller\r | |
646 | and cannot be NULL. When the receive operation completes, the EFI IPv6 Protocol\r | |
647 | driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event\r | |
648 | is signaled.\r | |
649 | \r | |
650 | Current Udp implementation creates an IP child for each Udp child.\r | |
651 | It initates a asynchronous receive immediately whether or not\r | |
652 | there is no mapping. Therefore, disable the returning EFI_NO_MAPPING for now.\r | |
653 | To enable it, the following check must be performed:\r | |
654 | \r | |
655 | if (NetIp6IsUnspecifiedAddr (&Config->StationAddress) && IP6_NO_MAPPING (IpInstance)) {\r | |
656 | Status = EFI_NO_MAPPING;\r | |
657 | goto Exit;\r | |
658 | }\r | |
659 | \r | |
660 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.\r | |
661 | @param[in] Token The pointer to a token that is associated with the\r | |
662 | receive data descriptor.\r | |
663 | \r | |
664 | @retval EFI_SUCCESS The receive completion token was cached.\r | |
665 | @retval EFI_NOT_STARTED This EFI IPv6 Protocol instance has not been started.\r | |
666 | @retval EFI_NO_MAPPING When IP6 driver responsible for binding source address to this instance,\r | |
667 | while no source address is available for use.\r | |
668 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
669 | - This is NULL.\r | |
670 | - Token is NULL.\r | |
671 | - Token.Event is NULL.\r | |
672 | @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system\r | |
673 | resources (usually memory).\r | |
674 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
675 | The EFI IPv6 Protocol instance has been reset to startup defaults.\r | |
676 | @retval EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already\r | |
677 | in the receive queue.\r | |
678 | @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r | |
679 | \r | |
680 | **/\r | |
681 | EFI_STATUS\r | |
682 | EFIAPI\r | |
683 | EfiIp6Receive (\r | |
684 | IN EFI_IP6_PROTOCOL *This,\r | |
685 | IN EFI_IP6_COMPLETION_TOKEN *Token\r | |
686 | );\r | |
687 | \r | |
688 | /**\r | |
689 | Abort an asynchronous transmit or receive request.\r | |
690 | \r | |
691 | The Cancel() function is used to abort a pending transmit or receive request.\r | |
692 | If the token is in the transmit or receive request queues, after calling this\r | |
693 | function, Token->Status will be set to EFI_ABORTED, and then Token->Event will\r | |
694 | be signaled. If the token is not in one of the queues, which usually means the\r | |
695 | asynchronous operation has completed, this function will not signal the token,\r | |
696 | and EFI_NOT_FOUND is returned.\r | |
697 | \r | |
698 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.\r | |
699 | @param[in] Token The pointer to a token that has been issued by\r | |
700 | EFI_IP6_PROTOCOL.Transmit() or\r | |
701 | EFI_IP6_PROTOCOL.Receive(). If NULL, all pending\r | |
702 | tokens are aborted. Type EFI_IP6_COMPLETION_TOKEN is\r | |
703 | defined in EFI_IP6_PROTOCOL.Transmit().\r | |
704 | \r | |
705 | @retval EFI_SUCCESS The asynchronous I/O request was aborted and\r | |
706 | Token->Event was signaled. When Token is NULL, all\r | |
707 | pending requests were aborted, and their events were signaled.\r | |
708 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
709 | @retval EFI_NOT_STARTED This instance has not been started.\r | |
710 | @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was\r | |
711 | not found in the transmit or receive queue. It has either completed\r | |
712 | or was not issued by Transmit() and Receive().\r | |
713 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
714 | \r | |
715 | **/\r | |
716 | EFI_STATUS\r | |
717 | EFIAPI\r | |
718 | EfiIp6Cancel (\r | |
719 | IN EFI_IP6_PROTOCOL *This,\r | |
720 | IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL\r | |
721 | );\r | |
722 | \r | |
723 | /**\r | |
724 | Polls for incoming data packets and processes outgoing data packets.\r | |
725 | \r | |
726 | The Poll() function polls for incoming data packets and processes outgoing data\r | |
727 | packets. Network drivers and applications can call the EFI_IP6_PROTOCOL.Poll()\r | |
728 | function to increase the rate that data packets are moved between the communications\r | |
729 | device and the transmit and receive queues.\r | |
730 | \r | |
731 | In some systems the periodic timer event may not poll the underlying communications\r | |
732 | device fast enough to transmit and/or receive all data packets without missing\r | |
733 | incoming packets or dropping outgoing packets. Drivers and applications that are\r | |
734 | experiencing packet loss should try calling the EFI_IP6_PROTOCOL.Poll() function\r | |
735 | more often.\r | |
736 | \r | |
737 | @param[in] This The pointer to the EFI_IP6_PROTOCOL instance.\r | |
738 | \r | |
739 | @retval EFI_SUCCESS Incoming or outgoing data was processed.\r | |
740 | @retval EFI_NOT_STARTED This EFI IPv6 Protocol instance has not been started.\r | |
741 | @retval EFI_INVALID_PARAMETER This is NULL.\r | |
742 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r | |
743 | @retval EFI_NOT_READY No incoming or outgoing data was processed.\r | |
744 | @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r | |
745 | Consider increasing the polling rate.\r | |
746 | \r | |
747 | **/\r | |
748 | EFI_STATUS\r | |
749 | EFIAPI\r | |
750 | EfiIp6Poll (\r | |
751 | IN EFI_IP6_PROTOCOL *This\r | |
752 | );\r | |
753 | \r | |
754 | #endif\r |