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