1 /** @file
2   Dhcp6 internal data structure and definition declaration.
3 
4   Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
5 
6   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 **/
15 
16 #ifndef __EFI_DHCP6_IMPL_H__
17 #define __EFI_DHCP6_IMPL_H__
18 
19 
20 #include <Uefi.h>
21 
22 #include <Protocol/Dhcp6.h>
23 #include <Protocol/Udp6.h>
24 #include <Protocol/Ip6Config.h>
25 #include <Protocol/ServiceBinding.h>
26 #include <Protocol/DriverBinding.h>
27 
28 #include <Library/UdpIoLib.h>
29 #include <Library/DebugLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/UefiBootServicesTableLib.h>
33 #include <Library/UefiRuntimeServicesTableLib.h>
34 #include <Library/UefiLib.h>
35 #include <Library/BaseLib.h>
36 #include <Library/NetLib.h>
37 #include <Library/PrintLib.h>
38 
39 
40 typedef struct _DHCP6_IA_CB    DHCP6_IA_CB;
41 typedef struct _DHCP6_INF_CB   DHCP6_INF_CB;
42 typedef struct _DHCP6_TX_CB    DHCP6_TX_CB;
43 typedef struct _DHCP6_SERVICE  DHCP6_SERVICE;
44 typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE;
45 
46 #include "Dhcp6Utility.h"
47 #include "Dhcp6Io.h"
48 #include "Dhcp6Driver.h"
49 
50 #define DHCP6_SERVICE_SIGNATURE   SIGNATURE_32 ('D', 'H', '6', 'S')
51 #define DHCP6_INSTANCE_SIGNATURE  SIGNATURE_32 ('D', 'H', '6', 'I')
52 
53 //
54 // Transmit parameters of solicit message, refers to section-5.5 of rfc-3315.
55 //
56 #define DHCP6_SOL_MAX_DELAY       1
57 #define DHCP6_SOL_IRT             1
58 #define DHCP6_SOL_MRC             0
59 #define DHCP6_SOL_MRT             120
60 #define DHCP6_SOL_MRD             0
61 //
62 // Transmit parameters of request message, refers to section-5.5 of rfc-3315.
63 //
64 #define DHCP6_REQ_IRT             1
65 #define DHCP6_REQ_MRC             10
66 #define DHCP6_REQ_MRT             30
67 #define DHCP6_REQ_MRD             0
68 //
69 // Transmit parameters of confirm message, refers to section-5.5 of rfc-3315.
70 //
71 #define DHCP6_CNF_MAX_DELAY       1
72 #define DHCP6_CNF_IRT             1
73 #define DHCP6_CNF_MRC             0
74 #define DHCP6_CNF_MRT             4
75 #define DHCP6_CNF_MRD             10
76 //
77 // Transmit parameters of renew message, refers to section-5.5 of rfc-3315.
78 //
79 #define DHCP6_REN_IRT             10
80 #define DHCP6_REN_MRC             0
81 #define DHCP6_REN_MRT             600
82 #define DHCP6_REN_MRD             0
83 //
84 // Transmit parameters of rebind message, refers to section-5.5 of rfc-3315.
85 //
86 #define DHCP6_REB_IRT             10
87 #define DHCP6_REB_MRC             0
88 #define DHCP6_REB_MRT             600
89 #define DHCP6_REB_MRD             0
90 //
91 // Transmit parameters of information request message, refers to section-5.5 of rfc-3315.
92 //
93 #define DHCP6_INF_MAX_DELAY       1
94 #define DHCP6_INF_IRT             1
95 #define DHCP6_INF_MRC             0
96 #define DHCP6_INF_MRT             120
97 #define DHCP6_INF_MRD             0
98 //
99 // Transmit parameters of release message, refers to section-5.5 of rfc-3315.
100 //
101 #define DHCP6_REL_IRT             1
102 #define DHCP6_REL_MRC             5
103 #define DHCP6_REL_MRT             0
104 #define DHCP6_REL_MRD             0
105 //
106 // Transmit parameters of decline message, refers to section-5.5 of rfc-3315.
107 //
108 #define DHCP6_DEC_IRT             1
109 #define DHCP6_DEC_MRC             5
110 #define DHCP6_DEC_MRT             0
111 #define DHCP6_DEC_MRD             0
112 
113 #define DHCP6_PACKET_ALL          0
114 #define DHCP6_PACKET_STATEFUL     1
115 #define DHCP6_PACKET_STATELESS    2
116 
117 #define DHCP6_BASE_PACKET_SIZE    1024
118 
119 #define DHCP6_PORT_CLIENT         546
120 #define DHCP6_PORT_SERVER         547
121 
122 #define DHCP6_INSTANCE_FROM_THIS(Instance) CR ((Instance), DHCP6_INSTANCE, Dhcp6, DHCP6_INSTANCE_SIGNATURE)
123 #define DHCP6_SERVICE_FROM_THIS(Service)   CR ((Service), DHCP6_SERVICE, ServiceBinding, DHCP6_SERVICE_SIGNATURE)
124 
125 extern EFI_IPv6_ADDRESS           mAllDhcpRelayAndServersAddress;
126 extern EFI_IPv6_ADDRESS           mAllDhcpServersAddress;
127 extern EFI_DHCP6_PROTOCOL         gDhcp6ProtocolTemplate;
128 
129 //
130 // Enumeration of Dhcp6 message type, refers to section-5.3 of rfc-3315.
131 //
132 typedef enum {
133   Dhcp6MsgSolicit               = 1,
134   Dhcp6MsgAdvertise             = 2,
135   Dhcp6MsgRequest               = 3,
136   Dhcp6MsgConfirm               = 4,
137   Dhcp6MsgRenew                 = 5,
138   Dhcp6MsgRebind                = 6,
139   Dhcp6MsgReply                 = 7,
140   Dhcp6MsgRelease               = 8,
141   Dhcp6MsgDecline               = 9,
142   Dhcp6MsgReconfigure           = 10,
143   Dhcp6MsgInfoRequest           = 11
144 } DHCP6_MSG_TYPE;
145 
146 //
147 // Enumeration of option code in Dhcp6 packet, refers to section-24.3 of rfc-3315.
148 //
149 typedef enum {
150   Dhcp6OptClientId              = 1,
151   Dhcp6OptServerId              = 2,
152   Dhcp6OptIana                  = 3,
153   Dhcp6OptIata                  = 4,
154   Dhcp6OptIaAddr                = 5,
155   Dhcp6OptRequestOption         = 6,
156   Dhcp6OptPreference            = 7,
157   Dhcp6OptElapsedTime           = 8,
158   Dhcp6OptReplayMessage         = 9,
159   Dhcp6OptAuthentication        = 11,
160   Dhcp6OptServerUnicast         = 12,
161   Dhcp6OptStatusCode            = 13,
162   Dhcp6OptRapidCommit           = 14,
163   Dhcp6OptUserClass             = 15,
164   Dhcp6OptVendorClass           = 16,
165   Dhcp6OptVendorInfo            = 17,
166   Dhcp6OptInterfaceId           = 18,
167   Dhcp6OptReconfigMessage       = 19,
168   Dhcp6OptReconfigureAccept     = 20
169 } DHCP6_OPT_CODE;
170 
171 //
172 // Enumeration of status code recorded by IANA, refers to section-24.4 of rfc-3315.
173 //
174 typedef enum {
175   Dhcp6StsSuccess               = 0,
176   Dhcp6StsUnspecFail            = 1,
177   Dhcp6StsNoAddrsAvail          = 2,
178   Dhcp6StsNoBinding             = 3,
179   Dhcp6StsNotOnLink             = 4,
180   Dhcp6StsUseMulticast          = 5
181 } DHCP6_STS_CODE;
182 
183 //
184 // Enumeration of Duid type recorded by IANA, refers to section-24.5 of rfc-3315.
185 //
186 typedef enum {
187   Dhcp6DuidTypeLlt              = 1,
188   Dhcp6DuidTypeEn               = 2,
189   Dhcp6DuidTypeLl               = 3,
190   Dhcp6DuidTypeUuid             = 4
191 } DHCP6_DUID_TYPE;
192 
193 //
194 // Control block for each IA.
195 //
196 struct _DHCP6_IA_CB {
197   EFI_DHCP6_IA                  *Ia;
198   UINT32                        T1;
199   UINT32                        T2;
200   UINT32                        AllExpireTime;
201   UINT32                        LeaseTime;
202 };
203 
204 //
205 // Control block for each transmitted message.
206 //
207 struct _DHCP6_TX_CB {
208   LIST_ENTRY                    Link;
209   UINT32                        Xid;
210   EFI_DHCP6_PACKET              *TxPacket;
211   EFI_DHCP6_RETRANSMISSION      RetryCtl;
212   UINT32                        RetryCnt;
213   UINT32                        RetryExp;
214   UINT32                        RetryLos;
215   UINT32                        TickTime;
216   UINT16                        *Elapsed;
217   BOOLEAN                       SolicitRetry;
218 };
219 
220 //
221 // Control block for each info-request message.
222 //
223 struct _DHCP6_INF_CB {
224   LIST_ENTRY                    Link;
225   UINT32                        Xid;
226   EFI_DHCP6_INFO_CALLBACK       ReplyCallback;
227   VOID                          *CallbackContext;
228   EFI_EVENT                     TimeoutEvent;
229 };
230 
231 //
232 // Control block for Dhcp6 instance, it's per configuration data.
233 //
234 struct _DHCP6_INSTANCE {
235   UINT32                        Signature;
236   EFI_HANDLE                    Handle;
237   DHCP6_SERVICE                 *Service;
238   LIST_ENTRY                    Link;
239   EFI_DHCP6_PROTOCOL            Dhcp6;
240   EFI_EVENT                     Timer;
241   EFI_DHCP6_CONFIG_DATA         *Config;
242   EFI_DHCP6_IA                  *CacheIa;
243   DHCP6_IA_CB                   IaCb;
244   LIST_ENTRY                    TxList;
245   LIST_ENTRY                    InfList;
246   EFI_DHCP6_PACKET              *AdSelect;
247   UINT8                         AdPref;
248   EFI_IPv6_ADDRESS              *Unicast;
249   volatile EFI_STATUS           UdpSts;
250   BOOLEAN                       InDestroy;
251   BOOLEAN                       MediaPresent;
252   //
253   // StartTime is used to calculate the 'elapsed-time' option. Refer to RFC3315,
254   // the elapsed-time is amount of time since the client began its current DHCP transaction.
255   //
256   UINT64                        StartTime;
257 };
258 
259 //
260 // Control block for Dhcp6 service, it's per Nic handle.
261 //
262 struct _DHCP6_SERVICE {
263   UINT32                        Signature;
264   EFI_HANDLE                    Controller;
265   EFI_HANDLE                    Image;
266   EFI_SERVICE_BINDING_PROTOCOL  ServiceBinding;
267   EFI_SIMPLE_NETWORK_PROTOCOL   *Snp;
268   EFI_IP6_CONFIG_PROTOCOL       *Ip6Cfg;
269   EFI_DHCP6_DUID                *ClientId;
270   UDP_IO                        *UdpIo;
271   UINT32                        Xid;
272   LIST_ENTRY                    Child;
273   UINTN                         NumOfChild;
274 };
275 
276 /**
277   Starts the DHCPv6 standard S.A.R.R. process.
278 
279   The Start() function starts the DHCPv6 standard process. This function can
280   be called only when the state of Dhcp6 instance is in the Dhcp6Init state.
281   If the DHCP process completes successfully, the state of the Dhcp6 instance
282   will be transferred through Dhcp6Selecting and Dhcp6Requesting to the
283   Dhcp6Bound state.
284   Refer to rfc-3315 for precise state transitions during this process. At the
285   time when each event occurs in this process, the callback function that was set
286   by EFI_DHCP6_PROTOCOL.Configure() will be called and the user can take this
287   opportunity to control the process.
288 
289   @param[in]  This              The pointer to Dhcp6 protocol.
290 
291   @retval EFI_SUCCESS           The DHCPv6 standard process has started, or it
292                                 completed when CompletionEvent was NULL.
293   @retval EFI_ACCESS_DENIED     The EFI DHCPv6 Child instance hasn't been configured.
294   @retval EFI_INVALID_PARAMETER This is NULL.
295   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
296   @retval EFI_TIMEOUT           The DHCPv6 configuration process failed because no
297                                 response was received from the server within the
298                                 specified timeout value.
299   @retval EFI_ABORTED           The user aborted the DHCPv6 process.
300   @retval EFI_ALREADY_STARTED   Some other Dhcp6 instance already started the DHCPv6
301                                 standard process.
302   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
303 
304 **/
305 EFI_STATUS
306 EFIAPI
307 EfiDhcp6Start (
308   IN EFI_DHCP6_PROTOCOL        *This
309   );
310 
311 /**
312   Stops the DHCPv6 standard S.A.R.R. process.
313 
314   The Stop() function is used to stop the DHCPv6 standard process. After this
315   function is called successfully, the state of Dhcp6 instance is transferred
316   into the Dhcp6Init. EFI_DHCP6_PROTOCOL.Configure() needs to be called
317   before DHCPv6 standard process can be started again. This function can be
318   called when the Dhcp6 instance is in any state.
319 
320   @param[in]  This              The pointer to the Dhcp6 protocol.
321 
322   @retval EFI_SUCCESS           The Dhcp6 instance is now in the Dhcp6Init state.
323   @retval EFI_INVALID_PARAMETER This is NULL.
324 
325 **/
326 EFI_STATUS
327 EFIAPI
328 EfiDhcp6Stop (
329   IN EFI_DHCP6_PROTOCOL        *This
330   );
331 
332 /**
333   Returns the current operating mode data for the Dhcp6 instance.
334 
335   The GetModeData() function returns the current operating mode and
336   cached data packet for the Dhcp6 instance.
337 
338   @param[in]  This              The pointer to the Dhcp6 protocol.
339   @param[out] Dhcp6ModeData     The pointer to the Dhcp6 mode data.
340   @param[out] Dhcp6ConfigData   The pointer to the Dhcp6 configure data.
341 
342   @retval EFI_SUCCESS           The mode data was returned.
343   @retval EFI_INVALID_PARAMETER This is NULL.
344   @retval EFI_ACCESS_DENIED     The EFI DHCPv6 Protocol instance has not
345                                 been configured when Dhcp6ConfigData is
346                                 not NULL.
347 **/
348 EFI_STATUS
349 EFIAPI
350 EfiDhcp6GetModeData (
351   IN  EFI_DHCP6_PROTOCOL       *This,
352   OUT EFI_DHCP6_MODE_DATA      *Dhcp6ModeData      OPTIONAL,
353   OUT EFI_DHCP6_CONFIG_DATA    *Dhcp6ConfigData    OPTIONAL
354   );
355 
356 /**
357   Initializes, changes, or resets the operational settings for the Dhcp6 instance.
358 
359   The Configure() function is used to initialize or clean up the configuration
360   data of the Dhcp6 instance:
361   - When Dhcp6CfgData is not NULL and Configure() is called successfully, the
362     configuration data will be initialized in the Dhcp6 instance and the state
363     of the configured IA will be transferred into Dhcp6Init.
364   - When Dhcp6CfgData is NULL and Configure() is called successfully, the
365     configuration data will be cleaned up and no IA will be associated with
366     the Dhcp6 instance.
367   To update the configuration data for an Dhcp6 instance, the original data
368   must be cleaned up before setting the new configuration data.
369 
370   @param[in]  This                   The pointer to the Dhcp6 protocol
371   @param[in]  Dhcp6CfgData           The pointer to the EFI_DHCP6_CONFIG_DATA.
372 
373   @retval EFI_SUCCESS           The Dhcp6 is configured successfully with the
374                                 Dhcp6Init state, or cleaned up the original
375                                 configuration setting.
376   @retval EFI_ACCESS_DENIED     The Dhcp6 instance has been already configured
377                                 when Dhcp6CfgData is not NULL.
378                                 The Dhcp6 instance has already started the
379                                 DHCPv6 S.A.R.R when Dhcp6CfgData is NULL.
380   @retval EFI_INVALID_PARAMETER Some of the parameter is invalid.
381   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
382   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
383 
384 **/
385 EFI_STATUS
386 EFIAPI
387 EfiDhcp6Configure (
388   IN EFI_DHCP6_PROTOCOL        *This,
389   IN EFI_DHCP6_CONFIG_DATA     *Dhcp6CfgData    OPTIONAL
390   );
391 
392 /**
393   Request configuration information without the assignment of any
394   Ia addresses of the client.
395 
396   The InfoRequest() function is used to request configuration information
397   without the assignment of any IPv6 address of the client. Client sends
398   out Information Request packet to obtain the required configuration
399   information, and DHCPv6 server responds with Reply packet containing
400   the information for the client. The received Reply packet will be passed
401   to the user by ReplyCallback function. If user returns EFI_NOT_READY from
402   ReplyCallback, the Dhcp6 instance will continue to receive other Reply
403   packets unless timeout according to the Retransmission parameter.
404   Otherwise, the Information Request exchange process will be finished
405   successfully if user returns EFI_SUCCESS from ReplyCallback.
406 
407   @param[in]  This              The pointer to the Dhcp6 protocol.
408   @param[in]  SendClientId      If TRUE, the DHCPv6 protocol instance will build Client
409                                 Identifier option and include it into Information Request
410                                 packet. Otherwise, Client Identifier option will not be included.
411   @param[in]  OptionRequest     The pointer to the buffer of option request options.
412   @param[in]  OptionCount       The option number in the OptionList.
413   @param[in]  OptionList        The list of appended options.
414   @param[in]  Retransmission    The pointer to the retransmission of the message.
415   @param[in]  TimeoutEvent      The event of timeout.
416   @param[in]  ReplyCallback     The callback function when a reply was received.
417   @param[in]  CallbackContext   The pointer to the parameter passed to the callback.
418 
419   @retval EFI_SUCCESS           The DHCPv6 information request exchange process
420                                 completed when TimeoutEvent is NULL. Information
421                                 Request packet has been sent to DHCPv6 server when
422                                 TimeoutEvent is not NULL.
423   @retval EFI_NO_RESPONSE       The DHCPv6 information request exchange process failed
424                                 because of no response, or not all requested-options
425                                 are responded to by DHCPv6 servers when Timeout happened.
426   @retval EFI_ABORTED           The DHCPv6 information request exchange process was aborted
427                                 by the user.
428   @retval EFI_INVALID_PARAMETER Some parameter is NULL.
429   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
430   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
431 
432 **/
433 EFI_STATUS
434 EFIAPI
435 EfiDhcp6InfoRequest (
436   IN EFI_DHCP6_PROTOCOL        *This,
437   IN BOOLEAN                   SendClientId,
438   IN EFI_DHCP6_PACKET_OPTION   *OptionRequest,
439   IN UINT32                    OptionCount,
440   IN EFI_DHCP6_PACKET_OPTION   *OptionList[]    OPTIONAL,
441   IN EFI_DHCP6_RETRANSMISSION  *Retransmission,
442   IN EFI_EVENT                 TimeoutEvent     OPTIONAL,
443   IN EFI_DHCP6_INFO_CALLBACK   ReplyCallback,
444   IN VOID                      *CallbackContext OPTIONAL
445   );
446 
447 /**
448   Manually extend the valid and preferred lifetimes for the IPv6 addresses
449   of the configured IA and update other configuration parameters by sending
450   Renew or Rebind packet.
451 
452   The RenewRebind() function is used to manually extend the valid and preferred
453   lifetimes for the IPv6 addresses of the configured IA and update other
454   configuration parameters by sending a Renew or Rebind packet.
455   - When RebindRequest is FALSE and the state of the configured IA is Dhcp6Bound,
456     it will send Renew packet to the previously DHCPv6 server and transfer the
457     state of the configured IA to Dhcp6Renewing. If valid Reply packet received,
458     the state transfers to Dhcp6Bound and the valid and preferred timer restarts.
459     If fails, the state transfers to Dhcp6Bound but the timer continues.
460   - When RebindRequest is TRUE and the state of the configured IA is Dhcp6Bound,
461     it will send a Rebind packet. If a valid Reply packet is received, the state transfers
462     to Dhcp6Bound, and the valid and preferred timer restarts. If it fails, the state
463     transfers to Dhcp6Init, and the IA can't be used.
464 
465   @param[in]  This              The pointer to the Dhcp6 protocol.
466   @param[in]  RebindRequest     If TRUE, Rebind packet will be sent and enter Dhcp6Rebinding state.
467                                 Otherwise, Renew packet will be sent and enter Dhcp6Renewing state.
468 
469   @retval EFI_SUCCESS           The DHCPv6 renew/rebind exchange process
470                                 completed and at least one IPv6 address of the
471                                 configured IA was bound again when
472                                 EFI_DHCP6_CONFIG_DATA.IaInfoEvent was NULL.
473                                 The EFI DHCPv6 Protocol instance has sent Renew
474                                 or Rebind packet when
475                                 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.
476   @retval EFI_ACCESS_DENIED     The Dhcp6 instance hasn't been configured, or the
477                                 state of the configured IA is not in Dhcp6Bound.
478   @retval EFI_ALREADY_STARTED   The state of the configured IA has already entered
479                                 Dhcp6Renewing when RebindRequest is FALSE.
480                                 The state of the configured IA has already entered
481                                 Dhcp6Rebinding when RebindRequest is TRUE.
482   @retval EFI_ABORTED           The DHCPv6 renew/rebind exchange process aborted
483                                 by user.
484   @retval EFI_NO_RESPONSE       The DHCPv6 renew/rebind exchange process failed
485                                 because of no response.
486   @retval EFI_NO_MAPPING        No IPv6 address has been bound to the configured
487                                 IA after the DHCPv6 renew/rebind exchange process.
488   @retval EFI_INVALID_PARAMETER Some parameter is NULL.
489   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
490 
491 **/
492 EFI_STATUS
493 EFIAPI
494 EfiDhcp6RenewRebind (
495   IN EFI_DHCP6_PROTOCOL        *This,
496   IN BOOLEAN                   RebindRequest
497   );
498 
499 /**
500   Inform that one or more addresses assigned by a server are already
501   in use by another node.
502 
503   The Decline() function is used to manually decline the assignment of
504   IPv6 addresses, which have been already used by another node. If all
505   IPv6 addresses of the configured IA are declined through this function,
506   the state of the IA will switch through Dhcp6Declining to Dhcp6Init.
507   Otherwise, the state of the IA will restore to Dhcp6Bound after the
508   declining process. The Decline() can only be called when the IA is in
509   Dhcp6Bound state. If the EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL,
510   this function is a blocking operation. It will return after the
511   declining process finishes, or aborted by user.
512 
513   @param[in]  This              The pointer to the Dhcp6 protocol.
514   @param[in]  AddressCount      The number of declining addresses.
515   @param[in]  Addresses         The pointer to the buffer stored the declining
516                                 addresses.
517 
518   @retval EFI_SUCCESS           The DHCPv6 decline exchange process completed
519                                 when EFI_DHCP6_CONFIG_DATA.IaInfoEvent was NULL.
520                                 The Dhcp6 instance has sent Decline packet when
521                                 EFI_DHCP6_CONFIG_DATA.IaInfoEvent is not NULL.
522   @retval EFI_ACCESS_DENIED     The Dhcp6 instance hasn't been configured, or the
523                                 state of the configured IA is not in Dhcp6Bound.
524   @retval EFI_ABORTED           The DHCPv6 decline exchange process was aborted by the user.
525   @retval EFI_NOT_FOUND         Any specified IPv6 address is not correlated with
526                                 the configured IA for this instance.
527   @retval EFI_INVALID_PARAMETER Some parameter is NULL.
528   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
529 
530 **/
531 EFI_STATUS
532 EFIAPI
533 EfiDhcp6Decline (
534   IN EFI_DHCP6_PROTOCOL        *This,
535   IN UINT32                    AddressCount,
536   IN EFI_IPv6_ADDRESS          *Addresses
537   );
538 
539 /**
540   Release one or more addresses associated with the configured Ia
541   for the current instance.
542 
543   The Release() function is used to manually release the one or more
544   IPv6 address. If AddressCount is zero, it will release all IPv6
545   addresses of the configured IA. If all IPv6 addresses of the IA are
546   released through this function, the state of the IA will switch
547   through Dhcp6Releasing to Dhcp6Init, otherwise, the state of the
548   IA will restore to Dhcp6Bound after the releasing process.
549   The Release() can only be called when the IA is in a Dhcp6Bound state.
550   If the EFI_DHCP6_CONFIG_DATA.IaInfoEvent is NULL, the function is
551   a blocking operation. It will return after the releasing process
552   finishes, or aborted by user.
553 
554   @param[in]  This              The pointer to the Dhcp6 protocol.
555   @param[in]  AddressCount      The number of releasing addresses.
556   @param[in]  Addresses         The pointer to the buffer stored the releasing
557                                 addresses.
558   @retval EFI_SUCCESS           The DHCPv6 release exchange process has
559                                 completed when EFI_DHCP6_CONFIG_DATA.IaInfoEvent
560                                 is NULL. The Dhcp6 instance has sent Release
561                                 packet when EFI_DHCP6_CONFIG_DATA.IaInfoEvent
562                                 is not NULL.
563   @retval EFI_ACCESS_DENIED     The Dhcp6 instance hasn't been configured, or the
564                                 state of the configured IA is not in Dhcp6Bound.
565   @retval EFI_ABORTED           The DHCPv6 release exchange process was aborted by the user.
566   @retval EFI_NOT_FOUND         Any specified IPv6 address is not correlated with
567                                 the configured IA for this instance.
568   @retval EFI_INVALID_PARAMETER Some parameter is NULL.
569   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.
570 
571 **/
572 EFI_STATUS
573 EFIAPI
574 EfiDhcp6Release (
575   IN EFI_DHCP6_PROTOCOL        *This,
576   IN UINT32                    AddressCount,
577   IN EFI_IPv6_ADDRESS          *Addresses
578   );
579 
580 /**
581   Parse the option data in the Dhcp6 packet.
582 
583   The Parse() function is used to retrieve the option list in the DHCPv6 packet.
584 
585   @param[in]      This              The pointer to the Dhcp6 protocol.
586   @param[in]      Packet            The pointer to the Dhcp6 packet.
587   @param[in, out] OptionCount       The number of option in the packet.
588   @param[out]     PacketOptionList  The array of pointers to the each option in the packet.
589 
590   @retval EFI_SUCCESS           The packet was successfully parsed.
591   @retval EFI_INVALID_PARAMETER Some parameter is NULL.
592   @retval EFI_BUFFER_TOO_SMALL  *OptionCount is smaller than the number of options
593                                 that were found in the Packet.
594 
595 **/
596 EFI_STATUS
597 EFIAPI
598 EfiDhcp6Parse (
599   IN EFI_DHCP6_PROTOCOL        *This,
600   IN EFI_DHCP6_PACKET          *Packet,
601   IN OUT UINT32                *OptionCount,
602   OUT EFI_DHCP6_PACKET_OPTION  *PacketOptionList[]  OPTIONAL
603   );
604 
605 #endif
606