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