1 /** @file
2   The EFI UDPv6 (User Datagram Protocol version 6) Protocol Definition, which is built upon
3   the EFI IPv6 Protocol and provides simple packet-oriented services to transmit and receive
4   UDP packets.
5 
6   Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
7   SPDX-License-Identifier: BSD-2-Clause-Patent
8 
9   @par Revision Reference:
10   This Protocol is introduced in UEFI Specification 2.2
11 
12 **/
13 
14 #ifndef __EFI_UDP6_PROTOCOL_H__
15 #define __EFI_UDP6_PROTOCOL_H__
16 
17 #include <Protocol/Ip6.h>
18 
19 #define EFI_UDP6_SERVICE_BINDING_PROTOCOL_GUID \
20   { \
21     0x66ed4721, 0x3c98, 0x4d3e, {0x81, 0xe3, 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54 } \
22   }
23 
24 #define EFI_UDP6_PROTOCOL_GUID \
25   { \
26     0x4f948815, 0xb4b9, 0x43cb, {0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55 } \
27   }
28 
29 ///
30 /// EFI_UDP6_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
31 /// The definition in here is only present to provide backwards compatability.
32 ///
33 typedef struct {
34   ///
35   /// The EFI UDPv6 Protocol instance handle that is using this address/port pair.
36   ///
37   EFI_HANDLE          InstanceHandle;
38   ///
39   /// The IPv6 address to which this instance of the EFI UDPv6 Protocol is bound.
40   /// Set to 0::/128, if this instance is used to listen all packets from any
41   /// source address.
42   ///
43   EFI_IPv6_ADDRESS    LocalAddress;
44   ///
45   /// The port number in host byte order on which the service is listening.
46   ///
47   UINT16              LocalPort;
48   ///
49   /// The IPv6 address of the remote host. May be 0::/128 if it is not connected
50   /// to any remote host or connected with more than one remote host.
51   ///
52   EFI_IPv6_ADDRESS    RemoteAddress;
53   ///
54   /// The port number in host byte order on which the remote host is
55   /// listening. Maybe zero if it is not connected to any remote host.
56   ///
57   UINT16              RemotePort;
58 } EFI_UDP6_SERVICE_POINT;
59 
60 ///
61 /// EFI_UDP6_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
62 /// The definition in here is only present to provide backwards compatability.
63 ///
64 typedef struct {
65   ///
66   /// The handle of the driver that creates this entry.
67   ///
68   EFI_HANDLE                DriverHandle;
69   ///
70   /// The number of address/port pairs that follow this data structure.
71   ///
72   UINT32                    ServiceCount;
73   ///
74   /// List of address/port pairs that are currently in use.
75   ///
76   EFI_UDP6_SERVICE_POINT    Services[1];
77 } EFI_UDP6_VARIABLE_DATA;
78 
79 typedef struct _EFI_UDP6_PROTOCOL EFI_UDP6_PROTOCOL;
80 
81 ///
82 /// EFI_UDP6_FRAGMENT_DATA allows multiple receive or transmit buffers to be specified.
83 /// The purpose of this structure is to avoid copying the same packet multiple times.
84 ///
85 typedef struct {
86   UINT32    FragmentLength;      ///< Length of the fragment data buffer.
87   VOID      *FragmentBuffer;     ///< Pointer to the fragment data buffer.
88 } EFI_UDP6_FRAGMENT_DATA;
89 
90 ///
91 /// The EFI_UDP6_SESSION_DATA is used to retrieve the settings when receiving packets or
92 /// to override the existing settings (only DestinationAddress and DestinationPort can
93 /// be overridden) of this EFI UDPv6 Protocol instance when sending packets.
94 ///
95 typedef struct {
96   ///
97   /// Address from which this packet is sent. This field should not be used when
98   /// sending packets.
99   ///
100   EFI_IPv6_ADDRESS    SourceAddress;
101   ///
102   /// Port from which this packet is sent. It is in host byte order. This field should
103   /// not be used when sending packets.
104   ///
105   UINT16              SourcePort;
106   ///
107   /// Address to which this packet is sent. When sending packet, it'll be ignored
108   /// if it is zero.
109   ///
110   EFI_IPv6_ADDRESS    DestinationAddress;
111   ///
112   /// Port to which this packet is sent. When sending packet, it'll be
113   /// ignored if it is zero.
114   ///
115   UINT16              DestinationPort;
116 } EFI_UDP6_SESSION_DATA;
117 
118 typedef struct {
119   ///
120   /// Set to TRUE to accept UDP packets that are sent to any address.
121   ///
122   BOOLEAN    AcceptPromiscuous;
123   ///
124   /// Set to TRUE to accept UDP packets that are sent to any port.
125   ///
126   BOOLEAN    AcceptAnyPort;
127   ///
128   /// Set to TRUE to allow this EFI UDPv6 Protocol child instance to open a port number
129   /// that is already being used by another EFI UDPv6 Protocol child instance.
130   ///
131   BOOLEAN    AllowDuplicatePort;
132   ///
133   /// TrafficClass field in transmitted IPv6 packets.
134   ///
135   UINT8      TrafficClass;
136   ///
137   /// HopLimit field in transmitted IPv6 packets.
138   ///
139   UINT8      HopLimit;
140   ///
141   /// The receive timeout value (number of microseconds) to be associated with each
142   /// incoming packet. Zero means do not drop incoming packets.
143   ///
144   UINT32     ReceiveTimeout;
145   ///
146   /// The transmit timeout value (number of microseconds) to be associated with each
147   /// outgoing packet. Zero means do not drop outgoing packets.
148   ///
149   UINT32     TransmitTimeout;
150   ///
151   /// The station IP address that will be assigned to this EFI UDPv6 Protocol instance.
152   /// The EFI UDPv6 and EFI IPv6 Protocol drivers will only deliver incoming packets
153   /// whose destination matches this IP address exactly. Address 0::/128 is also accepted
154   /// as a special case. Under this situation, underlying IPv6 driver is responsible for
155   /// binding a source address to this EFI IPv6 protocol instance according to source
156   /// address selection algorithm. Only incoming packet from the selected source address
157   /// is delivered. This field can be set and changed only when the EFI IPv6 driver is
158   /// transitioning from the stopped to the started states. If no address is available
159   /// for selecting, the EFI IPv6 Protocol driver will use EFI_IP6_CONFIG_PROTOCOL to
160   /// retrieve the IPv6 address.
161   EFI_IPv6_ADDRESS    StationAddress;
162   ///
163   /// The port number to which this EFI UDPv6 Protocol instance is bound. If a client
164   /// of the EFI UDPv6 Protocol does not care about the port number, set StationPort
165   /// to zero. The EFI UDPv6 Protocol driver will assign a random port number to transmitted
166   /// UDP packets. Ignored it if AcceptAnyPort is TRUE.
167   ///
168   UINT16              StationPort;
169   ///
170   /// The IP address of remote host to which this EFI UDPv6 Protocol instance is connecting.
171   /// If RemoteAddress is not 0::/128, this EFI UDPv6 Protocol instance will be connected to
172   /// RemoteAddress; i.e., outgoing packets of this EFI UDPv6 Protocol instance will be sent
173   /// to this address by default and only incoming packets from this address will be delivered
174   /// to client. Ignored for incoming filtering if AcceptPromiscuous is TRUE.
175   EFI_IPv6_ADDRESS    RemoteAddress;
176   ///
177   /// The port number of the remote host to which this EFI UDPv6 Protocol instance is connecting.
178   /// If it is not zero, outgoing packets of this EFI UDPv6 Protocol instance will be sent to
179   /// this port number by default and only incoming packets from this port will be delivered
180   /// to client. Ignored if RemoteAddress is 0::/128 and ignored for incoming filtering if
181   /// AcceptPromiscuous is TRUE.
182   UINT16              RemotePort;
183 } EFI_UDP6_CONFIG_DATA;
184 
185 ///
186 /// The EFI UDPv6 Protocol client must fill this data structure before sending a packet.
187 /// The packet may contain multiple buffers that may be not in a continuous memory location.
188 ///
189 typedef struct {
190   ///
191   /// If not NULL, the data that is used to override the transmitting settings.Only the two
192   /// filed UdpSessionData.DestinationAddress and UdpSessionData.DestionPort can be used as
193   /// the transmitting setting filed.
194   ///
195   EFI_UDP6_SESSION_DATA     *UdpSessionData;
196   ///
197   /// Sum of the fragment data length. Must not exceed the maximum UDP packet size.
198   ///
199   UINT32                    DataLength;
200   ///
201   /// Number of fragments.
202   ///
203   UINT32                    FragmentCount;
204   ///
205   /// Array of fragment descriptors.
206   ///
207   EFI_UDP6_FRAGMENT_DATA    FragmentTable[1];
208 } EFI_UDP6_TRANSMIT_DATA;
209 
210 ///
211 /// EFI_UDP6_RECEIVE_DATA is filled by the EFI UDPv6 Protocol driver when this EFI UDPv6
212 /// Protocol instance receives an incoming packet. If there is a waiting token for incoming
213 /// packets, the CompletionToken.Packet.RxData field is updated to this incoming packet and
214 /// the CompletionToken.Event is signaled. The EFI UDPv6 Protocol client must signal the
215 /// RecycleSignal after processing the packet.
216 /// FragmentTable could contain multiple buffers that are not in the continuous memory locations.
217 /// The EFI UDPv6 Protocol client might need to combine two or more buffers in FragmentTable to
218 /// form their own protocol header.
219 ///
220 typedef struct {
221   ///
222   /// Time when the EFI UDPv6 Protocol accepted the packet.
223   ///
224   EFI_TIME                  TimeStamp;
225   ///
226   /// Indicates the event to signal when the received data has been processed.
227   ///
228   EFI_EVENT                 RecycleSignal;
229   ///
230   /// The UDP session data including SourceAddress, SourcePort, DestinationAddress,
231   /// and DestinationPort.
232   ///
233   EFI_UDP6_SESSION_DATA     UdpSession;
234   ///
235   /// The sum of the fragment data length.
236   ///
237   UINT32                    DataLength;
238   ///
239   /// Number of fragments. Maybe zero.
240   ///
241   UINT32                    FragmentCount;
242   ///
243   /// Array of fragment descriptors. Maybe zero.
244   ///
245   EFI_UDP6_FRAGMENT_DATA    FragmentTable[1];
246 } EFI_UDP6_RECEIVE_DATA;
247 
248 ///
249 /// The EFI_UDP6_COMPLETION_TOKEN structures are used for both transmit and receive operations.
250 /// When used for transmitting, the Event and TxData fields must be filled in by the EFI UDPv6
251 /// Protocol client. After the transmit operation completes, the Status field is updated by the
252 /// EFI UDPv6 Protocol and the Event is signaled.
253 /// When used for receiving, only the Event field must be filled in by the EFI UDPv6 Protocol
254 /// client. After a packet is received, RxData and Status are filled in by the EFI UDPv6 Protocol
255 /// and the Event is signaled.
256 ///
257 typedef struct {
258   ///
259   /// This Event will be signaled after the Status field is updated by the EFI UDPv6 Protocol
260   /// driver. The type of Event must be EVT_NOTIFY_SIGNAL.
261   ///
262   EFI_EVENT    Event;
263   ///
264   /// Will be set to one of the following values:
265   ///   - EFI_SUCCESS: The receive or transmit operation completed successfully.
266   ///   - EFI_ABORTED: The receive or transmit was aborted.
267   ///   - EFI_TIMEOUT: The transmit timeout expired.
268   ///   - EFI_NETWORK_UNREACHABLE: The destination network is unreachable. RxData is set to
269   ///     NULL in this situation.
270   ///   - EFI_HOST_UNREACHABLE: The destination host is unreachable. RxData is set to NULL in
271   ///     this situation.
272   ///   - EFI_PROTOCOL_UNREACHABLE: The UDP protocol is unsupported in the remote system.
273   ///     RxData is set to NULL in this situation.
274   ///   - EFI_PORT_UNREACHABLE: No service is listening on the remote port. RxData is set to
275   ///     NULL in this situation.
276   ///   - EFI_ICMP_ERROR: Some other Internet Control Message Protocol (ICMP) error report was
277   ///     received. For example, packets are being sent too fast for the destination to receive them
278   ///     and the destination sent an ICMP source quench report. RxData is set to NULL in this situation.
279   ///   - EFI_DEVICE_ERROR: An unexpected system or network error occurred.
280   ///   - EFI_SECURITY_VIOLATION: The transmit or receive was failed because of IPsec policy check.
281   ///   - EFI_NO_MEDIA: There was a media error.
282   ///
283   EFI_STATUS    Status;
284   union {
285     ///
286     /// When this token is used for receiving, RxData is a pointer to EFI_UDP6_RECEIVE_DATA.
287     ///
288     EFI_UDP6_RECEIVE_DATA     *RxData;
289     ///
290     /// When this token is used for transmitting, TxData is a pointer to EFI_UDP6_TRANSMIT_DATA.
291     ///
292     EFI_UDP6_TRANSMIT_DATA    *TxData;
293   } Packet;
294 } EFI_UDP6_COMPLETION_TOKEN;
295 
296 /**
297   Read the current operational settings.
298 
299   The GetModeData() function copies the current operational settings of this EFI UDPv6 Protocol
300   instance into user-supplied buffers. This function is used optionally to retrieve the operational
301   mode data of underlying networks or drivers.
302 
303   @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.
304   @param[out]  Udp6ConfigData   The buffer in which the current UDP configuration data is returned.
305   @param[out]  Ip6ModeData      The buffer in which the current EFI IPv6 Protocol mode data is returned.
306   @param[out]  MnpConfigData    The buffer in which the current managed network configuration data is
307                                 returned.
308   @param[out]  SnpModeData      The buffer in which the simple network mode data is returned.
309 
310   @retval EFI_SUCCESS           The mode data was read.
311   @retval EFI_NOT_STARTED       When Udp6ConfigData is queried, no configuration data is available
312                                 because this instance has not been started.
313   @retval EFI_INVALID_PARAMETER This is NULL.
314 
315 **/
316 typedef
317 EFI_STATUS
318 (EFIAPI *EFI_UDP6_GET_MODE_DATA)(
319   IN EFI_UDP6_PROTOCOL                 *This,
320   OUT EFI_UDP6_CONFIG_DATA             *Udp6ConfigData OPTIONAL,
321   OUT EFI_IP6_MODE_DATA                *Ip6ModeData    OPTIONAL,
322   OUT EFI_MANAGED_NETWORK_CONFIG_DATA  *MnpConfigData  OPTIONAL,
323   OUT EFI_SIMPLE_NETWORK_MODE          *SnpModeData    OPTIONAL
324   );
325 
326 /**
327   Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv6
328   Protocol.
329 
330   The Configure() function is used to do the following:
331   - Initialize and start this instance of the EFI UDPv6 Protocol.
332   - Change the filtering rules and operational parameters.
333   - Reset this instance of the EFI UDPv6 Protocol.
334 
335   Until these parameters are initialized, no network traffic can be sent or received by this instance.
336   This instance can be also reset by calling Configure() with UdpConfigData set to NULL.
337   Once reset, the receiving queue and transmitting queue are flushed and no traffic is allowed through
338   this instance.
339 
340   With different parameters in UdpConfigData, Configure() can be used to bind this instance to specified
341   port.
342 
343   @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.
344   @param[in]   UdpConfigData    Pointer to the buffer contained the configuration data.
345 
346   @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.
347   @retval EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source
348                                 address for this instance, but no source address was available for use.
349   @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
350                                 - This is NULL.
351                                 - UdpConfigData.StationAddress neither zero nor one of the configured IP
352                                   addresses in the underlying IPv6 driver.
353                                 - UdpConfigData.RemoteAddress is not a valid unicast IPv6 address if it
354                                   is not zero.
355   @retval EFI_ALREADY_STARTED   The EFI UDPv6 Protocol instance is already started/configured and must be
356                                 stopped/reset before it can be reconfigured. Only TrafficClass, HopLimit,
357                                 ReceiveTimeout, and TransmitTimeout can be reconfigured without stopping
358                                 the current instance of the EFI UDPv6 Protocol.
359   @retval EFI_ACCESS_DENIED     UdpConfigData.AllowDuplicatePort is FALSE and UdpConfigData.StationPort
360                                 is already used by other instance.
361   @retval EFI_OUT_OF_RESOURCES  The EFI UDPv6 Protocol driver cannot allocate memory for this EFI UDPv6
362                                 Protocol instance.
363   @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred and this instance was not
364                                 opened.
365 
366 **/
367 typedef
368 EFI_STATUS
369 (EFIAPI *EFI_UDP6_CONFIGURE)(
370   IN EFI_UDP6_PROTOCOL     *This,
371   IN EFI_UDP6_CONFIG_DATA  *UdpConfigData OPTIONAL
372   );
373 
374 /**
375   Joins and leaves multicast groups.
376 
377   The Groups() function is used to join or leave one or more multicast group.
378   If the JoinFlag is FALSE and the MulticastAddress is NULL, then all currently joined groups are left.
379 
380   @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.
381   @param[in]   JoinFlag         Set to TRUE to join a multicast group. Set to FALSE to leave one
382                                 or all multicast groups.
383   @param[in]   MulticastAddress Pointer to multicast group address to join or leave.
384 
385   @retval EFI_SUCCESS           The operation completed successfully.
386   @retval EFI_NOT_STARTED       The EFI UDPv6 Protocol instance has not been started.
387   @retval EFI_OUT_OF_RESOURCES  Could not allocate resources to join the group.
388   @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
389                                 - This is NULL.
390                                 - JoinFlag is TRUE and MulticastAddress is NULL.
391                                 - JoinFlag is TRUE and *MulticastAddress is not a valid multicast address.
392   @retval EFI_ALREADY_STARTED   The group address is already in the group table (when JoinFlag is TRUE).
393   @retval EFI_NOT_FOUND         The group address is not in the group table (when JoinFlag is FALSE).
394   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
395 
396 **/
397 typedef
398 EFI_STATUS
399 (EFIAPI *EFI_UDP6_GROUPS)(
400   IN EFI_UDP6_PROTOCOL  *This,
401   IN BOOLEAN            JoinFlag,
402   IN EFI_IPv6_ADDRESS   *MulticastAddress OPTIONAL
403   );
404 
405 /**
406   Queues outgoing data packets into the transmit queue.
407 
408   The Transmit() function places a sending request to this instance of the EFI UDPv6 Protocol,
409   alongside the transmit data that was filled by the user. Whenever the packet in the token is
410   sent out or some errors occur, the Token.Event will be signaled and Token.Status is updated.
411   Providing a proper notification function and context for the event will enable the user to
412   receive the notification and transmitting status.
413 
414   @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.
415   @param[in]   Token            Pointer to the completion token that will be placed into the
416                                 transmit queue.
417 
418   @retval EFI_SUCCESS           The data has been queued for transmission.
419   @retval EFI_NOT_STARTED       This EFI UDPv6 Protocol instance has not been started.
420   @retval EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source
421                                 address for this instance, but no source address was available
422                                 for use.
423   @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
424                                 - This is NULL.
425                                 - Token is NULL.
426                                 - Token.Event is NULL.
427                                 - Token.Packet.TxData is NULL.
428                                 - Token.Packet.TxData.FragmentCount is zero.
429                                 - Token.Packet.TxData.DataLength is not equal to the sum of fragment
430                                   lengths.
431                                 - One or more of the Token.Packet.TxData.FragmentTable[].FragmentLength
432                                   fields is zero.
433                                 - One or more of the Token.Packet.TxData.FragmentTable[].FragmentBuffer
434                                   fields is NULL.
435                                 - Token.Packet.TxData.UdpSessionData.DestinationAddress is not zero
436                                   and is not valid unicast Ipv6 address if UdpSessionData is not NULL.
437                                 - Token.Packet.TxData.UdpSessionData is NULL and this instance's
438                                   UdpConfigData.RemoteAddress is unspecified.
439                                 - Token.Packet.TxData.UdpSessionData.DestinationAddress is non-zero
440                                   when DestinationAddress is configured as non-zero when doing Configure()
441                                   for this EFI Udp6 protocol instance.
442                                 - Token.Packet.TxData.UdpSesionData.DestinationAddress is zero when
443                                   DestinationAddress is unspecified when doing Configure() for this
444                                   EFI Udp6 protocol instance.
445   @retval EFI_ACCESS_DENIED     The transmit completion token with the same Token.Event was already
446                                 in the transmit queue.
447   @retval EFI_NOT_READY         The completion token could not be queued because the transmit queue
448                                 is full.
449   @retval EFI_OUT_OF_RESOURCES  Could not queue the transmit data.
450   @retval EFI_NOT_FOUND         There is no route to the destination network or address.
451   @retval EFI_BAD_BUFFER_SIZE   The data length is greater than the maximum UDP packet size.
452 
453 **/
454 typedef
455 EFI_STATUS
456 (EFIAPI *EFI_UDP6_TRANSMIT)(
457   IN EFI_UDP6_PROTOCOL          *This,
458   IN EFI_UDP6_COMPLETION_TOKEN  *Token
459   );
460 
461 /**
462   Places an asynchronous receive request into the receiving queue.
463 
464   The Receive() function places a completion token into the receive packet queue. This function is
465   always asynchronous.
466   The caller must fill in the Token.Event field in the completion token, and this field cannot be
467   NULL. When the receive operation completes, the EFI UDPv6 Protocol driver updates the Token.Status
468   and Token.Packet.RxData fields and the Token.Event is signaled.
469   Providing a proper notification function and context for the event will enable the user to receive
470   the notification and receiving status. That notification function is guaranteed to not be re-entered.
471 
472   @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.
473   @param[in]   Token            Pointer to a token that is associated with the receive data descriptor.
474 
475   @retval EFI_SUCCESS           The receive completion token was cached.
476   @retval EFI_NOT_STARTED       This EFI UDPv6 Protocol instance has not been started.
477   @retval EFI_NO_MAPPING        The underlying IPv6 driver was responsible for choosing a source
478                                 address for this instance, but no source address was available
479                                 for use.
480   @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
481                                 - This is NULL.
482                                 - Token is NULL.
483                                 - Token.Event is NULL.
484   @retval EFI_OUT_OF_RESOURCES  The receive completion token could not be queued due to a lack of system
485                                 resources (usually memory).
486   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred. The EFI UDPv6 Protocol
487                                 instance has been reset to startup defaults.
488   @retval EFI_ACCESS_DENIED     A receive completion token with the same Token.Event was already in
489                                 the receive queue.
490   @retval EFI_NOT_READY         The receive request could not be queued because the receive queue is full.
491 
492 **/
493 typedef
494 EFI_STATUS
495 (EFIAPI *EFI_UDP6_RECEIVE)(
496   IN EFI_UDP6_PROTOCOL          *This,
497   IN EFI_UDP6_COMPLETION_TOKEN  *Token
498   );
499 
500 /**
501   Aborts an asynchronous transmit or receive request.
502 
503   The Cancel() function is used to abort a pending transmit or receive request. If the token is in the
504   transmit or receive request queues, after calling this function, Token.Status will be set to
505   EFI_ABORTED and then Token.Event will be signaled. If the token is not in one of the queues,
506   which usually means that the asynchronous operation has completed, this function will not signal the
507   token and EFI_NOT_FOUND is returned.
508 
509   @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.
510   @param[in]   Token            Pointer to a token that has been issued by EFI_UDP6_PROTOCOL.Transmit()
511                                 or EFI_UDP6_PROTOCOL.Receive().If NULL, all pending tokens are aborted.
512 
513   @retval EFI_SUCCESS           The asynchronous I/O request was aborted and Token.Event was signaled.
514                                 When Token is NULL, all pending requests are aborted and their events
515                                 are signaled.
516   @retval EFI_INVALID_PARAMETER This is NULL.
517   @retval EFI_NOT_STARTED       This instance has not been started.
518   @retval EFI_NOT_FOUND         When Token is not NULL, the asynchronous I/O request was not found in
519                                 the transmit or receive queue. It has either completed or was not issued
520                                 by Transmit() and Receive().
521 
522 **/
523 typedef
524 EFI_STATUS
525 (EFIAPI *EFI_UDP6_CANCEL)(
526   IN EFI_UDP6_PROTOCOL          *This,
527   IN EFI_UDP6_COMPLETION_TOKEN  *Token OPTIONAL
528   );
529 
530 /**
531   Polls for incoming data packets and processes outgoing data packets.
532 
533   The Poll() function can be used by network drivers and applications to increase the rate that data
534   packets are moved between the communications device and the transmit and receive queues.
535   In some systems, the periodic timer event in the managed network driver may not poll the underlying
536   communications device fast enough to transmit and/or receive all data packets without missing incoming
537   packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should
538   try calling the Poll() function more often.
539 
540   @param[in]   This             Pointer to the EFI_UDP6_PROTOCOL instance.
541 
542   @retval EFI_SUCCESS           Incoming or outgoing data was processed.
543   @retval EFI_INVALID_PARAMETER This is NULL.
544   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
545   @retval EFI_TIMEOUT           Data was dropped out of the transmit and/or receive queue.
546                                 Consider increasing the polling rate.
547 
548 **/
549 typedef
550 EFI_STATUS
551 (EFIAPI *EFI_UDP6_POLL)(
552   IN EFI_UDP6_PROTOCOL  *This
553   );
554 
555 ///
556 /// The EFI_UDP6_PROTOCOL defines an EFI UDPv6 Protocol session that can be used by any network drivers,
557 /// applications, or daemons to transmit or receive UDP packets. This protocol instance can either be
558 /// bound to a specified port as a service or connected to some remote peer as an active client.
559 /// Each instance has its own settings, such as group table, that are independent from each other.
560 ///
561 struct _EFI_UDP6_PROTOCOL {
562   EFI_UDP6_GET_MODE_DATA    GetModeData;
563   EFI_UDP6_CONFIGURE        Configure;
564   EFI_UDP6_GROUPS           Groups;
565   EFI_UDP6_TRANSMIT         Transmit;
566   EFI_UDP6_RECEIVE          Receive;
567   EFI_UDP6_CANCEL           Cancel;
568   EFI_UDP6_POLL             Poll;
569 };
570 
571 extern EFI_GUID  gEfiUdp6ServiceBindingProtocolGuid;
572 extern EFI_GUID  gEfiUdp6ProtocolGuid;
573 
574 #endif
575