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, 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.
20 #ifndef __EFI_DHCP4_PROTOCOL_H__
21 #define __EFI_DHCP4_PROTOCOL_H__
23 #define EFI_DHCP4_PROTOCOL_GUID \
25 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \
28 #define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \
30 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \
33 typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL
;
41 } EFI_DHCP4_PACKET_OPTION
;
54 EFI_IPv4_ADDRESS ClientAddr
; //Client IP address from client
55 EFI_IPv4_ADDRESS YourAddr
; //Client IP address from server
56 EFI_IPv4_ADDRESS ServerAddr
; //IP address of next server in bootstrap
57 EFI_IPv4_ADDRESS GatewayAddr
; //Relay agent IP address
58 UINT8 ClientHwAddr
[16]; //Client hardware address
60 CHAR8 BootFileName
[128];
71 EFI_DHCP4_HEADER Header
;
83 Dhcp4Requesting
= 0x3,
87 Dhcp4InitReboot
= 0x7,
93 Dhcp4SendDiscover
= 0x01,
94 Dhcp4RcvdOffer
= 0x02,
95 Dhcp4SelectOffer
= 0x03,
96 Dhcp4SendRequest
= 0x04,
99 Dhcp4SendDecline
= 0x07,
100 Dhcp4BoundCompleted
= 0x08,
101 Dhcp4EnterRenewing
= 0x09,
102 Dhcp4EnterRebinding
= 0x0a,
103 Dhcp4AddressLost
= 0x0b,
110 @param This Pointer to the EFI DHCPv4 Protocol instance that is used to
111 configure this callback function.
112 @param Context Pointer to the context that is initialized by
113 EFI_DHCP4_PROTOCOL.Configure().
114 @param CurrentState The current operational state of the EFI DHCPv4 Protocol
116 @param Dhcp4Event The event that occurs in the current state, which usually means a
118 @param Packet The DHCP packet that is going to be sent or already received.
119 @param NewPacket The packet that is used to replace the above Packet.
121 @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.
122 @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol
123 driver will continue to wait for more DHCPOFFER packets until the retry
125 @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and
126 return to the Dhcp4Init or Dhcp4InitReboot state.
131 (EFIAPI
*EFI_DHCP4_CALLBACK
) (
132 IN EFI_DHCP4_PROTOCOL
*This
,
134 IN EFI_DHCP4_STATE CurrentState
,
135 IN EFI_DHCP4_EVENT Dhcp4Event
,
136 IN EFI_DHCP4_PACKET
*Packet OPTIONAL
,
137 OUT EFI_DHCP4_PACKET
**NewPacket OPTIONAL
142 UINT32 DiscoverTryCount
;
143 UINT32
*DiscoverTimeout
;
144 UINT32 RequestTryCount
;
145 UINT32
*RequestTimeout
;
146 EFI_IPv4_ADDRESS ClientAddress
;
147 EFI_DHCP4_CALLBACK Dhcp4Callback
;
148 void *CallbackContext
;
150 EFI_DHCP4_PACKET_OPTION
**OptionList
;
151 } EFI_DHCP4_CONFIG_DATA
;
155 EFI_DHCP4_STATE State
;
156 EFI_DHCP4_CONFIG_DATA ConfigData
;
157 EFI_IPv4_ADDRESS ClientAddress
;
158 EFI_MAC_ADDRESS ClientMacAddress
;
159 EFI_IPv4_ADDRESS ServerAddress
;
160 EFI_IPv4_ADDRESS RouterAddress
;
161 EFI_IPv4_ADDRESS SubnetMask
;
163 EFI_DHCP4_PACKET
*ReplyPacket
;
164 } EFI_DHCP4_MODE_DATA
;
168 EFI_IPv4_ADDRESS ListenAddress
;
169 EFI_IPv4_ADDRESS SubnetMask
;
171 } EFI_DHCP4_LISTEN_POINT
;
175 OUT EFI_STATUS Status
;
176 IN EFI_EVENT CompletionEvent
;
177 IN EFI_IPv4_ADDRESS RemoteAddress
;
178 IN UINT16 RemotePort
;
179 IN EFI_IPv4_ADDRESS GatewayAddress
;
180 IN UINT32 ListenPointCount
;
181 IN EFI_DHCP4_LISTEN_POINT
*ListenPoints
;
182 IN UINT32 TimeoutValue
;
183 IN EFI_DHCP4_PACKET
*Packet
;
184 OUT UINT32 ResponseCount
;
185 OUT EFI_DHCP4_PACKET
*ResponseList
;
186 } EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN
;
190 Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.
192 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
193 @param Dhcp4ModeData Pointer to storage for the EFI_DHCP4_MODE_DATA structure.
195 @retval EFI_SUCCESS The mode data was returned.
196 @retval EFI_INVALID_PARAMETER This is NULL.
201 (EFIAPI
*EFI_DHCP4_GET_MODE_DATA
)(
202 IN EFI_DHCP4_PROTOCOL
*This
,
203 OUT EFI_DHCP4_MODE_DATA
*Dhcp4ModeData
208 Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.
210 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
211 @param Dhcp4CfgData Pointer to the EFI_DHCP4_CONFIG_DATA.
213 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or
214 Dhcp4InitReboot state, if the original state of this driver
215 was Dhcp4Stopped and the value of Dhcp4CfgData was
216 not NULL. Otherwise, the state was left unchanged.
217 @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the
218 Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;
219 Or onother instance of this EFI DHCPv4 Protocol driver is already
220 in a valid configured state.
221 @retval EFI_INVALID_PARAMETER Some parameter is NULL.
222 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
223 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
228 (EFIAPI
*EFI_DHCP4_CONFIGURE
) (
229 IN EFI_DHCP4_PROTOCOL
*This
,
230 IN EFI_DHCP4_CONFIG_DATA
*Dhcp4CfgData OPTIONAL
236 Starts the DHCP configuration process.
238 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
239 @param CompletionEvent If not NULL, indicates the event that will be signaled when the
240 EFI DHCPv4 Protocol driver is transferred into the
241 Dhcp4Bound state or when the DHCP process is aborted.
242 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
243 check the completion status. If NULL,
244 EFI_DHCP4_PROTOCOL.Start() will wait until the driver
245 is transferred into the Dhcp4Bound state or the process fails.
247 @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed
248 when CompletionEvent is NULL.
249 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
250 state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.
251 @retval EFI_INVALID_PARAMETER This is NULL.
252 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
253 @retval EFI_TIMEOUT The DHCP configuration process failed because no response was
254 received from the server within the specified timeout value.
255 @retval EFI_ABORTED The user aborted the DHCP process.
256 @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the
258 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
263 (EFIAPI
*EFI_DHCP4_START
) (
264 IN EFI_DHCP4_PROTOCOL
*This
,
265 IN EFI_EVENT CompletionEvent OPTIONAL
270 Extends the lease time by sending a request packet.
272 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
273 @param RebindRequest If TRUE, this function broadcasts the request packets and enters
274 the Dhcp4Rebinding state. Otherwise, it sends a unicast
275 request packet and enters the Dhcp4Renewing state.
276 @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase
277 completes or some error occurs.
278 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
279 check the completion status. If NULL,
280 EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait
281 until the DHCP process finishes.
283 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the
284 Dhcp4Renewing state or is back to the Dhcp4Bound state.
285 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
286 state. EFI_DHCP4_PROTOCOL.Configure() needs to
288 @retval EFI_INVALID_PARAMETER This is NULL.
289 @retval EFI_TIMEOUT There was no response from the server when the try count was
291 @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state.
292 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
297 (EFIAPI
*EFI_DHCP4_RENEW_REBIND
) (
298 IN EFI_DHCP4_PROTOCOL
*This
,
299 IN BOOLEAN RebindRequest
,
300 IN EFI_EVENT CompletionEvent OPTIONAL
305 Releases the current address configuration.
307 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
309 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.
310 @retval EFI_INVALID_PARAMETER This is NULL.
311 @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.
312 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
317 (EFIAPI
*EFI_DHCP4_RELEASE
) (
318 IN EFI_DHCP4_PROTOCOL
*This
323 Stops the current address configuration.
325 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
327 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.
328 @retval EFI_INVALID_PARAMETER This is NULL.
333 (EFIAPI
*EFI_DHCP4_STOP
) (
334 IN EFI_DHCP4_PROTOCOL
*This
339 Builds a DHCP packet, given the options to be appended or deleted or replaced.
341 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
342 @param SeedPacket Initial packet to be used as a base for building new packet.
343 @param DeleteCount Number of opcodes in the DeleteList.
344 @param DeleteList List of opcodes to be deleted from the seed packet.
345 Ignored if DeleteCount is zero.
346 @param AppendCount Number of entries in the OptionList.
347 @param AppendList Pointer to a DHCP option list to be appended to SeedPacket.
348 If SeedPacket also contains options in this list, they are
349 replaced by new options (except pad option). Ignored if
350 AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION
351 @param NewPacket Pointer to storage for the pointer to the new allocated packet.
352 Use the EFI Boot Service FreePool() on the resulting pointer
353 when done with the packet.
355 @retval EFI_SUCCESS The new packet was built.
356 @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated.
357 @retval EFI_INVALID_PARAMETER Some parameter is NULL.
362 (EFIAPI
*EFI_DHCP4_BUILD
) (
363 IN EFI_DHCP4_PROTOCOL
*This
,
364 IN EFI_DHCP4_PACKET
*SeedPacket
,
365 IN UINT32 DeleteCount
,
366 IN UINT8
*DeleteList OPTIONAL
,
367 IN UINT32 AppendCount
,
368 IN EFI_DHCP4_PACKET_OPTION
*AppendList
[] OPTIONAL
,
369 OUT EFI_DHCP4_PACKET
**NewPacket
374 Transmits a DHCP formatted packet and optionally waits for responses.
376 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
377 @param Token Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.
379 @retval EFI_SUCCESS The packet was successfully queued for transmission.
380 @retval EFI_INVALID_PARAMETER Some parameter is NULL.
381 @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call
382 this function after collection process completes.
383 @retval EFI_NO_MAPPING The default station address is not available yet.
384 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
385 @retval Others Some other unexpected error occurred.
390 (EFIAPI
*EFI_DHCP4_TRANSMIT_RECEIVE
) (
391 IN EFI_DHCP4_PROTOCOL
*This
,
392 IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN
*Token
398 Parses the packed DHCP option data.
400 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
401 @param Packet Pointer to packet to be parsed.
402 @param OptionCount On input, the number of entries in the PacketOptionList.
403 On output, the number of entries that were written into the
405 @param PacketOptionList List of packet option entries to be filled in. End option or pad
406 options are not included.
408 @retval EFI_SUCCESS The packet was successfully parsed.
409 @retval EFI_INVALID_PARAMETER Some parameter is NULL.
410 @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE:
411 1) *OptionCount is smaller than the number of options that
412 were found in the Packet.
413 2) PacketOptionList is NULL.
418 (EFIAPI
*EFI_DHCP4_PARSE
) (
419 IN EFI_DHCP4_PROTOCOL
*This
,
420 IN EFI_DHCP4_PACKET
*Packet
,
421 IN OUT UINT32
*OptionCount
,
422 OUT EFI_DHCP4_PACKET_OPTION
*PacketOptionList
[] OPTIONAL
427 struct _EFI_DHCP4_PROTOCOL
{
428 EFI_DHCP4_GET_MODE_DATA GetModeData
;
429 EFI_DHCP4_CONFIGURE Configure
;
430 EFI_DHCP4_START Start
;
431 EFI_DHCP4_RENEW_REBIND RenewRebind
;
432 EFI_DHCP4_RELEASE Release
;
434 EFI_DHCP4_BUILD Build
;
435 EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive
;
436 EFI_DHCP4_PARSE Parse
;
439 extern EFI_GUID gEfiDhcp4ProtocolGuid
;
440 extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid
;