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, 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 SnpData 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
184 Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
186 @param This Pointer to the EFI_IP4_PROTOCOL instance.
187 @param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.
189 @retval EFI_SUCCESS The driver instance was successfully opened.
190 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
191 RARP, etc.) is not finished yet.
192 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
193 @retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:
194 A configuration protocol (DHCP, BOOTP, RARP, etc.) could
195 not be located when clients choose to use the default IPv4
196 address. This EFI IPv4 Protocol implementation does not
197 support this requested filter or timeout setting.
198 @retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.
199 @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the
200 IPv4 address or subnet mask can be changed. The interface must
201 also be stopped when switching to/from raw packet mode.
202 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4
203 Protocol driver instance is not opened.
208 (EFIAPI
*EFI_IP4_CONFIGURE
) (
209 IN EFI_IP4_PROTOCOL
*This
,
210 IN EFI_IP4_CONFIG_DATA
*IpConfigData OPTIONAL
215 Joins and leaves multicast groups.
217 @param This Pointer to the EFI_IP4_PROTOCOL instance.
218 @param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
219 @param GroupAddress Pointer to the IPv4 multicast address.
221 @retval EFI_SUCCESS The operation completed successfully.
222 @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
224 - JoinFlag is TRUE and GroupAddress is NULL.
225 - GroupAddress is not NULL and *GroupAddress is
226 not a multicast IPv4 address.
227 @retval EFI_NOT_STARTED This instance has not been started.
228 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
229 RARP, etc.) is not finished yet.
230 @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
231 @retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.
232 @retval EFI_ALREADY_STARTED The group address is already in the group table (when
234 @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
235 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
240 (EFIAPI
*EFI_IP4_GROUPS
) (
241 IN EFI_IP4_PROTOCOL
*This
,
243 IN EFI_IPv4_ADDRESS
*GroupAddress OPTIONAL
248 Adds and deletes routing table entries.
250 @param This Pointer to the EFI_IP4_PROTOCOL instance.
251 @param DeleteRoute Set to TRUE to delete this route from the routing table. Set to
252 FALSE to add this route to the routing table. SubnetAddress
253 and SubnetMask are used as the key to each route entry.
254 @param SubnetAddress The address of the subnet that needs to be routed.
255 @param SubnetMask The subnet mask of SubnetAddress.
256 @param GatewayAddress The unicast gateway IPv4 address for this route.
258 @retval EFI_SUCCESS The operation completed successfully.
259 @retval EFI_NOT_STARTED The driver instance has not been started.
260 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
261 RARP, etc.) is not finished yet.
262 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
264 - SubnetAddress is NULL.
265 - SubnetMask is NULL.
266 - GatewayAddress is NULL.
267 - *SubnetAddress is not a valid subnet address.
268 - *SubnetMask is not a valid subnet mask.
269 - *GatewayAddress is not a valid unicast IPv4 address.
270 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
271 @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
272 @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
273 DeleteRoute is FALSE).
278 (EFIAPI
*EFI_IP4_ROUTES
) (
279 IN EFI_IP4_PROTOCOL
*This
,
280 IN BOOLEAN DeleteRoute
,
281 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
282 IN EFI_IPv4_ADDRESS
*SubnetMask
,
283 IN EFI_IPv4_ADDRESS
*GatewayAddress
288 Places outgoing data packets into the transmit queue.
290 @param This Pointer to the EFI_IP4_PROTOCOL instance.
291 @param Token Pointer to the transmit token.
293 @retval EFI_SUCCESS The data has been queued for transmission.
294 @retval EFI_NOT_STARTED This instance has not been started.
295 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
296 RARP, etc.) is not finished yet.
297 @retval EFI_INVALID_PARAMETER One or more pameters are invalid.
298 @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
299 was already in the transmit queue.
300 @retval EFI_NOT_READY The completion token could not be queued because the transmit
302 @retval EFI_NOT_FOUND Not route is found to destination address.
303 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
304 @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
306 @retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is
307 greater than MTU (or greater than the maximum packet size if
308 Token.Packet.TxData.OverrideData.
309 DoNotFragment is TRUE.)
314 (EFIAPI
*EFI_IP4_TRANSMIT
) (
315 IN EFI_IP4_PROTOCOL
*This
,
316 IN EFI_IP4_COMPLETION_TOKEN
*Token
321 Places a receiving request into the receiving queue.
323 @param This Pointer to the EFI_IP4_PROTOCOL instance.
324 @param Token Pointer to a token that is associated with the receive data descriptor.
326 @retval EFI_SUCCESS The receive completion token was cached.
327 @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
328 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, RARP, etc.)
330 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
333 - Token.Event is NULL.
334 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
335 resources (usually memory).
336 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
337 The EFI IPv4 Protocol instance has been reset to startup defaults.
338 EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already
339 in the receive queue.
340 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
341 @retval EFI_ICMP_ERROR An ICMP error packet was received.
346 (EFIAPI
*EFI_IP4_RECEIVE
) (
347 IN EFI_IP4_PROTOCOL
*This
,
348 IN EFI_IP4_COMPLETION_TOKEN
*Token
353 Abort an asynchronous transmit or receive request.
355 @param This Pointer to the EFI_IP4_PROTOCOL instance.
356 @param Token Pointer to a token that has been issued by
357 EFI_IP4_PROTOCOL.Transmit() or
358 EFI_IP4_PROTOCOL.Receive(). If NULL, all pending
359 tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is
360 defined in EFI_IP4_PROTOCOL.Transmit().
362 @retval EFI_SUCCESS The asynchronous I/O request was aborted and
363 Token.->Event was signaled. When Token is NULL, all
364 pending requests were aborted and their events were signaled.
365 @retval EFI_INVALID_PARAMETER This is NULL.
366 @retval EFI_NOT_STARTED This instance has not been started.
367 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
368 RARP, etc.) is not finished yet.
369 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
370 not found in the transmit or receive queue. It has either completed
371 or was not issued by Transmit() and Receive().
376 (EFIAPI
*EFI_IP4_CANCEL
) (
377 IN EFI_IP4_PROTOCOL
*This
,
378 IN EFI_IP4_COMPLETION_TOKEN
*Token OPTIONAL
383 Polls for incoming data packets and processes outgoing data packets.
385 @param This Pointer to the EFI_IP4_PROTOCOL instance.
387 @retval EFI_SUCCESS Incoming or outgoing data was processed.
388 @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
389 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
390 RARP, etc.) is not finished yet.
391 @retval EFI_INVALID_PARAMETER This is NULL.
392 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
393 @retval EFI_NOT_READY No incoming or outgoing data is processed.
394 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
395 Consider increasing the polling rate.
400 (EFIAPI
*EFI_IP4_POLL
) (
401 IN EFI_IP4_PROTOCOL
*This
405 struct _EFI_IP4_PROTOCOL
{
406 EFI_IP4_GET_MODE_DATA GetModeData
;
407 EFI_IP4_CONFIGURE Configure
;
408 EFI_IP4_GROUPS Groups
;
409 EFI_IP4_ROUTES Routes
;
410 EFI_IP4_TRANSMIT Transmit
;
411 EFI_IP4_RECEIVE Receive
;
412 EFI_IP4_CANCEL Cancel
;
416 extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid
;
417 extern EFI_GUID gEfiIp4ProtocolGuid
;