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
;
41 /// Length of the DHCP option data. Not present if OpCode is 0 or 255.
45 /// Start of the DHCP option data. Not present if OpCode is 0 or 255 or if Length is zero.
48 } EFI_DHCP4_PACKET_OPTION
;
54 /// EFI_DHCP4_PACKET defines the format of DHCPv4 packets. See RFC 2131 for more information.
64 EFI_IPv4_ADDRESS ClientAddr
; ///< Client IP address from client
65 EFI_IPv4_ADDRESS YourAddr
; ///< Client IP address from server
66 EFI_IPv4_ADDRESS ServerAddr
; ///< IP address of next server in bootstrap
67 EFI_IPv4_ADDRESS GatewayAddr
; ///< Relay agent IP address
68 UINT8 ClientHwAddr
[16]; ///< Client hardware address
70 CHAR8 BootFileName
[128];
78 /// Size of the EFI_DHCP4_PACKET buffer.
82 /// Length of the EFI_DHCP4_PACKET from the first byte of the Header field
83 /// to the last byte of the Option[] field.
89 /// DHCP packet header.
91 EFI_DHCP4_HEADER Header
;
93 /// DHCP magik cookie in network byte order.
97 /// Start of the DHCP packed option data.
107 /// The EFI DHCPv4 Protocol driver is stopped
111 /// The EFI DHCPv4 Protocol driver is inactive
115 /// The EFI DHCPv4 Protocol driver is collecting DHCP offer packets from DHCP servers.
117 Dhcp4Selecting
= 0x2,
119 /// The EFI DHCPv4 Protocol driver has sent the request to the DHCP server and is waiting for a response.
121 Dhcp4Requesting
= 0x3,
123 /// The DHCP configuration has completed.
127 /// The DHCP configuration is being renewed and another request has
128 /// been sent out, but it has not received a response from the server yet.
132 /// The DHCP configuration has timed out and the EFI DHCPv4
133 /// Protocol driver is trying to extend the lease time.
135 Dhcp4Rebinding
= 0x6,
137 /// The EFI DHCPv4 Protocol driver is initialized with a previously
138 /// allocated or known IP address.
140 Dhcp4InitReboot
= 0x7,
142 /// The EFI DHCPv4 Protocol driver is seeking to reuse the previously
143 /// allocated IP address by sending a request to the DHCP server.
151 /// A DHCPDISCOVER packet is about to be sent.
153 Dhcp4SendDiscover
= 0x01,
155 /// A DHCPOFFER packet was just received.
157 Dhcp4RcvdOffer
= 0x02,
159 /// It is time for Dhcp4Callback to select an offer.
161 Dhcp4SelectOffer
= 0x03,
163 /// A request packet is about to be sent.
165 Dhcp4SendRequest
= 0x04,
167 /// A DHCPACK packet was received and will be passed to Dhcp4Callback.
171 /// A DHCPNAK packet was received and will be passed to Dhcp4Callback.
175 /// A decline packet is about to be sent.
177 Dhcp4SendDecline
= 0x07,
179 /// The DHCP configuration process has completed. No packet is associated with this event.
181 Dhcp4BoundCompleted
= 0x08,
183 /// It is time to enter the Dhcp4Renewing state and to contact the server
184 /// that originally issued the network address. No packet is associated with this event.
186 Dhcp4EnterRenewing
= 0x09,
188 /// It is time to enter the Dhcp4Rebinding state and to contact any server.
189 /// No packet is associated with this event.
191 Dhcp4EnterRebinding
= 0x0a,
193 /// The configured IP address was lost either because the lease has expired,
194 /// the user released the configuration, or a DHCPNAK packet was received in
195 /// the Dhcp4Renewing or Dhcp4Rebinding state. No packet is associated with this event.
197 Dhcp4AddressLost
= 0x0b,
199 /// The DHCP process failed because a DHCPNAK packet was received or the user
200 /// aborted the DHCP process at a time when the configuration was not available yet.
201 /// No packet is associated with this event.
209 EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver
210 to intercept events that occurred in the configuration process. This structure
211 provides advanced control of each state transition of the DHCP process. The
212 returned status code determines the behavior of the EFI DHCPv4 Protocol driver.
213 There are three possible returned values, which are described in the following
216 @param This Pointer to the EFI DHCPv4 Protocol instance that is used to
217 configure this callback function.
218 @param Context Pointer to the context that is initialized by
219 EFI_DHCP4_PROTOCOL.Configure().
220 @param CurrentState The current operational state of the EFI DHCPv4 Protocol
222 @param Dhcp4Event The event that occurs in the current state, which usually means a
224 @param Packet The DHCP packet that is going to be sent or already received.
225 @param NewPacket The packet that is used to replace the above Packet.
227 @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.
228 @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol
229 driver will continue to wait for more DHCPOFFER packets until the retry
231 @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and
232 return to the Dhcp4Init or Dhcp4InitReboot state.
237 (EFIAPI
*EFI_DHCP4_CALLBACK
)(
238 IN EFI_DHCP4_PROTOCOL
*This
,
240 IN EFI_DHCP4_STATE CurrentState
,
241 IN EFI_DHCP4_EVENT Dhcp4Event
,
242 IN EFI_DHCP4_PACKET
*Packet OPTIONAL
,
243 OUT EFI_DHCP4_PACKET
**NewPacket OPTIONAL
248 /// Number of times to try sending DHCPDISCOVER packets and
249 /// waiting for DHCPOFFER packets before accepting failure.
250 /// Set to zero to use the default try counts and timeout values.
252 UINT32 DiscoverTryCount
;
254 /// Maximum amount of time (in seconds) to wait for DHCPOFFER packets in each
255 /// of the retries. Timeout values of zero will default to a timeout value
256 /// of one second. Set to NULL to use default timeout values.
258 UINT32
*DiscoverTimeout
;
260 /// Number of times to try sending DHCPREQUEST packets and waiting for DHCPACK
261 /// packets before accepting failure. Set to zero to use the default try counts and timeout values.
263 UINT32 RequestTryCount
;
265 /// Maximum amount of time (in seconds) to wait for DHCPACK packets in each of the retries.
266 /// Timeout values of zero will default to a timeout value of one second.
267 /// Set to NULL to use default timeout values.
269 UINT32
*RequestTimeout
;
271 /// Setting this parameter to the previously allocated IP address will cause
272 /// the EFI DHCPv4 Protocol driver to enter the Dhcp4InitReboot state.
273 /// Set this field to 0.0.0.0 to enter the Dhcp4Init state.
275 EFI_IPv4_ADDRESS ClientAddress
;
277 /// The callback function to intercept various events that occurred in
278 /// the DHCP configuration process. Set to NULL to ignore all those events.
280 EFI_DHCP4_CALLBACK Dhcp4Callback
;
282 /// Pointer to the context that will be passed to Dhcp4Callback when it is called.
284 VOID
*CallbackContext
;
286 /// Number of DHCP options in the OptionList.
290 /// List of DHCP options to be included in every DHCPDISCOVER packet and
291 /// subsequent DHCPREQUEST packet that is generated from DHCPOFFER packets.
293 EFI_DHCP4_PACKET_OPTION
**OptionList
;
294 } EFI_DHCP4_CONFIG_DATA
;
299 /// The EFI DHCPv4 Protocol driver operating state.
301 EFI_DHCP4_STATE State
;
303 /// The configuration data of the current EFI DHCPv4 Protocol driver instance.
305 EFI_DHCP4_CONFIG_DATA ConfigData
;
307 /// The client IP address that was acquired from the DHCP server. If it is zero,
308 /// the DHCP acquisition has not completed yet and the following fields in this structure are undefined.
310 EFI_IPv4_ADDRESS ClientAddress
;
312 /// The local hardware address.
314 EFI_MAC_ADDRESS ClientMacAddress
;
316 /// The server IP address that is providing the DHCP service to this client.
318 EFI_IPv4_ADDRESS ServerAddress
;
320 /// The router IP address that was acquired from the DHCP server.
321 /// May be zero if the server does not offer this address.
323 EFI_IPv4_ADDRESS RouterAddress
;
325 /// The subnet mask of the connected network that was acquired from the DHCP server.
327 EFI_IPv4_ADDRESS SubnetMask
;
329 /// The lease time (in 1-second units) of the configured IP address.
330 /// The value 0xFFFFFFFF means that the lease time is infinite.
331 /// A default lease of 7 days is used if the DHCP server does not provide a value.
335 /// The cached latest DHCPACK or DHCPNAK or BOOTP REPLY packet. May be NULL if no packet is cached.
337 EFI_DHCP4_PACKET
*ReplyPacket
;
338 } EFI_DHCP4_MODE_DATA
;
343 /// Alternate listening address. It can be a unicast, multicast, or broadcast address.
345 EFI_IPv4_ADDRESS ListenAddress
;
347 /// The subnet mask of above listening unicast/broadcast IP address.
348 /// Ignored if ListenAddress is a multicast address.
350 EFI_IPv4_ADDRESS SubnetMask
;
352 /// Alternate station source (or listening) port number.
353 /// If zero, then the default station port number (68) will be used.
356 } EFI_DHCP4_LISTEN_POINT
;
361 /// The completion status of transmitting and receiving.
365 /// If not NULL, the event that will be signaled when the collection process
366 /// completes. If NULL, this function will busy-wait until the collection process competes.
368 EFI_EVENT CompletionEvent
;
370 /// Pointer to the server IP address. This address may be a unicast, multicast, or broadcast address.
372 EFI_IPv4_ADDRESS RemoteAddress
;
374 /// Server listening port number. If zero, the default server listening port number (67) will be used.
378 /// Pointer to the gateway address to override the existing setting.
380 EFI_IPv4_ADDRESS GatewayAddress
;
382 /// The number of entries in ListenPoints. If zero, the default station address and port number 68 are used.
384 UINT32 ListenPointCount
;
386 /// An array of station address and port number pairs that are used as receiving filters.
387 /// The first entry is also used as the source address and source port of the outgoing packet.
389 EFI_DHCP4_LISTEN_POINT
*ListenPoints
;
391 /// Number of seconds to collect responses. Zero is invalid.
395 /// Pointer to the packet to be transmitted.
397 EFI_DHCP4_PACKET
*Packet
;
399 /// Number of received packets.
401 UINT32 ResponseCount
;
403 /// Pointer to the allocated list of received packets.
405 EFI_DHCP4_PACKET
*ResponseList
;
406 } EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN
;
410 Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.
412 The GetModeData() function returns the current operating mode and cached data
413 packet for the EFI DHCPv4 Protocol driver.
415 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
416 @param Dhcp4ModeData Pointer to storage for the EFI_DHCP4_MODE_DATA structure.
418 @retval EFI_SUCCESS The mode data was returned.
419 @retval EFI_INVALID_PARAMETER This is NULL.
424 (EFIAPI
*EFI_DHCP4_GET_MODE_DATA
)(
425 IN EFI_DHCP4_PROTOCOL
*This
,
426 OUT EFI_DHCP4_MODE_DATA
*Dhcp4ModeData
430 Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.
432 The Configure() function is used to initialize, change, or reset the operational
433 settings of the EFI DHCPv4 Protocol driver for the communication device on which
434 the EFI DHCPv4 Service Binding Protocol is installed. This function can be
435 successfully called only if both of the following are true:
436 * This instance of the EFI DHCPv4 Protocol driver is in the Dhcp4Stopped, Dhcp4Init,
437 Dhcp4InitReboot, or Dhcp4Bound states.
438 * No other EFI DHCPv4 Protocol driver instance that is controlled by this EFI
439 DHCPv4 Service Binding Protocol driver instance has configured this EFI DHCPv4
441 When this driver is in the Dhcp4Stopped state, it can transfer into one of the
442 following two possible initial states:
445 The driver can transfer into these states by calling Configure() with a non-NULL
446 Dhcp4CfgData. The driver will transfer into the appropriate state based on the
447 supplied client network address in the ClientAddress parameter and DHCP options
448 in the OptionList parameter as described in RFC 2131.
449 When Configure() is called successfully while Dhcp4CfgData is set to NULL, the
450 default configuring data will be reset in the EFI DHCPv4 Protocol driver and
451 the state of the EFI DHCPv4 Protocol driver will not be changed. If one instance
452 wants to make it possible for another instance to configure the EFI DHCPv4 Protocol
453 driver, it must call this function with Dhcp4CfgData set to NULL.
455 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
456 @param Dhcp4CfgData Pointer to the EFI_DHCP4_CONFIG_DATA.
458 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or
459 Dhcp4InitReboot state, if the original state of this driver
460 was Dhcp4Stopped and the value of Dhcp4CfgData was
461 not NULL. Otherwise, the state was left unchanged.
462 @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the
463 Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;
464 Or onother instance of this EFI DHCPv4 Protocol driver is already
465 in a valid configured state.
466 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
468 DiscoverTryCount > 0 and DiscoverTimeout is NULL
469 RequestTryCount > 0 and RequestTimeout is NULL.
470 OptionCount >0 and OptionList is NULL.
471 ClientAddress is not a valid unicast address.
472 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
473 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
478 (EFIAPI
*EFI_DHCP4_CONFIGURE
)(
479 IN EFI_DHCP4_PROTOCOL
*This
,
480 IN EFI_DHCP4_CONFIG_DATA
*Dhcp4CfgData OPTIONAL
485 Starts the DHCP configuration process.
487 The Start() function starts the DHCP configuration process. This function can
488 be called only when the EFI DHCPv4 Protocol driver is in the Dhcp4Init or
489 Dhcp4InitReboot state.
490 If the DHCP process completes successfully, the state of the EFI DHCPv4 Protocol
491 driver will be transferred through Dhcp4Selecting and Dhcp4Requesting to the
492 Dhcp4Bound state. The CompletionEvent will then be signaled if it is not NULL.
493 If the process aborts, either by the user or by some unexpected network error,
494 the state is restored to the Dhcp4Init state. The Start() function can be called
495 again to restart the process.
496 Refer to RFC 2131 for precise state transitions during this process. At the
497 time when each event occurs in this process, the callback function that was set
498 by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this
499 opportunity to control the process.
501 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
502 @param CompletionEvent If not NULL, indicates the event that will be signaled when the
503 EFI DHCPv4 Protocol driver is transferred into the
504 Dhcp4Bound state or when the DHCP process is aborted.
505 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
506 check the completion status. If NULL,
507 EFI_DHCP4_PROTOCOL.Start() will wait until the driver
508 is transferred into the Dhcp4Bound state or the process fails.
510 @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed
511 when CompletionEvent is NULL.
512 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
513 state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.
514 @retval EFI_INVALID_PARAMETER This is NULL.
515 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
516 @retval EFI_TIMEOUT The DHCP configuration process failed because no response was
517 received from the server within the specified timeout value.
518 @retval EFI_ABORTED The user aborted the DHCP process.
519 @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the
521 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
526 (EFIAPI
*EFI_DHCP4_START
)(
527 IN EFI_DHCP4_PROTOCOL
*This
,
528 IN EFI_EVENT CompletionEvent OPTIONAL
532 Extends the lease time by sending a request packet.
534 The RenewRebind() function is used to manually extend the lease time when the
535 EFI DHCPv4 Protocol driver is in the Dhcp4Bound state and the lease time has
536 not expired yet. This function will send a request packet to the previously
537 found server (or to any server when RebindRequest is TRUE) and transfer the
538 state into the Dhcp4Renewing state (or Dhcp4Rebinding when RebindingRequest is
539 TRUE). When a response is received, the state is returned to Dhcp4Bound.
540 If no response is received before the try count is exceeded (the RequestTryCount
541 field that is specified in EFI_DHCP4_CONFIG_DATA) but before the lease time that
542 was issued by the previous server expires, the driver will return to the Dhcp4Bound
543 state and the previous configuration is restored. The outgoing and incoming packets
544 can be captured by the EFI_DHCP4_CALLBACK function.
546 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
547 @param RebindRequest If TRUE, this function broadcasts the request packets and enters
548 the Dhcp4Rebinding state. Otherwise, it sends a unicast
549 request packet and enters the Dhcp4Renewing state.
550 @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase
551 completes or some error occurs.
552 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
553 check the completion status. If NULL,
554 EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait
555 until the DHCP process finishes.
557 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the
558 Dhcp4Renewing state or is back to the Dhcp4Bound state.
559 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
560 state. EFI_DHCP4_PROTOCOL.Configure() needs to
562 @retval EFI_INVALID_PARAMETER This is NULL.
563 @retval EFI_TIMEOUT There was no response from the server when the try count was
565 @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state.
566 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
571 (EFIAPI
*EFI_DHCP4_RENEW_REBIND
)(
572 IN EFI_DHCP4_PROTOCOL
*This
,
573 IN BOOLEAN RebindRequest
,
574 IN EFI_EVENT CompletionEvent OPTIONAL
578 Releases the current address configuration.
580 The Release() function releases the current configured IP address by doing either
582 * Sending a DHCPRELEASE packet when the EFI DHCPv4 Protocol driver is in the
584 * Setting the previously assigned IP address that was provided with the
585 EFI_DHCP4_PROTOCOL.Configure() function to 0.0.0.0 when the driver is in
586 Dhcp4InitReboot state
587 After a successful call to this function, the EFI DHCPv4 Protocol driver returns
588 to the Dhcp4Init state and any subsequent incoming packets will be discarded silently.
590 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
592 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.
593 @retval EFI_INVALID_PARAMETER This is NULL.
594 @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.
595 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
600 (EFIAPI
*EFI_DHCP4_RELEASE
)(
601 IN EFI_DHCP4_PROTOCOL
*This
605 Stops the current address configuration.
607 The Stop() function is used to stop the DHCP configuration process. After this
608 function is called successfully, the EFI DHCPv4 Protocol driver is transferred
609 into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called
610 before DHCP configuration process can be started again. This function can be
611 called when the EFI DHCPv4 Protocol driver is in any state.
613 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
615 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.
616 @retval EFI_INVALID_PARAMETER This is NULL.
621 (EFIAPI
*EFI_DHCP4_STOP
)(
622 IN EFI_DHCP4_PROTOCOL
*This
626 Builds a DHCP packet, given the options to be appended or deleted or replaced.
628 The Build() function is used to assemble a new packet from the original packet
629 by replacing or deleting existing options or appending new options. This function
630 does not change any state of the EFI DHCPv4 Protocol driver and can be used at
633 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
634 @param SeedPacket Initial packet to be used as a base for building new packet.
635 @param DeleteCount Number of opcodes in the DeleteList.
636 @param DeleteList List of opcodes to be deleted from the seed packet.
637 Ignored if DeleteCount is zero.
638 @param AppendCount Number of entries in the OptionList.
639 @param AppendList Pointer to a DHCP option list to be appended to SeedPacket.
640 If SeedPacket also contains options in this list, they are
641 replaced by new options (except pad option). Ignored if
642 AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION
643 @param NewPacket Pointer to storage for the pointer to the new allocated packet.
644 Use the EFI Boot Service FreePool() on the resulting pointer
645 when done with the packet.
647 @retval EFI_SUCCESS The new packet was built.
648 @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated.
649 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
652 SeedPacket is not a well-formed DHCP packet.
653 AppendCount is not zero and AppendList is NULL.
654 DeleteCount is not zero and DeleteList is NULL.
656 Both DeleteCount and AppendCount are zero and
657 NewPacket is not NULL.
662 (EFIAPI
*EFI_DHCP4_BUILD
)(
663 IN EFI_DHCP4_PROTOCOL
*This
,
664 IN EFI_DHCP4_PACKET
*SeedPacket
,
665 IN UINT32 DeleteCount
,
666 IN UINT8
*DeleteList OPTIONAL
,
667 IN UINT32 AppendCount
,
668 IN EFI_DHCP4_PACKET_OPTION
*AppendList
[] OPTIONAL
,
669 OUT EFI_DHCP4_PACKET
**NewPacket
674 Transmits a DHCP formatted packet and optionally waits for responses.
676 The TransmitReceive() function is used to transmit a DHCP packet and optionally
677 wait for the response from servers. This function does not change the state of
678 the EFI DHCPv4 Protocol driver and thus can be used at any time.
680 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
681 @param Token Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.
683 @retval EFI_SUCCESS The packet was successfully queued for transmission.
684 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
686 Token.RemoteAddress is zero.
687 Token.Packet is NULL.
688 Token.Packet is not a well-formed DHCP packet.
689 The transaction ID in Token.Packet is in use by another DHCP process.
690 @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call
691 this function after collection process completes.
692 @retval EFI_NO_MAPPING The default station address is not available yet.
693 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
694 @retval EFI_UNSUPPORTED The implementation doesn't support this function
695 @retval Others Some other unexpected error occurred.
700 (EFIAPI
*EFI_DHCP4_TRANSMIT_RECEIVE
)(
701 IN EFI_DHCP4_PROTOCOL
*This
,
702 IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN
*Token
707 Parses the packed DHCP option data.
709 The Parse() function is used to retrieve the option list from a DHCP packet.
710 If *OptionCount isn't zero, and there is enough space for all the DHCP options
711 in the Packet, each element of PacketOptionList is set to point to somewhere in
712 the Packet->Dhcp4.Option where a new DHCP option begins. If RFC3396 is supported,
713 the caller should reassemble the parsed DHCP options to get the finial result.
714 If *OptionCount is zero or there isn't enough space for all of them, the number
715 of DHCP options in the Packet is returned in OptionCount.
717 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.
718 @param Packet Pointer to packet to be parsed.
719 @param OptionCount On input, the number of entries in the PacketOptionList.
720 On output, the number of entries that were written into the
722 @param PacketOptionList List of packet option entries to be filled in. End option or pad
723 options are not included.
725 @retval EFI_SUCCESS The packet was successfully parsed.
726 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
729 Packet is not a well-formed DHCP packet.
731 @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE:
732 1) *OptionCount is smaller than the number of options that
733 were found in the Packet.
734 2) PacketOptionList is NULL.
735 @retval EFI_OUT_OF_RESOURCE The packet is failed to parse because of resource shortage.
740 (EFIAPI
*EFI_DHCP4_PARSE
)(
741 IN EFI_DHCP4_PROTOCOL
*This
,
742 IN EFI_DHCP4_PACKET
*Packet
,
743 IN OUT UINT32
*OptionCount
,
744 OUT EFI_DHCP4_PACKET_OPTION
*PacketOptionList
[] OPTIONAL
748 /// This protocol is used to collect configuration information for the EFI IPv4 Protocol drivers
749 /// and to provide DHCPv4 server and PXE boot server discovery services.
751 struct _EFI_DHCP4_PROTOCOL
{
752 EFI_DHCP4_GET_MODE_DATA GetModeData
;
753 EFI_DHCP4_CONFIGURE Configure
;
754 EFI_DHCP4_START Start
;
755 EFI_DHCP4_RENEW_REBIND RenewRebind
;
756 EFI_DHCP4_RELEASE Release
;
758 EFI_DHCP4_BUILD Build
;
759 EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive
;
760 EFI_DHCP4_PARSE Parse
;
763 extern EFI_GUID gEfiDhcp4ProtocolGuid
;
764 extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid
;