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