iPXE
Udp4.h
Go to the documentation of this file.
1 /** @file
2  UDP4 Service Binding Protocol as defined in UEFI specification.
3 
4  The EFI UDPv4 Protocol provides simple packet-oriented services
5  to transmit and receive UDP packets.
6 
7 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9 
10  @par Revision Reference:
11  This Protocol is introduced in UEFI Specification 2.0.
12 
13 **/
14 
15 #ifndef __EFI_UDP4_PROTOCOL_H__
16 #define __EFI_UDP4_PROTOCOL_H__
17 
18 FILE_LICENCE ( BSD2_PATENT );
19 
20 #include <ipxe/efi/Protocol/Ip4.h>
21 //
22 // GUID definitions
23 //
24 #define EFI_UDP4_SERVICE_BINDING_PROTOCOL_GUID \
25  { \
26  0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } \
27  }
28 
29 #define EFI_UDP4_PROTOCOL_GUID \
30  { \
31  0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } \
32  }
33 
35 
36 ///
37 /// EFI_UDP4_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
38 /// The definition in here is only present to provide backwards compatability.
39 ///
40 typedef struct {
47 
48 ///
49 /// EFI_UDP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
50 /// The definition in here is only present to provide backwards compatability.
51 ///
52 typedef struct {
57 
58 typedef struct {
62 
63 typedef struct {
69 typedef struct {
70  //
71  // Receiving Filters
72  //
77  //
78  // I/O parameters
79  //
85  //
86  // Access Point
87  //
95 
96 typedef struct {
101  EFI_UDP4_FRAGMENT_DATA FragmentTable[1];
103 
104 typedef struct {
110  EFI_UDP4_FRAGMENT_DATA FragmentTable[1];
112 
113 typedef struct {
116  union {
119  } Packet;
121 
122 /**
123  Reads the current operational settings.
124 
125  The GetModeData() function copies the current operational settings of this EFI
126  UDPv4 Protocol instance into user-supplied buffers. This function is used
127  optionally to retrieve the operational mode data of underlying networks or
128  drivers.
129 
130  @param This The pointer to the EFI_UDP4_PROTOCOL instance.
131  @param Udp4ConfigData The pointer to the buffer to receive the current configuration data.
132  @param Ip4ModeData The pointer to the EFI IPv4 Protocol mode data structure.
133  @param MnpConfigData The pointer to the managed network configuration data structure.
134  @param SnpModeData The pointer to the simple network mode data structure.
135 
136  @retval EFI_SUCCESS The mode data was read.
137  @retval EFI_NOT_STARTED When Udp4ConfigData is queried, no configuration data is
138  available because this instance has not been started.
139  @retval EFI_INVALID_PARAMETER This is NULL.
140 
141 **/
142 typedef
145  IN EFI_UDP4_PROTOCOL *This,
146  OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL,
147  OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
150  );
151 
152 /**
153  Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4
154  Protocol.
155 
156  The Configure() function is used to do the following:
157  * Initialize and start this instance of the EFI UDPv4 Protocol.
158  * Change the filtering rules and operational parameters.
159  * Reset this instance of the EFI UDPv4 Protocol.
160  Until these parameters are initialized, no network traffic can be sent or
161  received by this instance. This instance can be also reset by calling Configure()
162  with UdpConfigData set to NULL. Once reset, the receiving queue and transmitting
163  queue are flushed and no traffic is allowed through this instance.
164  With different parameters in UdpConfigData, Configure() can be used to bind
165  this instance to specified port.
166 
167  @param This The pointer to the EFI_UDP4_PROTOCOL instance.
168  @param Udp4ConfigData The pointer to the buffer to receive the current configuration data.
169 
170  @retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully.
171  @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
172  RARP, etc.) is not finished yet.
173  @retval EFI_INVALID_PARAMETER This is NULL.
174  @retval EFI_INVALID_PARAMETER UdpConfigData.StationAddress is not a valid unicast IPv4 address.
175  @retval EFI_INVALID_PARAMETER UdpConfigData.SubnetMask is not a valid IPv4 address mask. The subnet
176  mask must be contiguous.
177  @retval EFI_INVALID_PARAMETER UdpConfigData.RemoteAddress is not a valid unicast IPv4 address if it
178  is not zero.
179  @retval EFI_ALREADY_STARTED The EFI UDPv4 Protocol instance is already started/configured
180  and must be stopped/reset before it can be reconfigured.
181  @retval EFI_ACCESS_DENIED UdpConfigData. AllowDuplicatePort is FALSE
182  and UdpConfigData.StationPort is already used by
183  other instance.
184  @retval EFI_OUT_OF_RESOURCES The EFI UDPv4 Protocol driver cannot allocate memory for this
185  EFI UDPv4 Protocol instance.
186  @retval EFI_DEVICE_ERROR An unexpected network or system error occurred and this instance
187  was not opened.
188 
189 **/
190 typedef
193  IN EFI_UDP4_PROTOCOL *This,
194  IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL
195  );
196 
197 /**
198  Joins and leaves multicast groups.
199 
200  The Groups() function is used to enable and disable the multicast group
201  filtering. If the JoinFlag is FALSE and the MulticastAddress is NULL, then all
202  currently joined groups are left.
203 
204  @param This The pointer to the EFI_UDP4_PROTOCOL instance.
205  @param JoinFlag Set to TRUE to join a multicast group. Set to FALSE to leave one
206  or all multicast groups.
207  @param MulticastAddress The pointer to multicast group address to join or leave.
208 
209  @retval EFI_SUCCESS The operation completed successfully.
210  @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started.
211  @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
212  RARP, etc.) is not finished yet.
213  @retval EFI_OUT_OF_RESOURCES Could not allocate resources to join the group.
214  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
215  - This is NULL.
216  - JoinFlag is TRUE and MulticastAddress is NULL.
217  - JoinFlag is TRUE and *MulticastAddress is not
218  a valid multicast address.
219  @retval EFI_ALREADY_STARTED The group address is already in the group table (when
220  JoinFlag is TRUE).
221  @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is
222  FALSE).
223  @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
224 
225 **/
226 typedef
229  IN EFI_UDP4_PROTOCOL *This,
230  IN BOOLEAN JoinFlag,
231  IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL
232  );
233 
234 /**
235  Adds and deletes routing table entries.
236 
237  The Routes() function adds a route to or deletes a route from the routing table.
238  Routes are determined by comparing the SubnetAddress with the destination IP
239  address and arithmetically AND-ing it with the SubnetMask. The gateway address
240  must be on the same subnet as the configured station address.
241  The default route is added with SubnetAddress and SubnetMask both set to 0.0.0.0.
242  The default route matches all destination IP addresses that do not match any
243  other routes.
244  A zero GatewayAddress is a nonroute. Packets are sent to the destination IP
245  address if it can be found in the Address Resolution Protocol (ARP) cache or
246  on the local subnet. One automatic nonroute entry will be inserted into the
247  routing table for outgoing packets that are addressed to a local subnet
248  (gateway address of 0.0.0.0).
249  Each instance of the EFI UDPv4 Protocol has its own independent routing table.
250  Instances of the EFI UDPv4 Protocol that use the default IP address will also
251  have copies of the routing table provided by the EFI_IP4_CONFIG_PROTOCOL. These
252  copies will be updated automatically whenever the IP driver reconfigures its
253  instances; as a result, the previous modification to these copies will be lost.
254 
255  @param This The pointer to the EFI_UDP4_PROTOCOL instance.
256  @param DeleteRoute Set to TRUE to delete this route from the routing table.
257  Set to FALSE to add this route to the routing table.
258  @param SubnetAddress The destination network address that needs to be routed.
259  @param SubnetMask The subnet mask of SubnetAddress.
260  @param GatewayAddress The gateway IP address for this route.
261 
262  @retval EFI_SUCCESS The operation completed successfully.
263  @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started.
264  @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
265  - RARP, etc.) is not finished yet.
266  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
267  @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
268  @retval EFI_NOT_FOUND This route is not in the routing table.
269  @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
270 
271 **/
272 typedef
275  IN EFI_UDP4_PROTOCOL *This,
276  IN BOOLEAN DeleteRoute,
277  IN EFI_IPv4_ADDRESS *SubnetAddress,
278  IN EFI_IPv4_ADDRESS *SubnetMask,
279  IN EFI_IPv4_ADDRESS *GatewayAddress
280  );
281 
282 /**
283  Polls for incoming data packets and processes outgoing data packets.
284 
285  The Poll() function can be used by network drivers and applications to increase
286  the rate that data packets are moved between the communications device and the
287  transmit and receive queues.
288  In some systems, the periodic timer event in the managed network driver may not
289  poll the underlying communications device fast enough to transmit and/or receive
290  all data packets without missing incoming packets or dropping outgoing packets.
291  Drivers and applications that are experiencing packet loss should try calling
292  the Poll() function more often.
293 
294  @param This The pointer to the EFI_UDP4_PROTOCOL instance.
295 
296  @retval EFI_SUCCESS Incoming or outgoing data was processed.
297  @retval EFI_INVALID_PARAMETER This is NULL.
298  @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
299  @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
300 
301 **/
302 typedef
305  IN EFI_UDP4_PROTOCOL *This
306  );
307 
308 /**
309  Places an asynchronous receive request into the receiving queue.
310 
311  The Receive() function places a completion token into the receive packet queue.
312  This function is always asynchronous.
313  The caller must fill in the Token.Event field in the completion token, and this
314  field cannot be NULL. When the receive operation completes, the EFI UDPv4 Protocol
315  driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event
316  is signaled. Providing a proper notification function and context for the event
317  will enable the user to receive the notification and receiving status. That
318  notification function is guaranteed to not be re-entered.
319 
320  @param This The pointer to the EFI_UDP4_PROTOCOL instance.
321  @param Token The pointer to a token that is associated with the receive data
322  descriptor.
323 
324  @retval EFI_SUCCESS The receive completion token was cached.
325  @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started.
326  @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP, etc.)
327  is not finished yet.
328  @retval EFI_INVALID_PARAMETER This is NULL.
329  @retval EFI_INVALID_PARAMETER Token is NULL.
330  @retval EFI_INVALID_PARAMETER Token.Event is NULL.
331  @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
332  resources (usually memory).
333  @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
334  @retval EFI_ACCESS_DENIED A receive completion token with the same Token.Event was already in
335  the receive queue.
336  @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
337 
338 **/
339 typedef
342  IN EFI_UDP4_PROTOCOL *This,
344  );
345 
346 /**
347  Queues outgoing data packets into the transmit queue.
348 
349  The Transmit() function places a sending request to this instance of the EFI
350  UDPv4 Protocol, alongside the transmit data that was filled by the user. Whenever
351  the packet in the token is sent out or some errors occur, the Token.Event will
352  be signaled and Token.Status is updated. Providing a proper notification function
353  and context for the event will enable the user to receive the notification and
354  transmitting status.
355 
356  @param This The pointer to the EFI_UDP4_PROTOCOL instance.
357  @param Token The pointer to the completion token that will be placed into the
358  transmit queue.
359 
360  @retval EFI_SUCCESS The data has been queued for transmission.
361  @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started.
362  @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
363  RARP, etc.) is not finished yet.
364  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
365  @retval EFI_ACCESS_DENIED The transmit completion token with the same
366  Token.Event was already in the transmit queue.
367  @retval EFI_NOT_READY The completion token could not be queued because the
368  transmit queue is full.
369  @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
370  @retval EFI_NOT_FOUND There is no route to the destination network or address.
371  @retval EFI_BAD_BUFFER_SIZE The data length is greater than the maximum UDP packet
372  size. Or the length of the IP header + UDP header + data
373  length is greater than MTU if DoNotFragment is TRUE.
374 
375 **/
376 typedef
379  IN EFI_UDP4_PROTOCOL *This,
381  );
382 
383 /**
384  Aborts an asynchronous transmit or receive request.
385 
386  The Cancel() function is used to abort a pending transmit or receive request.
387  If the token is in the transmit or receive request queues, after calling this
388  function, Token.Status will be set to EFI_ABORTED and then Token.Event will be
389  signaled. If the token is not in one of the queues, which usually means that
390  the asynchronous operation has completed, this function will not signal the
391  token and EFI_NOT_FOUND is returned.
392 
393  @param This The pointer to the EFI_UDP4_PROTOCOL instance.
394  @param Token The pointer to a token that has been issued by
395  EFI_UDP4_PROTOCOL.Transmit() or
396  EFI_UDP4_PROTOCOL.Receive().If NULL, all pending
397  tokens are aborted.
398 
399  @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event
400  was signaled. When Token is NULL, all pending requests are
401  aborted and their events are signaled.
402  @retval EFI_INVALID_PARAMETER This is NULL.
403  @retval EFI_NOT_STARTED This instance has not been started.
404  @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
405  RARP, etc.) is not finished yet.
406  @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
407  not found in the transmit or receive queue. It has either completed
408  or was not issued by Transmit() and Receive().
409 
410 **/
411 typedef
414  IN EFI_UDP4_PROTOCOL *This,
416  );
417 
418 ///
419 /// The EFI_UDP4_PROTOCOL defines an EFI UDPv4 Protocol session that can be used
420 /// by any network drivers, applications, or daemons to transmit or receive UDP packets.
421 /// This protocol instance can either be bound to a specified port as a service or
422 /// connected to some remote peer as an active client. Each instance has its own settings,
423 /// such as the routing table and group table, which are independent from each other.
424 ///
434 };
435 
438 
439 #endif
UINT16 RemotePort
Definition: Udp4.h:45
#define OPTIONAL
Passing the datum to the function is optional, and a NULL is passed if the value is not supplied.
Definition: Base.h:292
FILE_LICENCE(BSD2_PATENT)
BOOLEAN DoNotFragment
Definition: Udp4.h:82
EFI_UDP4_TRANSMIT Transmit
Definition: Udp4.h:430
UINT32 FragmentCount
Definition: Udp4.h:100
EFI_UDP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
Definition: Udp4.h:52
EFI_EVENT RecycleSignal
Definition: Udp4.h:106
BOOLEAN AcceptAnyPort
Definition: Udp4.h:75
128 bit buffer containing a unique identifier value.
Definition: Base.h:215
VOID * FragmentBuffer
Definition: Udp4.h:60
VOID * EFI_EVENT
Handle to an event structure.
Definition: UefiBaseType.h:39
unsigned char BOOLEAN
EFI_GUID gEfiUdp4ServiceBindingProtocolGuid
UINT16 SourcePort
Definition: Udp4.h:65
EFI_STATUS(EFIAPI * EFI_UDP4_GROUPS)(IN EFI_UDP4_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL)
Joins and leaves multicast groups.
Definition: Udp4.h:228
BOOLEAN AllowDuplicatePort
Definition: Udp4.h:76
EFI_UDP4_POLL Poll
Definition: Udp4.h:433
unsigned int UINT32
Definition: ProcessorBind.h:98
EFI_UDP4_RECEIVE Receive
Definition: Udp4.h:431
EFI_UDP4_SESSION_DATA * UdpSessionData
Definition: Udp4.h:97
UINT32 FragmentLength
Definition: Udp4.h:59
unsigned char UINT8
EFI_UDP4_ROUTES Routes
Definition: Udp4.h:429
EFI_STATUS(EFIAPI * EFI_UDP4_CONFIGURE)(IN EFI_UDP4_PROTOCOL *This, IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL)
Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4 Protoco...
Definition: Udp4.h:192
EFI_IPv4_ADDRESS DestinationAddress
Definition: Udp4.h:66
UINT32 ReceiveTimeout
Definition: Udp4.h:83
EFI_STATUS(EFIAPI * EFI_UDP4_GET_MODE_DATA)(IN EFI_UDP4_PROTOCOL *This, OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL, OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL)
Reads the current operational settings.
Definition: Udp4.h:144
EFI_IPv4_ADDRESS * GatewayAddress
Definition: Udp4.h:98
UINT32 FragmentCount
Definition: Udp4.h:109
UINT16 LocalPort
Definition: Udp4.h:43
EFI_STATUS(EFIAPI * EFI_UDP4_TRANSMIT)(IN EFI_UDP4_PROTOCOL *This, IN EFI_UDP4_COMPLETION_TOKEN *Token)
Queues outgoing data packets into the transmit queue.
Definition: Udp4.h:378
#define OUT
Definition: mlx_utils.h:29
EFI_UDP4_SESSION_DATA UdpSession
Definition: Udp4.h:107
This file defines the EFI IPv4 (Internet Protocol version 4) Protocol interface.
EFI_UDP4_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
Definition: Udp4.h:40
4-byte buffer.
Definition: Base.h:225
UINT16 StationPort
Definition: Udp4.h:91
EFI_UDP4_CONFIGURE Configure
Definition: Udp4.h:427
EFI_STATUS(EFIAPI * EFI_UDP4_CANCEL)(IN EFI_UDP4_PROTOCOL *This, IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL)
Aborts an asynchronous transmit or receive request.
Definition: Udp4.h:413
EFI_STATUS Status
Definition: Udp4.h:115
unsigned short UINT16
EFI_GUID gEfiUdp4ProtocolGuid
EFI_UDP4_TRANSMIT_DATA * TxData
Definition: Udp4.h:118
#define EFIAPI
EFI_UDP4_RECEIVE_DATA * RxData
Definition: Udp4.h:117
BOOLEAN AcceptBroadcast
Definition: Udp4.h:73
UINT32 DataLength
Definition: Udp4.h:99
UINT32 DataLength
Definition: Udp4.h:108
EFI_UDP4_CANCEL Cancel
Definition: Udp4.h:432
EFI_IPv4_ADDRESS SourceAddress
Definition: Udp4.h:64
EFI_HANDLE DriverHandle
Definition: Udp4.h:53
UINT8 TimeToLive
Definition: Udp4.h:81
UINT16 RemotePort
Definition: Udp4.h:93
#define VOID
Undeclared type.
Definition: Base.h:271
EFI_IPv4_ADDRESS LocalAddress
Definition: Udp4.h:42
UINT32 ServiceCount
Definition: Udp4.h:54
EFI Time Abstraction: Year: 1900 - 9999 Month: 1 - 12 Day: 1 - 31 Hour: 0 - 23 Minute: 0 - 59 Second:...
Definition: UefiBaseType.h:70
#define IN
Definition: mlx_utils.h:28
EFI_STATUS(EFIAPI * EFI_UDP4_RECEIVE)(IN EFI_UDP4_PROTOCOL *This, IN EFI_UDP4_COMPLETION_TOKEN *Token)
Places an asynchronous receive request into the receiving queue.
Definition: Udp4.h:341
EFI_UDP4_GROUPS Groups
Definition: Udp4.h:428
EFI_IPv4_ADDRESS StationAddress
Definition: Udp4.h:89
EFI_STATUS(EFIAPI * EFI_UDP4_ROUTES)(IN EFI_UDP4_PROTOCOL *This, IN BOOLEAN DeleteRoute, IN EFI_IPv4_ADDRESS *SubnetAddress, IN EFI_IPv4_ADDRESS *SubnetMask, IN EFI_IPv4_ADDRESS *GatewayAddress)
Adds and deletes routing table entries.
Definition: Udp4.h:274
EFI_IPv4_ADDRESS RemoteAddress
Definition: Udp4.h:92
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
The EFI_UDP4_PROTOCOL defines an EFI UDPv4 Protocol session that can be used by any network drivers,...
Definition: Udp4.h:425
BOOLEAN AcceptPromiscuous
Definition: Udp4.h:74
EFI_UDP4_GET_MODE_DATA GetModeData
Definition: Udp4.h:426
BOOLEAN UseDefaultAddress
Definition: Udp4.h:88
EFI_IPv4_ADDRESS SubnetMask
Definition: Udp4.h:90
EFI_IPv4_ADDRESS RemoteAddress
Definition: Udp4.h:44
EFI_TIME TimeStamp
Definition: Udp4.h:105
EFI_STATUS(EFIAPI * EFI_UDP4_POLL)(IN EFI_UDP4_PROTOCOL *This)
Polls for incoming data packets and processes outgoing data packets.
Definition: Udp4.h:304
EFI_HANDLE InstanceHandle
Definition: Udp4.h:41
UINT8 TypeOfService
Definition: Udp4.h:80
UINT32 TransmitTimeout
Definition: Udp4.h:84
UINT16 DestinationPort
Definition: Udp4.h:67
Definition: efi.h:59