]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Dhcp4.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Protocol / Dhcp4.h
CommitLineData
d1f95000 1/** @file\r
2 EFI_DHCP4_PROTOCOL as defined in UEFI 2.0.\r
3 EFI_DHCP4_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.\r
305a1279 4 These protocols are used to collect configuration information for the EFI IPv4 Protocol\r
d1f95000 5 drivers and to provide DHCPv4 server and PXE boot server discovery services.\r
6\r
9095d37b 7Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 8SPDX-License-Identifier: BSD-2-Clause-Patent\r
d1f95000 9\r
9095d37b 10 @par Revision Reference:\r
af2dc6a7 11 This Protocol was introduced in UEFI Specification 2.0.\r
5899caf0 12\r
d1f95000 13**/\r
14\r
15#ifndef __EFI_DHCP4_PROTOCOL_H__\r
16#define __EFI_DHCP4_PROTOCOL_H__\r
17\r
18#define EFI_DHCP4_PROTOCOL_GUID \\r
19 { \\r
20 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \\r
21 }\r
22\r
23#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \\r
24 { \\r
25 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \\r
26 }\r
305a1279 27\r
d1f95000 28typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL;\r
29\r
d1f95000 30#pragma pack(1)\r
31typedef struct {\r
74fec708
LG
32 ///\r
33 /// DHCP option code.\r
34 ///\r
2f88bd3a 35 UINT8 OpCode;\r
74fec708
LG
36 ///\r
37 /// Length of the DHCP option data. Not present if OpCode is 0 or 255.\r
38 ///\r
2f88bd3a 39 UINT8 Length;\r
74fec708
LG
40 ///\r
41 /// Start of the DHCP option data. Not present if OpCode is 0 or 255 or if Length is zero.\r
42 ///\r
2f88bd3a 43 UINT8 Data[1];\r
d1f95000 44} EFI_DHCP4_PACKET_OPTION;\r
45#pragma pack()\r
46\r
d1f95000 47#pragma pack(1)\r
74fec708
LG
48///\r
49/// EFI_DHCP4_PACKET defines the format of DHCPv4 packets. See RFC 2131 for more information.\r
50///\r
d1f95000 51typedef struct {\r
2f88bd3a
MK
52 UINT8 OpCode;\r
53 UINT8 HwType;\r
54 UINT8 HwAddrLen;\r
55 UINT8 Hops;\r
56 UINT32 Xid;\r
57 UINT16 Seconds;\r
58 UINT16 Reserved;\r
59 EFI_IPv4_ADDRESS ClientAddr; ///< Client IP address from client.\r
60 EFI_IPv4_ADDRESS YourAddr; ///< Client IP address from server.\r
61 EFI_IPv4_ADDRESS ServerAddr; ///< IP address of next server in bootstrap.\r
62 EFI_IPv4_ADDRESS GatewayAddr; ///< Relay agent IP address.\r
63 UINT8 ClientHwAddr[16]; ///< Client hardware address.\r
64 CHAR8 ServerName[64];\r
65 CHAR8 BootFileName[128];\r
66} EFI_DHCP4_HEADER;\r
d1f95000 67#pragma pack()\r
68\r
d1f95000 69#pragma pack(1)\r
70typedef struct {\r
74fec708
LG
71 ///\r
72 /// Size of the EFI_DHCP4_PACKET buffer.\r
73 ///\r
2f88bd3a 74 UINT32 Size;\r
74fec708 75 ///\r
9095d37b 76 /// Length of the EFI_DHCP4_PACKET from the first byte of the Header field\r
74fec708
LG
77 /// to the last byte of the Option[] field.\r
78 ///\r
2f88bd3a 79 UINT32 Length;\r
d1f95000 80\r
81 struct {\r
74fec708
LG
82 ///\r
83 /// DHCP packet header.\r
84 ///\r
2f88bd3a 85 EFI_DHCP4_HEADER Header;\r
74fec708
LG
86 ///\r
87 /// DHCP magik cookie in network byte order.\r
88 ///\r
2f88bd3a 89 UINT32 Magik;\r
74fec708
LG
90 ///\r
91 /// Start of the DHCP packed option data.\r
92 ///\r
2f88bd3a 93 UINT8 Option[1];\r
d1f95000 94 } Dhcp4;\r
95} EFI_DHCP4_PACKET;\r
96#pragma pack()\r
97\r
d1f95000 98typedef enum {\r
74fec708 99 ///\r
af2dc6a7 100 /// The EFI DHCPv4 Protocol driver is stopped.\r
74fec708 101 ///\r
2f88bd3a 102 Dhcp4Stopped = 0x0,\r
74fec708 103 ///\r
af2dc6a7 104 /// The EFI DHCPv4 Protocol driver is inactive.\r
74fec708 105 ///\r
2f88bd3a 106 Dhcp4Init = 0x1,\r
74fec708
LG
107 ///\r
108 /// The EFI DHCPv4 Protocol driver is collecting DHCP offer packets from DHCP servers.\r
109 ///\r
2f88bd3a 110 Dhcp4Selecting = 0x2,\r
74fec708
LG
111 ///\r
112 /// The EFI DHCPv4 Protocol driver has sent the request to the DHCP server and is waiting for a response.\r
113 ///\r
2f88bd3a 114 Dhcp4Requesting = 0x3,\r
74fec708
LG
115 ///\r
116 /// The DHCP configuration has completed.\r
117 ///\r
2f88bd3a 118 Dhcp4Bound = 0x4,\r
74fec708
LG
119 ///\r
120 /// The DHCP configuration is being renewed and another request has\r
121 /// been sent out, but it has not received a response from the server yet.\r
122 ///\r
2f88bd3a 123 Dhcp4Renewing = 0x5,\r
74fec708
LG
124 ///\r
125 /// The DHCP configuration has timed out and the EFI DHCPv4\r
126 /// Protocol driver is trying to extend the lease time.\r
127 ///\r
2f88bd3a 128 Dhcp4Rebinding = 0x6,\r
74fec708 129 ///\r
af2dc6a7 130 /// The EFI DHCPv4 Protocol driver was initialized with a previously\r
74fec708
LG
131 /// allocated or known IP address.\r
132 ///\r
2f88bd3a 133 Dhcp4InitReboot = 0x7,\r
74fec708
LG
134 ///\r
135 /// The EFI DHCPv4 Protocol driver is seeking to reuse the previously\r
136 /// allocated IP address by sending a request to the DHCP server.\r
137 ///\r
2f88bd3a 138 Dhcp4Rebooting = 0x8\r
d1f95000 139} EFI_DHCP4_STATE;\r
140\r
2f88bd3a 141typedef enum {\r
74fec708 142 ///\r
0acd6015 143 /// The packet to start the configuration sequence is about to be sent.\r
74fec708 144 ///\r
2f88bd3a 145 Dhcp4SendDiscover = 0x01,\r
74fec708 146 ///\r
0acd6015 147 /// A reply packet was just received.\r
74fec708 148 ///\r
2f88bd3a 149 Dhcp4RcvdOffer = 0x02,\r
74fec708
LG
150 ///\r
151 /// It is time for Dhcp4Callback to select an offer.\r
152 ///\r
2f88bd3a 153 Dhcp4SelectOffer = 0x03,\r
74fec708
LG
154 ///\r
155 /// A request packet is about to be sent.\r
156 ///\r
2f88bd3a 157 Dhcp4SendRequest = 0x04,\r
74fec708
LG
158 ///\r
159 /// A DHCPACK packet was received and will be passed to Dhcp4Callback.\r
160 ///\r
2f88bd3a 161 Dhcp4RcvdAck = 0x05,\r
74fec708
LG
162 ///\r
163 /// A DHCPNAK packet was received and will be passed to Dhcp4Callback.\r
164 ///\r
2f88bd3a 165 Dhcp4RcvdNak = 0x06,\r
74fec708
LG
166 ///\r
167 /// A decline packet is about to be sent.\r
168 ///\r
2f88bd3a 169 Dhcp4SendDecline = 0x07,\r
74fec708
LG
170 ///\r
171 /// The DHCP configuration process has completed. No packet is associated with this event.\r
172 ///\r
d1f95000 173 Dhcp4BoundCompleted = 0x08,\r
74fec708 174 ///\r
9095d37b 175 /// It is time to enter the Dhcp4Renewing state and to contact the server\r
74fec708
LG
176 /// that originally issued the network address. No packet is associated with this event.\r
177 ///\r
2f88bd3a 178 Dhcp4EnterRenewing = 0x09,\r
74fec708 179 ///\r
9095d37b 180 /// It is time to enter the Dhcp4Rebinding state and to contact any server.\r
74fec708
LG
181 /// No packet is associated with this event.\r
182 ///\r
d1f95000 183 Dhcp4EnterRebinding = 0x0a,\r
74fec708 184 ///\r
9095d37b
LG
185 /// The configured IP address was lost either because the lease has expired,\r
186 /// the user released the configuration, or a DHCPNAK packet was received in\r
74fec708
LG
187 /// the Dhcp4Renewing or Dhcp4Rebinding state. No packet is associated with this event.\r
188 ///\r
2f88bd3a 189 Dhcp4AddressLost = 0x0b,\r
74fec708 190 ///\r
9095d37b
LG
191 /// The DHCP process failed because a DHCPNAK packet was received or the user\r
192 /// aborted the DHCP process at a time when the configuration was not available yet.\r
74fec708
LG
193 /// No packet is associated with this event.\r
194 ///\r
2f88bd3a 195 Dhcp4Fail = 0x0c\r
d1f95000 196} EFI_DHCP4_EVENT;\r
197\r
305a1279 198/**\r
faac3f0c 199 Callback routine.\r
9095d37b 200\r
faac3f0c 201 EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver\r
202 to intercept events that occurred in the configuration process. This structure\r
203 provides advanced control of each state transition of the DHCP process. The\r
204 returned status code determines the behavior of the EFI DHCPv4 Protocol driver.\r
205 There are three possible returned values, which are described in the following\r
206 table.\r
305a1279 207\r
af2dc6a7 208 @param This The pointer to the EFI DHCPv4 Protocol instance that is used to\r
305a1279 209 configure this callback function.\r
af2dc6a7 210 @param Context The pointer to the context that is initialized by\r
305a1279 211 EFI_DHCP4_PROTOCOL.Configure().\r
d1f95000 212 @param CurrentState The current operational state of the EFI DHCPv4 Protocol\r
305a1279 213 driver.\r
d1f95000 214 @param Dhcp4Event The event that occurs in the current state, which usually means a\r
305a1279 215 state transition.\r
216 @param Packet The DHCP packet that is going to be sent or already received.\r
d1f95000 217 @param NewPacket The packet that is used to replace the above Packet.\r
305a1279 218\r
d1f95000 219 @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.\r
0acd6015 220 When it is in the Dhcp4Selecting state, it tells the EFI DHCPv4 Protocol\r
221 driver to stop collecting additional packets. The driver will exit\r
222 the Dhcp4Selecting state and enter the Dhcp4Requesting state.\r
305a1279 223 @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol\r
0acd6015 224 driver will continue to wait for more packets until the retry\r
305a1279 225 timeout expires.\r
d1f95000 226 @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and\r
305a1279 227 return to the Dhcp4Init or Dhcp4InitReboot state.\r
228\r
d1f95000 229**/\r
305a1279 230typedef\r
231EFI_STATUS\r
8b13229b 232(EFIAPI *EFI_DHCP4_CALLBACK)(\r
d1f95000 233 IN EFI_DHCP4_PROTOCOL *This,\r
234 IN VOID *Context,\r
235 IN EFI_DHCP4_STATE CurrentState,\r
236 IN EFI_DHCP4_EVENT Dhcp4Event,\r
305a1279 237 IN EFI_DHCP4_PACKET *Packet OPTIONAL,\r
d1f95000 238 OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL\r
239 );\r
240\r
d1f95000 241typedef struct {\r
74fec708 242 ///\r
af2dc6a7 243 /// The number of times to try sending a packet during the Dhcp4SendDiscover\r
0acd6015 244 /// event and waiting for a response during the Dhcp4RcvdOffer event.\r
74fec708
LG
245 /// Set to zero to use the default try counts and timeout values.\r
246 ///\r
2f88bd3a 247 UINT32 DiscoverTryCount;\r
74fec708 248 ///\r
9095d37b
LG
249 /// The maximum amount of time (in seconds) to wait for returned packets in each\r
250 /// of the retries. Timeout values of zero will default to a timeout value\r
74fec708
LG
251 /// of one second. Set to NULL to use default timeout values.\r
252 ///\r
2f88bd3a 253 UINT32 *DiscoverTimeout;\r
74fec708 254 ///\r
af2dc6a7 255 /// The number of times to try sending a packet during the Dhcp4SendRequest event\r
0acd6015 256 /// and waiting for a response during the Dhcp4RcvdAck event before accepting\r
257 /// failure. Set to zero to use the default try counts and timeout values.\r
74fec708 258 ///\r
2f88bd3a 259 UINT32 RequestTryCount;\r
74fec708 260 ///\r
9095d37b
LG
261 /// The maximum amount of time (in seconds) to wait for return packets in each of the retries.\r
262 /// Timeout values of zero will default to a timeout value of one second.\r
74fec708
LG
263 /// Set to NULL to use default timeout values.\r
264 ///\r
2f88bd3a 265 UINT32 *RequestTimeout;\r
74fec708 266 ///\r
0acd6015 267 /// For a DHCPDISCOVER, setting this parameter to the previously allocated IP\r
9095d37b 268 /// address will cause the EFI DHCPv4 Protocol driver to enter the Dhcp4InitReboot state.\r
0acd6015 269 /// And set this field to 0.0.0.0 to enter the Dhcp4Init state.\r
270 /// For a DHCPINFORM this parameter should be set to the client network address\r
271 /// which was assigned to the client during a DHCPDISCOVER.\r
74fec708 272 ///\r
2f88bd3a 273 EFI_IPv4_ADDRESS ClientAddress;\r
74fec708 274 ///\r
9095d37b 275 /// The callback function to intercept various events that occurred in\r
74fec708
LG
276 /// the DHCP configuration process. Set to NULL to ignore all those events.\r
277 ///\r
2f88bd3a 278 EFI_DHCP4_CALLBACK Dhcp4Callback;\r
74fec708 279 ///\r
af2dc6a7 280 /// The pointer to the context that will be passed to Dhcp4Callback when it is called.\r
74fec708 281 ///\r
2f88bd3a 282 VOID *CallbackContext;\r
74fec708
LG
283 ///\r
284 /// Number of DHCP options in the OptionList.\r
285 ///\r
2f88bd3a 286 UINT32 OptionCount;\r
74fec708 287 ///\r
0acd6015 288 /// List of DHCP options to be included in every packet that is sent during the\r
289 /// Dhcp4SendDiscover event. Pad options are appended automatically by DHCP driver\r
290 /// in outgoing DHCP packets. If OptionList itself contains pad option, they are\r
291 /// ignored by the driver. OptionList can be freed after EFI_DHCP4_PROTOCOL.Configure()\r
292 /// returns. Ignored if OptionCount is zero.\r
74fec708 293 ///\r
2f88bd3a 294 EFI_DHCP4_PACKET_OPTION **OptionList;\r
d1f95000 295} EFI_DHCP4_CONFIG_DATA;\r
296\r
d1f95000 297typedef struct {\r
74fec708 298 ///\r
9095d37b 299 /// The EFI DHCPv4 Protocol driver operating state.\r
74fec708 300 ///\r
2f88bd3a 301 EFI_DHCP4_STATE State;\r
74fec708
LG
302 ///\r
303 /// The configuration data of the current EFI DHCPv4 Protocol driver instance.\r
304 ///\r
2f88bd3a 305 EFI_DHCP4_CONFIG_DATA ConfigData;\r
74fec708
LG
306 ///\r
307 /// The client IP address that was acquired from the DHCP server. If it is zero,\r
308 /// the DHCP acquisition has not completed yet and the following fields in this structure are undefined.\r
309 ///\r
2f88bd3a 310 EFI_IPv4_ADDRESS ClientAddress;\r
74fec708
LG
311 ///\r
312 /// The local hardware address.\r
313 ///\r
2f88bd3a 314 EFI_MAC_ADDRESS ClientMacAddress;\r
74fec708
LG
315 ///\r
316 /// The server IP address that is providing the DHCP service to this client.\r
317 ///\r
2f88bd3a 318 EFI_IPv4_ADDRESS ServerAddress;\r
74fec708 319 ///\r
9095d37b 320 /// The router IP address that was acquired from the DHCP server.\r
74fec708
LG
321 /// May be zero if the server does not offer this address.\r
322 ///\r
2f88bd3a 323 EFI_IPv4_ADDRESS RouterAddress;\r
74fec708
LG
324 ///\r
325 /// The subnet mask of the connected network that was acquired from the DHCP server.\r
326 ///\r
2f88bd3a 327 EFI_IPv4_ADDRESS SubnetMask;\r
74fec708 328 ///\r
9095d37b
LG
329 /// The lease time (in 1-second units) of the configured IP address.\r
330 /// The value 0xFFFFFFFF means that the lease time is infinite.\r
74fec708
LG
331 /// A default lease of 7 days is used if the DHCP server does not provide a value.\r
332 ///\r
2f88bd3a 333 UINT32 LeaseTime;\r
74fec708
LG
334 ///\r
335 /// The cached latest DHCPACK or DHCPNAK or BOOTP REPLY packet. May be NULL if no packet is cached.\r
336 ///\r
2f88bd3a 337 EFI_DHCP4_PACKET *ReplyPacket;\r
d1f95000 338} EFI_DHCP4_MODE_DATA;\r
339\r
d1f95000 340typedef struct {\r
74fec708
LG
341 ///\r
342 /// Alternate listening address. It can be a unicast, multicast, or broadcast address.\r
343 ///\r
2f88bd3a 344 EFI_IPv4_ADDRESS ListenAddress;\r
74fec708 345 ///\r
9095d37b 346 /// The subnet mask of above listening unicast/broadcast IP address.\r
74fec708
LG
347 /// Ignored if ListenAddress is a multicast address.\r
348 ///\r
2f88bd3a 349 EFI_IPv4_ADDRESS SubnetMask;\r
74fec708 350 ///\r
9095d37b 351 /// Alternate station source (or listening) port number.\r
74fec708
LG
352 /// If zero, then the default station port number (68) will be used.\r
353 ///\r
2f88bd3a 354 UINT16 ListenPort;\r
d1f95000 355} EFI_DHCP4_LISTEN_POINT;\r
356\r
d1f95000 357typedef struct {\r
74fec708
LG
358 ///\r
359 /// The completion status of transmitting and receiving.\r
360 ///\r
2f88bd3a 361 EFI_STATUS Status;\r
74fec708 362 ///\r
9095d37b 363 /// If not NULL, the event that will be signaled when the collection process\r
74fec708
LG
364 /// completes. If NULL, this function will busy-wait until the collection process competes.\r
365 ///\r
2f88bd3a 366 EFI_EVENT CompletionEvent;\r
74fec708 367 ///\r
af2dc6a7 368 /// The pointer to the server IP address. This address may be a unicast, multicast, or broadcast address.\r
74fec708 369 ///\r
2f88bd3a 370 EFI_IPv4_ADDRESS RemoteAddress;\r
74fec708 371 ///\r
af2dc6a7 372 /// The server listening port number. If zero, the default server listening port number (67) will be used.\r
74fec708 373 ///\r
2f88bd3a 374 UINT16 RemotePort;\r
74fec708 375 ///\r
af2dc6a7 376 /// The pointer to the gateway address to override the existing setting.\r
74fec708 377 ///\r
2f88bd3a 378 EFI_IPv4_ADDRESS GatewayAddress;\r
74fec708
LG
379 ///\r
380 /// The number of entries in ListenPoints. If zero, the default station address and port number 68 are used.\r
381 ///\r
2f88bd3a 382 UINT32 ListenPointCount;\r
74fec708 383 ///\r
9095d37b 384 /// An array of station address and port number pairs that are used as receiving filters.\r
74fec708
LG
385 /// The first entry is also used as the source address and source port of the outgoing packet.\r
386 ///\r
2f88bd3a 387 EFI_DHCP4_LISTEN_POINT *ListenPoints;\r
74fec708 388 ///\r
af2dc6a7 389 /// The number of seconds to collect responses. Zero is invalid.\r
74fec708 390 ///\r
2f88bd3a 391 UINT32 TimeoutValue;\r
74fec708 392 ///\r
af2dc6a7 393 /// The pointer to the packet to be transmitted.\r
74fec708 394 ///\r
2f88bd3a 395 EFI_DHCP4_PACKET *Packet;\r
74fec708
LG
396 ///\r
397 /// Number of received packets.\r
398 ///\r
2f88bd3a 399 UINT32 ResponseCount;\r
74fec708 400 ///\r
af2dc6a7 401 /// The pointer to the allocated list of received packets.\r
74fec708 402 ///\r
2f88bd3a 403 EFI_DHCP4_PACKET *ResponseList;\r
d1f95000 404} EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN;\r
405\r
d1f95000 406/**\r
407 Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.\r
9095d37b 408\r
faac3f0c 409 The GetModeData() function returns the current operating mode and cached data\r
410 packet for the EFI DHCPv4 Protocol driver.\r
d1f95000 411\r
af2dc6a7 412 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.\r
413 @param Dhcp4ModeData The pointer to storage for the EFI_DHCP4_MODE_DATA structure.\r
d1f95000 414\r
415 @retval EFI_SUCCESS The mode data was returned.\r
416 @retval EFI_INVALID_PARAMETER This is NULL.\r
417\r
418**/\r
305a1279 419typedef\r
420EFI_STATUS\r
8b13229b 421(EFIAPI *EFI_DHCP4_GET_MODE_DATA)(\r
d1f95000 422 IN EFI_DHCP4_PROTOCOL *This,\r
423 OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData\r
ed66e1bc 424 );\r
d1f95000 425\r
426/**\r
427 Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.\r
428\r
faac3f0c 429 The Configure() function is used to initialize, change, or reset the operational\r
430 settings of the EFI DHCPv4 Protocol driver for the communication device on which\r
431 the EFI DHCPv4 Service Binding Protocol is installed. This function can be\r
432 successfully called only if both of the following are true:\r
433 * This instance of the EFI DHCPv4 Protocol driver is in the Dhcp4Stopped, Dhcp4Init,\r
434 Dhcp4InitReboot, or Dhcp4Bound states.\r
435 * No other EFI DHCPv4 Protocol driver instance that is controlled by this EFI\r
436 DHCPv4 Service Binding Protocol driver instance has configured this EFI DHCPv4\r
437 Protocol driver.\r
438 When this driver is in the Dhcp4Stopped state, it can transfer into one of the\r
439 following two possible initial states:\r
440 * Dhcp4Init\r
af2dc6a7 441 * Dhcp4InitReboot.\r
faac3f0c 442 The driver can transfer into these states by calling Configure() with a non-NULL\r
443 Dhcp4CfgData. The driver will transfer into the appropriate state based on the\r
444 supplied client network address in the ClientAddress parameter and DHCP options\r
445 in the OptionList parameter as described in RFC 2131.\r
446 When Configure() is called successfully while Dhcp4CfgData is set to NULL, the\r
447 default configuring data will be reset in the EFI DHCPv4 Protocol driver and\r
448 the state of the EFI DHCPv4 Protocol driver will not be changed. If one instance\r
449 wants to make it possible for another instance to configure the EFI DHCPv4 Protocol\r
450 driver, it must call this function with Dhcp4CfgData set to NULL.\r
451\r
af2dc6a7 452 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.\r
453 @param Dhcp4CfgData The pointer to the EFI_DHCP4_CONFIG_DATA.\r
d1f95000 454\r
455 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or\r
456 Dhcp4InitReboot state, if the original state of this driver\r
0acd6015 457 was Dhcp4Stopped, Dhcp4Init,Dhcp4InitReboot, or Dhcp4Bound\r
458 and the value of Dhcp4CfgData was not NULL.\r
459 Otherwise, the state was left unchanged.\r
d1f95000 460 @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the\r
461 Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;\r
462 Or onother instance of this EFI DHCPv4 Protocol driver is already\r
463 in a valid configured state.\r
74fec708
LG
464 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
465 This is NULL.\r
466 DiscoverTryCount > 0 and DiscoverTimeout is NULL\r
467 RequestTryCount > 0 and RequestTimeout is NULL.\r
468 OptionCount >0 and OptionList is NULL.\r
469 ClientAddress is not a valid unicast address.\r
d1f95000 470 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
471 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
472\r
473**/\r
305a1279 474typedef\r
d1f95000 475EFI_STATUS\r
8b13229b 476(EFIAPI *EFI_DHCP4_CONFIGURE)(\r
d1f95000 477 IN EFI_DHCP4_PROTOCOL *This,\r
478 IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL\r
ed66e1bc 479 );\r
d1f95000 480\r
d1f95000 481/**\r
482 Starts the DHCP configuration process.\r
483\r
faac3f0c 484 The Start() function starts the DHCP configuration process. This function can\r
485 be called only when the EFI DHCPv4 Protocol driver is in the Dhcp4Init or\r
486 Dhcp4InitReboot state.\r
487 If the DHCP process completes successfully, the state of the EFI DHCPv4 Protocol\r
488 driver will be transferred through Dhcp4Selecting and Dhcp4Requesting to the\r
489 Dhcp4Bound state. The CompletionEvent will then be signaled if it is not NULL.\r
490 If the process aborts, either by the user or by some unexpected network error,\r
491 the state is restored to the Dhcp4Init state. The Start() function can be called\r
492 again to restart the process.\r
493 Refer to RFC 2131 for precise state transitions during this process. At the\r
494 time when each event occurs in this process, the callback function that was set\r
495 by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this\r
496 opportunity to control the process.\r
9095d37b 497\r
af2dc6a7 498 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.\r
499 @param CompletionEvent If not NULL, it indicates the event that will be signaled when the\r
d1f95000 500 EFI DHCPv4 Protocol driver is transferred into the\r
501 Dhcp4Bound state or when the DHCP process is aborted.\r
502 EFI_DHCP4_PROTOCOL.GetModeData() can be called to\r
503 check the completion status. If NULL,\r
504 EFI_DHCP4_PROTOCOL.Start() will wait until the driver\r
505 is transferred into the Dhcp4Bound state or the process fails.\r
506\r
507 @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed\r
508 when CompletionEvent is NULL.\r
509 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped\r
510 state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.\r
511 @retval EFI_INVALID_PARAMETER This is NULL.\r
512 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
513 @retval EFI_TIMEOUT The DHCP configuration process failed because no response was\r
514 received from the server within the specified timeout value.\r
515 @retval EFI_ABORTED The user aborted the DHCP process.\r
516 @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the\r
517 DHCP process.\r
518 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
c5c3e7e2 519 @retval EFI_NO_MEDIA There was a media error.\r
d1f95000 520\r
521**/\r
305a1279 522typedef\r
d1f95000 523EFI_STATUS\r
8b13229b 524(EFIAPI *EFI_DHCP4_START)(\r
d1f95000 525 IN EFI_DHCP4_PROTOCOL *This,\r
526 IN EFI_EVENT CompletionEvent OPTIONAL\r
ed66e1bc 527 );\r
d1f95000 528\r
529/**\r
530 Extends the lease time by sending a request packet.\r
9095d37b 531\r
faac3f0c 532 The RenewRebind() function is used to manually extend the lease time when the\r
af2dc6a7 533 EFI DHCPv4 Protocol driver is in the Dhcp4Bound state, and the lease time has\r
faac3f0c 534 not expired yet. This function will send a request packet to the previously\r
535 found server (or to any server when RebindRequest is TRUE) and transfer the\r
536 state into the Dhcp4Renewing state (or Dhcp4Rebinding when RebindingRequest is\r
537 TRUE). When a response is received, the state is returned to Dhcp4Bound.\r
538 If no response is received before the try count is exceeded (the RequestTryCount\r
539 field that is specified in EFI_DHCP4_CONFIG_DATA) but before the lease time that\r
540 was issued by the previous server expires, the driver will return to the Dhcp4Bound\r
af2dc6a7 541 state, and the previous configuration is restored. The outgoing and incoming packets\r
faac3f0c 542 can be captured by the EFI_DHCP4_CALLBACK function.\r
d1f95000 543\r
af2dc6a7 544 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.\r
d1f95000 545 @param RebindRequest If TRUE, this function broadcasts the request packets and enters\r
546 the Dhcp4Rebinding state. Otherwise, it sends a unicast\r
547 request packet and enters the Dhcp4Renewing state.\r
548 @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase\r
549 completes or some error occurs.\r
550 EFI_DHCP4_PROTOCOL.GetModeData() can be called to\r
551 check the completion status. If NULL,\r
552 EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait\r
553 until the DHCP process finishes.\r
554\r
555 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the\r
556 Dhcp4Renewing state or is back to the Dhcp4Bound state.\r
557 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped\r
558 state. EFI_DHCP4_PROTOCOL.Configure() needs to\r
559 be called.\r
560 @retval EFI_INVALID_PARAMETER This is NULL.\r
561 @retval EFI_TIMEOUT There was no response from the server when the try count was\r
562 exceeded.\r
563 @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state.\r
564 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
565\r
566**/\r
567typedef\r
568EFI_STATUS\r
8b13229b 569(EFIAPI *EFI_DHCP4_RENEW_REBIND)(\r
d1f95000 570 IN EFI_DHCP4_PROTOCOL *This,\r
571 IN BOOLEAN RebindRequest,\r
572 IN EFI_EVENT CompletionEvent OPTIONAL\r
ed66e1bc 573 );\r
d1f95000 574\r
575/**\r
576 Releases the current address configuration.\r
577\r
faac3f0c 578 The Release() function releases the current configured IP address by doing either\r
579 of the following:\r
580 * Sending a DHCPRELEASE packet when the EFI DHCPv4 Protocol driver is in the\r
581 Dhcp4Bound state\r
582 * Setting the previously assigned IP address that was provided with the\r
583 EFI_DHCP4_PROTOCOL.Configure() function to 0.0.0.0 when the driver is in\r
584 Dhcp4InitReboot state\r
585 After a successful call to this function, the EFI DHCPv4 Protocol driver returns\r
af2dc6a7 586 to the Dhcp4Init state, and any subsequent incoming packets will be discarded silently.\r
faac3f0c 587\r
af2dc6a7 588 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.\r
d1f95000 589\r
590 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.\r
591 @retval EFI_INVALID_PARAMETER This is NULL.\r
592 @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.\r
593 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
594\r
595**/\r
305a1279 596typedef\r
d1f95000 597EFI_STATUS\r
8b13229b 598(EFIAPI *EFI_DHCP4_RELEASE)(\r
d1f95000 599 IN EFI_DHCP4_PROTOCOL *This\r
ed66e1bc 600 );\r
d1f95000 601\r
602/**\r
603 Stops the current address configuration.\r
9095d37b 604\r
faac3f0c 605 The Stop() function is used to stop the DHCP configuration process. After this\r
606 function is called successfully, the EFI DHCPv4 Protocol driver is transferred\r
607 into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called\r
608 before DHCP configuration process can be started again. This function can be\r
609 called when the EFI DHCPv4 Protocol driver is in any state.\r
d1f95000 610\r
af2dc6a7 611 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.\r
305a1279 612\r
d1f95000 613 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.\r
614 @retval EFI_INVALID_PARAMETER This is NULL.\r
615\r
616**/\r
305a1279 617typedef\r
d1f95000 618EFI_STATUS\r
8b13229b 619(EFIAPI *EFI_DHCP4_STOP)(\r
d1f95000 620 IN EFI_DHCP4_PROTOCOL *This\r
ed66e1bc 621 );\r
d1f95000 622\r
623/**\r
624 Builds a DHCP packet, given the options to be appended or deleted or replaced.\r
625\r
faac3f0c 626 The Build() function is used to assemble a new packet from the original packet\r
627 by replacing or deleting existing options or appending new options. This function\r
628 does not change any state of the EFI DHCPv4 Protocol driver and can be used at\r
629 any time.\r
630\r
af2dc6a7 631 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.\r
eecd469b 632 @param SeedPacket Initial packet to be used as a base for building new packet.\r
d1f95000 633 @param DeleteCount Number of opcodes in the DeleteList.\r
634 @param DeleteList List of opcodes to be deleted from the seed packet.\r
635 Ignored if DeleteCount is zero.\r
636 @param AppendCount Number of entries in the OptionList.\r
af2dc6a7 637 @param AppendList The pointer to a DHCP option list to be appended to SeedPacket.\r
d1f95000 638 If SeedPacket also contains options in this list, they are\r
639 replaced by new options (except pad option). Ignored if\r
640 AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION\r
af2dc6a7 641 @param NewPacket The pointer to storage for the pointer to the new allocated packet.\r
d1f95000 642 Use the EFI Boot Service FreePool() on the resulting pointer\r
643 when done with the packet.\r
644\r
645 @retval EFI_SUCCESS The new packet was built.\r
646 @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated.\r
74fec708
LG
647 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
648 This is NULL.\r
649 SeedPacket is NULL.\r
650 SeedPacket is not a well-formed DHCP packet.\r
651 AppendCount is not zero and AppendList is NULL.\r
652 DeleteCount is not zero and DeleteList is NULL.\r
653 NewPacket is NULL\r
654 Both DeleteCount and AppendCount are zero and\r
655 NewPacket is not NULL.\r
d1f95000 656\r
657**/\r
658typedef\r
659EFI_STATUS\r
8b13229b 660(EFIAPI *EFI_DHCP4_BUILD)(\r
d1f95000 661 IN EFI_DHCP4_PROTOCOL *This,\r
662 IN EFI_DHCP4_PACKET *SeedPacket,\r
663 IN UINT32 DeleteCount,\r
664 IN UINT8 *DeleteList OPTIONAL,\r
665 IN UINT32 AppendCount,\r
666 IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,\r
667 OUT EFI_DHCP4_PACKET **NewPacket\r
ed66e1bc 668 );\r
faac3f0c 669\r
d1f95000 670/**\r
671 Transmits a DHCP formatted packet and optionally waits for responses.\r
9095d37b 672\r
faac3f0c 673 The TransmitReceive() function is used to transmit a DHCP packet and optionally\r
674 wait for the response from servers. This function does not change the state of\r
af2dc6a7 675 the EFI DHCPv4 Protocol driver. It can be used at any time because of this.\r
d1f95000 676\r
af2dc6a7 677 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.\r
678 @param Token The pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.\r
d1f95000 679\r
680 @retval EFI_SUCCESS The packet was successfully queued for transmission.\r
74fec708
LG
681 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
682 This is NULL.\r
683 Token.RemoteAddress is zero.\r
684 Token.Packet is NULL.\r
685 Token.Packet is not a well-formed DHCP packet.\r
686 The transaction ID in Token.Packet is in use by another DHCP process.\r
d1f95000 687 @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call\r
688 this function after collection process completes.\r
689 @retval EFI_NO_MAPPING The default station address is not available yet.\r
690 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
ff7630cc 691 @retval EFI_UNSUPPORTED The implementation doesn't support this function\r
d1f95000 692 @retval Others Some other unexpected error occurred.\r
693\r
694**/\r
305a1279 695typedef\r
d1f95000 696EFI_STATUS\r
8b13229b 697(EFIAPI *EFI_DHCP4_TRANSMIT_RECEIVE)(\r
d1f95000 698 IN EFI_DHCP4_PROTOCOL *This,\r
699 IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token\r
ed66e1bc 700 );\r
d1f95000 701\r
d1f95000 702/**\r
703 Parses the packed DHCP option data.\r
9095d37b 704\r
faac3f0c 705 The Parse() function is used to retrieve the option list from a DHCP packet.\r
ff7630cc 706 If *OptionCount isn't zero, and there is enough space for all the DHCP options\r
faac3f0c 707 in the Packet, each element of PacketOptionList is set to point to somewhere in\r
708 the Packet->Dhcp4.Option where a new DHCP option begins. If RFC3396 is supported,\r
630b4187 709 the caller should reassemble the parsed DHCP options to get the final result.\r
ff7630cc 710 If *OptionCount is zero or there isn't enough space for all of them, the number\r
faac3f0c 711 of DHCP options in the Packet is returned in OptionCount.\r
d1f95000 712\r
af2dc6a7 713 @param This The pointer to the EFI_DHCP4_PROTOCOL instance.\r
714 @param Packet The pointer to packet to be parsed.\r
d1f95000 715 @param OptionCount On input, the number of entries in the PacketOptionList.\r
716 On output, the number of entries that were written into the\r
717 PacketOptionList.\r
af2dc6a7 718 @param PacketOptionList A list of packet option entries to be filled in. End option or pad\r
d1f95000 719 options are not included.\r
720\r
721 @retval EFI_SUCCESS The packet was successfully parsed.\r
74fec708
LG
722 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
723 This is NULL.\r
af2dc6a7 724 The packet is NULL.\r
725 The packet is not a well-formed DHCP packet.\r
74fec708 726 OptionCount is NULL.\r
d1f95000 727 @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE:\r
728 1) *OptionCount is smaller than the number of options that\r
729 were found in the Packet.\r
730 2) PacketOptionList is NULL.\r
af2dc6a7 731 @retval EFI_OUT_OF_RESOURCE The packet failed to parse because of a resource shortage.\r
d1f95000 732\r
733**/\r
734typedef\r
735EFI_STATUS\r
8b13229b 736(EFIAPI *EFI_DHCP4_PARSE)(\r
d1f95000 737 IN EFI_DHCP4_PROTOCOL *This,\r
738 IN EFI_DHCP4_PACKET *Packet,\r
739 IN OUT UINT32 *OptionCount,\r
740 OUT EFI_DHCP4_PACKET_OPTION *PacketOptionList[] OPTIONAL\r
ed66e1bc 741 );\r
d1f95000 742\r
44717a39 743///\r
744/// This protocol is used to collect configuration information for the EFI IPv4 Protocol drivers\r
745/// and to provide DHCPv4 server and PXE boot server discovery services.\r
746///\r
d1f95000 747struct _EFI_DHCP4_PROTOCOL {\r
2f88bd3a
MK
748 EFI_DHCP4_GET_MODE_DATA GetModeData;\r
749 EFI_DHCP4_CONFIGURE Configure;\r
750 EFI_DHCP4_START Start;\r
751 EFI_DHCP4_RENEW_REBIND RenewRebind;\r
752 EFI_DHCP4_RELEASE Release;\r
753 EFI_DHCP4_STOP Stop;\r
754 EFI_DHCP4_BUILD Build;\r
755 EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive;\r
756 EFI_DHCP4_PARSE Parse;\r
d1f95000 757};\r
758\r
2f88bd3a
MK
759extern EFI_GUID gEfiDhcp4ProtocolGuid;\r
760extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid;\r
d1f95000 761\r
762#endif\r