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_IP4_PROTOCOL_H__
16 #define __EFI_IP4_PROTOCOL_H__
18 #include <Protocol/ManagedNetwork.h>
20 #define EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID \
22 0xc51711e7, 0xb4bf, 0x404a, {0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } \
25 #define EFI_IP4_PROTOCOL_GUID \
27 0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \
30 typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL
;
33 EFI_HANDLE InstanceHandle
;
34 EFI_IPv4_ADDRESS Ip4Address
;
35 EFI_IPv4_ADDRESS SubnetMask
;
36 } EFI_IP4_ADDRESS_PAIR
;
39 EFI_HANDLE DriverHandle
;
41 EFI_IP4_ADDRESS_PAIR AddressPairs
[1];
42 } EFI_IP4_VARIABLE_DATA
;
45 UINT8 DefaultProtocol
;
46 BOOLEAN AcceptAnyProtocol
;
47 BOOLEAN AcceptIcmpErrors
;
48 BOOLEAN AcceptBroadcast
;
49 BOOLEAN AcceptPromiscuous
;
50 BOOLEAN UseDefaultAddress
;
51 EFI_IPv4_ADDRESS StationAddress
;
52 EFI_IPv4_ADDRESS SubnetMask
;
55 BOOLEAN DoNotFragment
;
57 UINT32 ReceiveTimeout
;
58 UINT32 TransmitTimeout
;
59 } EFI_IP4_CONFIG_DATA
;
63 EFI_IPv4_ADDRESS SubnetAddress
;
64 EFI_IPv4_ADDRESS SubnetMask
;
65 EFI_IPv4_ADDRESS GatewayAddress
;
66 } EFI_IP4_ROUTE_TABLE
;
75 EFI_IP4_CONFIG_DATA ConfigData
;
78 EFI_IPv4_ADDRESS
*GroupTable
;
80 EFI_IP4_ROUTE_TABLE
*RouteTable
;
82 EFI_IP4_ICMP_TYPE
*IcmpTypeList
;
88 #ifdef EFI_NET_LITTLE_ENDIAN
97 UINT16 Identification
;
102 EFI_IPv4_ADDRESS SourceAddress
;
103 EFI_IPv4_ADDRESS DestinationAddress
;
109 UINT32 FragmentLength
;
110 VOID
*FragmentBuffer
;
111 } EFI_IP4_FRAGMENT_DATA
;
116 EFI_EVENT RecycleSignal
;
118 EFI_IP4_HEADER
*Header
;
119 UINT32 OptionsLength
;
122 UINT32 FragmentCount
;
123 EFI_IP4_FRAGMENT_DATA FragmentTable
[1];
124 } EFI_IP4_RECEIVE_DATA
;
128 EFI_IPv4_ADDRESS SourceAddress
;
129 EFI_IPv4_ADDRESS GatewayAddress
;
133 BOOLEAN DoNotFragment
;
134 } EFI_IP4_OVERRIDE_DATA
;
137 EFI_IPv4_ADDRESS DestinationAddress
;
138 EFI_IP4_OVERRIDE_DATA
*OverrideData
; //OPTIONAL
139 UINT32 OptionsLength
; //OPTIONAL
140 VOID
*OptionsBuffer
; //OPTIONAL
141 UINT32 TotalDataLength
;
142 UINT32 FragmentCount
;
143 EFI_IP4_FRAGMENT_DATA FragmentTable
[1];
144 } EFI_IP4_TRANSMIT_DATA
;
150 EFI_IP4_RECEIVE_DATA
*RxData
;
151 EFI_IP4_TRANSMIT_DATA
*TxData
;
153 } EFI_IP4_COMPLETION_TOKEN
;
156 Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
158 @param This Pointer to the EFI_IP4_PROTOCOL instance.
159 @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure.
160 @param MnpConfigData Pointer to the managed network configuration data structure.
161 @param SnpData Pointer to the simple network mode data structure.
163 @retval EFI_SUCCESS The operation completed successfully.
164 @retval EFI_INVALID_PARAMETER This is NULL.
165 @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
170 (EFIAPI
*EFI_IP4_GET_MODE_DATA
) (
171 IN CONST EFI_IP4_PROTOCOL
*This
,
172 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
173 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
174 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
179 Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
181 @param This Pointer to the EFI_IP4_PROTOCOL instance.
182 @param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.
184 @retval EFI_SUCCESS The driver instance was successfully opened.
185 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
186 RARP, etc.) is not finished yet.
187 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
188 @retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:
189 A configuration protocol (DHCP, BOOTP, RARP, etc.) could
190 not be located when clients choose to use the default IPv4
191 address. This EFI IPv4 Protocol implementation does not
192 support this requested filter or timeout setting.
193 @retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.
194 @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the
195 IPv4 address or subnet mask can be changed. The interface must
196 also be stopped when switching to/from raw packet mode.
197 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4
198 Protocol driver instance is not opened.
203 (EFIAPI
*EFI_IP4_CONFIGURE
) (
204 IN EFI_IP4_PROTOCOL
*This
,
205 IN EFI_IP4_CONFIG_DATA
*IpConfigData OPTIONAL
210 Joins and leaves multicast groups.
212 @param This Pointer to the EFI_IP4_PROTOCOL instance.
213 @param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
214 @param GroupAddress Pointer to the IPv4 multicast address.
216 @retval EFI_SUCCESS The operation completed successfully.
217 @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
219 - JoinFlag is TRUE and GroupAddress is NULL.
220 - GroupAddress is not NULL and *GroupAddress is
221 not a multicast IPv4 address.
222 @retval EFI_NOT_STARTED This instance has not been started.
223 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
224 RARP, etc.) is not finished yet.
225 @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
226 @retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.
227 @retval EFI_ALREADY_STARTED The group address is already in the group table (when
229 @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
230 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
235 (EFIAPI
*EFI_IP4_GROUPS
) (
236 IN EFI_IP4_PROTOCOL
*This
,
238 IN EFI_IPv4_ADDRESS
*GroupAddress OPTIONAL
243 Adds and deletes routing table entries.
245 @param This Pointer to the EFI_IP4_PROTOCOL instance.
246 @param DeleteRoute Set to TRUE to delete this route from the routing table. Set to
247 FALSE to add this route to the routing table. SubnetAddress
248 and SubnetMask are used as the key to each route entry.
249 @param SubnetAddress The address of the subnet that needs to be routed.
250 @param SubnetMask The subnet mask of SubnetAddress.
251 @param GatewayAddress The unicast gateway IPv4 address for this route.
253 @retval EFI_SUCCESS The operation completed successfully.
254 @retval EFI_NOT_STARTED The driver instance has not been started.
255 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
256 RARP, etc.) is not finished yet.
257 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
259 - SubnetAddress is NULL.
260 - SubnetMask is NULL.
261 - GatewayAddress is NULL.
262 - *SubnetAddress is not a valid subnet address.
263 - *SubnetMask is not a valid subnet mask.
264 - *GatewayAddress is not a valid unicast IPv4 address.
265 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
266 @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
267 @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
268 DeleteRoute is FALSE).
273 (EFIAPI
*EFI_IP4_ROUTES
) (
274 IN EFI_IP4_PROTOCOL
*This
,
275 IN BOOLEAN DeleteRoute
,
276 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
277 IN EFI_IPv4_ADDRESS
*SubnetMask
,
278 IN EFI_IPv4_ADDRESS
*GatewayAddress
283 Places outgoing data packets into the transmit queue.
285 @param This Pointer to the EFI_IP4_PROTOCOL instance.
286 @param Token Pointer to the transmit token.
288 @retval EFI_SUCCESS The data has been queued for transmission.
289 @retval EFI_NOT_STARTED This instance has not been started.
290 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
291 RARP, etc.) is not finished yet.
292 @retval EFI_INVALID_PARAMETER One or more pameters are invalid.
293 @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
294 was already in the transmit queue.
295 @retval EFI_NOT_READY The completion token could not be queued because the transmit
297 @retval EFI_NOT_FOUND Not route is found to destination address.
298 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
299 @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
301 @retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is
302 greater than MTU (or greater than the maximum packet size if
303 Token.Packet.TxData.OverrideData.
304 DoNotFragment is TRUE.)
309 (EFIAPI
*EFI_IP4_TRANSMIT
) (
310 IN EFI_IP4_PROTOCOL
*This
,
311 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
348 Abort an asynchronous transmit or receive request.
350 @param This Pointer to the EFI_IP4_PROTOCOL instance.
351 @param Token Pointer to a token that has been issued by
352 EFI_IP4_PROTOCOL.Transmit() or
353 EFI_IP4_PROTOCOL.Receive(). If NULL, all pending
354 tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is
355 defined in EFI_IP4_PROTOCOL.Transmit().
357 @retval EFI_SUCCESS The asynchronous I/O request was aborted and
358 Token.->Event was signaled. When Token is NULL, all
359 pending requests were aborted and their events were signaled.
360 @retval EFI_INVALID_PARAMETER This is NULL.
361 @retval EFI_NOT_STARTED This instance has not been started.
362 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
363 RARP, etc.) is not finished yet.
364 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
365 not found in the transmit or receive queue. It has either completed
366 or was not issued by Transmit() and Receive().
371 (EFIAPI
*EFI_IP4_CANCEL
) (
372 IN EFI_IP4_PROTOCOL
*This
,
373 IN EFI_IP4_COMPLETION_TOKEN
*Token OPTIONAL
378 Polls for incoming data packets and processes outgoing data packets.
380 @param This Pointer to the EFI_IP4_PROTOCOL instance.
382 @retval EFI_SUCCESS Incoming or outgoing data was processed.
383 @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
384 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
385 RARP, etc.) is not finished yet.
386 @retval EFI_INVALID_PARAMETER This is NULL.
387 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
388 @retval EFI_NOT_READY No incoming or outgoing data is processed.
389 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
390 Consider increasing the polling rate.
395 (EFIAPI
*EFI_IP4_POLL
) (
396 IN EFI_IP4_PROTOCOL
*This
400 struct _EFI_IP4_PROTOCOL
{
401 EFI_IP4_GET_MODE_DATA GetModeData
;
402 EFI_IP4_CONFIGURE Configure
;
403 EFI_IP4_GROUPS Groups
;
404 EFI_IP4_ROUTES Routes
;
405 EFI_IP4_TRANSMIT Transmit
;
406 EFI_IP4_RECEIVE Receive
;
407 EFI_IP4_CANCEL Cancel
;
411 extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid
;
412 extern EFI_GUID gEfiIp4ProtocolGuid
;