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