2 Dhcp6 support functions declaration.
4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
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.
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.
16 #ifndef __EFI_DHCP6_UTILITY_H__
17 #define __EFI_DHCP6_UTILITY_H__
20 #define DHCP6_10_BIT_MASK 0x3ff
23 Generate client Duid in the format of Duid-llt.
25 @param[in] Mode The pointer to the mode of SNP.
27 @retval NULL if failed to generate client Id.
28 @retval Others The pointer to the new client id.
32 Dhcp6GenerateClientId (
33 IN EFI_SIMPLE_NETWORK_MODE
*Mode
37 Copy the Dhcp6 configure data.
39 @param[in] DstCfg The pointer to the destination configure data.
40 @param[in] SorCfg The pointer to the source configure data.
42 @retval EFI_SUCCESS Copy the content from SorCfg from DstCfg successfully.
43 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
48 IN EFI_DHCP6_CONFIG_DATA
*DstCfg
,
49 IN EFI_DHCP6_CONFIG_DATA
*SorCfg
53 Clean up the configure data.
55 @param[in, out] CfgData The pointer to the configure data.
59 Dhcp6CleanupConfigData (
60 IN OUT EFI_DHCP6_CONFIG_DATA
*CfgData
64 Clean up the mode data.
66 @param[in, out] ModeData The pointer to the mode data.
70 Dhcp6CleanupModeData (
71 IN OUT EFI_DHCP6_MODE_DATA
*ModeData
75 Calculate the expire time by the algorithm defined in rfc.
77 @param[in] Base The base value of the time.
78 @param[in] IsFirstRt If TRUE, it is the first time to calculate expire time.
79 @param[in] NeedSigned If TRUE, the the signed factor is needed.
81 @return Expire The calculated result for the new expire time.
85 Dhcp6CalculateExpireTime (
92 Calculate the lease time by the algorithm defined in rfc.
94 @param[in] IaCb The pointer to the Ia control block.
98 Dhcp6CalculateLeaseTime (
103 Check whether the addresses are all included by the configured Ia.
105 @param[in] Ia The pointer to the Ia.
106 @param[in] AddressCount The number of addresses.
107 @param[in] Addresses The pointer to the addresses buffer.
109 @retval EFI_SUCCESS The addresses are all included by the configured IA.
110 @retval EFI_NOT_FOUND The addresses are not included by the configured IA.
116 IN UINT32 AddressCount
,
117 IN EFI_IPv6_ADDRESS
*Addresses
121 Deprive the addresses from current Ia, and generate another eliminated Ia.
123 @param[in] Ia The pointer to the Ia.
124 @param[in] AddressCount The number of addresses.
125 @param[in] Addresses The pointer to the addresses buffer.
127 @retval NULL If failed to generate the deprived Ia.
128 @retval others The pointer to the deprived Ia.
132 Dhcp6DepriveAddress (
134 IN UINT32 AddressCount
,
135 IN EFI_IPv6_ADDRESS
*Addresses
139 The dummy ext buffer free callback routine.
141 @param[in] Arg The pointer to the parameter.
151 The callback routine once message transmitted.
153 @param[in] Wrap The pointer to the received net buffer.
154 @param[in] EndPoint The pointer to the udp end point.
155 @param[in] IoStatus The return status from udp io.
156 @param[in] Context The opaque parameter to the function.
163 IN UDP_END_POINT
*EndPoint
,
164 IN EFI_STATUS IoStatus
,
169 Append the appointed option to the buf, and move the buf to the end.
171 @param[in, out] Buf The pointer to buffer.
172 @param[in] OptType The option type.
173 @param[in] OptLen The lenght of option content.s
174 @param[in] Data The pointer to the option content.
176 @return Buf The position to append the next option.
188 Append the Ia option to Buf, and move Buf to the end.
190 @param[in, out] Buf The pointer to the position to append.
191 @param[in] Ia The pointer to the Ia.
192 @param[in] T1 The time of T1.
193 @param[in] T2 The time of T2.
195 @return Buf The position to append the next Ia option.
199 Dhcp6AppendIaOption (
207 Append the appointed Elapsed time option to Buf, and move Buf to the end.
209 @param[in, out] Buf The pointer to the position to append.
210 @param[in] Instance The pointer to the Dhcp6 instance.
211 @param[out] Elapsed The pointer to the elapsed time value in
212 the generated packet.
214 @return Buf The position to append the next Ia option.
218 Dhcp6AppendETOption (
220 IN DHCP6_INSTANCE
*Instance
,
225 Set the elapsed time based on the given instance and the pointer to the
228 @param[in] Elapsed The pointer to the position to append.
229 @param[in] Instance The pointer to the Dhcp6 instance.
234 IN DHCP6_INSTANCE
*Instance
238 Seek the address of the first byte of the option header.
240 @param[in] Buf The pointer to buffer.
241 @param[in] SeekLen The length to seek.
242 @param[in] OptType The option type.
244 @retval NULL If failed to seek the option.
245 @retval others The position to the option.
256 Seek the address of the first byte of the Ia option header.
258 @param[in] Buf The pointer to the buffer.
259 @param[in] SeekLen The length to seek.
260 @param[in] IaDesc The pointer to the Ia descriptor.
262 @retval NULL If failed to seek the Ia option.
263 @retval others The position to the Ia option.
270 IN EFI_DHCP6_IA_DESCRIPTOR
*IaDesc
274 Parse the address option and update the address info.
276 @param[in] IaInnerOpt The pointer to the buffer.
277 @param[in] IaInnerLen The length to parse.
278 @param[out] AddrNum The number of addresses.
279 @param[in, out] AddrBuf The pointer to the address buffer.
283 Dhcp6ParseAddrOption (
284 IN UINT8
*IaInnerOpt
,
285 IN UINT16 IaInnerLen
,
287 IN OUT EFI_DHCP6_IA_ADDRESS
*AddrBuf
291 Create a control blcok for the Ia according to the corresponding options.
293 @param[in] Instance The pointer to DHCP6 Instance.
294 @param[in] IaInnerOpt The pointer to the inner options in the Ia option.
295 @param[in] IaInnerLen The length of all the inner options in the Ia option.
296 @param[in] T1 T1 time in the Ia option.
297 @param[in] T2 T2 time in the Ia option.
299 @retval EFI_NOT_FOUND No valid IA option is found.
300 @retval EFI_SUCCESS Create an IA control block successfully.
301 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
306 IN DHCP6_INSTANCE
*Instance
,
307 IN UINT8
*IaInnerOpt
,
308 IN UINT16 IaInnerLen
,
315 Cache the current IA configuration information.
317 @param[in] Instance The pointer to DHCP6 Instance.
319 @retval EFI_SUCCESS Cache the current IA successfully.
320 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
325 IN DHCP6_INSTANCE
*Instance
330 Append CacheIa to the currrent IA. Meanwhile, clear CacheIa.ValidLifetime to 0.
332 @param[in] Instance The pointer to DHCP6 instance.
337 IN DHCP6_INSTANCE
*Instance