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 - 2010, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 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.
16 @par Revision Reference:
17 This Protocol was introduced in UEFI Specification 2.0.
21 #ifndef __EFI_DHCP4_PROTOCOL_H__
22 #define __EFI_DHCP4_PROTOCOL_H__
24 FILE_LICENCE ( BSD3 );
26 #define EFI_DHCP4_PROTOCOL_GUID \
28 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \
31 #define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \
33 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \
36 typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL;
46 /// Length of the DHCP option data. Not present if OpCode is 0 or 255.
50 /// Start of the DHCP option data. Not present if OpCode is 0 or 255 or if Length is zero.
53 } EFI_DHCP4_PACKET_OPTION;
59 /// EFI_DHCP4_PACKET defines the format of DHCPv4 packets. See RFC 2131 for more information.
69 EFI_IPv4_ADDRESS ClientAddr; ///< Client IP address from client.
70 EFI_IPv4_ADDRESS YourAddr; ///< Client IP address from server.
71 EFI_IPv4_ADDRESS ServerAddr; ///< IP address of next server in bootstrap.
72 EFI_IPv4_ADDRESS GatewayAddr; ///< Relay agent IP address.
73 UINT8 ClientHwAddr[16]; ///< Client hardware address.
75 CHAR8 BootFileName[128];
83 /// Size of the EFI_DHCP4_PACKET buffer.
87 /// Length of the EFI_DHCP4_PACKET from the first byte of the Header field
88 /// to the last byte of the Option[] field.
94 /// DHCP packet header.
96 EFI_DHCP4_HEADER Header;
98 /// DHCP magik cookie in network byte order.
102 /// Start of the DHCP packed option data.
112 /// The EFI DHCPv4 Protocol driver is stopped.
116 /// The EFI DHCPv4 Protocol driver is inactive.
120 /// The EFI DHCPv4 Protocol driver is collecting DHCP offer packets from DHCP servers.
122 Dhcp4Selecting = 0x2,
124 /// The EFI DHCPv4 Protocol driver has sent the request to the DHCP server and is waiting for a response.
126 Dhcp4Requesting = 0x3,
128 /// The DHCP configuration has completed.
132 /// The DHCP configuration is being renewed and another request has
133 /// been sent out, but it has not received a response from the server yet.
137 /// The DHCP configuration has timed out and the EFI DHCPv4
138 /// Protocol driver is trying to extend the lease time.
140 Dhcp4Rebinding = 0x6,
142 /// The EFI DHCPv4 Protocol driver was initialized with a previously
143 /// allocated or known IP address.
145 Dhcp4InitReboot = 0x7,
147 /// The EFI DHCPv4 Protocol driver is seeking to reuse the previously
148 /// allocated IP address by sending a request to the DHCP server.
156 /// The packet to start the configuration sequence is about to be sent.
158 Dhcp4SendDiscover = 0x01,
160 /// A reply packet was just received.
162 Dhcp4RcvdOffer = 0x02,
164 /// It is time for Dhcp4Callback to select an offer.
166 Dhcp4SelectOffer = 0x03,
168 /// A request packet is about to be sent.
170 Dhcp4SendRequest = 0x04,
172 /// A DHCPACK packet was received and will be passed to Dhcp4Callback.
176 /// A DHCPNAK packet was received and will be passed to Dhcp4Callback.
180 /// A decline packet is about to be sent.
182 Dhcp4SendDecline = 0x07,
184 /// The DHCP configuration process has completed. No packet is associated with this event.
186 Dhcp4BoundCompleted = 0x08,
188 /// It is time to enter the Dhcp4Renewing state and to contact the server
189 /// that originally issued the network address. No packet is associated with this event.
191 Dhcp4EnterRenewing = 0x09,
193 /// It is time to enter the Dhcp4Rebinding state and to contact any server.
194 /// No packet is associated with this event.
196 Dhcp4EnterRebinding = 0x0a,
198 /// The configured IP address was lost either because the lease has expired,
199 /// the user released the configuration, or a DHCPNAK packet was received in
200 /// the Dhcp4Renewing or Dhcp4Rebinding state. No packet is associated with this event.
202 Dhcp4AddressLost = 0x0b,
204 /// The DHCP process failed because a DHCPNAK packet was received or the user
205 /// aborted the DHCP process at a time when the configuration was not available yet.
206 /// No packet is associated with this event.
214 EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver
215 to intercept events that occurred in the configuration process. This structure
216 provides advanced control of each state transition of the DHCP process. The
217 returned status code determines the behavior of the EFI DHCPv4 Protocol driver.
218 There are three possible returned values, which are described in the following
221 @param This The pointer to the EFI DHCPv4 Protocol instance that is used to
222 configure this callback function.
223 @param Context The pointer to the context that is initialized by
224 EFI_DHCP4_PROTOCOL.Configure().
225 @param CurrentState The current operational state of the EFI DHCPv4 Protocol
227 @param Dhcp4Event The event that occurs in the current state, which usually means a
229 @param Packet The DHCP packet that is going to be sent or already received.
230 @param NewPacket The packet that is used to replace the above Packet.
232 @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.
233 When it is in the Dhcp4Selecting state, it tells the EFI DHCPv4 Protocol
234 driver to stop collecting additional packets. The driver will exit
235 the Dhcp4Selecting state and enter the Dhcp4Requesting state.
236 @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol
237 driver will continue to wait for more packets until the retry
239 @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and
240 return to the Dhcp4Init or Dhcp4InitReboot state.
245 (EFIAPI *EFI_DHCP4_CALLBACK)(
246 IN EFI_DHCP4_PROTOCOL *This,
248 IN EFI_DHCP4_STATE CurrentState,
249 IN EFI_DHCP4_EVENT Dhcp4Event,
250 IN EFI_DHCP4_PACKET *Packet OPTIONAL,
251 OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL
256 /// The number of times to try sending a packet during the Dhcp4SendDiscover
257 /// event and waiting for a response during the Dhcp4RcvdOffer event.
258 /// Set to zero to use the default try counts and timeout values.
260 UINT32 DiscoverTryCount;
262 /// The maximum amount of time (in seconds) to wait for returned packets in each
263 /// of the retries. Timeout values of zero will default to a timeout value
264 /// of one second. Set to NULL to use default timeout values.
266 UINT32 *DiscoverTimeout;
268 /// The number of times to try sending a packet during the Dhcp4SendRequest event
269 /// and waiting for a response during the Dhcp4RcvdAck event before accepting
270 /// failure. Set to zero to use the default try counts and timeout values.
272 UINT32 RequestTryCount;
274 /// The maximum amount of time (in seconds) to wait for return packets in each of the retries.
275 /// Timeout values of zero will default to a timeout value of one second.
276 /// Set to NULL to use default timeout values.
278 UINT32 *RequestTimeout;
280 /// For a DHCPDISCOVER, setting this parameter to the previously allocated IP
281 /// address will cause the EFI DHCPv4 Protocol driver to enter the Dhcp4InitReboot state.
282 /// And set this field to 0.0.0.0 to enter the Dhcp4Init state.
283 /// For a DHCPINFORM this parameter should be set to the client network address
284 /// which was assigned to the client during a DHCPDISCOVER.
286 EFI_IPv4_ADDRESS ClientAddress;
288 /// The callback function to intercept various events that occurred in
289 /// the DHCP configuration process. Set to NULL to ignore all those events.
291 EFI_DHCP4_CALLBACK Dhcp4Callback;
293 /// The pointer to the context that will be passed to Dhcp4Callback when it is called.
295 VOID *CallbackContext;
297 /// Number of DHCP options in the OptionList.
301 /// List of DHCP options to be included in every packet that is sent during the
302 /// Dhcp4SendDiscover event. Pad options are appended automatically by DHCP driver
303 /// in outgoing DHCP packets. If OptionList itself contains pad option, they are
304 /// ignored by the driver. OptionList can be freed after EFI_DHCP4_PROTOCOL.Configure()
305 /// returns. Ignored if OptionCount is zero.
307 EFI_DHCP4_PACKET_OPTION **OptionList;
308 } EFI_DHCP4_CONFIG_DATA;
313 /// The EFI DHCPv4 Protocol driver operating state.
315 EFI_DHCP4_STATE State;
317 /// The configuration data of the current EFI DHCPv4 Protocol driver instance.
319 EFI_DHCP4_CONFIG_DATA ConfigData;
321 /// The client IP address that was acquired from the DHCP server. If it is zero,
322 /// the DHCP acquisition has not completed yet and the following fields in this structure are undefined.
324 EFI_IPv4_ADDRESS ClientAddress;
326 /// The local hardware address.
328 EFI_MAC_ADDRESS ClientMacAddress;
330 /// The server IP address that is providing the DHCP service to this client.
332 EFI_IPv4_ADDRESS ServerAddress;
334 /// The router IP address that was acquired from the DHCP server.
335 /// May be zero if the server does not offer this address.
337 EFI_IPv4_ADDRESS RouterAddress;
339 /// The subnet mask of the connected network that was acquired from the DHCP server.
341 EFI_IPv4_ADDRESS SubnetMask;
343 /// The lease time (in 1-second units) of the configured IP address.
344 /// The value 0xFFFFFFFF means that the lease time is infinite.
345 /// A default lease of 7 days is used if the DHCP server does not provide a value.
349 /// The cached latest DHCPACK or DHCPNAK or BOOTP REPLY packet. May be NULL if no packet is cached.
351 EFI_DHCP4_PACKET *ReplyPacket;
352 } EFI_DHCP4_MODE_DATA;
357 /// Alternate listening address. It can be a unicast, multicast, or broadcast address.
359 EFI_IPv4_ADDRESS ListenAddress;
361 /// The subnet mask of above listening unicast/broadcast IP address.
362 /// Ignored if ListenAddress is a multicast address.
364 EFI_IPv4_ADDRESS SubnetMask;
366 /// Alternate station source (or listening) port number.
367 /// If zero, then the default station port number (68) will be used.
370 } EFI_DHCP4_LISTEN_POINT;
375 /// The completion status of transmitting and receiving.
379 /// If not NULL, the event that will be signaled when the collection process
380 /// completes. If NULL, this function will busy-wait until the collection process competes.
382 EFI_EVENT CompletionEvent;
384 /// The pointer to the server IP address. This address may be a unicast, multicast, or broadcast address.
386 EFI_IPv4_ADDRESS RemoteAddress;
388 /// The server listening port number. If zero, the default server listening port number (67) will be used.
392 /// The pointer to the gateway address to override the existing setting.
394 EFI_IPv4_ADDRESS GatewayAddress;
396 /// The number of entries in ListenPoints. If zero, the default station address and port number 68 are used.
398 UINT32 ListenPointCount;
400 /// An array of station address and port number pairs that are used as receiving filters.
401 /// The first entry is also used as the source address and source port of the outgoing packet.
403 EFI_DHCP4_LISTEN_POINT *ListenPoints;
405 /// The number of seconds to collect responses. Zero is invalid.
409 /// The pointer to the packet to be transmitted.
411 EFI_DHCP4_PACKET *Packet;
413 /// Number of received packets.
415 UINT32 ResponseCount;
417 /// The pointer to the allocated list of received packets.
419 EFI_DHCP4_PACKET *ResponseList;
420 } EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN;
424 Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.
426 The GetModeData() function returns the current operating mode and cached data
427 packet for the EFI DHCPv4 Protocol driver.
429 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
430 @param Dhcp4ModeData The pointer to storage for the EFI_DHCP4_MODE_DATA structure.
432 @retval EFI_SUCCESS The mode data was returned.
433 @retval EFI_INVALID_PARAMETER This is NULL.
438 (EFIAPI *EFI_DHCP4_GET_MODE_DATA)(
439 IN EFI_DHCP4_PROTOCOL *This,
440 OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData
444 Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.
446 The Configure() function is used to initialize, change, or reset the operational
447 settings of the EFI DHCPv4 Protocol driver for the communication device on which
448 the EFI DHCPv4 Service Binding Protocol is installed. This function can be
449 successfully called only if both of the following are true:
450 * This instance of the EFI DHCPv4 Protocol driver is in the Dhcp4Stopped, Dhcp4Init,
451 Dhcp4InitReboot, or Dhcp4Bound states.
452 * No other EFI DHCPv4 Protocol driver instance that is controlled by this EFI
453 DHCPv4 Service Binding Protocol driver instance has configured this EFI DHCPv4
455 When this driver is in the Dhcp4Stopped state, it can transfer into one of the
456 following two possible initial states:
459 The driver can transfer into these states by calling Configure() with a non-NULL
460 Dhcp4CfgData. The driver will transfer into the appropriate state based on the
461 supplied client network address in the ClientAddress parameter and DHCP options
462 in the OptionList parameter as described in RFC 2131.
463 When Configure() is called successfully while Dhcp4CfgData is set to NULL, the
464 default configuring data will be reset in the EFI DHCPv4 Protocol driver and
465 the state of the EFI DHCPv4 Protocol driver will not be changed. If one instance
466 wants to make it possible for another instance to configure the EFI DHCPv4 Protocol
467 driver, it must call this function with Dhcp4CfgData set to NULL.
469 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
470 @param Dhcp4CfgData The pointer to the EFI_DHCP4_CONFIG_DATA.
472 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or
473 Dhcp4InitReboot state, if the original state of this driver
474 was Dhcp4Stopped, Dhcp4Init,Dhcp4InitReboot, or Dhcp4Bound
475 and the value of Dhcp4CfgData was not NULL.
476 Otherwise, the state was left unchanged.
477 @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the
478 Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;
479 Or onother instance of this EFI DHCPv4 Protocol driver is already
480 in a valid configured state.
481 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
483 DiscoverTryCount > 0 and DiscoverTimeout is NULL
484 RequestTryCount > 0 and RequestTimeout is NULL.
485 OptionCount >0 and OptionList is NULL.
486 ClientAddress is not a valid unicast address.
487 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
488 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
493 (EFIAPI *EFI_DHCP4_CONFIGURE)(
494 IN EFI_DHCP4_PROTOCOL *This,
495 IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL
500 Starts the DHCP configuration process.
502 The Start() function starts the DHCP configuration process. This function can
503 be called only when the EFI DHCPv4 Protocol driver is in the Dhcp4Init or
504 Dhcp4InitReboot state.
505 If the DHCP process completes successfully, the state of the EFI DHCPv4 Protocol
506 driver will be transferred through Dhcp4Selecting and Dhcp4Requesting to the
507 Dhcp4Bound state. The CompletionEvent will then be signaled if it is not NULL.
508 If the process aborts, either by the user or by some unexpected network error,
509 the state is restored to the Dhcp4Init state. The Start() function can be called
510 again to restart the process.
511 Refer to RFC 2131 for precise state transitions during this process. At the
512 time when each event occurs in this process, the callback function that was set
513 by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this
514 opportunity to control the process.
516 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
517 @param CompletionEvent If not NULL, it indicates the event that will be signaled when the
518 EFI DHCPv4 Protocol driver is transferred into the
519 Dhcp4Bound state or when the DHCP process is aborted.
520 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
521 check the completion status. If NULL,
522 EFI_DHCP4_PROTOCOL.Start() will wait until the driver
523 is transferred into the Dhcp4Bound state or the process fails.
525 @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed
526 when CompletionEvent is NULL.
527 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
528 state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.
529 @retval EFI_INVALID_PARAMETER This is NULL.
530 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
531 @retval EFI_TIMEOUT The DHCP configuration process failed because no response was
532 received from the server within the specified timeout value.
533 @retval EFI_ABORTED The user aborted the DHCP process.
534 @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the
536 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
537 @retval EFI_NO_MEDIA There was a media error.
542 (EFIAPI *EFI_DHCP4_START)(
543 IN EFI_DHCP4_PROTOCOL *This,
544 IN EFI_EVENT CompletionEvent OPTIONAL
548 Extends the lease time by sending a request packet.
550 The RenewRebind() function is used to manually extend the lease time when the
551 EFI DHCPv4 Protocol driver is in the Dhcp4Bound state, and the lease time has
552 not expired yet. This function will send a request packet to the previously
553 found server (or to any server when RebindRequest is TRUE) and transfer the
554 state into the Dhcp4Renewing state (or Dhcp4Rebinding when RebindingRequest is
555 TRUE). When a response is received, the state is returned to Dhcp4Bound.
556 If no response is received before the try count is exceeded (the RequestTryCount
557 field that is specified in EFI_DHCP4_CONFIG_DATA) but before the lease time that
558 was issued by the previous server expires, the driver will return to the Dhcp4Bound
559 state, and the previous configuration is restored. The outgoing and incoming packets
560 can be captured by the EFI_DHCP4_CALLBACK function.
562 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
563 @param RebindRequest If TRUE, this function broadcasts the request packets and enters
564 the Dhcp4Rebinding state. Otherwise, it sends a unicast
565 request packet and enters the Dhcp4Renewing state.
566 @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase
567 completes or some error occurs.
568 EFI_DHCP4_PROTOCOL.GetModeData() can be called to
569 check the completion status. If NULL,
570 EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait
571 until the DHCP process finishes.
573 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the
574 Dhcp4Renewing state or is back to the Dhcp4Bound state.
575 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped
576 state. EFI_DHCP4_PROTOCOL.Configure() needs to
578 @retval EFI_INVALID_PARAMETER This is NULL.
579 @retval EFI_TIMEOUT There was no response from the server when the try count was
581 @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state.
582 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
587 (EFIAPI *EFI_DHCP4_RENEW_REBIND)(
588 IN EFI_DHCP4_PROTOCOL *This,
589 IN BOOLEAN RebindRequest,
590 IN EFI_EVENT CompletionEvent OPTIONAL
594 Releases the current address configuration.
596 The Release() function releases the current configured IP address by doing either
598 * Sending a DHCPRELEASE packet when the EFI DHCPv4 Protocol driver is in the
600 * Setting the previously assigned IP address that was provided with the
601 EFI_DHCP4_PROTOCOL.Configure() function to 0.0.0.0 when the driver is in
602 Dhcp4InitReboot state
603 After a successful call to this function, the EFI DHCPv4 Protocol driver returns
604 to the Dhcp4Init state, and any subsequent incoming packets will be discarded silently.
606 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
608 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.
609 @retval EFI_INVALID_PARAMETER This is NULL.
610 @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.
611 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
616 (EFIAPI *EFI_DHCP4_RELEASE)(
617 IN EFI_DHCP4_PROTOCOL *This
621 Stops the current address configuration.
623 The Stop() function is used to stop the DHCP configuration process. After this
624 function is called successfully, the EFI DHCPv4 Protocol driver is transferred
625 into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called
626 before DHCP configuration process can be started again. This function can be
627 called when the EFI DHCPv4 Protocol driver is in any state.
629 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
631 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.
632 @retval EFI_INVALID_PARAMETER This is NULL.
637 (EFIAPI *EFI_DHCP4_STOP)(
638 IN EFI_DHCP4_PROTOCOL *This
642 Builds a DHCP packet, given the options to be appended or deleted or replaced.
644 The Build() function is used to assemble a new packet from the original packet
645 by replacing or deleting existing options or appending new options. This function
646 does not change any state of the EFI DHCPv4 Protocol driver and can be used at
649 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
650 @param SeedPacket Initial packet to be used as a base for building new packet.
651 @param DeleteCount Number of opcodes in the DeleteList.
652 @param DeleteList List of opcodes to be deleted from the seed packet.
653 Ignored if DeleteCount is zero.
654 @param AppendCount Number of entries in the OptionList.
655 @param AppendList The pointer to a DHCP option list to be appended to SeedPacket.
656 If SeedPacket also contains options in this list, they are
657 replaced by new options (except pad option). Ignored if
658 AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION
659 @param NewPacket The pointer to storage for the pointer to the new allocated packet.
660 Use the EFI Boot Service FreePool() on the resulting pointer
661 when done with the packet.
663 @retval EFI_SUCCESS The new packet was built.
664 @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated.
665 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
668 SeedPacket is not a well-formed DHCP packet.
669 AppendCount is not zero and AppendList is NULL.
670 DeleteCount is not zero and DeleteList is NULL.
672 Both DeleteCount and AppendCount are zero and
673 NewPacket is not NULL.
678 (EFIAPI *EFI_DHCP4_BUILD)(
679 IN EFI_DHCP4_PROTOCOL *This,
680 IN EFI_DHCP4_PACKET *SeedPacket,
681 IN UINT32 DeleteCount,
682 IN UINT8 *DeleteList OPTIONAL,
683 IN UINT32 AppendCount,
684 IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,
685 OUT EFI_DHCP4_PACKET **NewPacket
690 Transmits a DHCP formatted packet and optionally waits for responses.
692 The TransmitReceive() function is used to transmit a DHCP packet and optionally
693 wait for the response from servers. This function does not change the state of
694 the EFI DHCPv4 Protocol driver. It can be used at any time because of this.
696 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
697 @param Token The pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.
699 @retval EFI_SUCCESS The packet was successfully queued for transmission.
700 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
702 Token.RemoteAddress is zero.
703 Token.Packet is NULL.
704 Token.Packet is not a well-formed DHCP packet.
705 The transaction ID in Token.Packet is in use by another DHCP process.
706 @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call
707 this function after collection process completes.
708 @retval EFI_NO_MAPPING The default station address is not available yet.
709 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
710 @retval EFI_UNSUPPORTED The implementation doesn't support this function
711 @retval Others Some other unexpected error occurred.
716 (EFIAPI *EFI_DHCP4_TRANSMIT_RECEIVE)(
717 IN EFI_DHCP4_PROTOCOL *This,
718 IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token
723 Parses the packed DHCP option data.
725 The Parse() function is used to retrieve the option list from a DHCP packet.
726 If *OptionCount isn't zero, and there is enough space for all the DHCP options
727 in the Packet, each element of PacketOptionList is set to point to somewhere in
728 the Packet->Dhcp4.Option where a new DHCP option begins. If RFC3396 is supported,
729 the caller should reassemble the parsed DHCP options to get the final result.
730 If *OptionCount is zero or there isn't enough space for all of them, the number
731 of DHCP options in the Packet is returned in OptionCount.
733 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.
734 @param Packet The pointer to packet to be parsed.
735 @param OptionCount On input, the number of entries in the PacketOptionList.
736 On output, the number of entries that were written into the
738 @param PacketOptionList A list of packet option entries to be filled in. End option or pad
739 options are not included.
741 @retval EFI_SUCCESS The packet was successfully parsed.
742 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
745 The packet is not a well-formed DHCP packet.
747 @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE:
748 1) *OptionCount is smaller than the number of options that
749 were found in the Packet.
750 2) PacketOptionList is NULL.
751 @retval EFI_OUT_OF_RESOURCE The packet failed to parse because of a resource shortage.
756 (EFIAPI *EFI_DHCP4_PARSE)(
757 IN EFI_DHCP4_PROTOCOL *This,
758 IN EFI_DHCP4_PACKET *Packet,
759 IN OUT UINT32 *OptionCount,
760 OUT EFI_DHCP4_PACKET_OPTION *PacketOptionList[] OPTIONAL
764 /// This protocol is used to collect configuration information for the EFI IPv4 Protocol drivers
765 /// and to provide DHCPv4 server and PXE boot server discovery services.
767 struct _EFI_DHCP4_PROTOCOL {
768 EFI_DHCP4_GET_MODE_DATA GetModeData;
769 EFI_DHCP4_CONFIGURE Configure;
770 EFI_DHCP4_START Start;
771 EFI_DHCP4_RENEW_REBIND RenewRebind;
772 EFI_DHCP4_RELEASE Release;
774 EFI_DHCP4_BUILD Build;
775 EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive;
776 EFI_DHCP4_PARSE Parse;
779 extern EFI_GUID gEfiDhcp4ProtocolGuid;
780 extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid;