2 Definitions for EFI IPv6 Configuration 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 \
34 #define IP6_CONFIG_INSTANCE_FROM_FORM_CALLBACK(Callback) \
36 IP6_CONFIG_INSTANCE, \
38 IP6_CONFIG_INSTANCE_SIGNATURE \
41 #define IP6_SERVICE_FROM_IP6_CONFIG_INSTANCE(Instance) \
45 IP6_SERVICE_SIGNATURE \
48 #define IP6_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(ConfigAccess) \
50 IP6_FORM_CALLBACK_INFO, \
52 IP6_FORM_CALLBACK_INFO_SIGNATURE \
56 The prototype of work function for EfiIp6ConfigSetData().
58 @param[in] Instance The pointer to the IP6 config instance data.
59 @param[in] DataSize In bytes, the size of the buffer pointed to by Data.
60 @param[in] Data The data buffer to set.
62 @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type,
64 @retval EFI_SUCCESS The specified configuration data for the EFI IPv6
65 network stack was set successfully.
70 (*IP6_CONFIG_SET_DATA
) (
71 IN IP6_CONFIG_INSTANCE
*Instance
,
77 The prototype of work function for EfiIp6ConfigGetData().
79 @param[in] Instance The pointer to the IP6 config instance data.
80 @param[in, out] DataSize On input, in bytes, the size of Data. On output, in
81 bytes, the size of buffer required to store the specified
83 @param[in] Data The data buffer in which the configuration data is returned.
84 Ignored if DataSize is ZERO.
86 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified
87 configuration data, and the required size is
89 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
94 (*IP6_CONFIG_GET_DATA
) (
95 IN IP6_CONFIG_INSTANCE
*Instance
,
96 IN OUT UINTN
*DataSize
,
97 IN VOID
*Data OPTIONAL
102 EFI_IP6_CONFIG_INTERFACE_INFO
*IfInfo
;
103 EFI_IP6_CONFIG_INTERFACE_ID
*AltIfId
;
104 EFI_IP6_CONFIG_POLICY
*Policy
;
105 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS
*DadXmits
;
106 EFI_IP6_CONFIG_MANUAL_ADDRESS
*ManualAddress
;
107 EFI_IPv6_ADDRESS
*Gateway
;
108 EFI_IPv6_ADDRESS
*DnsServers
;
112 IP6_CONFIG_SET_DATA SetData
;
113 IP6_CONFIG_GET_DATA GetData
;
117 IP6_CONFIG_DATA Data
;
119 } IP6_CONFIG_DATA_ITEM
;
124 EFI_IP6_CONFIG_DATA_TYPE DataType
;
125 } IP6_CONFIG_DATA_RECORD
;
130 // heap data that contains the data for each data record.
132 // BOOLEAN IsAltIfIdSet;
133 // EFI_IP6_CONFIG_POLICY Policy;
134 // EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits;
135 // UINT32 ManualaddressCount;
136 // UINT32 GatewayCount;
137 // UINT32 DnsServersCount;
138 // EFI_IP6_CONFIG_INTERFACE_ID AltIfId;
139 // EFI_IP6_CONFIG_MANUAL_ADDRESS ManualAddress[];
140 // EFI_IPv6_ADDRESS Gateway[];
141 // EFI_IPv6_ADDRESS DnsServers[];
146 UINT16 DataRecordCount
;
147 IP6_CONFIG_DATA_RECORD DataRecord
[1];
148 } IP6_CONFIG_VARIABLE
;
154 EFI_IP6_ADDRESS_INFO AddrInfo
;
155 } IP6_ADDRESS_INFO_ENTRY
;
158 EFI_IP6_CONFIG_POLICY Policy
; ///< manual or automatic
159 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadTransmitCount
; ///< dad transmits count
160 EFI_IP6_CONFIG_INTERFACE_ID InterfaceId
; ///< alternative interface id
161 LIST_ENTRY ManualAddress
; ///< IP addresses
162 UINT32 ManualAddressCount
; ///< IP addresses count
163 LIST_ENTRY GatewayAddress
; ///< Gateway address
164 UINT32 GatewayAddressCount
; ///< Gateway address count
165 LIST_ENTRY DnsAddress
; ///< DNS server address
166 UINT32 DnsAddressCount
; ///< DNS server address count
169 typedef struct _IP6_FORM_CALLBACK_INFO
{
171 EFI_HANDLE ChildHandle
;
172 EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccess
;
173 EFI_DEVICE_PATH_PROTOCOL
*HiiVendorDevicePath
;
174 EFI_HII_HANDLE RegisteredHandle
;
175 } IP6_FORM_CALLBACK_INFO
;
177 struct _IP6_CONFIG_INSTANCE
{
183 EFI_IP6_CONFIG_INTERFACE_INFO InterfaceInfo
;
184 EFI_IP6_CONFIG_INTERFACE_ID AltIfId
;
185 EFI_IP6_CONFIG_POLICY Policy
;
186 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits
;
188 IP6_CONFIG_DATA_ITEM DataItem
[Ip6ConfigDataTypeMaximum
];
189 NET_MAP DadFailedMap
;
190 NET_MAP DadPassedMap
;
192 EFI_IP6_CONFIG_PROTOCOL Ip6Config
;
194 EFI_EVENT Dhcp6SbNotifyEvent
;
196 EFI_HANDLE Dhcp6Handle
;
197 EFI_DHCP6_PROTOCOL
*Dhcp6
;
198 BOOLEAN OtherInfoOnly
;
200 EFI_EVENT Dhcp6Event
;
201 UINT32 FailedIaAddressCount
;
202 EFI_IPv6_ADDRESS
*DeclineAddress
;
203 UINT32 DeclineAddressCount
;
205 IP6_FORM_CALLBACK_INFO CallbackInfo
;
206 IP6_CONFIG_NVDATA Ip6NvData
;
210 Read the configuration data from variable storage according to the VarName and
211 gEfiIp6ConfigProtocolGuid. It checks the integrity of variable data. If the
212 data is corrupted, it clears the variable data to ZERO. Otherwise, it outputs the
213 configuration data to IP6_CONFIG_INSTANCE.
215 @param[in] VarName The pointer to the variable name
216 @param[in, out] Instance The pointer to the IP6 config instance data.
218 @retval EFI_NOT_FOUND The variable can not be found or already corrupted.
219 @retval EFI_OUT_OF_RESOURCES Fail to allocate resource to complete the operation.
220 @retval EFI_SUCCESS The configuration data was retrieved successfully.
224 Ip6ConfigReadConfigData (
226 IN OUT IP6_CONFIG_INSTANCE
*Instance
230 The event process routine when the DHCPv6 server is answered with a reply packet
231 for an information request.
233 @param[in] This Points to the EFI_DHCP6_PROTOCOL.
234 @param[in] Context The pointer to the IP6 configuration instance data.
235 @param[in] Packet The DHCPv6 reply packet.
237 @retval EFI_SUCCESS The DNS server address was retrieved from the reply packet.
238 @retval EFI_NOT_READY The reply packet does not contain the DNS server option, or
239 the DNS server address is not valid.
244 Ip6ConfigOnDhcp6Reply (
245 IN EFI_DHCP6_PROTOCOL
*This
,
247 IN EFI_DHCP6_PACKET
*Packet
251 The work function to trigger the DHCPv6 process to perform a stateful autoconfiguration.
253 @param[in] Instance Pointer to the IP6 config instance data.
254 @param[in] OtherInfoOnly If FALSE, get stateful address and other information
255 via DHCPv6. Otherwise, only get the other information.
257 @retval EFI_SUCCESS The operation finished successfully.
258 @retval EFI_UNSUPPORTED The DHCP6 driver is not available.
262 Ip6ConfigStartStatefulAutoConfig (
263 IN IP6_CONFIG_INSTANCE
*Instance
,
264 IN BOOLEAN OtherInfoOnly
268 Initialize an IP6_CONFIG_INSTANCE.
270 @param[out] Instance The buffer of IP6_CONFIG_INSTANCE to be initialized.
272 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation.
273 @retval EFI_SUCCESS The IP6_CONFIG_INSTANCE initialized successfully.
277 Ip6ConfigInitInstance (
278 OUT IP6_CONFIG_INSTANCE
*Instance
282 Release an IP6_CONFIG_INSTANCE.
284 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed.
288 Ip6ConfigCleanInstance (
289 IN OUT IP6_CONFIG_INSTANCE
*Instance
293 Destroy the Dhcp6 child in IP6_CONFIG_INSTANCE and release the resources.
295 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed.
297 @retval EFI_SUCCESS The child was successfully destroyed.
298 @retval Others Failed to destroy the child.
302 Ip6ConfigDestroyDhcp6 (
303 IN OUT IP6_CONFIG_INSTANCE
*Instance