Path: blob/main/sys/contrib/edk2/Include/Protocol/Dhcp4.h
96339 views
/** @file1EFI_DHCP4_PROTOCOL as defined in UEFI 2.0.2EFI_DHCP4_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.3These protocols are used to collect configuration information for the EFI IPv4 Protocol4drivers and to provide DHCPv4 server and PXE boot server discovery services.56Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>7SPDX-License-Identifier: BSD-2-Clause-Patent89@par Revision Reference:10This Protocol was introduced in UEFI Specification 2.0.1112**/1314#ifndef __EFI_DHCP4_PROTOCOL_H__15#define __EFI_DHCP4_PROTOCOL_H__1617#define EFI_DHCP4_PROTOCOL_GUID \18{ \190x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \20}2122#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \23{ \240x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \25}2627typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL;2829#pragma pack(1)30typedef struct {31///32/// DHCP option code.33///34UINT8 OpCode;35///36/// Length of the DHCP option data. Not present if OpCode is 0 or 255.37///38UINT8 Length;39///40/// Start of the DHCP option data. Not present if OpCode is 0 or 255 or if Length is zero.41///42UINT8 Data[1];43} EFI_DHCP4_PACKET_OPTION;44#pragma pack()4546#pragma pack(1)47///48/// EFI_DHCP4_PACKET defines the format of DHCPv4 packets. See RFC 2131 for more information.49///50typedef struct {51UINT8 OpCode;52UINT8 HwType;53UINT8 HwAddrLen;54UINT8 Hops;55UINT32 Xid;56UINT16 Seconds;57UINT16 Reserved;58EFI_IPv4_ADDRESS ClientAddr; ///< Client IP address from client.59EFI_IPv4_ADDRESS YourAddr; ///< Client IP address from server.60EFI_IPv4_ADDRESS ServerAddr; ///< IP address of next server in bootstrap.61EFI_IPv4_ADDRESS GatewayAddr; ///< Relay agent IP address.62UINT8 ClientHwAddr[16]; ///< Client hardware address.63CHAR8 ServerName[64];64CHAR8 BootFileName[128];65} EFI_DHCP4_HEADER;66#pragma pack()6768#pragma pack(1)69typedef struct {70///71/// Size of the EFI_DHCP4_PACKET buffer.72///73UINT32 Size;74///75/// Length of the EFI_DHCP4_PACKET from the first byte of the Header field76/// to the last byte of the Option[] field.77///78UINT32 Length;7980struct {81///82/// DHCP packet header.83///84EFI_DHCP4_HEADER Header;85///86/// DHCP magik cookie in network byte order.87///88UINT32 Magik;89///90/// Start of the DHCP packed option data.91///92UINT8 Option[1];93} Dhcp4;94} EFI_DHCP4_PACKET;95#pragma pack()9697typedef enum {98///99/// The EFI DHCPv4 Protocol driver is stopped.100///101Dhcp4Stopped = 0x0,102///103/// The EFI DHCPv4 Protocol driver is inactive.104///105Dhcp4Init = 0x1,106///107/// The EFI DHCPv4 Protocol driver is collecting DHCP offer packets from DHCP servers.108///109Dhcp4Selecting = 0x2,110///111/// The EFI DHCPv4 Protocol driver has sent the request to the DHCP server and is waiting for a response.112///113Dhcp4Requesting = 0x3,114///115/// The DHCP configuration has completed.116///117Dhcp4Bound = 0x4,118///119/// The DHCP configuration is being renewed and another request has120/// been sent out, but it has not received a response from the server yet.121///122Dhcp4Renewing = 0x5,123///124/// The DHCP configuration has timed out and the EFI DHCPv4125/// Protocol driver is trying to extend the lease time.126///127Dhcp4Rebinding = 0x6,128///129/// The EFI DHCPv4 Protocol driver was initialized with a previously130/// allocated or known IP address.131///132Dhcp4InitReboot = 0x7,133///134/// The EFI DHCPv4 Protocol driver is seeking to reuse the previously135/// allocated IP address by sending a request to the DHCP server.136///137Dhcp4Rebooting = 0x8138} EFI_DHCP4_STATE;139140typedef enum {141///142/// The packet to start the configuration sequence is about to be sent.143///144Dhcp4SendDiscover = 0x01,145///146/// A reply packet was just received.147///148Dhcp4RcvdOffer = 0x02,149///150/// It is time for Dhcp4Callback to select an offer.151///152Dhcp4SelectOffer = 0x03,153///154/// A request packet is about to be sent.155///156Dhcp4SendRequest = 0x04,157///158/// A DHCPACK packet was received and will be passed to Dhcp4Callback.159///160Dhcp4RcvdAck = 0x05,161///162/// A DHCPNAK packet was received and will be passed to Dhcp4Callback.163///164Dhcp4RcvdNak = 0x06,165///166/// A decline packet is about to be sent.167///168Dhcp4SendDecline = 0x07,169///170/// The DHCP configuration process has completed. No packet is associated with this event.171///172Dhcp4BoundCompleted = 0x08,173///174/// It is time to enter the Dhcp4Renewing state and to contact the server175/// that originally issued the network address. No packet is associated with this event.176///177Dhcp4EnterRenewing = 0x09,178///179/// It is time to enter the Dhcp4Rebinding state and to contact any server.180/// No packet is associated with this event.181///182Dhcp4EnterRebinding = 0x0a,183///184/// The configured IP address was lost either because the lease has expired,185/// the user released the configuration, or a DHCPNAK packet was received in186/// the Dhcp4Renewing or Dhcp4Rebinding state. No packet is associated with this event.187///188Dhcp4AddressLost = 0x0b,189///190/// The DHCP process failed because a DHCPNAK packet was received or the user191/// aborted the DHCP process at a time when the configuration was not available yet.192/// No packet is associated with this event.193///194Dhcp4Fail = 0x0c195} EFI_DHCP4_EVENT;196197/**198Callback routine.199200EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver201to intercept events that occurred in the configuration process. This structure202provides advanced control of each state transition of the DHCP process. The203returned status code determines the behavior of the EFI DHCPv4 Protocol driver.204There are three possible returned values, which are described in the following205table.206207@param This The pointer to the EFI DHCPv4 Protocol instance that is used to208configure this callback function.209@param Context The pointer to the context that is initialized by210EFI_DHCP4_PROTOCOL.Configure().211@param CurrentState The current operational state of the EFI DHCPv4 Protocol212driver.213@param Dhcp4Event The event that occurs in the current state, which usually means a214state transition.215@param Packet The DHCP packet that is going to be sent or already received.216@param NewPacket The packet that is used to replace the above Packet.217218@retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.219When it is in the Dhcp4Selecting state, it tells the EFI DHCPv4 Protocol220driver to stop collecting additional packets. The driver will exit221the Dhcp4Selecting state and enter the Dhcp4Requesting state.222@retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol223driver will continue to wait for more packets until the retry224timeout expires.225@retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and226return to the Dhcp4Init or Dhcp4InitReboot state.227228**/229typedef230EFI_STATUS231(EFIAPI *EFI_DHCP4_CALLBACK)(232IN EFI_DHCP4_PROTOCOL *This,233IN VOID *Context,234IN EFI_DHCP4_STATE CurrentState,235IN EFI_DHCP4_EVENT Dhcp4Event,236IN EFI_DHCP4_PACKET *Packet OPTIONAL,237OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL238);239240typedef struct {241///242/// The number of times to try sending a packet during the Dhcp4SendDiscover243/// event and waiting for a response during the Dhcp4RcvdOffer event.244/// Set to zero to use the default try counts and timeout values.245///246UINT32 DiscoverTryCount;247///248/// The maximum amount of time (in seconds) to wait for returned packets in each249/// of the retries. Timeout values of zero will default to a timeout value250/// of one second. Set to NULL to use default timeout values.251///252UINT32 *DiscoverTimeout;253///254/// The number of times to try sending a packet during the Dhcp4SendRequest event255/// and waiting for a response during the Dhcp4RcvdAck event before accepting256/// failure. Set to zero to use the default try counts and timeout values.257///258UINT32 RequestTryCount;259///260/// The maximum amount of time (in seconds) to wait for return packets in each of the retries.261/// Timeout values of zero will default to a timeout value of one second.262/// Set to NULL to use default timeout values.263///264UINT32 *RequestTimeout;265///266/// For a DHCPDISCOVER, setting this parameter to the previously allocated IP267/// address will cause the EFI DHCPv4 Protocol driver to enter the Dhcp4InitReboot state.268/// And set this field to 0.0.0.0 to enter the Dhcp4Init state.269/// For a DHCPINFORM this parameter should be set to the client network address270/// which was assigned to the client during a DHCPDISCOVER.271///272EFI_IPv4_ADDRESS ClientAddress;273///274/// The callback function to intercept various events that occurred in275/// the DHCP configuration process. Set to NULL to ignore all those events.276///277EFI_DHCP4_CALLBACK Dhcp4Callback;278///279/// The pointer to the context that will be passed to Dhcp4Callback when it is called.280///281VOID *CallbackContext;282///283/// Number of DHCP options in the OptionList.284///285UINT32 OptionCount;286///287/// List of DHCP options to be included in every packet that is sent during the288/// Dhcp4SendDiscover event. Pad options are appended automatically by DHCP driver289/// in outgoing DHCP packets. If OptionList itself contains pad option, they are290/// ignored by the driver. OptionList can be freed after EFI_DHCP4_PROTOCOL.Configure()291/// returns. Ignored if OptionCount is zero.292///293EFI_DHCP4_PACKET_OPTION **OptionList;294} EFI_DHCP4_CONFIG_DATA;295296typedef struct {297///298/// The EFI DHCPv4 Protocol driver operating state.299///300EFI_DHCP4_STATE State;301///302/// The configuration data of the current EFI DHCPv4 Protocol driver instance.303///304EFI_DHCP4_CONFIG_DATA ConfigData;305///306/// The client IP address that was acquired from the DHCP server. If it is zero,307/// the DHCP acquisition has not completed yet and the following fields in this structure are undefined.308///309EFI_IPv4_ADDRESS ClientAddress;310///311/// The local hardware address.312///313EFI_MAC_ADDRESS ClientMacAddress;314///315/// The server IP address that is providing the DHCP service to this client.316///317EFI_IPv4_ADDRESS ServerAddress;318///319/// The router IP address that was acquired from the DHCP server.320/// May be zero if the server does not offer this address.321///322EFI_IPv4_ADDRESS RouterAddress;323///324/// The subnet mask of the connected network that was acquired from the DHCP server.325///326EFI_IPv4_ADDRESS SubnetMask;327///328/// The lease time (in 1-second units) of the configured IP address.329/// The value 0xFFFFFFFF means that the lease time is infinite.330/// A default lease of 7 days is used if the DHCP server does not provide a value.331///332UINT32 LeaseTime;333///334/// The cached latest DHCPACK or DHCPNAK or BOOTP REPLY packet. May be NULL if no packet is cached.335///336EFI_DHCP4_PACKET *ReplyPacket;337} EFI_DHCP4_MODE_DATA;338339typedef struct {340///341/// Alternate listening address. It can be a unicast, multicast, or broadcast address.342///343EFI_IPv4_ADDRESS ListenAddress;344///345/// The subnet mask of above listening unicast/broadcast IP address.346/// Ignored if ListenAddress is a multicast address.347///348EFI_IPv4_ADDRESS SubnetMask;349///350/// Alternate station source (or listening) port number.351/// If zero, then the default station port number (68) will be used.352///353UINT16 ListenPort;354} EFI_DHCP4_LISTEN_POINT;355356typedef struct {357///358/// The completion status of transmitting and receiving.359///360EFI_STATUS Status;361///362/// If not NULL, the event that will be signaled when the collection process363/// completes. If NULL, this function will busy-wait until the collection process competes.364///365EFI_EVENT CompletionEvent;366///367/// The pointer to the server IP address. This address may be a unicast, multicast, or broadcast address.368///369EFI_IPv4_ADDRESS RemoteAddress;370///371/// The server listening port number. If zero, the default server listening port number (67) will be used.372///373UINT16 RemotePort;374///375/// The pointer to the gateway address to override the existing setting.376///377EFI_IPv4_ADDRESS GatewayAddress;378///379/// The number of entries in ListenPoints. If zero, the default station address and port number 68 are used.380///381UINT32 ListenPointCount;382///383/// An array of station address and port number pairs that are used as receiving filters.384/// The first entry is also used as the source address and source port of the outgoing packet.385///386EFI_DHCP4_LISTEN_POINT *ListenPoints;387///388/// The number of seconds to collect responses. Zero is invalid.389///390UINT32 TimeoutValue;391///392/// The pointer to the packet to be transmitted.393///394EFI_DHCP4_PACKET *Packet;395///396/// Number of received packets.397///398UINT32 ResponseCount;399///400/// The pointer to the allocated list of received packets.401///402EFI_DHCP4_PACKET *ResponseList;403} EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN;404405/**406Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.407408The GetModeData() function returns the current operating mode and cached data409packet for the EFI DHCPv4 Protocol driver.410411@param This The pointer to the EFI_DHCP4_PROTOCOL instance.412@param Dhcp4ModeData The pointer to storage for the EFI_DHCP4_MODE_DATA structure.413414@retval EFI_SUCCESS The mode data was returned.415@retval EFI_INVALID_PARAMETER This is NULL.416417**/418typedef419EFI_STATUS420(EFIAPI *EFI_DHCP4_GET_MODE_DATA)(421IN EFI_DHCP4_PROTOCOL *This,422OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData423);424425/**426Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.427428The Configure() function is used to initialize, change, or reset the operational429settings of the EFI DHCPv4 Protocol driver for the communication device on which430the EFI DHCPv4 Service Binding Protocol is installed. This function can be431successfully called only if both of the following are true:432* This instance of the EFI DHCPv4 Protocol driver is in the Dhcp4Stopped, Dhcp4Init,433Dhcp4InitReboot, or Dhcp4Bound states.434* No other EFI DHCPv4 Protocol driver instance that is controlled by this EFI435DHCPv4 Service Binding Protocol driver instance has configured this EFI DHCPv4436Protocol driver.437When this driver is in the Dhcp4Stopped state, it can transfer into one of the438following two possible initial states:439* Dhcp4Init440* Dhcp4InitReboot.441The driver can transfer into these states by calling Configure() with a non-NULL442Dhcp4CfgData. The driver will transfer into the appropriate state based on the443supplied client network address in the ClientAddress parameter and DHCP options444in the OptionList parameter as described in RFC 2131.445When Configure() is called successfully while Dhcp4CfgData is set to NULL, the446default configuring data will be reset in the EFI DHCPv4 Protocol driver and447the state of the EFI DHCPv4 Protocol driver will not be changed. If one instance448wants to make it possible for another instance to configure the EFI DHCPv4 Protocol449driver, it must call this function with Dhcp4CfgData set to NULL.450451@param This The pointer to the EFI_DHCP4_PROTOCOL instance.452@param Dhcp4CfgData The pointer to the EFI_DHCP4_CONFIG_DATA.453454@retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or455Dhcp4InitReboot state, if the original state of this driver456was Dhcp4Stopped, Dhcp4Init,Dhcp4InitReboot, or Dhcp4Bound457and the value of Dhcp4CfgData was not NULL.458Otherwise, the state was left unchanged.459@retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the460Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;461Or onother instance of this EFI DHCPv4 Protocol driver is already462in a valid configured state.463@retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:464This is NULL.465DiscoverTryCount > 0 and DiscoverTimeout is NULL466RequestTryCount > 0 and RequestTimeout is NULL.467OptionCount >0 and OptionList is NULL.468ClientAddress is not a valid unicast address.469@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.470@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.471472**/473typedef474EFI_STATUS475(EFIAPI *EFI_DHCP4_CONFIGURE)(476IN EFI_DHCP4_PROTOCOL *This,477IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL478);479480/**481Starts the DHCP configuration process.482483The Start() function starts the DHCP configuration process. This function can484be called only when the EFI DHCPv4 Protocol driver is in the Dhcp4Init or485Dhcp4InitReboot state.486If the DHCP process completes successfully, the state of the EFI DHCPv4 Protocol487driver will be transferred through Dhcp4Selecting and Dhcp4Requesting to the488Dhcp4Bound state. The CompletionEvent will then be signaled if it is not NULL.489If the process aborts, either by the user or by some unexpected network error,490the state is restored to the Dhcp4Init state. The Start() function can be called491again to restart the process.492Refer to RFC 2131 for precise state transitions during this process. At the493time when each event occurs in this process, the callback function that was set494by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this495opportunity to control the process.496497@param This The pointer to the EFI_DHCP4_PROTOCOL instance.498@param CompletionEvent If not NULL, it indicates the event that will be signaled when the499EFI DHCPv4 Protocol driver is transferred into the500Dhcp4Bound state or when the DHCP process is aborted.501EFI_DHCP4_PROTOCOL.GetModeData() can be called to502check the completion status. If NULL,503EFI_DHCP4_PROTOCOL.Start() will wait until the driver504is transferred into the Dhcp4Bound state or the process fails.505506@retval EFI_SUCCESS The DHCP configuration process has started, or it has completed507when CompletionEvent is NULL.508@retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped509state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.510@retval EFI_INVALID_PARAMETER This is NULL.511@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.512@retval EFI_TIMEOUT The DHCP configuration process failed because no response was513received from the server within the specified timeout value.514@retval EFI_ABORTED The user aborted the DHCP process.515@retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the516DHCP process.517@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.518@retval EFI_NO_MEDIA There was a media error.519520**/521typedef522EFI_STATUS523(EFIAPI *EFI_DHCP4_START)(524IN EFI_DHCP4_PROTOCOL *This,525IN EFI_EVENT CompletionEvent OPTIONAL526);527528/**529Extends the lease time by sending a request packet.530531The RenewRebind() function is used to manually extend the lease time when the532EFI DHCPv4 Protocol driver is in the Dhcp4Bound state, and the lease time has533not expired yet. This function will send a request packet to the previously534found server (or to any server when RebindRequest is TRUE) and transfer the535state into the Dhcp4Renewing state (or Dhcp4Rebinding when RebindingRequest is536TRUE). When a response is received, the state is returned to Dhcp4Bound.537If no response is received before the try count is exceeded (the RequestTryCount538field that is specified in EFI_DHCP4_CONFIG_DATA) but before the lease time that539was issued by the previous server expires, the driver will return to the Dhcp4Bound540state, and the previous configuration is restored. The outgoing and incoming packets541can be captured by the EFI_DHCP4_CALLBACK function.542543@param This The pointer to the EFI_DHCP4_PROTOCOL instance.544@param RebindRequest If TRUE, this function broadcasts the request packets and enters545the Dhcp4Rebinding state. Otherwise, it sends a unicast546request packet and enters the Dhcp4Renewing state.547@param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase548completes or some error occurs.549EFI_DHCP4_PROTOCOL.GetModeData() can be called to550check the completion status. If NULL,551EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait552until the DHCP process finishes.553554@retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the555Dhcp4Renewing state or is back to the Dhcp4Bound state.556@retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped557state. EFI_DHCP4_PROTOCOL.Configure() needs to558be called.559@retval EFI_INVALID_PARAMETER This is NULL.560@retval EFI_TIMEOUT There was no response from the server when the try count was561exceeded.562@retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state.563@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.564565**/566typedef567EFI_STATUS568(EFIAPI *EFI_DHCP4_RENEW_REBIND)(569IN EFI_DHCP4_PROTOCOL *This,570IN BOOLEAN RebindRequest,571IN EFI_EVENT CompletionEvent OPTIONAL572);573574/**575Releases the current address configuration.576577The Release() function releases the current configured IP address by doing either578of the following:579* Sending a DHCPRELEASE packet when the EFI DHCPv4 Protocol driver is in the580Dhcp4Bound state581* Setting the previously assigned IP address that was provided with the582EFI_DHCP4_PROTOCOL.Configure() function to 0.0.0.0 when the driver is in583Dhcp4InitReboot state584After a successful call to this function, the EFI DHCPv4 Protocol driver returns585to the Dhcp4Init state, and any subsequent incoming packets will be discarded silently.586587@param This The pointer to the EFI_DHCP4_PROTOCOL instance.588589@retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.590@retval EFI_INVALID_PARAMETER This is NULL.591@retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.592@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.593594**/595typedef596EFI_STATUS597(EFIAPI *EFI_DHCP4_RELEASE)(598IN EFI_DHCP4_PROTOCOL *This599);600601/**602Stops the current address configuration.603604The Stop() function is used to stop the DHCP configuration process. After this605function is called successfully, the EFI DHCPv4 Protocol driver is transferred606into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called607before DHCP configuration process can be started again. This function can be608called when the EFI DHCPv4 Protocol driver is in any state.609610@param This The pointer to the EFI_DHCP4_PROTOCOL instance.611612@retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.613@retval EFI_INVALID_PARAMETER This is NULL.614615**/616typedef617EFI_STATUS618(EFIAPI *EFI_DHCP4_STOP)(619IN EFI_DHCP4_PROTOCOL *This620);621622/**623Builds a DHCP packet, given the options to be appended or deleted or replaced.624625The Build() function is used to assemble a new packet from the original packet626by replacing or deleting existing options or appending new options. This function627does not change any state of the EFI DHCPv4 Protocol driver and can be used at628any time.629630@param This The pointer to the EFI_DHCP4_PROTOCOL instance.631@param SeedPacket Initial packet to be used as a base for building new packet.632@param DeleteCount Number of opcodes in the DeleteList.633@param DeleteList List of opcodes to be deleted from the seed packet.634Ignored if DeleteCount is zero.635@param AppendCount Number of entries in the OptionList.636@param AppendList The pointer to a DHCP option list to be appended to SeedPacket.637If SeedPacket also contains options in this list, they are638replaced by new options (except pad option). Ignored if639AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION640@param NewPacket The pointer to storage for the pointer to the new allocated packet.641Use the EFI Boot Service FreePool() on the resulting pointer642when done with the packet.643644@retval EFI_SUCCESS The new packet was built.645@retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated.646@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:647This is NULL.648SeedPacket is NULL.649SeedPacket is not a well-formed DHCP packet.650AppendCount is not zero and AppendList is NULL.651DeleteCount is not zero and DeleteList is NULL.652NewPacket is NULL653Both DeleteCount and AppendCount are zero and654NewPacket is not NULL.655656**/657typedef658EFI_STATUS659(EFIAPI *EFI_DHCP4_BUILD)(660IN EFI_DHCP4_PROTOCOL *This,661IN EFI_DHCP4_PACKET *SeedPacket,662IN UINT32 DeleteCount,663IN UINT8 *DeleteList OPTIONAL,664IN UINT32 AppendCount,665IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,666OUT EFI_DHCP4_PACKET **NewPacket667);668669/**670Transmits a DHCP formatted packet and optionally waits for responses.671672The TransmitReceive() function is used to transmit a DHCP packet and optionally673wait for the response from servers. This function does not change the state of674the EFI DHCPv4 Protocol driver. It can be used at any time because of this.675676@param This The pointer to the EFI_DHCP4_PROTOCOL instance.677@param Token The pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.678679@retval EFI_SUCCESS The packet was successfully queued for transmission.680@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:681This is NULL.682Token.RemoteAddress is zero.683Token.Packet is NULL.684Token.Packet is not a well-formed DHCP packet.685The transaction ID in Token.Packet is in use by another DHCP process.686@retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call687this function after collection process completes.688@retval EFI_NO_MAPPING The default station address is not available yet.689@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.690@retval EFI_UNSUPPORTED The implementation doesn't support this function691@retval Others Some other unexpected error occurred.692693**/694typedef695EFI_STATUS696(EFIAPI *EFI_DHCP4_TRANSMIT_RECEIVE)(697IN EFI_DHCP4_PROTOCOL *This,698IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token699);700701/**702Parses the packed DHCP option data.703704The Parse() function is used to retrieve the option list from a DHCP packet.705If *OptionCount isn't zero, and there is enough space for all the DHCP options706in the Packet, each element of PacketOptionList is set to point to somewhere in707the Packet->Dhcp4.Option where a new DHCP option begins. If RFC3396 is supported,708the caller should reassemble the parsed DHCP options to get the final result.709If *OptionCount is zero or there isn't enough space for all of them, the number710of DHCP options in the Packet is returned in OptionCount.711712@param This The pointer to the EFI_DHCP4_PROTOCOL instance.713@param Packet The pointer to packet to be parsed.714@param OptionCount On input, the number of entries in the PacketOptionList.715On output, the number of entries that were written into the716PacketOptionList.717@param PacketOptionList A list of packet option entries to be filled in. End option or pad718options are not included.719720@retval EFI_SUCCESS The packet was successfully parsed.721@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:722This is NULL.723The packet is NULL.724The packet is not a well-formed DHCP packet.725OptionCount is NULL.726@retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE:7271) *OptionCount is smaller than the number of options that728were found in the Packet.7292) PacketOptionList is NULL.730@retval EFI_OUT_OF_RESOURCE The packet failed to parse because of a resource shortage.731732**/733typedef734EFI_STATUS735(EFIAPI *EFI_DHCP4_PARSE)(736IN EFI_DHCP4_PROTOCOL *This,737IN EFI_DHCP4_PACKET *Packet,738IN OUT UINT32 *OptionCount,739OUT EFI_DHCP4_PACKET_OPTION *PacketOptionList[] OPTIONAL740);741742///743/// This protocol is used to collect configuration information for the EFI IPv4 Protocol drivers744/// and to provide DHCPv4 server and PXE boot server discovery services.745///746struct _EFI_DHCP4_PROTOCOL {747EFI_DHCP4_GET_MODE_DATA GetModeData;748EFI_DHCP4_CONFIGURE Configure;749EFI_DHCP4_START Start;750EFI_DHCP4_RENEW_REBIND RenewRebind;751EFI_DHCP4_RELEASE Release;752EFI_DHCP4_STOP Stop;753EFI_DHCP4_BUILD Build;754EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive;755EFI_DHCP4_PARSE Parse;756};757758extern EFI_GUID gEfiDhcp4ProtocolGuid;759extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid;760761#endif762763764