3 This file defines the EFI IPv4 (Internet Protocol version 4)
4 Protocol interface. It is split into the following three main
6 - EFI IPv4 Service Binding Protocol
8 - EFI IPv4 Protocol The EFI IPv4 Protocol provides basic
9 network IPv4 packet I/O services, which includes support for
10 a subset of the Internet Control Message Protocol (ICMP) and
11 may include support for the Internet Group Management
14 Copyright (c) 2006 - 2008, Intel Corporation
15 All rights reserved. This program and the accompanying materials
16 are licensed and made available under the terms and conditions of the BSD License
17 which accompanies this distribution. The full text of the license may be found at
18 http://opensource.org/licenses/bsd-license.php
20 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
21 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 #ifndef __EFI_IP4_PROTOCOL_H__
26 #define __EFI_IP4_PROTOCOL_H__
28 #include <Protocol/ManagedNetwork.h>
30 #define EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID \
32 0xc51711e7, 0xb4bf, 0x404a, {0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } \
35 #define EFI_IP4_PROTOCOL_GUID \
37 0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \
40 typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL
;
43 EFI_HANDLE InstanceHandle
;
44 EFI_IPv4_ADDRESS Ip4Address
;
45 EFI_IPv4_ADDRESS SubnetMask
;
46 } EFI_IP4_ADDRESS_PAIR
;
49 EFI_HANDLE DriverHandle
;
51 EFI_IP4_ADDRESS_PAIR AddressPairs
[1];
52 } EFI_IP4_VARIABLE_DATA
;
55 UINT8 DefaultProtocol
;
56 BOOLEAN AcceptAnyProtocol
;
57 BOOLEAN AcceptIcmpErrors
;
58 BOOLEAN AcceptBroadcast
;
59 BOOLEAN AcceptPromiscuous
;
60 BOOLEAN UseDefaultAddress
;
61 EFI_IPv4_ADDRESS StationAddress
;
62 EFI_IPv4_ADDRESS SubnetMask
;
65 BOOLEAN DoNotFragment
;
67 UINT32 ReceiveTimeout
;
68 UINT32 TransmitTimeout
;
69 } EFI_IP4_CONFIG_DATA
;
73 EFI_IPv4_ADDRESS SubnetAddress
;
74 EFI_IPv4_ADDRESS SubnetMask
;
75 EFI_IPv4_ADDRESS GatewayAddress
;
76 } EFI_IP4_ROUTE_TABLE
;
85 EFI_IP4_CONFIG_DATA ConfigData
;
88 EFI_IPv4_ADDRESS
*GroupTable
;
90 EFI_IP4_ROUTE_TABLE
*RouteTable
;
92 EFI_IP4_ICMP_TYPE
*IcmpTypeList
;
102 UINT16 Identification
;
103 UINT16 Fragmentation
;
107 EFI_IPv4_ADDRESS SourceAddress
;
108 EFI_IPv4_ADDRESS DestinationAddress
;
114 UINT32 FragmentLength
;
115 VOID
*FragmentBuffer
;
116 } EFI_IP4_FRAGMENT_DATA
;
121 EFI_EVENT RecycleSignal
;
123 EFI_IP4_HEADER
*Header
;
124 UINT32 OptionsLength
;
127 UINT32 FragmentCount
;
128 EFI_IP4_FRAGMENT_DATA FragmentTable
[1];
129 } EFI_IP4_RECEIVE_DATA
;
133 EFI_IPv4_ADDRESS SourceAddress
;
134 EFI_IPv4_ADDRESS GatewayAddress
;
138 BOOLEAN DoNotFragment
;
139 } EFI_IP4_OVERRIDE_DATA
;
142 EFI_IPv4_ADDRESS DestinationAddress
;
143 EFI_IP4_OVERRIDE_DATA
*OverrideData
; //OPTIONAL
144 UINT32 OptionsLength
; //OPTIONAL
145 VOID
*OptionsBuffer
; //OPTIONAL
146 UINT32 TotalDataLength
;
147 UINT32 FragmentCount
;
148 EFI_IP4_FRAGMENT_DATA FragmentTable
[1];
149 } EFI_IP4_TRANSMIT_DATA
;
155 EFI_IP4_RECEIVE_DATA
*RxData
;
156 EFI_IP4_TRANSMIT_DATA
*TxData
;
158 } EFI_IP4_COMPLETION_TOKEN
;
161 Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
163 @param This Pointer to the EFI_IP4_PROTOCOL instance.
164 @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure.
165 @param MnpConfigData Pointer to the managed network configuration data structure.
166 @param SnpModeData Pointer to the simple network mode data structure.
168 @retval EFI_SUCCESS The operation completed successfully.
169 @retval EFI_INVALID_PARAMETER This is NULL.
170 @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
175 (EFIAPI
*EFI_IP4_GET_MODE_DATA
)(
176 IN CONST EFI_IP4_PROTOCOL
*This
,
177 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
178 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
179 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
183 Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
185 @param This Pointer to the EFI_IP4_PROTOCOL instance.
186 @param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.
188 @retval EFI_SUCCESS The driver instance was successfully opened.
189 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
190 RARP, etc.) is not finished yet.
191 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
192 @retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:
193 A configuration protocol (DHCP, BOOTP, RARP, etc.) could
194 not be located when clients choose to use the default IPv4
195 address. This EFI IPv4 Protocol implementation does not
196 support this requested filter or timeout setting.
197 @retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.
198 @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the
199 IPv4 address or subnet mask can be changed. The interface must
200 also be stopped when switching to/from raw packet mode.
201 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4
202 Protocol driver instance is not opened.
207 (EFIAPI
*EFI_IP4_CONFIGURE
)(
208 IN EFI_IP4_PROTOCOL
*This
,
209 IN EFI_IP4_CONFIG_DATA
*IpConfigData OPTIONAL
213 Joins and leaves multicast groups.
215 @param This Pointer to the EFI_IP4_PROTOCOL instance.
216 @param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
217 @param GroupAddress Pointer to the IPv4 multicast address.
219 @retval EFI_SUCCESS The operation completed successfully.
220 @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
222 - JoinFlag is TRUE and GroupAddress is NULL.
223 - GroupAddress is not NULL and *GroupAddress is
224 not a multicast IPv4 address.
225 @retval EFI_NOT_STARTED This instance has not been started.
226 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
227 RARP, etc.) is not finished yet.
228 @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
229 @retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.
230 @retval EFI_ALREADY_STARTED The group address is already in the group table (when
232 @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
233 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
238 (EFIAPI
*EFI_IP4_GROUPS
)(
239 IN EFI_IP4_PROTOCOL
*This
,
241 IN EFI_IPv4_ADDRESS
*GroupAddress OPTIONAL
245 Adds and deletes routing table entries.
247 @param This Pointer to the EFI_IP4_PROTOCOL instance.
248 @param DeleteRoute Set to TRUE to delete this route from the routing table. Set to
249 FALSE to add this route to the routing table. SubnetAddress
250 and SubnetMask are used as the key to each route entry.
251 @param SubnetAddress The address of the subnet that needs to be routed.
252 @param SubnetMask The subnet mask of SubnetAddress.
253 @param GatewayAddress The unicast gateway IPv4 address for this route.
255 @retval EFI_SUCCESS The operation completed successfully.
256 @retval EFI_NOT_STARTED The driver instance has not been started.
257 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
258 RARP, etc.) is not finished yet.
259 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
261 - SubnetAddress is NULL.
262 - SubnetMask is NULL.
263 - GatewayAddress is NULL.
264 - *SubnetAddress is not a valid subnet address.
265 - *SubnetMask is not a valid subnet mask.
266 - *GatewayAddress is not a valid unicast IPv4 address.
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 (when DeleteRoute is TRUE).
269 @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
270 DeleteRoute is FALSE).
275 (EFIAPI
*EFI_IP4_ROUTES
)(
276 IN EFI_IP4_PROTOCOL
*This
,
277 IN BOOLEAN DeleteRoute
,
278 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
279 IN EFI_IPv4_ADDRESS
*SubnetMask
,
280 IN EFI_IPv4_ADDRESS
*GatewayAddress
284 Places outgoing data packets into the transmit queue.
286 @param This Pointer to the EFI_IP4_PROTOCOL instance.
287 @param Token Pointer to the transmit token.
289 @retval EFI_SUCCESS The data has been queued for transmission.
290 @retval EFI_NOT_STARTED This instance has not been started.
291 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
292 RARP, etc.) is not finished yet.
293 @retval EFI_INVALID_PARAMETER One or more pameters are invalid.
294 @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
295 was already in the transmit queue.
296 @retval EFI_NOT_READY The completion token could not be queued because the transmit
298 @retval EFI_NOT_FOUND Not route is found to destination address.
299 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
300 @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
302 @retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is
303 greater than MTU (or greater than the maximum packet size if
304 Token.Packet.TxData.OverrideData.
305 DoNotFragment is TRUE.)
310 (EFIAPI
*EFI_IP4_TRANSMIT
)(
311 IN EFI_IP4_PROTOCOL
*This
,
312 IN EFI_IP4_COMPLETION_TOKEN
*Token
316 Places a receiving request into the receiving queue.
318 @param This Pointer to the EFI_IP4_PROTOCOL instance.
319 @param Token Pointer to a token that is associated with the receive data descriptor.
321 @retval EFI_SUCCESS The receive completion token was cached.
322 @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
323 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, RARP, etc.)
325 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
328 - Token.Event is NULL.
329 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
330 resources (usually memory).
331 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
332 The EFI IPv4 Protocol instance has been reset to startup defaults.
333 EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already
334 in the receive queue.
335 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
336 @retval EFI_ICMP_ERROR An ICMP error packet was received.
341 (EFIAPI
*EFI_IP4_RECEIVE
)(
342 IN EFI_IP4_PROTOCOL
*This
,
343 IN EFI_IP4_COMPLETION_TOKEN
*Token
347 Abort an asynchronous transmit or receive request.
349 @param This Pointer to the EFI_IP4_PROTOCOL instance.
350 @param Token Pointer to a token that has been issued by
351 EFI_IP4_PROTOCOL.Transmit() or
352 EFI_IP4_PROTOCOL.Receive(). If NULL, all pending
353 tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is
354 defined in EFI_IP4_PROTOCOL.Transmit().
356 @retval EFI_SUCCESS The asynchronous I/O request was aborted and
357 Token.->Event was signaled. When Token is NULL, all
358 pending requests were aborted and their events were signaled.
359 @retval EFI_INVALID_PARAMETER This is NULL.
360 @retval EFI_NOT_STARTED This instance has not been started.
361 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
362 RARP, etc.) is not finished yet.
363 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
364 not found in the transmit or receive queue. It has either completed
365 or was not issued by Transmit() and Receive().
370 (EFIAPI
*EFI_IP4_CANCEL
)(
371 IN EFI_IP4_PROTOCOL
*This
,
372 IN EFI_IP4_COMPLETION_TOKEN
*Token OPTIONAL
376 Polls for incoming data packets and processes outgoing data packets.
378 @param This Pointer to the EFI_IP4_PROTOCOL instance.
380 @retval EFI_SUCCESS Incoming or outgoing data was processed.
381 @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
382 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
383 RARP, etc.) is not finished yet.
384 @retval EFI_INVALID_PARAMETER This is NULL.
385 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
386 @retval EFI_NOT_READY No incoming or outgoing data is processed.
387 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
388 Consider increasing the polling rate.
393 (EFIAPI
*EFI_IP4_POLL
)(
394 IN EFI_IP4_PROTOCOL
*This
398 /// The EFI IPv4 Protocol implements a simple packet-oriented interface that can be
399 /// used by drivers, daemons, and applications to transmit and receive network packets.
401 struct _EFI_IP4_PROTOCOL
{
402 EFI_IP4_GET_MODE_DATA GetModeData
;
403 EFI_IP4_CONFIGURE Configure
;
404 EFI_IP4_GROUPS Groups
;
405 EFI_IP4_ROUTES Routes
;
406 EFI_IP4_TRANSMIT Transmit
;
407 EFI_IP4_RECEIVE Receive
;
408 EFI_IP4_CANCEL Cancel
;
412 extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid
;
413 extern EFI_GUID gEfiIp4ProtocolGuid
;