Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / NetworkPkg / Udp6Dxe / Udp6Impl.h
CommitLineData
a3bcde70
HT
1/** @file\r
2 Udp6 driver's whole implementation and internal data structures.\r
3\r
216f7970 4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
a3bcde70
HT
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _UDP6_IMPL_H_\r
17#define _UDP6_IMPL_H_\r
18\r
19#include <Uefi.h>\r
20\r
21#include <Protocol/Ip6.h>\r
22#include <Protocol/Udp6.h>\r
23\r
24#include <Library/IpIoLib.h>\r
25#include <Library/DebugLib.h>\r
26#include <Library/UefiRuntimeServicesTableLib.h>\r
27#include <Library/UefiBootServicesTableLib.h>\r
28#include <Library/BaseLib.h>\r
29#include <Library/UefiLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31#include <Library/MemoryAllocationLib.h>\r
32#include <Library/DpcLib.h>\r
216f7970 33#include <Library/PrintLib.h>\r
a3bcde70
HT
34\r
35#include "Udp6Driver.h"\r
36\r
37extern EFI_COMPONENT_NAME2_PROTOCOL gUdp6ComponentName2;\r
38extern EFI_COMPONENT_NAME_PROTOCOL gUdp6ComponentName;\r
216f7970 39extern EFI_UNICODE_STRING_TABLE *gUdp6ControllerNameTable;\r
a3bcde70
HT
40extern EFI_SERVICE_BINDING_PROTOCOL mUdp6ServiceBinding;\r
41extern EFI_UDP6_PROTOCOL mUdp6Protocol;\r
42extern UINT16 mUdp6RandomPort;\r
43\r
44//\r
45// Define time out 50 milliseconds\r
46//\r
47#define UDP6_TIMEOUT_INTERVAL (50 * TICKS_PER_MS)\r
48#define UDP6_HEADER_SIZE sizeof (EFI_UDP_HEADER)\r
49#define UDP6_MAX_DATA_SIZE 65507\r
50#define UDP6_PORT_KNOWN 1024\r
51\r
52#define UDP6_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('U', 'd', 'p', '6')\r
53#define UDP6_INSTANCE_DATA_SIGNATURE SIGNATURE_32 ('U', 'd', 'p', 'S')\r
54\r
55#define UDP6_SERVICE_DATA_FROM_THIS(a) \\r
56 CR ( \\r
57 (a), \\r
58 UDP6_SERVICE_DATA, \\r
59 ServiceBinding, \\r
60 UDP6_SERVICE_DATA_SIGNATURE \\r
61 )\r
62\r
63#define UDP6_INSTANCE_DATA_FROM_THIS(a) \\r
64 CR ( \\r
65 (a), \\r
66 UDP6_INSTANCE_DATA, \\r
67 Udp6Proto, \\r
68 UDP6_INSTANCE_DATA_SIGNATURE \\r
69 )\r
70//\r
71// Udp6 service contest data\r
72//\r
73typedef struct _UDP6_SERVICE_DATA {\r
74 UINT32 Signature;\r
75 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r
76 EFI_HANDLE ImageHandle;\r
77 EFI_HANDLE ControllerHandle;\r
78 LIST_ENTRY ChildrenList;\r
79 UINTN ChildrenNumber;\r
80 IP_IO *IpIo;\r
81 EFI_EVENT TimeoutEvent;\r
82 CHAR16 *MacString;\r
83} UDP6_SERVICE_DATA;\r
84\r
85typedef struct _UDP6_INSTANCE_DATA {\r
86 UINT32 Signature;\r
87 LIST_ENTRY Link;\r
88 UDP6_SERVICE_DATA *Udp6Service;\r
89 EFI_UDP6_PROTOCOL Udp6Proto;\r
90 EFI_UDP6_CONFIG_DATA ConfigData;\r
91 EFI_HANDLE ChildHandle;\r
92 BOOLEAN Configured;\r
93 BOOLEAN IsNoMapping;\r
94 NET_MAP TxTokens;\r
95 NET_MAP RxTokens;\r
96 NET_MAP McastIps;\r
97 LIST_ENTRY RcvdDgramQue;\r
98 LIST_ENTRY DeliveredDgramQue;\r
99 UINT16 HeadSum;\r
100 EFI_STATUS IcmpError;\r
101 IP_IO_IP_INFO *IpInfo;\r
216f7970 102 BOOLEAN InDestroy;\r
a3bcde70
HT
103} UDP6_INSTANCE_DATA;\r
104\r
105typedef struct _UDP6_RXDATA_WRAP {\r
106 LIST_ENTRY Link;\r
107 NET_BUF *Packet;\r
108 UINT32 TimeoutTick;\r
109 EFI_UDP6_RECEIVE_DATA RxData;\r
110} UDP6_RXDATA_WRAP;\r
111\r
216f7970 112typedef struct {\r
113 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;\r
114 UINTN NumberOfChildren;\r
115 EFI_HANDLE *ChildHandleBuffer;\r
116} UDP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;\r
117\r
a3bcde70
HT
118/**\r
119 Clean the Udp service context data.\r
120\r
121 @param[in, out] Udp6Service Pointer to the UDP6_SERVICE_DATA.\r
122\r
123**/\r
124VOID\r
125Udp6CleanService (\r
126 IN OUT UDP6_SERVICE_DATA *Udp6Service\r
127 );\r
128\r
129/**\r
130 Create the Udp service context data.\r
131\r
132 @param[in] Udp6Service Pointer to the UDP6_SERVICE_DATA.\r
133 @param[in] ImageHandle The image handle of this udp6 driver.\r
134 @param[in] ControllerHandle The controller handle this udp6 driver binds on.\r
135\r
136 @retval EFI_SUCCESS The udp6 service context data was created and\r
137 initialized.\r
138 @retval EFI_OUT_OF_RESOURCES Cannot allocate memory.\r
139 @retval Others An error condition occurred.\r
140\r
141**/\r
142EFI_STATUS\r
143Udp6CreateService (\r
144 IN UDP6_SERVICE_DATA *Udp6Service,\r
145 IN EFI_HANDLE ImageHandle,\r
146 IN EFI_HANDLE ControllerHandle\r
147 );\r
148\r
149/**\r
150 Set the Udp6 variable data.\r
151\r
152 @param[in] Udp6Service Udp6 service data.\r
153\r
154 @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the\r
155 variable.\r
156 @retval other Set variable failed.\r
157\r
158**/\r
159EFI_STATUS\r
160Udp6SetVariableData (\r
161 IN UDP6_SERVICE_DATA *Udp6Service\r
162 );\r
163\r
164/**\r
165 This function cleans the udp instance.\r
166\r
167 @param[in, out] Instance Pointer to the UDP6_INSTANCE_DATA to clean.\r
168\r
169**/\r
170VOID\r
171Udp6CleanInstance (\r
172 IN OUT UDP6_INSTANCE_DATA *Instance\r
173 );\r
174\r
175/**\r
176 Clear the variable and free the resource.\r
177\r
178 @param[in, out] Udp6Service Udp6 service data.\r
179\r
180**/\r
181VOID\r
182Udp6ClearVariableData (\r
183 IN OUT UDP6_SERVICE_DATA *Udp6Service\r
184 );\r
185\r
186/**\r
187 This function intializes the new created udp instance.\r
188\r
189 @param[in] Udp6Service Pointer to the UDP6_SERVICE_DATA.\r
190 @param[in, out] Instance Pointer to the un-initialized UDP6_INSTANCE_DATA.\r
191\r
192**/\r
193VOID\r
194Udp6InitInstance (\r
195 IN UDP6_SERVICE_DATA *Udp6Service,\r
196 IN OUT UDP6_INSTANCE_DATA *Instance\r
197 );\r
198\r
199/**\r
200 This function reports the received ICMP error.\r
201\r
202 @param[in] Instance Pointer to the udp instance context data.\r
203\r
204**/\r
205VOID\r
206Udp6ReportIcmpError (\r
207 IN UDP6_INSTANCE_DATA *Instance\r
208 );\r
209\r
210/**\r
211 This function copies the current operational settings of this EFI UDPv6 Protocol\r
212 instance into user-supplied buffers. This function is used optionally to retrieve\r
213 the operational mode data of underlying networks or drivers.\r
214\r
215 @param[in] This Pointer to the EFI_UDP6_PROTOCOL instance.\r
216 @param[out] Udp6ConfigData The buffer in which the current UDP configuration\r
217 data is returned. This parameter is optional and\r
218 may be NULL.\r
219 @param[out] Ip6ModeData The buffer in which the current EFI IPv6 Protocol\r
220 mode data is returned. This parameter is optional\r
221 and may be NULL.\r
222 @param[out] MnpConfigData The buffer in which the current managed network\r
223 configuration data is returned. This parameter\r
224 is optional and may be NULL.\r
225 @param[out] SnpModeData The buffer in which the simple network mode data\r
226 is returned. This parameter is optional and may be NULL.\r
227\r
228 @retval EFI_SUCCESS The mode data was read.\r
229 @retval EFI_NOT_STARTED When Udp6ConfigData is queried, no configuration\r
230 data is available because this instance has not\r
231 been started.\r
232 @retval EFI_INVALID_PARAMETER This is NULL.\r
233\r
234**/\r
235EFI_STATUS\r
236EFIAPI\r
237Udp6GetModeData (\r
238 IN EFI_UDP6_PROTOCOL *This,\r
239 OUT EFI_UDP6_CONFIG_DATA *Udp6ConfigData OPTIONAL,\r
240 OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,\r
241 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
242 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
243 );\r
244\r
245/**\r
246 This function is used to do the following:\r
247 Initialize and start this instance of the EFI UDPv6 Protocol.\r
248 Change the filtering rules and operational parameters.\r
249 Reset this instance of the EFI UDPv6 Protocol.\r
250\r
251 @param[in] This Pointer to the EFI_UDP6_PROTOCOL instance.\r
252 @param[in] UdpConfigData Pointer to the buffer to set the configuration\r
253 data. This parameter is optional and may be NULL.\r
254\r
255 @retval EFI_SUCCESS The configuration settings were set, changed, or\r
256 reset successfully.\r
257 @retval EFI_NO_MAPPING When the UdpConifgData.UseAnyStationAddress is set\r
258 to true and there is no address available for IP6\r
259 driver to binding source address to this\r
260 instance.\r
261 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
262 This is NULL.\r
263 UdpConfigData.StationAddress is not a valid\r
264 unicast IPv6 address.\r
265 UdpConfigData.RemoteAddress is not a valid unicast\r
266 IPv6 address, if it is not zero.\r
267 @retval EFI_ALREADY_STARTED The EFI UDPv6 Protocol instance is already\r
268 started/configured and must be stopped/reset\r
269 before it can be reconfigured. Only TrafficClass,\r
270 HopLimit, ReceiveTimeout, and TransmitTimeout can\r
271 be reconfigured without stopping the current\r
272 instance of the EFI UDPv6 Protocol.\r
273 @retval EFI_ACCESS_DENIED UdpConfigData.AllowDuplicatePort is FALSE, and\r
274 UdpConfigData.StationPort is already used by another\r
275 instance.\r
276 @retval EFI_OUT_OF_RESOURCES The EFI UDPv6 Protocol driver cannot allocate\r
277 memory for this EFI UDPv6 Protocol instance.\r
278 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred, and\r
279 this instance was not opened.\r
280\r
281**/\r
282EFI_STATUS\r
283EFIAPI\r
284Udp6Configure (\r
285 IN EFI_UDP6_PROTOCOL *This,\r
286 IN EFI_UDP6_CONFIG_DATA *UdpConfigData OPTIONAL\r
287 );\r
288\r
289/**\r
290 This function places a sending request to this instance of the EFI UDPv6 Protocol,\r
291 alongside the transmit data that was filled by the user.\r
292\r
293 @param[in] This Pointer to the EFI_UDP6_PROTOCOL instance.\r
294 @param[in] Token Pointer to the completion token that will be\r
295 placed into the transmit queue.\r
296\r
297 @retval EFI_SUCCESS The data has been queued for transmission.\r
298 @retval EFI_NOT_STARTED This EFI UDPv6 Protocol instance has not been\r
299 started.\r
300 @retval EFI_NO_MAPPING The under-layer IPv6 driver was responsible for\r
301 choosing a source address for this instance, but\r
302 no source address was available for use.\r
303 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
304 This is NULL. Token is NULL. Token.Event is NULL.\r
305 Token.Packet.TxData is NULL.\r
306 Token.Packet.TxData.FragmentCount is zero.\r
307 Token.Packet.TxData.DataLength is not equal to the\r
308 sum of fragment lengths.\r
309 One or more of the\r
310 Token.Packet.TxData.FragmentTable[]\r
311 .FragmentLength fields is zero.\r
312 One or more of the\r
313 Token.Packet.TxData.FragmentTable[]\r
314 .FragmentBuffer fields is NULL.\r
315 One or more of the\r
316 Token.Packet.TxData.UdpSessionData.\r
317 DestinationAddres are not valid unicast IPv6\r
318 addresses, if the UdpSessionData is not NULL.\r
319 Token.Packet.TxData.UdpSessionData.\r
320 DestinationAddres is NULL\r
321 Token.Packet.TxData.UdpSessionData.\r
322 DestinatioPort is zero.\r
323 Token.Packet.TxData.UdpSessionData is\r
324 NULL and this instance's\r
325 UdpConfigData.RemoteAddress is unspecified.\r
326 @retval EFI_ACCESS_DENIED The transmit completion token with the same\r
327 Token.Event is already in the transmit queue.\r
328 @retval EFI_NOT_READY The completion token could not be queued because\r
329 the transmit queue is full.\r
330 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.\r
331 @retval EFI_NOT_FOUND There is no route to the destination network or\r
332 address.\r
333 @retval EFI_BAD_BUFFER_SIZE The data length is greater than the maximum UDP\r
334 packet size. Or the length of the IP header + UDP\r
335 header + data length is greater than MTU if\r
336 DoNotFragment is TRUE.\r
337\r
338**/\r
339EFI_STATUS\r
340EFIAPI\r
341Udp6Transmit (\r
342 IN EFI_UDP6_PROTOCOL *This,\r
343 IN EFI_UDP6_COMPLETION_TOKEN *Token\r
344 );\r
345\r
346/**\r
347 This function places a completion token into the receive packet queue. This function\r
348 is always asynchronous.\r
349\r
350 @param[in] This Pointer to the EFI_UDP6_PROTOCOL instance.\r
351 @param[in] Token Pointer to a token that is associated with the\r
352 receive data descriptor.\r
353\r
354 @retval EFI_SUCCESS The receive completion token is cached.\r
355 @retval EFI_NOT_STARTED This EFI UDPv6 Protocol instance has not been\r
356 started.\r
357 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP,\r
358 BOOTP, RARP, etc.) is not finished yet.\r
359 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
360 This is NULL.\r
361 Token is NULL.\r
362 Token.Event is NULL.\r
363 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued\r
364 due to a lack of system resources (usually\r
365 memory).\r
366 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
367 The EFI UDPv6 Protocol instance has been reset to\r
368 startup defaults.\r
369 @retval EFI_ACCESS_DENIED A receive completion token with the same\r
370 Token.Event is already in the receive queue.\r
371 @retval EFI_NOT_READY The receive request could not be queued because\r
372 the receive queue is full.\r
373\r
374**/\r
375EFI_STATUS\r
376EFIAPI\r
377Udp6Receive (\r
378 IN EFI_UDP6_PROTOCOL *This,\r
379 IN EFI_UDP6_COMPLETION_TOKEN *Token\r
380 );\r
381\r
382/**\r
383 This function is used to abort a pending transmit or receive request.\r
384\r
385 @param[in] This Pointer to the EFI_UDP6_PROTOCOL instance.\r
386 @param[in] Token Pointer to a token that has been issued by\r
387 EFI_UDP6_PROTOCOL.Transmit() or\r
388 EFI_UDP6_PROTOCOL.Receive(). This parameter is\r
389 optional and may be NULL.\r
390\r
391 @retval EFI_SUCCESS The asynchronous I/O request is aborted and\r
392 Token.Event is signaled. When Token is NULL, all\r
393 pending requests are aborted and their events are\r
394 signaled.\r
395 @retval EFI_INVALID_PARAMETER This is NULL.\r
396 @retval EFI_NOT_STARTED This instance has not been started.\r
397 @retval EFI_NO_MAPPING When using the default address, configuration\r
398 (DHCP, BOOTP, RARP, etc.) is not finished yet.\r
399 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O\r
400 request is not found in the transmit or receive\r
401 queue. It either completed or was not issued by\r
402 Transmit() or Receive().\r
403\r
404**/\r
405EFI_STATUS\r
406EFIAPI\r
407Udp6Cancel (\r
408 IN EFI_UDP6_PROTOCOL *This,\r
409 IN EFI_UDP6_COMPLETION_TOKEN *Token OPTIONAL\r
410 );\r
411\r
412/**\r
413 This function can be used by network drivers and applications to increase the rate that\r
414 data packets are moved between the communications device and the transmit/receive queues.\r
415\r
416 @param[in] This Pointer to the EFI_UDP6_PROTOCOL instance.\r
417\r
418 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
419 @retval EFI_INVALID_PARAMETER This is NULL.\r
420 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
421 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or\r
422 receive queue.\r
423\r
424**/\r
425EFI_STATUS\r
426EFIAPI\r
427Udp6Poll (\r
428 IN EFI_UDP6_PROTOCOL *This\r
429 );\r
430\r
431/**\r
432 This function is used to enable and disable the multicast group filtering.\r
433\r
434 @param[in] This Pointer to the EFI_UDP6_PROTOCOL instance.\r
435 @param[in] JoinFlag Set to TRUE to join a multicast group. Set to\r
436 FALSE to leave one or all multicast groups.\r
437 @param[in] MulticastAddress Pointer to multicast group address to join or\r
438 leave. This parameter is optional and may be NULL.\r
439\r
440 @retval EFI_SUCCESS The operation completed successfully.\r
441 @retval EFI_NOT_STARTED The EFI UDPv6 Protocol instance has not been\r
442 started.\r
443 @retval EFI_OUT_OF_RESOURCES Could not allocate resources to join the group.\r
444 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
445 This is NULL. JoinFlag is TRUE and\r
446 MulticastAddress is NULL. JoinFlag is TRUE and\r
447 *MulticastAddress is not a valid multicast\r
448 address.\r
449 @retval EFI_ALREADY_STARTED The group address is already in the group table\r
450 (when JoinFlag is TRUE).\r
451 @retval EFI_NOT_FOUND The group address is not in the group table (when\r
452 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
458Udp6Groups (\r
459 IN EFI_UDP6_PROTOCOL *This,\r
460 IN BOOLEAN JoinFlag,\r
461 IN EFI_IPv6_ADDRESS *MulticastAddress OPTIONAL\r
462 );\r
463\r
464/**\r
465 This function tries to bind the udp instance according to the configured port\r
466 allocation stragety.\r
467\r
468 @param[in] InstanceList Pointer to the head of the list linking the udp\r
469 instances.\r
470 @param[in] ConfigData Pointer to the ConfigData of the instance to be\r
471 bound.\r
472\r
473 @retval EFI_SUCCESS The bound operation completed successfully.\r
474 @retval EFI_ACCESS_DENIED The <Address, Port> specified by the ConfigData is\r
475 already used by another instance.\r
476 @retval EFI_OUT_OF_RESOURCES No available port resources.\r
477\r
478**/\r
479EFI_STATUS\r
480Udp6Bind (\r
481 IN LIST_ENTRY *InstanceList,\r
482 IN EFI_UDP6_CONFIG_DATA *ConfigData\r
483 );\r
484\r
485/**\r
486 This function builds the Ip6 configdata from the Udp6ConfigData.\r
487\r
488 @param[in] Udp6ConfigData Pointer to the EFI_UDP6_CONFIG_DATA.\r
489 @param[in, out] Ip6ConfigData Pointer to the EFI_IP6_CONFIG_DATA.\r
490\r
491**/\r
492VOID\r
493Udp6BuildIp6ConfigData (\r
494 IN EFI_UDP6_CONFIG_DATA *Udp6ConfigData,\r
495 IN OUT EFI_IP6_CONFIG_DATA *Ip6ConfigData\r
496 );\r
497\r
498/**\r
499 This function checks whether the specified Token duplicates with the one in the Map.\r
500\r
501 @param[in] Map Pointer to the NET_MAP.\r
502 @param[in] Item Pointer to the NET_MAP_ITEM contain the pointer to\r
503 the Token.\r
504 @param[in] Context Pointer to the Token to be checked.\r
505\r
506 @retval EFI_SUCCESS The Token specified by Context differs from the\r
507 one in the Item.\r
508 @retval EFI_ACCESS_DENIED The Token duplicates with the one in the Item.\r
509\r
510**/\r
511EFI_STATUS\r
512EFIAPI\r
513Udp6TokenExist (\r
514 IN NET_MAP *Map,\r
515 IN NET_MAP_ITEM *Item,\r
516 IN VOID *Context\r
517 );\r
518\r
519/**\r
520 This function removes the specified Token from the TokenMap.\r
521\r
522 @param[in] TokenMap Pointer to the NET_MAP containing the tokens.\r
523 @param[in] Token Pointer to the Token to be removed.\r
524\r
525 @retval EFI_SUCCESS The specified Token is removed from the TokenMap.\r
526 @retval EFI_NOT_FOUND The specified Token is not found in the TokenMap.\r
527\r
528**/\r
529EFI_STATUS\r
530Udp6RemoveToken (\r
531 IN NET_MAP *TokenMap,\r
532 IN EFI_UDP6_COMPLETION_TOKEN *Token\r
533 );\r
534\r
535/**\r
536 This function is used to check whether the NewConfigData has any un-reconfigurable\r
537 parameters changed compared to the OldConfigData.\r
538\r
539 @param[in] OldConfigData Pointer to the current ConfigData the udp instance\r
540 uses.\r
541 @param[in] NewConfigData Pointer to the new ConfigData.\r
542\r
543 @retval TRUE The instance is reconfigurable according to NewConfigData.\r
544 @retval FALSE The instance is not reconfigurable according to NewConfigData.\r
545\r
546**/\r
547BOOLEAN\r
548Udp6IsReconfigurable (\r
549 IN EFI_UDP6_CONFIG_DATA *OldConfigData,\r
550 IN EFI_UDP6_CONFIG_DATA *NewConfigData\r
551 );\r
552\r
553/**\r
554 This function removes the multicast group specified by Arg from the Map.\r
555\r
556 @param[in] Map Pointer to the NET_MAP.\r
557 @param[in] Item Pointer to the NET_MAP_ITEM.\r
558 @param[in] Arg Pointer to the Arg. It is the pointer to a\r
559 multicast IPv6 Address. This parameter is\r
560 optional and may be NULL.\r
561\r
562 @retval EFI_SUCCESS The multicast address is removed.\r
563 @retval EFI_ABORTED The specified multicast address is removed, and the\r
564 Arg is not NULL.\r
565\r
566**/\r
567EFI_STATUS\r
568EFIAPI\r
569Udp6LeaveGroup (\r
570 IN NET_MAP *Map,\r
571 IN NET_MAP_ITEM *Item,\r
572 IN VOID *Arg OPTIONAL\r
573 );\r
574\r
575/**\r
576 This function validates the TxToken, it returns the error code according to the spec.\r
577\r
578 @param[in] Instance Pointer to the udp instance context data.\r
579 @param[in] TxToken Pointer to the token to be checked.\r
580\r
581 @retval EFI_SUCCESS The TxToken is valid.\r
582 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
583 Token.Event is NULL.\r
584 Token.Packet.TxData is NULL.\r
585 Token.Packet.TxData.FragmentCount is zero.\r
586 Token.Packet.TxData.DataLength is not equal to the\r
587 sum of fragment lengths.\r
588 One or more of the\r
589 Token.Packet.TxData.FragmentTable[].FragmentLength\r
590 fields is zero.\r
591 One or more of the\r
592 Token.Packet.TxData.FragmentTable[].FragmentBuffer\r
593 fields is NULL.\r
594 UdpSessionData.DestinationAddress are not valid\r
595 unicast IPv6 addresses if the UdpSessionData is\r
596 not NULL.\r
597 UdpSessionData.DestinationPort and\r
598 ConfigData.RemotePort are all zero if the\r
599 UdpSessionData is not NULL.\r
600 @retval EFI_BAD_BUFFER_SIZE The data length is greater than the maximum UDP\r
601 packet size.\r
602\r
603**/\r
604EFI_STATUS\r
605Udp6ValidateTxToken (\r
606 IN UDP6_INSTANCE_DATA *Instance,\r
607 IN EFI_UDP6_COMPLETION_TOKEN *TxToken\r
608 );\r
609\r
610/**\r
611 This function is a dummy ext-free function for the NET_BUF created for the output\r
612 udp datagram.\r
613\r
614 @param[in] Context Pointer to the context data.\r
615\r
616**/\r
617VOID\r
618EFIAPI\r
619Udp6NetVectorExtFree (\r
620 IN VOID *Context\r
621 );\r
622\r
623/**\r
624 This function calculates the checksum for the Packet, utilizing the pre-calculated\r
625 pseudo header to reduce overhead.\r
626\r
627 @param[in] Packet Pointer to the NET_BUF contains the udp datagram.\r
628 @param[in] HeadSum Checksum of the pseudo header execpt the length\r
629 field.\r
630\r
631 @return The 16-bit checksum of this udp datagram.\r
632\r
633**/\r
634UINT16\r
635Udp6Checksum (\r
636 IN NET_BUF *Packet,\r
637 IN UINT16 HeadSum\r
638 );\r
639\r
640/**\r
641 This function delivers the received datagrams to the specified instance.\r
642\r
643 @param[in] Instance Pointer to the instance context data.\r
644\r
645**/\r
646VOID\r
647Udp6InstanceDeliverDgram (\r
648 IN UDP6_INSTANCE_DATA *Instance\r
649 );\r
650\r
651/**\r
652 Cancel Udp6 tokens from the Udp6 instance.\r
653\r
654 @param[in] Instance Pointer to the udp instance context data.\r
655 @param[in] Token Pointer to the token to be canceled. If NULL, all\r
656 tokens in this instance will be cancelled.\r
657 This parameter is optional and may be NULL.\r
658\r
659 @retval EFI_SUCCESS The Token is cancelled.\r
660 @retval EFI_NOT_FOUND The Token is not found.\r
661\r
662**/\r
663EFI_STATUS\r
664Udp6InstanceCancelToken (\r
665 IN UDP6_INSTANCE_DATA *Instance,\r
666 IN EFI_UDP6_COMPLETION_TOKEN *Token OPTIONAL\r
667 );\r
668\r
669/**\r
670 This function removes all the Wrap datas in the RcvdDgramQue.\r
671\r
672 @param[in] Instance Pointer to the Udp6 Instance.\r
673\r
674**/\r
675VOID\r
676Udp6FlushRcvdDgram (\r
677 IN UDP6_INSTANCE_DATA *Instance\r
678 );\r
679\r
680#endif\r
681\r