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 #define EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID \
20 0xc51711e7, 0xb4bf, 0x404a, {0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } \
23 #define EFI_IP4_PROTOCOL_GUID \
25 0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \
28 typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL
;
31 EFI_IPv4_ADDRESS Ip4Address
;
32 EFI_IPv4_ADDRESS SubnetMask
;
33 } EFI_IP4_ADDRESS_PAIR
;
36 EFI_HANDLE DriverHandle
;
38 EFI_IP4_ADDRESS_PAIR AddressPairs
[1];
39 } EFI_IP4_VARIABLE_DATA
;
42 UINT8 DefaultProtocol
;
43 BOOLEAN AcceptAnyProtocol
;
44 BOOLEAN AcceptIcmpErrors
;
45 BOOLEAN AcceptBroadcast
;
46 BOOLEAN AcceptPromiscuous
;
47 BOOLEAN UseDefaultAddress
;
48 EFI_IPv4_ADDRESS StationAddress
;
49 EFI_IPv4_ADDRESS SubnetMask
;
52 BOOLEAN DoNotFragment
;
54 UINT32 ReceiveTimeout
;
55 UINT32 TransmitTimeout
;
56 } EFI_IP4_CONFIG_DATA
;
60 EFI_IPv4_ADDRESS SubnetAddress
;
61 EFI_IPv4_ADDRESS SubnetMask
;
62 EFI_IPv4_ADDRESS GatewayAddress
;
63 } EFI_IP4_ROUTE_TABLE
;
72 EFI_IP4_CONFIG_DATA ConfigData
;
75 EFI_IPv4_ADDRESS
*GroupTable
;
77 EFI_IP4_ROUTE_TABLE
*RouteTable
;
79 EFI_IP4_ICMP_TYPE
*IcmpTypeList
;
85 #ifdef EFI_NET_LITTLE_ENDIAN
94 UINT16 Identification
;
99 EFI_IPv4_ADDRESS SourceAddress
;
100 EFI_IPv4_ADDRESS DestinationAddress
;
106 UINT32 FragmentLength
;
107 VOID
*FragmentBuffer
;
108 } EFI_IP4_FRAGMENT_DATA
;
113 EFI_EVENT RecycleSignal
;
115 EFI_IP4_HEADER
*Header
;
116 UINT32 OptionsLength
;
119 UINT32 FragmentCount
;
120 EFI_IP4_FRAGMENT_DATA FragmentTable
[1];
121 } EFI_IP4_RECEIVE_DATA
;
125 EFI_IPv4_ADDRESS SourceAddress
;
126 EFI_IPv4_ADDRESS GatewayAddress
;
130 BOOLEAN DoNotFragment
;
131 } EFI_IP4_OVERRIDE_DATA
;
134 EFI_IPv4_ADDRESS DestinationAddress
;
135 EFI_IP4_OVERRIDE_DATA
*OverrideData
; //OPTIONAL
136 UINT32 OptionsLength
; //OPTIONAL
137 VOID
*OptionsBuffer
; //OPTIONAL
138 UINT32 TotalDataLength
;
139 UINT32 FragmentCount
;
140 EFI_IP4_FRAGMENT_DATA FragmentTable
[1];
141 } EFI_IP4_TRANSMIT_DATA
;
147 EFI_IP4_RECEIVE_DATA
*RxData
;
148 EFI_IP4_TRANSMIT_DATA
*TxData
;
150 } EFI_IP4_COMPLETION_TOKEN
;
153 Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
155 @param This Pointer to the EFI_IP4_PROTOCOL instance.
156 @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure.
157 @param MnpConfigData Pointer to the managed network configuration data structure.
158 @param SnpData Pointer to the simple network mode data structure.
160 @retval EFI_SUCCESS The operation completed successfully.
161 @retval EFI_INVALID_PARAMETER This is NULL.
162 @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
167 (EFIAPI
*EFI_IP4_GET_MODE_DATA
) (
168 IN EFI_IP4_PROTOCOL
*This
,
169 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
170 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
171 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
176 Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
178 @param This Pointer to the EFI_IP4_PROTOCOL instance.
179 @param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.
181 @retval EFI_SUCCESS The driver instance was successfully opened.
182 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
183 RARP, etc.) is not finished yet.
184 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
185 @retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:
186 A configuration protocol (DHCP, BOOTP, RARP, etc.) could
187 not be located when clients choose to use the default IPv4
188 address. This EFI IPv4 Protocol implementation does not
189 support this requested filter or timeout setting.
190 @retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.
191 @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the
192 IPv4 address or subnet mask can be changed. The interface must
193 also be stopped when switching to/from raw packet mode.
194 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4
195 Protocol driver instance is not opened.
200 (EFIAPI
*EFI_IP4_CONFIGURE
) (
201 IN EFI_IP4_PROTOCOL
*This
,
202 IN EFI_IP4_CONFIG_DATA
*IpConfigData OPTIONAL
207 Joins and leaves multicast groups.
209 @param This Pointer to the EFI_IP4_PROTOCOL instance.
210 @param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
211 @param GroupAddress Pointer to the IPv4 multicast address.
213 @retval EFI_SUCCESS The operation completed successfully.
214 @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
216 - JoinFlag is TRUE and GroupAddress is NULL.
217 - GroupAddress is not NULL and *GroupAddress is
218 not a multicast IPv4 address.
219 @retval EFI_NOT_STARTED This instance has not been started.
220 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
221 RARP, etc.) is not finished yet.
222 @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
223 @retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.
224 @retval EFI_ALREADY_STARTED The group address is already in the group table (when
226 @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
227 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
232 (EFIAPI
*EFI_IP4_GROUPS
) (
233 IN EFI_IP4_PROTOCOL
*This
,
235 IN EFI_IPv4_ADDRESS
*GroupAddress OPTIONAL
240 Adds and deletes routing table entries.
242 @param This Pointer to the EFI_IP4_PROTOCOL instance.
243 @param DeleteRoute Set to TRUE to delete this route from the routing table. Set to
244 FALSE to add this route to the routing table. SubnetAddress
245 and SubnetMask are used as the key to each route entry.
246 @param SubnetAddress The address of the subnet that needs to be routed.
247 @param SubnetMask The subnet mask of SubnetAddress.
248 @param GatewayAddress The unicast gateway IPv4 address for this route.
250 @retval EFI_SUCCESS The operation completed successfully.
251 @retval EFI_NOT_STARTED The driver instance has not been started.
252 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
253 RARP, etc.) is not finished yet.
254 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
256 - SubnetAddress is NULL.
257 - SubnetMask is NULL.
258 - GatewayAddress is NULL.
259 - *SubnetAddress is not a valid subnet address.
260 - *SubnetMask is not a valid subnet mask.
261 - *GatewayAddress is not a valid unicast IPv4 address.
262 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
263 @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
264 @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
265 DeleteRoute is FALSE).
270 (EFIAPI
*EFI_IP4_ROUTES
) (
271 IN EFI_IP4_PROTOCOL
*This
,
272 IN BOOLEAN DeleteRoute
,
273 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
274 IN EFI_IPv4_ADDRESS
*SubnetMask
,
275 IN EFI_IPv4_ADDRESS
*GatewayAddress
280 Places outgoing data packets into the transmit queue.
282 @param This Pointer to the EFI_IP4_PROTOCOL instance.
283 @param Token Pointer to the transmit token.
285 @retval EFI_SUCCESS The data has been queued for transmission.
286 @retval EFI_NOT_STARTED This instance has not been started.
287 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
288 RARP, etc.) is not finished yet.
289 @retval EFI_INVALID_PARAMETER One or more pameters are invalid.
290 @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
291 was already in the transmit queue.
292 @retval EFI_NOT_READY The completion token could not be queued because the transmit
294 @retval EFI_NOT_FOUND Not route is found to destination address.
295 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
296 @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
298 @retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is
299 greater than MTU (or greater than the maximum packet size if
300 Token.Packet.TxData.OverrideData.
301 DoNotFragment is TRUE.)
306 (EFIAPI
*EFI_IP4_TRANSMIT
) (
307 IN EFI_IP4_PROTOCOL
*This
,
308 IN EFI_IP4_COMPLETION_TOKEN
*Token
313 Places a receiving request into the receiving queue.
315 @param This Pointer to the EFI_IP4_PROTOCOL instance.
316 @param Token Pointer to a token that is associated with the receive data descriptor.
318 @retval EFI_SUCCESS The receive completion token was cached.
319 @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
320 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, RARP, etc.)
322 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
325 - Token.Event is NULL.
326 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
327 resources (usually memory).
328 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
329 The EFI IPv4 Protocol instance has been reset to startup defaults.
330 EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already
331 in the receive queue.
332 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
333 @retval EFI_ICMP_ERROR An ICMP error packet was received.
338 (EFIAPI
*EFI_IP4_RECEIVE
) (
339 IN EFI_IP4_PROTOCOL
*This
,
340 IN EFI_IP4_COMPLETION_TOKEN
*Token
345 Abort an asynchronous transmit or receive request.
347 @param This Pointer to the EFI_IP4_PROTOCOL instance.
348 @param Token Pointer to a token that has been issued by
349 EFI_IP4_PROTOCOL.Transmit() or
350 EFI_IP4_PROTOCOL.Receive(). If NULL, all pending
351 tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is
352 defined in EFI_IP4_PROTOCOL.Transmit().
354 @retval EFI_SUCCESS The asynchronous I/O request was aborted and
355 Token.->Event was signaled. When Token is NULL, all
356 pending requests were aborted and their events were signaled.
357 @retval EFI_INVALID_PARAMETER This is NULL.
358 @retval EFI_NOT_STARTED This instance has not been started.
359 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
360 RARP, etc.) is not finished yet.
361 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
362 not found in the transmit or receive queue. It has either completed
363 or was not issued by Transmit() and Receive().
368 (EFIAPI
*EFI_IP4_CANCEL
) (
369 IN EFI_IP4_PROTOCOL
*This
,
370 IN EFI_IP4_COMPLETION_TOKEN
*Token OPTIONAL
375 Polls for incoming data packets and processes outgoing data packets.
377 @param This Pointer to the EFI_IP4_PROTOCOL instance.
379 @retval EFI_SUCCESS Incoming or outgoing data was processed.
380 @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
381 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
382 RARP, etc.) is not finished yet.
383 @retval EFI_INVALID_PARAMETER This is NULL.
384 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
385 @retval EFI_NOT_READY No incoming or outgoing data is processed.
386 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
387 Consider increasing the polling rate.
392 (EFIAPI
*EFI_IP4_POLL
) (
393 IN EFI_IP4_PROTOCOL
*This
397 struct _EFI_IP4_PROTOCOL
{
398 EFI_IP4_GET_MODE_DATA GetModeData
;
399 EFI_IP4_CONFIGURE Configure
;
400 EFI_IP4_GROUPS Groups
;
401 EFI_IP4_ROUTES Routes
;
402 EFI_IP4_TRANSMIT Transmit
;
403 EFI_IP4_RECEIVE Receive
;
404 EFI_IP4_CANCEL Cancel
;
408 extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid
;
409 extern EFI_GUID gEfiIp4ProtocolGuid
;