]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Dhcp6.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / Dhcp6.h
CommitLineData
5d6a636c 1/** @file\r
2 UEFI Dynamic Host Configuration Protocol 6 Definition, which is used to get IPv6\r
3 addresses and other configuration parameters from DHCPv6 servers.\r
4\r
9095d37b 5 Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9095d37b
LG
7\r
8 @par Revision Reference:\r
5899caf0 9 This Protocol is introduced in UEFI Specification 2.2\r
5d6a636c 10\r
11**/\r
12\r
13#ifndef __EFI_DHCP6_PROTOCOL_H__\r
14#define __EFI_DHCP6_PROTOCOL_H__\r
15\r
16#define EFI_DHCP6_PROTOCOL_GUID \\r
17 { \\r
18 0x87c8bad7, 0x595, 0x4053, {0x82, 0x97, 0xde, 0xde, 0x39, 0x5f, 0x5d, 0x5b } \\r
19 }\r
20\r
21#define EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID \\r
22 { \\r
23 0x9fb9a8a1, 0x2f4a, 0x43a6, {0x88, 0x9c, 0xd0, 0xf7, 0xb6, 0xc4, 0x7a, 0xd5 } \\r
24 }\r
25\r
26typedef struct _EFI_DHCP6_PROTOCOL EFI_DHCP6_PROTOCOL;\r
27\r
9095d37b 28typedef enum {\r
5d6a636c 29 ///\r
9095d37b 30 /// The EFI DHCPv6 Protocol instance is configured, and start() needs\r
5d6a636c 31 /// to be called\r
32 ///\r
33 Dhcp6Init = 0x0,\r
34 ///\r
35 /// A Solicit packet is sent out to discover DHCPv6 server, and the EFI\r
36 /// DHCPv6 Protocol instance is collecting Advertise packets.\r
37 ///\r
38 Dhcp6Selecting = 0x1,\r
39 ///\r
9095d37b 40 /// A Request is sent out to the DHCPv6 server, and the EFI DHCPv6\r
5d6a636c 41 /// Protocol instance is waiting for Reply packet.\r
42 ///\r
43 Dhcp6Requesting = 0x2,\r
44 ///\r
45 /// A Decline packet is sent out to indicate one or more addresses of the\r
46 /// configured IA are in use by another node, and the EFI DHCPv6.\r
47 /// Protocol instance is waiting for Reply packet.\r
48 ///\r
49 Dhcp6Declining = 0x3,\r
50 ///\r
9095d37b 51 /// A Confirm packet is sent out to confirm the IPv6 addresses of the\r
5d6a636c 52 /// configured IA, and the EFI DHCPv6 Protocol instance is waiting for Reply packet.\r
53 ///\r
54 Dhcp6Confirming = 0x4,\r
55 ///\r
56 /// A Release packet is sent out to release one or more IPv6 addresses of\r
57 /// the configured IA, and the EFI DHCPv6 Protocol instance is waiting for Reply packet.\r
58 ///\r
59 Dhcp6Releasing = 0x5,\r
60 ///\r
61 /// The DHCPv6 S.A.R.R process is completed for the configured IA.\r
62 ///\r
63 Dhcp6Bound = 0x6,\r
64 ///\r
65 /// A Renew packet is sent out to extend lifetime for the IPv6 addresses of\r
66 /// the configured IA, and the EFI DHCPv6 Protocol instance is waiting for Reply packet.\r
67 ///\r
68 Dhcp6Renewing = 0x7,\r
69 ///\r
70 /// A Rebind packet is sent out to extend lifetime for the IPv6 addresses of\r
71 /// the configured IA, and the EFI DHCPv6 Protocol instance is waiting for Reply packet.\r
72 ///\r
73 Dhcp6Rebinding = 0x8\r
74} EFI_DHCP6_STATE;\r
75\r
76typedef enum {\r
9095d37b 77 ///\r
5d6a636c 78 /// A Solicit packet is about to be sent. The packet is passed to Dhcp6Callback and\r
79 /// can be modified or replaced in Dhcp6Callback.\r
80 ///\r
81 Dhcp6SendSolicit = 0x0,\r
9095d37b 82 ///\r
5d6a636c 83 /// An Advertise packet is received and will be passed to Dhcp6Callback.\r
84 ///\r
85 Dhcp6RcvdAdvertise = 0x1,\r
9095d37b 86 ///\r
5d6a636c 87 /// It is time for Dhcp6Callback to determine whether select the default Advertise\r
88 /// packet by RFC 3315 policy, or overwrite it by specific user policy.\r
89 ///\r
90 Dhcp6SelectAdvertise = 0x2,\r
9095d37b 91 ///\r
5d6a636c 92 /// A Request packet is about to be sent. The packet is passed to Dhcp6Callback and\r
93 /// can be modified or replaced in Dhcp6Callback.\r
94 ///\r
95 Dhcp6SendRequest = 0x3,\r
9095d37b 96 ///\r
5d6a636c 97 /// A Reply packet is received and will be passed to Dhcp6Callback.\r
98 ///\r
99 Dhcp6RcvdReply = 0x4,\r
9095d37b 100 ///\r
5d6a636c 101 /// A Reconfigure packet is received and will be passed to Dhcp6Callback.\r
102 ///\r
103 Dhcp6RcvdReconfigure = 0x5,\r
9095d37b 104 ///\r
5d6a636c 105 /// A Decline packet is about to be sent. The packet is passed to Dhcp6Callback and\r
106 /// can be modified or replaced in Dhcp6Callback.\r
107 ///\r
108 Dhcp6SendDecline = 0x6,\r
9095d37b 109 ///\r
5d6a636c 110 /// A Confirm packet is about to be sent. The packet is passed to Dhcp6Callback and\r
111 /// can be modified or replaced in Dhcp6Callback.\r
112 ///\r
113 Dhcp6SendConfirm = 0x7,\r
9095d37b 114 ///\r
5d6a636c 115 /// A Release packet is about to be sent. The packet is passed to Dhcp6Callback and\r
116 /// can be modified or replaced in Dhcp6Callback.\r
117 ///\r
118 Dhcp6SendRelease = 0x8,\r
9095d37b 119 ///\r
5d6a636c 120 /// A Renew packet is about to be sent. The packet is passed to Dhcp6Callback and\r
9095d37b 121 /// can be modified or replaced in Dhcp6Callback.\r
5d6a636c 122 ///\r
123 Dhcp6EnterRenewing = 0x9,\r
9095d37b
LG
124 ///\r
125 /// A Rebind packet is about to be sent. The packet is passed to Dhcp6Callback and\r
5d6a636c 126 /// can be modified or replaced in Dhcp6Callback.\r
127 ///\r
128 Dhcp6EnterRebinding = 0xa\r
129} EFI_DHCP6_EVENT;\r
130\r
131///\r
132/// An IA which carries assigned not temporary address.\r
133///\r
134#define EFI_DHCP6_IA_TYPE_NA 3\r
135///\r
136/// An IA which carries assigned temporary address.\r
137///\r
138#define EFI_DHCP6_IA_TYPE_TA 4\r
139\r
140#pragma pack(1)\r
abbfadd7 141///\r
142/// EFI_DHCP6_PACKET_OPTION\r
143/// defines the format of the DHCPv6 option, See RFC 3315 for more information.\r
9095d37b 144/// This data structure is used to reference option data that is packed in the DHCPv6 packet.\r
abbfadd7 145///\r
5d6a636c 146typedef struct {\r
147 ///\r
abbfadd7 148 /// The DHCPv6 option code, stored in network order.\r
5d6a636c 149 ///\r
150 UINT16 OpCode;\r
151 ///\r
abbfadd7 152 /// Length of the DHCPv6 option data, stored in network order.\r
153 /// From the first byte to the last byte of the Data field.\r
5d6a636c 154 ///\r
155 UINT16 OpLen;\r
156 ///\r
abbfadd7 157 /// The data for the DHCPv6 option, stored in network order.\r
5d6a636c 158 ///\r
159 UINT8 Data[1];\r
160} EFI_DHCP6_PACKET_OPTION;\r
161\r
abbfadd7 162///\r
163/// EFI_DHCP6_HEADER\r
9095d37b 164/// defines the format of the DHCPv6 header. See RFC 3315 for more information.\r
abbfadd7 165///\r
5d6a636c 166typedef struct{\r
167 ///\r
168 /// The DHCPv6 transaction ID.\r
169 ///\r
170 UINT32 MessageType:8;\r
171 ///\r
172 /// The DHCPv6 message type.\r
173 ///\r
174 UINT32 TransactionId:24;\r
175} EFI_DHCP6_HEADER;\r
176\r
abbfadd7 177///\r
9095d37b 178/// EFI_DHCP6_PACKET\r
abbfadd7 179/// defines the format of the DHCPv6 packet. See RFC 3315 for more information.\r
180///\r
5d6a636c 181typedef struct {\r
182 ///\r
183 /// Size of the EFI_DHCP6_PACKET buffer.\r
184 ///\r
185 UINT32 Size;\r
186 ///\r
187 /// Length of the EFI_DHCP6_PACKET from the first byte of the Header field to the last\r
188 /// byte of the Option[] field.\r
189 ///\r
190 UINT32 Length;\r
191 struct{\r
192 ///\r
193 /// The DHCPv6 packet header.\r
194 ///\r
195 EFI_DHCP6_HEADER Header;\r
196 ///\r
197 /// Start of the DHCPv6 packed option data.\r
198 ///\r
199 UINT8 Option[1];\r
200 } Dhcp6;\r
201} EFI_DHCP6_PACKET;\r
202\r
203#pragma pack()\r
204\r
205typedef struct {\r
206 ///\r
207 /// Length of DUID in octects.\r
208 ///\r
209 UINT16 Length;\r
210 ///\r
211 /// Array of DUID octects.\r
212 ///\r
213 UINT8 Duid[1];\r
214} EFI_DHCP6_DUID;\r
215\r
216typedef struct {\r
217 ///\r
218 /// Initial retransmission timeout.\r
219 ///\r
220 UINT32 Irt;\r
221 ///\r
9095d37b 222 /// Maximum retransmission count for one packet. If Mrc is zero, there's no upper limit\r
5d6a636c 223 /// for retransmission count.\r
224 ///\r
225 UINT32 Mrc;\r
226 ///\r
9095d37b
LG
227 /// Maximum retransmission timeout for each retry. It's the upper bound of the number of\r
228 /// retransmission timeout. If Mrt is zero, there is no upper limit for retransmission\r
5d6a636c 229 /// timeout.\r
230 ///\r
231 UINT32 Mrt;\r
232 ///\r
9095d37b
LG
233 /// Maximum retransmission duration for one packet. It's the upper bound of the numbers\r
234 /// the client may retransmit a message. If Mrd is zero, there's no upper limit for\r
5d6a636c 235 /// retransmission duration.\r
236 ///\r
237 UINT32 Mrd;\r
238} EFI_DHCP6_RETRANSMISSION;\r
239\r
240typedef struct {\r
241 ///\r
242 /// The IPv6 address.\r
243 ///\r
244 EFI_IPv6_ADDRESS IpAddress;\r
245 ///\r
246 /// The preferred lifetime in unit of seconds for the IPv6 address.\r
247 ///\r
248 UINT32 PreferredLifetime;\r
249 ///\r
250 /// The valid lifetime in unit of seconds for the IPv6 address.\r
251 ///\r
252 UINT32 ValidLifetime;\r
253} EFI_DHCP6_IA_ADDRESS;\r
254\r
255typedef struct {\r
256 UINT16 Type; ///< Type for an IA.\r
257 UINT32 IaId; ///< The identifier for an IA.\r
258} EFI_DHCP6_IA_DESCRIPTOR;\r
259\r
260typedef struct {\r
261 ///\r
262 /// The descriptor for IA.\r
263 ///\r
264 EFI_DHCP6_IA_DESCRIPTOR Descriptor;\r
265 ///\r
266 /// The state of the configured IA.\r
267 ///\r
268 EFI_DHCP6_STATE State;\r
269 ///\r
270 /// Pointer to the cached latest Reply packet. May be NULL if no packet is cached.\r
271 ///\r
272 EFI_DHCP6_PACKET *ReplyPacket;\r
273 ///\r
274 /// Number of IPv6 addresses of the configured IA.\r
275 ///\r
276 UINT32 IaAddressCount;\r
277 ///\r
9095d37b 278 /// List of the IPv6 addresses of the configured IA. When the state of the configured IA is\r
5d6a636c 279 /// in Dhcp6Bound, Dhcp6Renewing and Dhcp6Rebinding, the IPv6 addresses are usable.\r
280 ///\r
281 EFI_DHCP6_IA_ADDRESS IaAddress[1];\r
282} EFI_DHCP6_IA;\r
283\r
284typedef struct {\r
285 ///\r
286 /// Pointer to the DHCPv6 unique identifier. The caller is responsible for freeing this buffer.\r
287 ///\r
288 EFI_DHCP6_DUID *ClientId;\r
289 ///\r
290 /// Pointer to the configured IA of current instance. The caller can free this buffer after\r
291 /// using it.\r
292 ///\r
293 EFI_DHCP6_IA *Ia;\r
294} EFI_DHCP6_MODE_DATA;\r
295\r
296/**\r
9095d37b 297 EFI_DHCP6_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol instance to\r
5d6a636c 298 intercept events that occurs in the DHCPv6 S.A.R.R process.\r
299\r
9095d37b 300 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance that is used to configure this\r
5d6a636c 301 callback function.\r
302 @param[in] Context Pointer to the context that is initialized by EFI_DHCP6_PROTOCOL.Configure().\r
303 @param[in] CurrentState The current state of the configured IA.\r
304 @param[in] Dhcp6Event The event that occurs in the current state, which usually means a state transition.\r
305 @param[in] Packet Pointer to the DHCPv6 packet that is about to be sent or has been received.\r
9095d37b
LG
306 The EFI DHCPv6 Protocol instance is responsible for freeing the buffer.\r
307 @param[out] NewPacket Pointer to the new DHCPv6 packet to overwrite the Packet. NewPacket can not\r
308 share the buffer with Packet. If *NewPacket is not NULL, the EFI DHCPv6\r
5d6a636c 309 Protocol instance is responsible for freeing the buffer.\r
310\r
311 @retval EFI_SUCCESS Tell the EFI DHCPv6 Protocol instance to continue the DHCPv6 S.A.R.R process.\r
9095d37b 312 @retval EFI_ABORTED Tell the EFI DHCPv6 Protocol instance to abort the DHCPv6 S.A.R.R process,\r
5d6a636c 313 and the state of the configured IA will be transferred to Dhcp6Init.\r
314\r
315**/\r
9095d37b
LG
316typedef\r
317EFI_STATUS\r
66c95e79 318(EFIAPI *EFI_DHCP6_CALLBACK)(\r
5d6a636c 319 IN EFI_DHCP6_PROTOCOL *This,\r
320 IN VOID *Context,\r
321 IN EFI_DHCP6_STATE CurrentState,\r
322 IN EFI_DHCP6_EVENT Dhcp6Event,\r
9095d37b 323 IN EFI_DHCP6_PACKET *Packet,\r
5d6a636c 324 OUT EFI_DHCP6_PACKET **NewPacket OPTIONAL\r
325 );\r
326\r
327typedef struct {\r
328 ///\r
9095d37b 329 /// The callback function is to intercept various events that occur in the DHCPv6 S.A.R.R\r
5d6a636c 330 /// process. Set to NULL to ignore all those events.\r
331 ///\r
332 EFI_DHCP6_CALLBACK Dhcp6Callback;\r
333 ///\r
334 /// Pointer to the context that will be passed to Dhcp6Callback.\r
335 ///\r
336 VOID *CallbackContext;\r
337 ///\r
338 /// Number of the DHCPv6 options in the OptionList.\r
339 ///\r
340 UINT32 OptionCount;\r
341 ///\r
9095d37b
LG
342 /// List of the DHCPv6 options to be included in Solicit and Request packet. The buffer\r
343 /// can be freed after EFI_DHCP6_PROTOCOL.Configure() returns. Ignored if\r
344 /// OptionCount is zero. OptionList should not contain Client Identifier option\r
345 /// and any IA option, which will be appended by EFI DHCPv6 Protocol instance\r
346 /// automatically.\r
5d6a636c 347 ///\r
348 EFI_DHCP6_PACKET_OPTION **OptionList;\r
349 ///\r
350 /// The descriptor for the IA of the EFI DHCPv6 Protocol instance.\r
351 ///\r
352 EFI_DHCP6_IA_DESCRIPTOR IaDescriptor;\r
353 ///\r
9095d37b
LG
354 /// If not NULL, the event will be signaled when any IPv6 address information of the\r
355 /// configured IA is updated, including IPv6 address, preferred lifetime and valid\r
356 /// lifetime, or the DHCPv6 S.A.R.R process fails. Otherwise, Start(),\r
357 /// renewrebind(), decline(), release() and stop() will be blocking\r
5d6a636c 358 /// operations, and they will wait for the exchange process completion or failure.\r
359 ///\r
360 EFI_EVENT IaInfoEvent;\r
361 ///\r
9095d37b
LG
362 /// If TRUE, the EFI DHCPv6 Protocol instance is willing to accept Reconfigure packet.\r
363 /// Otherwise, it will ignore it. Reconfigure Accept option can not be specified through\r
5d6a636c 364 /// OptionList parameter.\r
365 ///\r
366 BOOLEAN ReconfigureAccept;\r
367 ///\r
9095d37b
LG
368 /// If TRUE, the EFI DHCPv6 Protocol instance will send Solicit packet with Rapid\r
369 /// Commit option. Otherwise, Rapid Commit option will not be included in Solicit\r
5d6a636c 370 /// packet. Rapid Commit option can not be specified through OptionList parameter.\r
371 ///\r
372 BOOLEAN RapidCommit;\r
373 ///\r
9095d37b 374 /// Parameter to control Solicit packet retransmission behavior. The\r
5d6a636c 375 /// buffer can be freed after EFI_DHCP6_PROTOCOL.Configure() returns.\r
376 ///\r
377 EFI_DHCP6_RETRANSMISSION *SolicitRetransmission;\r
378} EFI_DHCP6_CONFIG_DATA;\r
379\r
380/**\r
9095d37b 381 EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol\r
5d6a636c 382 instance to intercept events that occurs in the DHCPv6 Information Request exchange process.\r
383\r
9095d37b 384 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance that is used to configure this\r
5d6a636c 385 callback function.\r
386 @param[in] Context Pointer to the context that is initialized in the EFI_DHCP6_PROTOCOL.InfoRequest().\r
9095d37b 387 @param[in] Packet Pointer to Reply packet that has been received. The EFI DHCPv6 Protocol instance is\r
5d6a636c 388 responsible for freeing the buffer.\r
389\r
390 @retval EFI_SUCCESS Tell the EFI DHCPv6 Protocol instance to finish Information Request exchange process.\r
391 @retval EFI_NOT_READY Tell the EFI DHCPv6 Protocol instance to continue Information Request exchange process.\r
392 @retval EFI_ABORTED Tell the EFI DHCPv6 Protocol instance to abort the Information Request exchange process.\r
393\r
394**/\r
395typedef\r
396EFI_STATUS\r
66c95e79 397(EFIAPI *EFI_DHCP6_INFO_CALLBACK)(\r
5d6a636c 398 IN EFI_DHCP6_PROTOCOL *This,\r
399 IN VOID *Context,\r
400 IN EFI_DHCP6_PACKET *Packet\r
401 );\r
402\r
403/**\r
404 Retrieve the current operating mode data and configuration data for the EFI DHCPv6 Protocol instance.\r
405\r
406 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance.\r
9095d37b 407 @param[out] Dhcp6ModeData Pointer to the DHCPv6 mode data structure. The caller is responsible for freeing this\r
5d6a636c 408 structure and each reference buffer.\r
9095d37b 409 @param[out] Dhcp6ConfigData Pointer to the DHCPv6 configuration data structure. The caller is responsible for\r
5d6a636c 410 freeing this structure and each reference buffer.\r
411\r
412 @retval EFI_SUCCESS The mode data was returned.\r
413 @retval EFI_ACCESS_DENIED The EFI DHCPv6 Protocol instance has not been configured when Dhcp6ConfigData is not NULL.\r
414 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
9095d37b 415 - This is NULL.\r
5d6a636c 416 - Both Dhcp6ConfigData and Dhcp6ModeData are NULL.\r
417\r
418**/\r
9095d37b
LG
419typedef\r
420EFI_STATUS\r
5d6a636c 421(EFIAPI *EFI_DHCP6_GET_MODE_DATA)(\r
422 IN EFI_DHCP6_PROTOCOL *This,\r
423 OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,\r
424 OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL\r
425 );\r
426\r
427/**\r
428 Initialize or clean up the configuration data for the EFI DHCPv6 Protocol instance.\r
429\r
9095d37b 430 The Configure() function is used to initialize or clean up the configuration data of the EFI\r
5d6a636c 431 DHCPv6 Protocol instance.\r
9095d37b
LG
432 - When Dhcp6CfgData is not NULL and Configure() is called successfully, the\r
433 configuration data will be initialized in the EFI DHCPv6 Protocol instance and the state of the\r
5d6a636c 434 configured IA will be transferred into Dhcp6Init.\r
9095d37b 435 - When Dhcp6CfgData is NULL and Configure() is called successfully, the configuration\r
5d6a636c 436 data will be cleaned up and no IA will be associated with the EFI DHCPv6 Protocol instance.\r
437\r
9095d37b 438 To update the configuration data for an EFI DCHPv6 Protocol instance, the original data must be\r
5d6a636c 439 cleaned up before setting the new configuration data.\r
440\r
441 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance.\r
442 @param[in] Dhcp6CfgData Pointer to the DHCPv6 configuration data structure.\r
443\r
444 @retval EFI_SUCCESS The mode data was returned.\r
445 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE\r
9095d37b 446 - This is NULL.\r
5d6a636c 447 - OptionCount > 0 and OptionList is NULL.\r
448 - OptionList is not NULL, and Client Id option, Reconfigure Accept option,\r
449 Rapid Commit option or any IA option is specified in the OptionList.\r
450 - IaDescriptor.Type is neither EFI_DHCP6_IA_TYPE_NA nor EFI_DHCP6_IA_TYPE_NA.\r
451 - IaDescriptor is not unique.\r
452 - Both IaInfoEvent and SolicitRetransimssion are NULL.\r
9095d37b 453 - SolicitRetransmission is not NULL, and both SolicitRetransimssion->Mrc and\r
5d6a636c 454 SolicitRetransmission->Mrd are zero.\r
9095d37b 455 @retval EFI_ACCESS_DENIED The EFI DHCPv6 Protocol instance has been already configured\r
5d6a636c 456 when Dhcp6CfgData is not NULL.\r
9095d37b 457 The EFI DHCPv6 Protocol instance has already started the\r
5d6a636c 458 DHCPv6 S.A.R.R when Dhcp6CfgData is NULL.\r
459 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
460 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
461\r
462**/\r
9095d37b 463typedef\r
5d6a636c 464EFI_STATUS\r
465(EFIAPI *EFI_DHCP6_CONFIGURE)(\r
466 IN EFI_DHCP6_PROTOCOL *This,\r
467 IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL\r
468 );\r
469\r
470/**\r
471 Start the DHCPv6 S.A.R.R process.\r
472\r
9095d37b 473 The Start() function starts the DHCPv6 S.A.R.R process. This function can be called only when\r
5d6a636c 474 the state of the configured IA is in the Dhcp6Init state. If the DHCPv6 S.A.R.R process completes\r
9095d37b
LG
475 successfully, the state of the configured IA will be transferred through Dhcp6Selecting and\r
476 Dhcp6Requesting to Dhcp6Bound state. The update of the IPv6 addresses will be notified through\r
477 EFI_DHCP6_CONFIG_DATA.IaInfoEvent. At the time when each event occurs in this process, the\r
478 callback function set by EFI_DHCP6_PROTOCOL.Configure() will be called and the user can take\r
479 this opportunity to control the process. If EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL, the\r
5d6a636c 480 Start() function call is a blocking operation. It will return after the DHCPv6 S.A.R.R process\r
481 completes or aborted by users. If the process is aborted by system or network error, the state of\r
482 the configured IA will be transferred to Dhcp6Init. The Start() function can be called again to\r
483 restart the process.\r
484\r
485 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance.\r
486\r
9095d37b
LG
487 @retval EFI_SUCCESS The DHCPv6 S.A.R.R process is completed and at least one IPv6\r
488 address has been bound to the configured IA when\r
489 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL.\r
490 The DHCPv6 S.A.R.R process is started when\r
5d6a636c 491 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
17664848 492 @retval EFI_ACCESS_DENIED The EFI DHCPv6 Child instance hasn't been configured.\r
5d6a636c 493 @retval EFI_INVALID_PARAMETER This is NULL.\r
494 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
495 @retval EFI_ALREADY_STARTED The DHCPv6 S.A.R.R process has already started.\r
496 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
497 @retval EFI_NO_RESPONSE The DHCPv6 S.A.R.R process failed because of no response.\r
9095d37b 498 @retval EFI_NO_MAPPING No IPv6 address has been bound to the configured IA after the\r
5d6a636c 499 DHCPv6 S.A.R.R process.\r
500 @retval EFI_ABORTED The DHCPv6 S.A.R.R process aborted by user.\r
c5c3e7e2 501 @retval EFI_NO_MEDIA There was a media error.\r
5d6a636c 502\r
503**/\r
9095d37b 504typedef\r
5d6a636c 505EFI_STATUS\r
506(EFIAPI *EFI_DHCP6_START)(\r
507 IN EFI_DHCP6_PROTOCOL *This\r
508 );\r
509\r
510/**\r
511 Request configuration information without the assignment of any IA addresses of the client.\r
512\r
513 The InfoRequest() function is used to request configuration information without the assignment\r
9095d37b
LG
514 of any IPv6 address of the client. Client sends out Information Request packet to obtain\r
515 the required configuration information, and DHCPv6 server responds with Reply packet containing\r
516 the information for the client. The received Reply packet will be passed to the user by\r
5d6a636c 517 ReplyCallback function. If user returns EFI_NOT_READY from ReplyCallback, the EFI DHCPv6\r
9095d37b
LG
518 Protocol instance will continue to receive other Reply packets unless timeout according to\r
519 the Retransmission parameter. Otherwise, the Information Request exchange process will be\r
5d6a636c 520 finished successfully if user returns EFI_SUCCESS from ReplyCallback.\r
521\r
522 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance.\r
523 @param[in] SendClientId If TRUE, the EFI DHCPv6 Protocol instance will build Client\r
524 Identifier option and include it into Information Request\r
525 packet. If FALSE, Client Identifier option will not be included.\r
9095d37b 526 Client Identifier option can not be specified through OptionList\r
5d6a636c 527 parameter.\r
528 @param[in] OptionRequest Pointer to the Option Request option in the Information Request\r
529 packet. Option Request option can not be specified through\r
530 OptionList parameter.\r
531 @param[in] OptionCount Number of options in OptionList.\r
532 @param[in] OptionList List of other DHCPv6 options. These options will be appended\r
533 to the Option Request option. The caller is responsible for\r
534 freeing this buffer. Type is defined in EFI_DHCP6_PROTOCOL.GetModeData().\r
535 @param[in] Retransmission Parameter to control Information Request packet retransmission\r
536 behavior. The buffer can be freed after EFI_DHCP6_PROTOCOL.InfoRequest()\r
537 returns.\r
538 @param[in] TimeoutEvent If not NULL, this event is signaled when the information request\r
539 exchange aborted because of no response. If NULL, the function\r
9095d37b 540 call is a blocking operation; and it will return after the\r
5d6a636c 541 information-request exchange process finish or aborted by users.\r
542 @param[in] ReplyCallback The callback function is to intercept various events that occur\r
543 in the Information Request exchange process. It should not be\r
544 set to NULL.\r
545 @param[in] CallbackContext Pointer to the context that will be passed to ReplyCallback.\r
546\r
9095d37b
LG
547 @retval EFI_SUCCESS The DHCPv6 S.A.R.R process is completed and at least one IPv6\r
548 @retval EFI_SUCCESS The DHCPv6 information request exchange process completed\r
5d6a636c 549 when TimeoutEvent is NULL. Information Request packet has been\r
550 sent to DHCPv6 server when TimeoutEvent is not NULL.\r
551 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
9095d37b 552 - This is NULL.\r
5d6a636c 553 - OptionRequest is NULL or OptionRequest->OpCode is invalid.\r
554 - OptionCount > 0 and OptionList is NULL.\r
9095d37b 555 - OptionList is not NULL, and Client Identify option or\r
5d6a636c 556 Option Request option is specified in the OptionList.\r
557 - Retransimssion is NULL.\r
558 - Both Retransimssion->Mrc and Retransmission->Mrd are zero.\r
559 - ReplyCallback is NULL.\r
560 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
9095d37b
LG
561 @retval EFI_NO_RESPONSE The DHCPv6 information request exchange process failed\r
562 because of no response, or not all requested-options are\r
5d6a636c 563 responded by DHCPv6 servers when Timeout happened.\r
564 @retval EFI_ABORTED The DHCPv6 information request exchange process aborted by user.\r
565\r
566**/\r
567typedef\r
568EFI_STATUS\r
569(EFIAPI *EFI_DHCP6_INFO_REQUEST)(\r
570 IN EFI_DHCP6_PROTOCOL *This,\r
571 IN BOOLEAN SendClientId,\r
572 IN EFI_DHCP6_PACKET_OPTION *OptionRequest,\r
573 IN UINT32 OptionCount,\r
574 IN EFI_DHCP6_PACKET_OPTION *OptionList[] OPTIONAL,\r
9095d37b 575 IN EFI_DHCP6_RETRANSMISSION *Retransmission,\r
5d6a636c 576 IN EFI_EVENT TimeoutEvent OPTIONAL,\r
577 IN EFI_DHCP6_INFO_CALLBACK ReplyCallback,\r
578 IN VOID *CallbackContext OPTIONAL\r
579 );\r
580\r
581/**\r
582 Manually extend the valid and preferred lifetimes for the IPv6 addresses of the configured\r
583 IA and update other configuration parameters by sending Renew or Rebind packet.\r
584\r
9095d37b
LG
585 The RenewRebind() function is used to manually extend the valid and preferred lifetimes for the\r
586 IPv6 addresses of the configured IA and update other configuration parameters by sending Renew or\r
587 Rebind packet.\r
588 - When RebindRequest is FALSE and the state of the configured IA is Dhcp6Bound, it\r
589 will send Renew packet to the previously DHCPv6 server and transfer the state of the configured\r
590 IA to Dhcp6Renewing. If valid Reply packet received, the state transfers to Dhcp6Bound\r
591 and the valid and preferred timer restarts. If fails, the state transfers to Dhcp6Bound but the\r
592 timer continues.\r
593 - When RebindRequest is TRUE and the state of the configured IA is Dhcp6Bound, it will\r
594 send Rebind packet. If valid Reply packet received, the state transfers to Dhcp6Bound and the\r
17664848 595 valid and preferred timer restarts. If fails, the state transfers to Dhcp6Init and the IA can't\r
5d6a636c 596 be used.\r
597\r
598 @param[in] This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
9095d37b 599 @param[in] RebindRequest If TRUE, it will send Rebind packet and enter the Dhcp6Rebinding state.\r
5d6a636c 600 Otherwise, it will send Renew packet and enter the Dhcp6Renewing state.\r
601\r
9095d37b 602 @retval EFI_SUCCESS The DHCPv6 renew/rebind exchange process has completed and at\r
5d6a636c 603 least one IPv6 address of the configured IA has been bound again\r
9095d37b
LG
604 when EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL.\r
605 The EFI DHCPv6 Protocol instance has sent Renew or Rebind packet\r
5d6a636c 606 when EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
17664848 607 @retval EFI_ACCESS_DENIED The EFI DHCPv6 Child instance hasn't been configured, or the state\r
5d6a636c 608 of the configured IA is not in Dhcp6Bound.\r
9095d37b
LG
609 @retval EFI_ALREADY_STARTED The state of the configured IA has already entered Dhcp6Renewing\r
610 when RebindRequest is FALSE.\r
611 The state of the configured IA has already entered Dhcp6Rebinding\r
5d6a636c 612 when RebindRequest is TRUE.\r
613 @retval EFI_INVALID_PARAMETER This is NULL.\r
614 @retval EFI_DEVICE_ERROR An unexpected system or system error occurred.\r
615 @retval EFI_NO_RESPONSE The DHCPv6 renew/rebind exchange process failed because of no response.\r
9095d37b 616 @retval EFI_NO_MAPPING No IPv6 address has been bound to the configured IA after the DHCPv6\r
5d6a636c 617 renew/rebind exchange process.\r
618 @retval EFI_ABORTED The DHCPv6 renew/rebind exchange process aborted by user.\r
619\r
620**/\r
621typedef\r
622EFI_STATUS\r
623(EFIAPI *EFI_DHCP6_RENEW_REBIND)(\r
624 IN EFI_DHCP6_PROTOCOL *This,\r
625 IN BOOLEAN RebindRequest\r
626 );\r
627\r
628/**\r
629 Inform that one or more IPv6 addresses assigned by a server are already in use by\r
630 another node.\r
631\r
9095d37b
LG
632 The Decline() function is used to manually decline the assignment of IPv6 addresses, which\r
633 have been already used by another node. If all IPv6 addresses of the configured IA are declined\r
634 through this function, the state of the IA will switch through Dhcp6Declining to Dhcp6Init,\r
635 otherwise, the state of the IA will restore to Dhcp6Bound after the declining process. The\r
636 Decline() can only be called when the IA is in Dhcp6Bound state. If the\r
637 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL, this function is a blocking operation. It\r
5d6a636c 638 will return after the declining process finishes, or aborted by user.\r
639\r
640 @param[in] This Pointer to the EFI_DHCP4_PROTOCOL instance.\r
9095d37b 641 @param[in] AddressCount Number of declining IPv6 addresses.\r
5d6a636c 642 @param[in] Addresses Pointer to the buffer stored all the declining IPv6 addresses.\r
643\r
9095d37b 644 @retval EFI_SUCCESS The DHCPv6 decline exchange process has completed when\r
5d6a636c 645 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL.\r
9095d37b 646 The EFI DHCPv6 Protocol instance has sent Decline packet when\r
5d6a636c 647 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
648 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE\r
9095d37b 649 - This is NULL.\r
5d6a636c 650 - AddressCount is zero or Addresses is NULL.\r
9095d37b 651 @retval EFI_NOT_FOUND Any specified IPv6 address is not correlated with the configured IA\r
5d6a636c 652 for this instance.\r
9095d37b 653 @retval EFI_ACCESS_DENIED The EFI DHCPv6 Child instance hasn't been configured, or the\r
5d6a636c 654 state of the configured IA is not in Dhcp6Bound.\r
655 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
656 @retval EFI_ABORTED The DHCPv6 decline exchange process aborted by user.\r
657\r
658**/\r
9095d37b 659typedef\r
5d6a636c 660EFI_STATUS\r
661(EFIAPI *EFI_DHCP6_DECLINE)(\r
662 IN EFI_DHCP6_PROTOCOL *This,\r
663 IN UINT32 AddressCount,\r
664 IN EFI_IPv6_ADDRESS *Addresses\r
665 );\r
666\r
667/**\r
668 Release one or more IPv6 addresses associated with the configured IA for current instance.\r
669\r
670 The Release() function is used to manually release the one or more IPv6 address. If AddressCount\r
671 is zero, it will release all IPv6 addresses of the configured IA. If all IPv6 addresses of the IA\r
9095d37b 672 are released through this function, the state of the IA will switch through Dhcp6Releasing to\r
5d6a636c 673 Dhcp6Init, otherwise, the state of the IA will restore to Dhcp6Bound after the releasing process.\r
674 The Release() can only be called when the IA is in Dhcp6Bound state. If the\r
675 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL, the function is a blocking operation. It will return\r
9095d37b 676 after the releasing process finishes, or aborted by user.\r
5d6a636c 677\r
678 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance.\r
9095d37b 679 @param[in] AddressCount Number of releasing IPv6 addresses.\r
5d6a636c 680 @param[in] Addresses Pointer to the buffer stored all the releasing IPv6 addresses.\r
681 Ignored if AddressCount is zero.\r
9095d37b 682 @retval EFI_SUCCESS The DHCPv6 release exchange process has completed when\r
5d6a636c 683 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL.\r
9095d37b 684 The EFI DHCPv6 Protocol instance has sent Release packet when\r
5d6a636c 685 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
686 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE\r
9095d37b 687 - This is NULL.\r
5d6a636c 688 - AddressCount is not zero or Addresses is NULL.\r
689 @retval EFI_NOT_FOUND Any specified IPv6 address is not correlated with the configured\r
690 IA for this instance.\r
9095d37b 691 @retval EFI_ACCESS_DENIED The EFI DHCPv6 Child instance hasn't been configured, or the\r
5d6a636c 692 state of the configured IA is not in Dhcp6Bound.\r
693 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
9095d37b 694 @retval EFI_ABORTED The DHCPv6 release exchange process aborted by user.\r
5d6a636c 695\r
696**/\r
9095d37b 697typedef\r
5d6a636c 698EFI_STATUS\r
699(EFIAPI *EFI_DHCP6_RELEASE)(\r
700 IN EFI_DHCP6_PROTOCOL *This,\r
701 IN UINT32 AddressCount,\r
702 IN EFI_IPv6_ADDRESS *Addresses\r
703 );\r
704\r
705/**\r
706 Stop the DHCPv6 S.A.R.R process.\r
707\r
708 The Stop() function is used to stop the DHCPv6 S.A.R.R process. If this function is called\r
709 successfully, all the IPv6 addresses of the configured IA will be released and the state of\r
9095d37b 710 the configured IA will be transferred to Dhcp6Init.\r
5d6a636c 711\r
712 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance.\r
713\r
714 @retval EFI_SUCCESS The DHCPv6 S.A.R.R process has been stopped when\r
715 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL.\r
716 The EFI DHCPv6 Protocol instance has sent Release packet if\r
17664848 717 need release or has been stopped if needn't, when\r
5d6a636c 718 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.\r
719 @retval EFI_INVALID_PARAMETER This is NULL.\r
720\r
721**/\r
9095d37b 722typedef\r
5d6a636c 723EFI_STATUS\r
724(EFIAPI *EFI_DHCP6_STOP)(\r
725 IN EFI_DHCP6_PROTOCOL *This\r
726 );\r
727\r
728/**\r
729 Parse the option data in the DHCPv6 packet.\r
730\r
9095d37b 731 The Parse() function is used to retrieve the option list in the DHCPv6 packet.\r
5d6a636c 732\r
733 @param[in] This Pointer to the EFI_DHCP6_PROTOCOL instance.\r
734\r
735 @param[in] Packet Pointer to packet to be parsed.\r
736 @param[in] OptionCount On input, the number of entries in the PacketOptionList.\r
737 On output, the number of DHCPv6 options in the Packet.\r
738 @param[in] PacketOptionList List of pointers to the DHCPv6 options in the Packet.\r
739 The OpCode and OpLen in EFI_DHCP6_PACKET_OPTION are\r
740 both stored in network byte order.\r
741 @retval EFI_SUCCESS The packet was successfully parsed.\r
742 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE\r
743 - This is NULL.\r
744 - Packet is NULL.\r
745 - Packet is not a well-formed DHCPv6 packet.\r
746 - OptionCount is NULL.\r
747 - *OptionCount is not zero and PacketOptionList is NULL.\r
9095d37b 748 @retval EFI_BUFFER_TOO_SMALL *OptionCount is smaller than the number of options that were\r
5d6a636c 749 found in the Packet.\r
750\r
751**/\r
752typedef\r
753EFI_STATUS\r
754(EFIAPI *EFI_DHCP6_PARSE)(\r
755 IN EFI_DHCP6_PROTOCOL *This,\r
756 IN EFI_DHCP6_PACKET *Packet,\r
757 IN OUT UINT32 *OptionCount,\r
758 OUT EFI_DHCP6_PACKET_OPTION *PacketOptionList[] OPTIONAL\r
759);\r
760\r
761///\r
762/// The EFI DHCPv6 Protocol is used to get IPv6 addresses and other configuration parameters\r
763/// from DHCPv6 servers.\r
764///\r
765struct _EFI_DHCP6_PROTOCOL {\r
766 EFI_DHCP6_GET_MODE_DATA GetModeData;\r
767 EFI_DHCP6_CONFIGURE Configure;\r
768 EFI_DHCP6_START Start;\r
769 EFI_DHCP6_INFO_REQUEST InfoRequest;\r
770 EFI_DHCP6_RENEW_REBIND RenewRebind;\r
771 EFI_DHCP6_DECLINE Decline;\r
772 EFI_DHCP6_RELEASE Release;\r
773 EFI_DHCP6_STOP Stop;\r
774 EFI_DHCP6_PARSE Parse;\r
775};\r
776\r
777extern EFI_GUID gEfiDhcp6ProtocolGuid;\r
778extern EFI_GUID gEfiDhcp6ServiceBindingProtocolGuid;\r
779\r
780#endif\r