]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Dhcp4.h
Fix doxygen issue:
[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
305a1279 7 Copyright (c) 2006, Intel Corporation\r
8 All rights reserved. This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
d1f95000 12\r
305a1279 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
d1f95000 15\r
d1f95000 16**/\r
17\r
18#ifndef __EFI_DHCP4_PROTOCOL_H__\r
19#define __EFI_DHCP4_PROTOCOL_H__\r
20\r
21#define EFI_DHCP4_PROTOCOL_GUID \\r
22 { \\r
23 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \\r
24 }\r
25\r
26#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \\r
27 { \\r
28 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \\r
29 }\r
305a1279 30\r
d1f95000 31typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL;\r
32\r
33\r
34#pragma pack(1)\r
35typedef struct {\r
36 UINT8 OpCode;\r
37 UINT8 Length;\r
38 UINT8 Data[1];\r
39} EFI_DHCP4_PACKET_OPTION;\r
40#pragma pack()\r
41\r
42\r
43#pragma pack(1)\r
44typedef struct {\r
45 UINT8 OpCode;\r
46 UINT8 HwType;\r
47 UINT8 HwAddrLen;\r
48 UINT8 Hops;\r
49 UINT32 Xid;\r
50 UINT16 Seconds;\r
51 UINT16 Reserved;\r
52 EFI_IPv4_ADDRESS ClientAddr; //Client IP address from client\r
53 EFI_IPv4_ADDRESS YourAddr; //Client IP address from server\r
305a1279 54 EFI_IPv4_ADDRESS ServerAddr; //IP address of next server in bootstrap\r
d1f95000 55 EFI_IPv4_ADDRESS GatewayAddr; //Relay agent IP address\r
56 UINT8 ClientHwAddr[16]; //Client hardware address\r
305a1279 57 CHAR8 ServerName[64];\r
d1f95000 58 CHAR8 BootFileName[128];\r
59}EFI_DHCP4_HEADER;\r
60#pragma pack()\r
61\r
62\r
63#pragma pack(1)\r
64typedef struct {\r
65 UINT32 Size;\r
66 UINT32 Length;\r
67\r
68 struct {\r
69 EFI_DHCP4_HEADER Header;\r
70 UINT32 Magik;\r
71 UINT8 Option[1];\r
72 } Dhcp4;\r
73} EFI_DHCP4_PACKET;\r
74#pragma pack()\r
75\r
76\r
77typedef enum {\r
78 Dhcp4Stopped = 0x0,\r
79 Dhcp4Init = 0x1,\r
80 Dhcp4Selecting = 0x2,\r
81 Dhcp4Requesting = 0x3,\r
82 Dhcp4Bound = 0x4,\r
83 Dhcp4Renewing = 0x5,\r
84 Dhcp4Rebinding = 0x6,\r
85 Dhcp4InitReboot = 0x7,\r
86 Dhcp4Rebooting = 0x8\r
87} EFI_DHCP4_STATE;\r
88\r
89\r
90typedef enum{\r
91 Dhcp4SendDiscover = 0x01,\r
92 Dhcp4RcvdOffer = 0x02,\r
93 Dhcp4SelectOffer = 0x03,\r
94 Dhcp4SendRequest = 0x04,\r
95 Dhcp4RcvdAck = 0x05,\r
96 Dhcp4RcvdNak = 0x06,\r
97 Dhcp4SendDecline = 0x07,\r
98 Dhcp4BoundCompleted = 0x08,\r
99 Dhcp4EnterRenewing = 0x09,\r
100 Dhcp4EnterRebinding = 0x0a,\r
101 Dhcp4AddressLost = 0x0b,\r
102 Dhcp4Fail = 0x0c\r
103} EFI_DHCP4_EVENT;\r
104\r
305a1279 105/**\r
106 Callback routine\r
107\r
d1f95000 108 @param This Pointer to the EFI DHCPv4 Protocol instance that is used to\r
305a1279 109 configure this callback function.\r
d1f95000 110 @param Context Pointer to the context that is initialized by\r
305a1279 111 EFI_DHCP4_PROTOCOL.Configure().\r
d1f95000 112 @param CurrentState The current operational state of the EFI DHCPv4 Protocol\r
305a1279 113 driver.\r
d1f95000 114 @param Dhcp4Event The event that occurs in the current state, which usually means a\r
305a1279 115 state transition.\r
116 @param Packet The DHCP packet that is going to be sent or already received.\r
d1f95000 117 @param NewPacket The packet that is used to replace the above Packet.\r
305a1279 118\r
d1f95000 119 @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.\r
305a1279 120 @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol\r
d1f95000 121 driver will continue to wait for more DHCPOFFER packets until the retry\r
305a1279 122 timeout expires.\r
d1f95000 123 @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and\r
305a1279 124 return to the Dhcp4Init or Dhcp4InitReboot state.\r
125\r
d1f95000 126**/\r
305a1279 127typedef\r
128EFI_STATUS\r
8b13229b 129(EFIAPI *EFI_DHCP4_CALLBACK)(\r
d1f95000 130 IN EFI_DHCP4_PROTOCOL *This,\r
131 IN VOID *Context,\r
132 IN EFI_DHCP4_STATE CurrentState,\r
133 IN EFI_DHCP4_EVENT Dhcp4Event,\r
305a1279 134 IN EFI_DHCP4_PACKET *Packet OPTIONAL,\r
d1f95000 135 OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL\r
136 );\r
137\r
138\r
139typedef struct {\r
305a1279 140 UINT32 DiscoverTryCount;\r
d1f95000 141 UINT32 *DiscoverTimeout;\r
142 UINT32 RequestTryCount;\r
143 UINT32 *RequestTimeout;\r
144 EFI_IPv4_ADDRESS ClientAddress;\r
145 EFI_DHCP4_CALLBACK Dhcp4Callback;\r
146 void *CallbackContext;\r
147 UINT32 OptionCount;\r
148 EFI_DHCP4_PACKET_OPTION **OptionList;\r
149} EFI_DHCP4_CONFIG_DATA;\r
150\r
151\r
152typedef struct {\r
153 EFI_DHCP4_STATE State;\r
154 EFI_DHCP4_CONFIG_DATA ConfigData;\r
155 EFI_IPv4_ADDRESS ClientAddress;\r
156 EFI_MAC_ADDRESS ClientMacAddress;\r
157 EFI_IPv4_ADDRESS ServerAddress;\r
158 EFI_IPv4_ADDRESS RouterAddress;\r
159 EFI_IPv4_ADDRESS SubnetMask;\r
160 UINT32 LeaseTime;\r
161 EFI_DHCP4_PACKET *ReplyPacket;\r
162} EFI_DHCP4_MODE_DATA;\r
163\r
164\r
165typedef struct {\r
166 EFI_IPv4_ADDRESS ListenAddress;\r
167 EFI_IPv4_ADDRESS SubnetMask;\r
168 UINT16 ListenPort;\r
169} EFI_DHCP4_LISTEN_POINT;\r
170\r
171\r
172typedef struct {\r
305a1279 173 EFI_STATUS Status;\r
174 EFI_EVENT CompletionEvent;\r
175 EFI_IPv4_ADDRESS RemoteAddress;\r
176 UINT16 RemotePort;\r
177 EFI_IPv4_ADDRESS GatewayAddress;\r
178 UINT32 ListenPointCount;\r
179 EFI_DHCP4_LISTEN_POINT *ListenPoints;\r
180 UINT32 TimeoutValue;\r
181 EFI_DHCP4_PACKET *Packet;\r
182 UINT32 ResponseCount;\r
183 EFI_DHCP4_PACKET *ResponseList;\r
d1f95000 184} EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN;\r
185\r
186\r
187/**\r
188 Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.\r
189\r
190 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
191 @param Dhcp4ModeData Pointer to storage for the EFI_DHCP4_MODE_DATA structure.\r
192\r
193 @retval EFI_SUCCESS The mode data was returned.\r
194 @retval EFI_INVALID_PARAMETER This is NULL.\r
195\r
196**/\r
305a1279 197typedef\r
198EFI_STATUS\r
8b13229b 199(EFIAPI *EFI_DHCP4_GET_MODE_DATA)(\r
d1f95000 200 IN EFI_DHCP4_PROTOCOL *This,\r
201 OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData\r
202 )\r
203;\r
204\r
205/**\r
206 Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.\r
207\r
208 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
209 @param Dhcp4CfgData Pointer to the EFI_DHCP4_CONFIG_DATA.\r
210\r
211 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or\r
212 Dhcp4InitReboot state, if the original state of this driver\r
213 was Dhcp4Stopped and the value of Dhcp4CfgData was\r
214 not NULL. Otherwise, the state was left unchanged.\r
215 @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the\r
216 Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;\r
217 Or onother instance of this EFI DHCPv4 Protocol driver is already\r
218 in a valid configured state.\r
219 @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
220 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
221 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
222\r
223**/\r
305a1279 224typedef\r
d1f95000 225EFI_STATUS\r
8b13229b 226(EFIAPI *EFI_DHCP4_CONFIGURE)(\r
d1f95000 227 IN EFI_DHCP4_PROTOCOL *This,\r
228 IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL\r
229 )\r
230;\r
231\r
232\r
233/**\r
234 Starts the DHCP configuration process.\r
235\r
236 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
237 @param CompletionEvent If not NULL, indicates the event that will be signaled when the\r
238 EFI DHCPv4 Protocol driver is transferred into the\r
239 Dhcp4Bound state or when the DHCP process is aborted.\r
240 EFI_DHCP4_PROTOCOL.GetModeData() can be called to\r
241 check the completion status. If NULL,\r
242 EFI_DHCP4_PROTOCOL.Start() will wait until the driver\r
243 is transferred into the Dhcp4Bound state or the process fails.\r
244\r
245 @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed\r
246 when CompletionEvent is NULL.\r
247 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped\r
248 state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.\r
249 @retval EFI_INVALID_PARAMETER This is NULL.\r
250 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
251 @retval EFI_TIMEOUT The DHCP configuration process failed because no response was\r
252 received from the server within the specified timeout value.\r
253 @retval EFI_ABORTED The user aborted the DHCP process.\r
254 @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the\r
255 DHCP process.\r
256 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
257\r
258**/\r
305a1279 259typedef\r
d1f95000 260EFI_STATUS\r
8b13229b 261(EFIAPI *EFI_DHCP4_START)(\r
d1f95000 262 IN EFI_DHCP4_PROTOCOL *This,\r
263 IN EFI_EVENT CompletionEvent OPTIONAL\r
264 )\r
265;\r
266\r
267/**\r
268 Extends the lease time by sending a request packet.\r
269\r
270 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
271 @param RebindRequest If TRUE, this function broadcasts the request packets and enters\r
272 the Dhcp4Rebinding state. Otherwise, it sends a unicast\r
273 request packet and enters the Dhcp4Renewing state.\r
274 @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase\r
275 completes or some error occurs.\r
276 EFI_DHCP4_PROTOCOL.GetModeData() can be called to\r
277 check the completion status. If NULL,\r
278 EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait\r
279 until the DHCP process finishes.\r
280\r
281 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the\r
282 Dhcp4Renewing state or is back to the Dhcp4Bound state.\r
283 @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped\r
284 state. EFI_DHCP4_PROTOCOL.Configure() needs to\r
285 be called.\r
286 @retval EFI_INVALID_PARAMETER This is NULL.\r
287 @retval EFI_TIMEOUT There was no response from the server when the try count was\r
288 exceeded.\r
289 @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state.\r
290 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
291\r
292**/\r
293typedef\r
294EFI_STATUS\r
8b13229b 295(EFIAPI *EFI_DHCP4_RENEW_REBIND)(\r
d1f95000 296 IN EFI_DHCP4_PROTOCOL *This,\r
297 IN BOOLEAN RebindRequest,\r
298 IN EFI_EVENT CompletionEvent OPTIONAL\r
299 )\r
305a1279 300;\r
d1f95000 301\r
302/**\r
303 Releases the current address configuration.\r
304\r
305 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
306\r
307 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.\r
308 @retval EFI_INVALID_PARAMETER This is NULL.\r
309 @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.\r
310 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
311\r
312**/\r
305a1279 313typedef\r
d1f95000 314EFI_STATUS\r
8b13229b 315(EFIAPI *EFI_DHCP4_RELEASE)(\r
d1f95000 316 IN EFI_DHCP4_PROTOCOL *This\r
317 )\r
305a1279 318;\r
d1f95000 319\r
320/**\r
321 Stops the current address configuration.\r
322\r
323 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
305a1279 324\r
d1f95000 325 @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.\r
326 @retval EFI_INVALID_PARAMETER This is NULL.\r
327\r
328**/\r
305a1279 329typedef\r
d1f95000 330EFI_STATUS\r
8b13229b 331(EFIAPI *EFI_DHCP4_STOP)(\r
d1f95000 332 IN EFI_DHCP4_PROTOCOL *This\r
333 )\r
305a1279 334;\r
d1f95000 335\r
336/**\r
337 Builds a DHCP packet, given the options to be appended or deleted or replaced.\r
338\r
339 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
305a1279 340 @param SeedPacket Initial packet to be used as a base for building new packet.\r
d1f95000 341 @param DeleteCount Number of opcodes in the DeleteList.\r
342 @param DeleteList List of opcodes to be deleted from the seed packet.\r
343 Ignored if DeleteCount is zero.\r
344 @param AppendCount Number of entries in the OptionList.\r
345 @param AppendList Pointer to a DHCP option list to be appended to SeedPacket.\r
346 If SeedPacket also contains options in this list, they are\r
347 replaced by new options (except pad option). Ignored if\r
348 AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION\r
349 @param NewPacket Pointer to storage for the pointer to the new allocated packet.\r
350 Use the EFI Boot Service FreePool() on the resulting pointer\r
351 when done with the packet.\r
352\r
353 @retval EFI_SUCCESS The new packet was built.\r
354 @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated.\r
355 @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
356\r
357**/\r
358typedef\r
359EFI_STATUS\r
8b13229b 360(EFIAPI *EFI_DHCP4_BUILD)(\r
d1f95000 361 IN EFI_DHCP4_PROTOCOL *This,\r
362 IN EFI_DHCP4_PACKET *SeedPacket,\r
363 IN UINT32 DeleteCount,\r
364 IN UINT8 *DeleteList OPTIONAL,\r
365 IN UINT32 AppendCount,\r
366 IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,\r
367 OUT EFI_DHCP4_PACKET **NewPacket\r
83e6e9d5 368 )\r
305a1279 369;\r
d1f95000 370/**\r
371 Transmits a DHCP formatted packet and optionally waits for responses.\r
372\r
373 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
374 @param Token Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.\r
375\r
376 @retval EFI_SUCCESS The packet was successfully queued for transmission.\r
377 @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
378 @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call\r
379 this function after collection process completes.\r
380 @retval EFI_NO_MAPPING The default station address is not available yet.\r
381 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
382 @retval Others Some other unexpected error occurred.\r
383\r
384**/\r
305a1279 385typedef\r
d1f95000 386EFI_STATUS\r
8b13229b 387(EFIAPI *EFI_DHCP4_TRANSMIT_RECEIVE)(\r
d1f95000 388 IN EFI_DHCP4_PROTOCOL *This,\r
389 IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token\r
390 )\r
391;\r
392\r
393\r
394/**\r
395 Parses the packed DHCP option data.\r
396\r
397 @param This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
398 @param Packet Pointer to packet to be parsed.\r
399 @param OptionCount On input, the number of entries in the PacketOptionList.\r
400 On output, the number of entries that were written into the\r
401 PacketOptionList.\r
402 @param PacketOptionList List of packet option entries to be filled in. End option or pad\r
403 options are not included.\r
404\r
405 @retval EFI_SUCCESS The packet was successfully parsed.\r
406 @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
407 @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE:\r
408 1) *OptionCount is smaller than the number of options that\r
409 were found in the Packet.\r
410 2) PacketOptionList is NULL.\r
411\r
412**/\r
413typedef\r
414EFI_STATUS\r
8b13229b 415(EFIAPI *EFI_DHCP4_PARSE)(\r
d1f95000 416 IN EFI_DHCP4_PROTOCOL *This,\r
417 IN EFI_DHCP4_PACKET *Packet,\r
418 IN OUT UINT32 *OptionCount,\r
419 OUT EFI_DHCP4_PACKET_OPTION *PacketOptionList[] OPTIONAL\r
420 )\r
421;\r
422\r
423\r
424struct _EFI_DHCP4_PROTOCOL {\r
425 EFI_DHCP4_GET_MODE_DATA GetModeData;\r
426 EFI_DHCP4_CONFIGURE Configure;\r
427 EFI_DHCP4_START Start;\r
428 EFI_DHCP4_RENEW_REBIND RenewRebind;\r
429 EFI_DHCP4_RELEASE Release;\r
430 EFI_DHCP4_STOP Stop;\r
431 EFI_DHCP4_BUILD Build;\r
432 EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive;\r
433 EFI_DHCP4_PARSE Parse;\r
434};\r
435\r
436extern EFI_GUID gEfiDhcp4ProtocolGuid;\r
437extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid;\r
438\r
439#endif\r