2 Definitions for EFI IPv6 Configuartion Protocol implementation.
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __IP6_CONFIG_IMPL_H__
11 #define __IP6_CONFIG_IMPL_H__
13 #define IP6_CONFIG_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'C')
14 #define IP6_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'F', 'C', 'I')
15 #define IP6_CONFIG_VARIABLE_ATTRIBUTE (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)
17 #define IP6_CONFIG_DEFAULT_DAD_XMITS 1
19 #define DATA_ATTRIB_SIZE_FIXED 0x1
20 #define DATA_ATTRIB_VOLATILE 0x2
22 #define DATA_ATTRIB_SET(Attrib, Bits) (BOOLEAN)((Attrib) & (Bits))
23 #define SET_DATA_ATTRIB(Attrib, Bits) ((Attrib) |= (Bits))
25 typedef struct _IP6_CONFIG_INSTANCE IP6_CONFIG_INSTANCE
;
27 #define IP6_CONFIG_INSTANCE_FROM_PROTOCOL(Proto) \
29 IP6_CONFIG_INSTANCE, \
31 IP6_CONFIG_INSTANCE_SIGNATURE \
35 #define IP6_CONFIG_INSTANCE_FROM_FORM_CALLBACK(Callback) \
37 IP6_CONFIG_INSTANCE, \
39 IP6_CONFIG_INSTANCE_SIGNATURE \
42 #define IP6_SERVICE_FROM_IP6_CONFIG_INSTANCE(Instance) \
46 IP6_SERVICE_SIGNATURE \
49 #define IP6_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(ConfigAccess) \
51 IP6_FORM_CALLBACK_INFO, \
53 IP6_FORM_CALLBACK_INFO_SIGNATURE \
57 The prototype of work function for EfiIp6ConfigSetData().
59 @param[in] Instance The pointer to the IP6 config instance data.
60 @param[in] DataSize In bytes, the size of the buffer pointed to by Data.
61 @param[in] Data The data buffer to set.
63 @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type,
65 @retval EFI_SUCCESS The specified configuration data for the EFI IPv6
66 network stack was set successfully.
71 (*IP6_CONFIG_SET_DATA
) (
72 IN IP6_CONFIG_INSTANCE
*Instance
,
78 The prototype of work function for EfiIp6ConfigGetData().
80 @param[in] Instance The pointer to the IP6 config instance data.
81 @param[in, out] DataSize On input, in bytes, the size of Data. On output, in
82 bytes, the size of buffer required to store the specified
84 @param[in] Data The data buffer in which the configuration data is returned.
85 Ignored if DataSize is ZERO.
87 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified
88 configuration data, and the required size is
90 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
95 (*IP6_CONFIG_GET_DATA
) (
96 IN IP6_CONFIG_INSTANCE
*Instance
,
97 IN OUT UINTN
*DataSize
,
98 IN VOID
*Data OPTIONAL
103 EFI_IP6_CONFIG_INTERFACE_INFO
*IfInfo
;
104 EFI_IP6_CONFIG_INTERFACE_ID
*AltIfId
;
105 EFI_IP6_CONFIG_POLICY
*Policy
;
106 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS
*DadXmits
;
107 EFI_IP6_CONFIG_MANUAL_ADDRESS
*ManualAddress
;
108 EFI_IPv6_ADDRESS
*Gateway
;
109 EFI_IPv6_ADDRESS
*DnsServers
;
113 IP6_CONFIG_SET_DATA SetData
;
114 IP6_CONFIG_GET_DATA GetData
;
118 IP6_CONFIG_DATA Data
;
120 } IP6_CONFIG_DATA_ITEM
;
125 EFI_IP6_CONFIG_DATA_TYPE DataType
;
126 } IP6_CONFIG_DATA_RECORD
;
131 // heap data that contains the data for each data record.
133 // BOOLEAN IsAltIfIdSet;
134 // EFI_IP6_CONFIG_POLICY Policy;
135 // EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits;
136 // UINT32 ManualaddressCount;
137 // UINT32 GatewayCount;
138 // UINT32 DnsServersCount;
139 // EFI_IP6_CONFIG_INTERFACE_ID AltIfId;
140 // EFI_IP6_CONFIG_MANUAL_ADDRESS ManualAddress[];
141 // EFI_IPv6_ADDRESS Gateway[];
142 // EFI_IPv6_ADDRESS DnsServers[];
147 UINT16 DataRecordCount
;
148 IP6_CONFIG_DATA_RECORD DataRecord
[1];
149 } IP6_CONFIG_VARIABLE
;
155 EFI_IP6_ADDRESS_INFO AddrInfo
;
156 } IP6_ADDRESS_INFO_ENTRY
;
159 EFI_IP6_CONFIG_POLICY Policy
; ///< manual or automatic
160 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadTransmitCount
; ///< dad transmits count
161 EFI_IP6_CONFIG_INTERFACE_ID InterfaceId
; ///< alternative interface id
162 LIST_ENTRY ManualAddress
; ///< IP addresses
163 UINT32 ManualAddressCount
; ///< IP addresses count
164 LIST_ENTRY GatewayAddress
; ///< Gateway address
165 UINT32 GatewayAddressCount
; ///< Gateway address count
166 LIST_ENTRY DnsAddress
; ///< DNS server address
167 UINT32 DnsAddressCount
; ///< DNS server address count
170 typedef struct _IP6_FORM_CALLBACK_INFO
{
172 EFI_HANDLE ChildHandle
;
173 EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccess
;
174 EFI_DEVICE_PATH_PROTOCOL
*HiiVendorDevicePath
;
175 EFI_HII_HANDLE RegisteredHandle
;
176 } IP6_FORM_CALLBACK_INFO
;
178 struct _IP6_CONFIG_INSTANCE
{
184 EFI_IP6_CONFIG_INTERFACE_INFO InterfaceInfo
;
185 EFI_IP6_CONFIG_INTERFACE_ID AltIfId
;
186 EFI_IP6_CONFIG_POLICY Policy
;
187 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits
;
189 IP6_CONFIG_DATA_ITEM DataItem
[Ip6ConfigDataTypeMaximum
];
190 NET_MAP DadFailedMap
;
191 NET_MAP DadPassedMap
;
193 EFI_IP6_CONFIG_PROTOCOL Ip6Config
;
195 EFI_EVENT Dhcp6SbNotifyEvent
;
197 EFI_HANDLE Dhcp6Handle
;
198 EFI_DHCP6_PROTOCOL
*Dhcp6
;
199 BOOLEAN OtherInfoOnly
;
201 EFI_EVENT Dhcp6Event
;
202 UINT32 FailedIaAddressCount
;
203 EFI_IPv6_ADDRESS
*DeclineAddress
;
204 UINT32 DeclineAddressCount
;
206 IP6_FORM_CALLBACK_INFO CallbackInfo
;
207 IP6_CONFIG_NVDATA Ip6NvData
;
211 Read the configuration data from variable storage according to the VarName and
212 gEfiIp6ConfigProtocolGuid. It checks the integrity of variable data. If the
213 data is corrupted, it clears the variable data to ZERO. Othewise, it outputs the
214 configuration data to IP6_CONFIG_INSTANCE.
216 @param[in] VarName The pointer to the variable name
217 @param[in, out] Instance The pointer to the IP6 config instance data.
219 @retval EFI_NOT_FOUND The variable can not be found or already corrupted.
220 @retval EFI_OUT_OF_RESOURCES Fail to allocate resource to complete the operation.
221 @retval EFI_SUCCESS The configuration data was retrieved successfully.
225 Ip6ConfigReadConfigData (
227 IN OUT IP6_CONFIG_INSTANCE
*Instance
231 The event process routine when the DHCPv6 server is answered with a reply packet
232 for an information request.
234 @param[in] This Points to the EFI_DHCP6_PROTOCOL.
235 @param[in] Context The pointer to the IP6 configuration instance data.
236 @param[in] Packet The DHCPv6 reply packet.
238 @retval EFI_SUCCESS The DNS server address was retrieved from the reply packet.
239 @retval EFI_NOT_READY The reply packet does not contain the DNS server option, or
240 the DNS server address is not valid.
245 Ip6ConfigOnDhcp6Reply (
246 IN EFI_DHCP6_PROTOCOL
*This
,
248 IN EFI_DHCP6_PACKET
*Packet
252 The work function to trigger the DHCPv6 process to perform a stateful autoconfiguration.
254 @param[in] Instance Pointer to the IP6 config instance data.
255 @param[in] OtherInfoOnly If FALSE, get stateful address and other information
256 via DHCPv6. Otherwise, only get the other information.
258 @retval EFI_SUCCESS The operation finished successfully.
259 @retval EFI_UNSUPPORTED The DHCP6 driver is not available.
263 Ip6ConfigStartStatefulAutoConfig (
264 IN IP6_CONFIG_INSTANCE
*Instance
,
265 IN BOOLEAN OtherInfoOnly
269 Initialize an IP6_CONFIG_INSTANCE.
271 @param[out] Instance The buffer of IP6_CONFIG_INSTANCE to be initialized.
273 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation.
274 @retval EFI_SUCCESS The IP6_CONFIG_INSTANCE initialized successfully.
278 Ip6ConfigInitInstance (
279 OUT IP6_CONFIG_INSTANCE
*Instance
283 Release an IP6_CONFIG_INSTANCE.
285 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed.
289 Ip6ConfigCleanInstance (
290 IN OUT IP6_CONFIG_INSTANCE
*Instance
294 Destroy the Dhcp6 child in IP6_CONFIG_INSTANCE and release the resources.
296 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed.
298 @retval EFI_SUCCESS The child was successfully destroyed.
299 @retval Others Failed to destroy the child.
303 Ip6ConfigDestroyDhcp6 (
304 IN OUT IP6_CONFIG_INSTANCE
*Instance