2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __EFI_UDP4_PROTOCOL_H__
16 #define __EFI_UDP4_PROTOCOL_H__
21 #define EFI_UDP4_SERVICE_BINDING_PROTOCOL_GUID \
23 0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } \
26 #define EFI_UDP4_PROTOCOL_GUID \
28 0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } \
31 typedef struct _EFI_UDP4_PROTOCOL EFI_UDP4_PROTOCOL
;
34 EFI_HANDLE InstanceHandle
;
35 EFI_IPv4_ADDRESS LocalAddress
;
37 EFI_IPv4_ADDRESS RemoteAddress
;
39 } EFI_UDP4_SERVICE_POINT
;
42 EFI_HANDLE DriverHandle
;
44 EFI_UDP4_SERVICE_POINT Services
[1];
45 } EFI_UDP4_VARIABLE_DATA
;
48 //ICMP error definitions
50 #define EFI_NETWORK_UNREACHABLE EFIERR(100)
51 #define EFI_HOST_UNREACHABLE EFIERR(101)
52 #define EFI_PROTOCOL_UNREACHABLE EFIERR(102)
53 #define EFI_PORT_UNREACHABLE EFIERR(103)
57 UINT32 FragmentLength
;
59 } EFI_UDP4_FRAGMENT_DATA
;
62 EFI_IPv4_ADDRESS SourceAddress
;
64 EFI_IPv4_ADDRESS DestinationAddress
;
65 UINT16 DestinationPort
;
66 } EFI_UDP4_SESSION_DATA
;
71 BOOLEAN AcceptBroadcast
;
72 BOOLEAN AcceptPromiscuous
;
73 BOOLEAN AcceptAnyPort
;
74 BOOLEAN AllowDuplicatePort
;
80 BOOLEAN DoNotFragment
;
81 UINT32 ReceiveTimeout
;
82 UINT32 TransmitTimeout
;
86 BOOLEAN UseDefaultAddress
;
87 EFI_IPv4_ADDRESS StationAddress
;
88 EFI_IPv4_ADDRESS SubnetMask
;
90 EFI_IPv4_ADDRESS RemoteAddress
;
92 } EFI_UDP4_CONFIG_DATA
;
95 EFI_UDP4_SESSION_DATA
*UdpSessionData
; //OPTIONAL
96 EFI_IPv4_ADDRESS
*GatewayAddress
; //OPTIONAL
99 EFI_UDP4_FRAGMENT_DATA FragmentTable
[1];
100 } EFI_UDP4_TRANSMIT_DATA
;
104 EFI_EVENT RecycleSignal
;
105 EFI_UDP4_SESSION_DATA UdpSession
;
107 UINT32 FragmentCount
;
108 EFI_UDP4_FRAGMENT_DATA FragmentTable
[1];
109 } EFI_UDP4_RECEIVE_DATA
;
116 EFI_UDP4_RECEIVE_DATA
*RxData
;
117 EFI_UDP4_TRANSMIT_DATA
*TxData
;
119 } EFI_UDP4_COMPLETION_TOKEN
;
122 Reads the current operational settings.
124 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
125 @param Udp4ConfigData Pointer to the buffer to receive the current configuration data.
126 @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure.
127 @param MnpConfigData Pointer to the managed network configuration data structure.
128 @param SnpModeData Pointer to the simple network mode data structure.
130 @retval EFI_SUCCESS The mode data was read.
131 @retval EFI_NOT_STARTED When Udp4ConfigData is queried, no configuration data is
132 available because this instance has not been started.
133 @retval EFI_INVALID_PARAMETER This is NULL.
138 (EFIAPI
*EFI_UDP4_GET_MODE_DATA
) (
139 IN EFI_UDP4_PROTOCOL
*This
,
140 OUT EFI_UDP4_CONFIG_DATA
*Udp4ConfigData OPTIONAL
,
141 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
142 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
143 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
149 Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4
152 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
153 @param Udp4ConfigData Pointer to the buffer to receive the current configuration data.
155 @retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully.
156 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
157 RARP, etc.) is not finished yet.
158 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
159 @retval EFI_ALREADY_STARTED The EFI UDPv4 Protocol instance is already started/configured
160 and must be stopped/reset before it can be reconfigured.
161 @retval EFI_ACCESS_DENIED UdpConfigData. AllowDuplicatePort is FALSE
162 and UdpConfigData.StationPort is already used by
164 @retval EFI_OUT_OF_RESOURCES The EFI UDPv4 Protocol driver cannot allocate memory for this
165 EFI UDPv4 Protocol instance.
166 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred and this instance
172 (EFIAPI
*EFI_UDP4_CONFIGURE
) (
173 IN EFI_UDP4_PROTOCOL
*This
,
174 IN EFI_UDP4_CONFIG_DATA
*UdpConfigData OPTIONAL
179 Joins and leaves multicast groups.
181 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
182 @param JoinFlag Set to TRUE to join a multicast group. Set to FALSE to leave one
183 or all multicast groups.
184 @param MulticastAddress Pointer to multicast group address to join or leave.
186 @retval EFI_SUCCESS The operation completed successfully.
187 @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started.
188 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
189 RARP, etc.) is not finished yet.
190 @retval EFI_OUT_OF_RESOURCES Could not allocate resources to join the group.
191 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
193 - JoinFlag is TRUE and MulticastAddress is NULL.
194 - JoinFlag is TRUE and *MulticastAddress is not
195 a valid multicast address.
196 @retval EFI_ALREADY_STARTED The group address is already in the group table (when
198 @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is
200 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
205 (EFIAPI
*EFI_UDP4_GROUPS
) (
206 IN EFI_UDP4_PROTOCOL
*This
,
208 IN EFI_IPv4_ADDRESS
*MulticastAddress OPTIONAL
213 Adds and deletes routing table entries.
215 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
216 @param DeleteRoute Set to TRUE to delete this route from the routing table.
217 Set to FALSE to add this route to the routing table.
218 @param SubnetAddress The destination network address that needs to be routed.
219 @param SubnetMask The subnet mask of SubnetAddress.
220 @param GatewayAddress The gateway IP address for this route.
222 @retval EFI_SUCCESS The operation completed successfully.
223 @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started.
224 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
225 - RARP, etc.) is not finished yet.
226 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
227 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
228 @retval EFI_NOT_FOUND This route is not in the routing table.
229 @retval EFI_ACCESS_DENIED The route is already defined in the routing table.
234 (EFIAPI
*EFI_UDP4_ROUTES
) (
235 IN EFI_UDP4_PROTOCOL
*This
,
236 IN BOOLEAN DeleteRoute
,
237 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
238 IN EFI_IPv4_ADDRESS
*SubnetMask
,
239 IN EFI_IPv4_ADDRESS
*GatewayAddress
244 Polls for incoming data packets and processes outgoing data packets.
246 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
248 @retval EFI_SUCCESS Incoming or outgoing data was processed.
249 @retval EFI_INVALID_PARAMETER This is NULL.
250 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
251 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
256 (EFIAPI
*EFI_UDP4_POLL
) (
257 IN EFI_UDP4_PROTOCOL
*This
262 Places an asynchronous receive request into the receiving queue.
264 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
265 @param Token Pointer to a token that is associated with the receive data
268 @retval EFI_SUCCESS The receive completion token was cached.
269 @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started.
270 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP, etc.)
272 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
273 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
274 resources (usually memory).
275 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
276 @retval EFI_ACCESS_DENIED A receive completion token with the same Token.Event was already in
278 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
283 (EFIAPI
*EFI_UDP4_RECEIVE
) (
284 IN EFI_UDP4_PROTOCOL
*This
,
285 IN EFI_UDP4_COMPLETION_TOKEN
*Token
290 Queues outgoing data packets into the transmit queue.
292 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
293 @param Token Pointer to the completion token that will be placed into the
296 @retval EFI_SUCCESS The data has been queued for transmission.
297 @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started.
298 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
299 RARP, etc.) is not finished yet.
300 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
301 @retval EFI_ACCESS_DENIED The transmit completion token with the same
302 Token.Event was already in the transmit queue.
303 @retval EFI_NOT_READY The completion token could not be queued because the
304 transmit queue is full.
305 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
306 @retval EFI_NOT_FOUND There is no route to the destination network or address.
307 @retval EFI_BAD_BUFFER_SIZE The data length is greater than the maximum UDP packet
308 size. Or the length of the IP header + UDP header + data
309 length is greater than MTU if DoNotFragment is TRUE.
314 (EFIAPI
*EFI_UDP4_TRANSMIT
) (
315 IN EFI_UDP4_PROTOCOL
*This
,
316 IN EFI_UDP4_COMPLETION_TOKEN
*Token
321 Aborts an asynchronous transmit or receive request.
323 @param This Pointer to the EFI_UDP4_PROTOCOL instance.
324 @param Token Pointer to a token that has been issued by
325 EFI_UDP4_PROTOCOL.Transmit() or
326 EFI_UDP4_PROTOCOL.Receive().If NULL, all pending
329 @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event
330 was signaled. When Token is NULL, all pending requests are
331 aborted and their events are signaled.
332 @retval EFI_INVALID_PARAMETER This is NULL.
333 @retval EFI_NOT_STARTED This instance has not been started.
334 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
335 RARP, etc.) is not finished yet.
336 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
337 not found in the transmit or receive queue. It has either completed
338 or was not issued by Transmit() and Receive().
343 (EFIAPI
*EFI_UDP4_CANCEL
)(
344 IN EFI_UDP4_PROTOCOL
*This
,
345 IN EFI_UDP4_COMPLETION_TOKEN
*Token OPTIONAL
349 struct _EFI_UDP4_PROTOCOL
{
350 EFI_UDP4_GET_MODE_DATA GetModeData
;
351 EFI_UDP4_CONFIGURE Configure
;
352 EFI_UDP4_GROUPS Groups
;
353 EFI_UDP4_ROUTES Routes
;
354 EFI_UDP4_TRANSMIT Transmit
;
355 EFI_UDP4_RECEIVE Receive
;
356 EFI_UDP4_CANCEL Cancel
;
360 extern EFI_GUID gEfiUdp4ServiceBindingProtocolGuid
;
361 extern EFI_GUID gEfiUdp4ProtocolGuid
;