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