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