2 EFI_DHCP4_PROTOCOL as defined in UEFI 2.0.
3 EFI_DHCP4_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.
4 These protocols are used to collect configuration information for the EFI IPv4 Protocol
5 drivers and to provide DHCPv4 server and PXE boot server discovery services.
7 Copyright (c) 2006 - 2008, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef __EFI_DHCP4_PROTOCOL_H__
19 #define __EFI_DHCP4_PROTOCOL_H__
21 #define EFI_DHCP4_PROTOCOL_GUID \
23 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \
26 #define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \
28 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \
31 typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL
;
39 } EFI_DHCP4_PACKET_OPTION
;
52 EFI_IPv4_ADDRESS ClientAddr
; ///< Client IP address from client
53 EFI_IPv4_ADDRESS YourAddr
; ///< Client IP address from server
54 EFI_IPv4_ADDRESS ServerAddr
; ///< IP address of next server in bootstrap
55 EFI_IPv4_ADDRESS GatewayAddr
; ///< Relay agent IP address
56 UINT8 ClientHwAddr
[16]; ///< Client hardware address
58 CHAR8 BootFileName
[128];
69 EFI_DHCP4_HEADER Header
;
81 Dhcp4Requesting
= 0x3,
85 Dhcp4InitReboot
= 0x7,
91 Dhcp4SendDiscover
= 0x01,
92 Dhcp4RcvdOffer
= 0x02,
93 Dhcp4SelectOffer
= 0x03,
94 Dhcp4SendRequest
= 0x04,
97 Dhcp4SendDecline
= 0x07,
98 Dhcp4BoundCompleted
= 0x08,
99 Dhcp4EnterRenewing
= 0x09,
100 Dhcp4EnterRebinding
= 0x0a,
101 Dhcp4AddressLost
= 0x0b,
108 @param This Pointer to the EFI DHCPv4 Protocol instance that is used to
109 configure this callback function.
110 @param Context Pointer to the context that is initialized by
111 EFI_DHCP4_PROTOCOL.Configure().
112 @param CurrentState The current operational state of the EFI DHCPv4 Protocol
114 @param Dhcp4Event The event that occurs in the current state, which usually means a
116 @param Packet The DHCP packet that is going to be sent or already received.
117 @param NewPacket The packet that is used to replace the above Packet.
119 @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.
120 @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol
121 driver will continue to wait for more DHCPOFFER packets until the retry
123 @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and
124 return to the Dhcp4Init or Dhcp4InitReboot state.
129 (EFIAPI
*EFI_DHCP4_CALLBACK
)(
130 IN EFI_DHCP4_PROTOCOL
*This
,
132 IN EFI_DHCP4_STATE CurrentState
,
133 IN EFI_DHCP4_EVENT Dhcp4Event
,
134 IN EFI_DHCP4_PACKET
*Packet OPTIONAL
,
135 OUT EFI_DHCP4_PACKET
**NewPacket OPTIONAL
140 UINT32 DiscoverTryCount
;
141 UINT32
*DiscoverTimeout
;
142 UINT32 RequestTryCount
;
143 UINT32
*RequestTimeout
;
144 EFI_IPv4_ADDRESS ClientAddress
;
145 EFI_DHCP4_CALLBACK Dhcp4Callback
;
146 void *CallbackContext
;
148 EFI_DHCP4_PACKET_OPTION
**OptionList
;
149 } EFI_DHCP4_CONFIG_DATA
;
153 EFI_DHCP4_STATE State
;
154 EFI_DHCP4_CONFIG_DATA ConfigData
;
155 EFI_IPv4_ADDRESS ClientAddress
;
156 EFI_MAC_ADDRESS ClientMacAddress
;
157 EFI_IPv4_ADDRESS ServerAddress
;
158 EFI_IPv4_ADDRESS RouterAddress
;
159 EFI_IPv4_ADDRESS SubnetMask
;
161 EFI_DHCP4_PACKET
*ReplyPacket
;
162 } EFI_DHCP4_MODE_DATA
;
166 EFI_IPv4_ADDRESS ListenAddress
;
167 EFI_IPv4_ADDRESS SubnetMask
;
169 } EFI_DHCP4_LISTEN_POINT
;
174 EFI_EVENT CompletionEvent
;
175 EFI_IPv4_ADDRESS RemoteAddress
;
177 EFI_IPv4_ADDRESS GatewayAddress
;
178 UINT32 ListenPointCount
;
179 EFI_DHCP4_LISTEN_POINT
*ListenPoints
;
181 EFI_DHCP4_PACKET
*Packet
;
182 UINT32 ResponseCount
;
183 EFI_DHCP4_PACKET
*ResponseList
;
184 } EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN
;
188 Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.
190 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
191 @param Dhcp4ModeData Pointer to storage for the EFI_DHCP4_MODE_DATA structure.
193 @retval EFI_SUCCESS The mode data was returned.
194 @retval EFI_INVALID_PARAMETER This is NULL.
199 (EFIAPI
*EFI_DHCP4_GET_MODE_DATA
)(
200 IN EFI_DHCP4_PROTOCOL
*This
,
201 OUT EFI_DHCP4_MODE_DATA
*Dhcp4ModeData
205 Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.
207 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
208 @param Dhcp4CfgData Pointer to the EFI_DHCP4_CONFIG_DATA.
210 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or
211 Dhcp4InitReboot state, if the original state of this driver
212 was Dhcp4Stopped and the value of Dhcp4CfgData was
213 not NULL. Otherwise, the state was left unchanged.
214 @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the
215 Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;
216 Or onother instance of this EFI DHCPv4 Protocol driver is already
217 in a valid configured state.
218 @retval EFI_INVALID_PARAMETER Some parameter is NULL.
219 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
220 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
225 (EFIAPI
*EFI_DHCP4_CONFIGURE
)(
226 IN EFI_DHCP4_PROTOCOL
*This
,
227 IN EFI_DHCP4_CONFIG_DATA
*Dhcp4CfgData OPTIONAL
232 Starts the DHCP configuration process.
234 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
235 @param CompletionEvent If not NULL, indicates the event that will be signaled when the
236 EFI DHCPv4 Protocol driver is transferred into the
237 Dhcp4Bound state or when the DHCP process is aborted.
238 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
239 check the completion status. If NULL,
240 EFI_DHCP4_PROTOCOL.Start() will wait until the driver
241 is transferred into the Dhcp4Bound state or the process fails.
243 @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed
244 when CompletionEvent is NULL.
245 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
246 state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.
247 @retval EFI_INVALID_PARAMETER This is NULL.
248 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
249 @retval EFI_TIMEOUT The DHCP configuration process failed because no response was
250 received from the server within the specified timeout value.
251 @retval EFI_ABORTED The user aborted the DHCP process.
252 @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the
254 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
259 (EFIAPI
*EFI_DHCP4_START
)(
260 IN EFI_DHCP4_PROTOCOL
*This
,
261 IN EFI_EVENT CompletionEvent OPTIONAL
265 Extends the lease time by sending a request packet.
267 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
268 @param RebindRequest If TRUE, this function broadcasts the request packets and enters
269 the Dhcp4Rebinding state. Otherwise, it sends a unicast
270 request packet and enters the Dhcp4Renewing state.
271 @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase
272 completes or some error occurs.
273 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
274 check the completion status. If NULL,
275 EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait
276 until the DHCP process finishes.
278 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the
279 Dhcp4Renewing state or is back to the Dhcp4Bound state.
280 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
281 state. EFI_DHCP4_PROTOCOL.Configure() needs to
283 @retval EFI_INVALID_PARAMETER This is NULL.
284 @retval EFI_TIMEOUT There was no response from the server when the try count was
286 @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state.
287 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
292 (EFIAPI
*EFI_DHCP4_RENEW_REBIND
)(
293 IN EFI_DHCP4_PROTOCOL
*This
,
294 IN BOOLEAN RebindRequest
,
295 IN EFI_EVENT CompletionEvent OPTIONAL
299 Releases the current address configuration.
301 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
303 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.
304 @retval EFI_INVALID_PARAMETER This is NULL.
305 @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.
306 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
311 (EFIAPI
*EFI_DHCP4_RELEASE
)(
312 IN EFI_DHCP4_PROTOCOL
*This
316 Stops the current address configuration.
318 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
320 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.
321 @retval EFI_INVALID_PARAMETER This is NULL.
326 (EFIAPI
*EFI_DHCP4_STOP
)(
327 IN EFI_DHCP4_PROTOCOL
*This
331 Builds a DHCP packet, given the options to be appended or deleted or replaced.
333 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
334 @param SeedPacket Initial packet to be used as a base for building new packet.
335 @param DeleteCount Number of opcodes in the DeleteList.
336 @param DeleteList List of opcodes to be deleted from the seed packet.
337 Ignored if DeleteCount is zero.
338 @param AppendCount Number of entries in the OptionList.
339 @param AppendList Pointer to a DHCP option list to be appended to SeedPacket.
340 If SeedPacket also contains options in this list, they are
341 replaced by new options (except pad option). Ignored if
342 AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION
343 @param NewPacket Pointer to storage for the pointer to the new allocated packet.
344 Use the EFI Boot Service FreePool() on the resulting pointer
345 when done with the packet.
347 @retval EFI_SUCCESS The new packet was built.
348 @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated.
349 @retval EFI_INVALID_PARAMETER Some parameter is NULL.
354 (EFIAPI
*EFI_DHCP4_BUILD
)(
355 IN EFI_DHCP4_PROTOCOL
*This
,
356 IN EFI_DHCP4_PACKET
*SeedPacket
,
357 IN UINT32 DeleteCount
,
358 IN UINT8
*DeleteList OPTIONAL
,
359 IN UINT32 AppendCount
,
360 IN EFI_DHCP4_PACKET_OPTION
*AppendList
[] OPTIONAL
,
361 OUT EFI_DHCP4_PACKET
**NewPacket
364 Transmits a DHCP formatted packet and optionally waits for responses.
366 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
367 @param Token Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.
369 @retval EFI_SUCCESS The packet was successfully queued for transmission.
370 @retval EFI_INVALID_PARAMETER Some parameter is NULL.
371 @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call
372 this function after collection process completes.
373 @retval EFI_NO_MAPPING The default station address is not available yet.
374 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
375 @retval Others Some other unexpected error occurred.
380 (EFIAPI
*EFI_DHCP4_TRANSMIT_RECEIVE
)(
381 IN EFI_DHCP4_PROTOCOL
*This
,
382 IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN
*Token
387 Parses the packed DHCP option data.
389 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
390 @param Packet Pointer to packet to be parsed.
391 @param OptionCount On input, the number of entries in the PacketOptionList.
392 On output, the number of entries that were written into the
394 @param PacketOptionList List of packet option entries to be filled in. End option or pad
395 options are not included.
397 @retval EFI_SUCCESS The packet was successfully parsed.
398 @retval EFI_INVALID_PARAMETER Some parameter is NULL.
399 @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE:
400 1) *OptionCount is smaller than the number of options that
401 were found in the Packet.
402 2) PacketOptionList is NULL.
407 (EFIAPI
*EFI_DHCP4_PARSE
)(
408 IN EFI_DHCP4_PROTOCOL
*This
,
409 IN EFI_DHCP4_PACKET
*Packet
,
410 IN OUT UINT32
*OptionCount
,
411 OUT EFI_DHCP4_PACKET_OPTION
*PacketOptionList
[] OPTIONAL
415 @par Protocol Description:
416 This protocol is used to collect configuration information for the EFI IPv4 Protocol drivers
417 and to provide DHCPv4 server and PXE boot server discovery services.
419 struct _EFI_DHCP4_PROTOCOL
{
420 EFI_DHCP4_GET_MODE_DATA GetModeData
;
421 EFI_DHCP4_CONFIGURE Configure
;
422 EFI_DHCP4_START Start
;
423 EFI_DHCP4_RENEW_REBIND RenewRebind
;
424 EFI_DHCP4_RELEASE Release
;
426 EFI_DHCP4_BUILD Build
;
427 EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive
;
428 EFI_DHCP4_PARSE Parse
;
431 extern EFI_GUID gEfiDhcp4ProtocolGuid
;
432 extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid
;