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_HANDLE InstanceHandle
;
32 EFI_IPv4_ADDRESS Ip4Address
;
33 EFI_IPv4_ADDRESS SubnetMask
;
34 } EFI_IP4_ADDRESS_PAIR
;
37 EFI_HANDLE DriverHandle
;
39 EFI_IP4_ADDRESS_PAIR AddressPairs
[1];
40 } EFI_IP4_VARIABLE_DATA
;
43 UINT8 DefaultProtocol
;
44 BOOLEAN AcceptAnyProtocol
;
45 BOOLEAN AcceptIcmpErrors
;
46 BOOLEAN AcceptBroadcast
;
47 BOOLEAN AcceptPromiscuous
;
48 BOOLEAN UseDefaultAddress
;
49 EFI_IPv4_ADDRESS StationAddress
;
50 EFI_IPv4_ADDRESS SubnetMask
;
53 BOOLEAN DoNotFragment
;
55 UINT32 ReceiveTimeout
;
56 UINT32 TransmitTimeout
;
57 } EFI_IP4_CONFIG_DATA
;
61 EFI_IPv4_ADDRESS SubnetAddress
;
62 EFI_IPv4_ADDRESS SubnetMask
;
63 EFI_IPv4_ADDRESS GatewayAddress
;
64 } EFI_IP4_ROUTE_TABLE
;
73 EFI_IP4_CONFIG_DATA ConfigData
;
76 EFI_IPv4_ADDRESS
*GroupTable
;
78 EFI_IP4_ROUTE_TABLE
*RouteTable
;
80 EFI_IP4_ICMP_TYPE
*IcmpTypeList
;
90 UINT16 Identification
;
95 EFI_IPv4_ADDRESS SourceAddress
;
96 EFI_IPv4_ADDRESS DestinationAddress
;
102 UINT32 FragmentLength
;
103 VOID
*FragmentBuffer
;
104 } EFI_IP4_FRAGMENT_DATA
;
109 EFI_EVENT RecycleSignal
;
111 EFI_IP4_HEADER
*Header
;
112 UINT32 OptionsLength
;
115 UINT32 FragmentCount
;
116 EFI_IP4_FRAGMENT_DATA FragmentTable
[1];
117 } EFI_IP4_RECEIVE_DATA
;
121 EFI_IPv4_ADDRESS SourceAddress
;
122 EFI_IPv4_ADDRESS GatewayAddress
;
126 BOOLEAN DoNotFragment
;
127 } EFI_IP4_OVERRIDE_DATA
;
130 EFI_IPv4_ADDRESS DestinationAddress
;
131 EFI_IP4_OVERRIDE_DATA
*OverrideData
; //OPTIONAL
132 UINT32 OptionsLength
; //OPTIONAL
133 VOID
*OptionsBuffer
; //OPTIONAL
134 UINT32 TotalDataLength
;
135 UINT32 FragmentCount
;
136 EFI_IP4_FRAGMENT_DATA FragmentTable
[1];
137 } EFI_IP4_TRANSMIT_DATA
;
143 EFI_IP4_RECEIVE_DATA
*RxData
;
144 EFI_IP4_TRANSMIT_DATA
*TxData
;
146 } EFI_IP4_COMPLETION_TOKEN
;
149 Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
151 @param This Pointer to the EFI_IP4_PROTOCOL instance.
152 @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure.
153 @param MnpConfigData Pointer to the managed network configuration data structure.
154 @param SnpData Pointer to the simple network mode data structure.
156 @retval EFI_SUCCESS The operation completed successfully.
157 @retval EFI_INVALID_PARAMETER This is NULL.
158 @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
163 (EFIAPI
*EFI_IP4_GET_MODE_DATA
) (
164 IN EFI_IP4_PROTOCOL
*This
,
165 OUT EFI_IP4_MODE_DATA
*Ip4ModeData OPTIONAL
,
166 OUT EFI_MANAGED_NETWORK_CONFIG_DATA
*MnpConfigData OPTIONAL
,
167 OUT EFI_SIMPLE_NETWORK_MODE
*SnpModeData OPTIONAL
172 Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
174 @param This Pointer to the EFI_IP4_PROTOCOL instance.
175 @param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.
177 @retval EFI_SUCCESS The driver instance was successfully opened.
178 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
179 RARP, etc.) is not finished yet.
180 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
181 @retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:
182 A configuration protocol (DHCP, BOOTP, RARP, etc.) could
183 not be located when clients choose to use the default IPv4
184 address. This EFI IPv4 Protocol implementation does not
185 support this requested filter or timeout setting.
186 @retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.
187 @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the
188 IPv4 address or subnet mask can be changed. The interface must
189 also be stopped when switching to/from raw packet mode.
190 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4
191 Protocol driver instance is not opened.
196 (EFIAPI
*EFI_IP4_CONFIGURE
) (
197 IN EFI_IP4_PROTOCOL
*This
,
198 IN EFI_IP4_CONFIG_DATA
*IpConfigData OPTIONAL
203 Joins and leaves multicast groups.
205 @param This Pointer to the EFI_IP4_PROTOCOL instance.
206 @param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
207 @param GroupAddress Pointer to the IPv4 multicast address.
209 @retval EFI_SUCCESS The operation completed successfully.
210 @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
212 - JoinFlag is TRUE and GroupAddress is NULL.
213 - GroupAddress is not NULL and *GroupAddress is
214 not a multicast IPv4 address.
215 @retval EFI_NOT_STARTED This instance has not been started.
216 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
217 RARP, etc.) is not finished yet.
218 @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
219 @retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.
220 @retval EFI_ALREADY_STARTED The group address is already in the group table (when
222 @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
223 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
228 (EFIAPI
*EFI_IP4_GROUPS
) (
229 IN EFI_IP4_PROTOCOL
*This
,
231 IN EFI_IPv4_ADDRESS
*GroupAddress OPTIONAL
236 Adds and deletes routing table entries.
238 @param This Pointer to the EFI_IP4_PROTOCOL instance.
239 @param DeleteRoute Set to TRUE to delete this route from the routing table. Set to
240 FALSE to add this route to the routing table. SubnetAddress
241 and SubnetMask are used as the key to each route entry.
242 @param SubnetAddress The address of the subnet that needs to be routed.
243 @param SubnetMask The subnet mask of SubnetAddress.
244 @param GatewayAddress The unicast gateway IPv4 address for this route.
246 @retval EFI_SUCCESS The operation completed successfully.
247 @retval EFI_NOT_STARTED The driver instance has not been started.
248 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
249 RARP, etc.) is not finished yet.
250 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
252 - SubnetAddress is NULL.
253 - SubnetMask is NULL.
254 - GatewayAddress is NULL.
255 - *SubnetAddress is not a valid subnet address.
256 - *SubnetMask is not a valid subnet mask.
257 - *GatewayAddress is not a valid unicast IPv4 address.
258 @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
259 @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
260 @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
261 DeleteRoute is FALSE).
266 (EFIAPI
*EFI_IP4_ROUTES
) (
267 IN EFI_IP4_PROTOCOL
*This
,
268 IN BOOLEAN DeleteRoute
,
269 IN EFI_IPv4_ADDRESS
*SubnetAddress
,
270 IN EFI_IPv4_ADDRESS
*SubnetMask
,
271 IN EFI_IPv4_ADDRESS
*GatewayAddress
276 Places outgoing data packets into the transmit queue.
278 @param This Pointer to the EFI_IP4_PROTOCOL instance.
279 @param Token Pointer to the transmit token.
281 @retval EFI_SUCCESS The data has been queued for transmission.
282 @retval EFI_NOT_STARTED This instance has not been started.
283 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
284 RARP, etc.) is not finished yet.
285 @retval EFI_INVALID_PARAMETER One or more pameters are invalid.
286 @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
287 was already in the transmit queue.
288 @retval EFI_NOT_READY The completion token could not be queued because the transmit
290 @retval EFI_NOT_FOUND Not route is found to destination address.
291 @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
292 @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
294 @retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is
295 greater than MTU (or greater than the maximum packet size if
296 Token.Packet.TxData.OverrideData.
297 DoNotFragment is TRUE.)
302 (EFIAPI
*EFI_IP4_TRANSMIT
) (
303 IN EFI_IP4_PROTOCOL
*This
,
304 IN EFI_IP4_COMPLETION_TOKEN
*Token
309 Places a receiving request into the receiving queue.
311 @param This Pointer to the EFI_IP4_PROTOCOL instance.
312 @param Token Pointer to a token that is associated with the receive data descriptor.
314 @retval EFI_SUCCESS The receive completion token was cached.
315 @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
316 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, RARP, etc.)
318 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
321 - Token.Event is NULL.
322 @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
323 resources (usually memory).
324 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
325 The EFI IPv4 Protocol instance has been reset to startup defaults.
326 EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already
327 in the receive queue.
328 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
329 @retval EFI_ICMP_ERROR An ICMP error packet was received.
334 (EFIAPI
*EFI_IP4_RECEIVE
) (
335 IN EFI_IP4_PROTOCOL
*This
,
336 IN EFI_IP4_COMPLETION_TOKEN
*Token
341 Abort an asynchronous transmit or receive request.
343 @param This Pointer to the EFI_IP4_PROTOCOL instance.
344 @param Token Pointer to a token that has been issued by
345 EFI_IP4_PROTOCOL.Transmit() or
346 EFI_IP4_PROTOCOL.Receive(). If NULL, all pending
347 tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is
348 defined in EFI_IP4_PROTOCOL.Transmit().
350 @retval EFI_SUCCESS The asynchronous I/O request was aborted and
351 Token.->Event was signaled. When Token is NULL, all
352 pending requests were aborted and their events were signaled.
353 @retval EFI_INVALID_PARAMETER This is NULL.
354 @retval EFI_NOT_STARTED This instance has not been started.
355 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
356 RARP, etc.) is not finished yet.
357 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
358 not found in the transmit or receive queue. It has either completed
359 or was not issued by Transmit() and Receive().
364 (EFIAPI
*EFI_IP4_CANCEL
) (
365 IN EFI_IP4_PROTOCOL
*This
,
366 IN EFI_IP4_COMPLETION_TOKEN
*Token OPTIONAL
371 Polls for incoming data packets and processes outgoing data packets.
373 @param This Pointer to the EFI_IP4_PROTOCOL instance.
375 @retval EFI_SUCCESS Incoming or outgoing data was processed.
376 @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
377 @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
378 RARP, etc.) is not finished yet.
379 @retval EFI_INVALID_PARAMETER This is NULL.
380 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
381 @retval EFI_NOT_READY No incoming or outgoing data is processed.
382 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
383 Consider increasing the polling rate.
388 (EFIAPI
*EFI_IP4_POLL
) (
389 IN EFI_IP4_PROTOCOL
*This
393 struct _EFI_IP4_PROTOCOL
{
394 EFI_IP4_GET_MODE_DATA GetModeData
;
395 EFI_IP4_CONFIGURE Configure
;
396 EFI_IP4_GROUPS Groups
;
397 EFI_IP4_ROUTES Routes
;
398 EFI_IP4_TRANSMIT Transmit
;
399 EFI_IP4_RECEIVE Receive
;
400 EFI_IP4_CANCEL Cancel
;
404 extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid
;
405 extern EFI_GUID gEfiIp4ProtocolGuid
;