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