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