2 Definitions for EFI IPv6 Configuartion Protocol implementation.
4 Copyright (c) 2009 - 2016, 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 __IP6_CONFIG_IMPL_H__
17 #define __IP6_CONFIG_IMPL_H__
19 #define IP6_CONFIG_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', '6', 'C')
20 #define IP6_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'F', 'C', 'I')
21 #define IP6_CONFIG_VARIABLE_ATTRIBUTE (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)
23 #define IP6_CONFIG_DEFAULT_DAD_XMITS 1
25 #define DATA_ATTRIB_SIZE_FIXED 0x1
26 #define DATA_ATTRIB_VOLATILE 0x2
28 #define DATA_ATTRIB_SET(Attrib, Bits) (BOOLEAN)((Attrib) & (Bits))
29 #define SET_DATA_ATTRIB(Attrib, Bits) ((Attrib) |= (Bits))
31 typedef struct _IP6_CONFIG_INSTANCE IP6_CONFIG_INSTANCE
;
33 #define IP6_CONFIG_INSTANCE_FROM_PROTOCOL(Proto) \
35 IP6_CONFIG_INSTANCE, \
37 IP6_CONFIG_INSTANCE_SIGNATURE \
41 #define IP6_CONFIG_INSTANCE_FROM_FORM_CALLBACK(Callback) \
43 IP6_CONFIG_INSTANCE, \
45 IP6_CONFIG_INSTANCE_SIGNATURE \
48 #define IP6_SERVICE_FROM_IP6_CONFIG_INSTANCE(Instance) \
52 IP6_SERVICE_SIGNATURE \
55 #define IP6_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(ConfigAccess) \
57 IP6_FORM_CALLBACK_INFO, \
59 IP6_FORM_CALLBACK_INFO_SIGNATURE \
63 The prototype of work function for EfiIp6ConfigSetData().
65 @param[in] Instance The pointer to the IP6 config instance data.
66 @param[in] DataSize In bytes, the size of the buffer pointed to by Data.
67 @param[in] Data The data buffer to set.
69 @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type,
71 @retval EFI_SUCCESS The specified configuration data for the EFI IPv6
72 network stack was set successfully.
77 (*IP6_CONFIG_SET_DATA
) (
78 IN IP6_CONFIG_INSTANCE
*Instance
,
84 The prototype of work function for EfiIp6ConfigGetData().
86 @param[in] Instance The pointer to the IP6 config instance data.
87 @param[in, out] DataSize On input, in bytes, the size of Data. On output, in
88 bytes, the size of buffer required to store the specified
90 @param[in] Data The data buffer in which the configuration data is returned.
91 Ignored if DataSize is ZERO.
93 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified
94 configuration data, and the required size is
96 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
101 (*IP6_CONFIG_GET_DATA
) (
102 IN IP6_CONFIG_INSTANCE
*Instance
,
103 IN OUT UINTN
*DataSize
,
104 IN VOID
*Data OPTIONAL
109 EFI_IP6_CONFIG_INTERFACE_INFO
*IfInfo
;
110 EFI_IP6_CONFIG_INTERFACE_ID
*AltIfId
;
111 EFI_IP6_CONFIG_POLICY
*Policy
;
112 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS
*DadXmits
;
113 EFI_IP6_CONFIG_MANUAL_ADDRESS
*ManualAddress
;
114 EFI_IPv6_ADDRESS
*Gateway
;
115 EFI_IPv6_ADDRESS
*DnsServers
;
119 IP6_CONFIG_SET_DATA SetData
;
120 IP6_CONFIG_GET_DATA GetData
;
124 IP6_CONFIG_DATA Data
;
126 } IP6_CONFIG_DATA_ITEM
;
131 EFI_IP6_CONFIG_DATA_TYPE DataType
;
132 } IP6_CONFIG_DATA_RECORD
;
137 // heap data that contains the data for each data record.
139 // BOOLEAN IsAltIfIdSet;
140 // EFI_IP6_CONFIG_POLICY Policy;
141 // EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits;
142 // UINT32 ManualaddressCount;
143 // UINT32 GatewayCount;
144 // UINT32 DnsServersCount;
145 // EFI_IP6_CONFIG_INTERFACE_ID AltIfId;
146 // EFI_IP6_CONFIG_MANUAL_ADDRESS ManualAddress[];
147 // EFI_IPv6_ADDRESS Gateway[];
148 // EFI_IPv6_ADDRESS DnsServers[];
153 UINT16 DataRecordCount
;
154 IP6_CONFIG_DATA_RECORD DataRecord
[1];
155 } IP6_CONFIG_VARIABLE
;
161 EFI_IP6_ADDRESS_INFO AddrInfo
;
162 } IP6_ADDRESS_INFO_ENTRY
;
165 EFI_IP6_CONFIG_POLICY Policy
; ///< manual or automatic
166 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadTransmitCount
; ///< dad transmits count
167 EFI_IP6_CONFIG_INTERFACE_ID InterfaceId
; ///< alternative interface id
168 LIST_ENTRY ManualAddress
; ///< IP addresses
169 UINT32 ManualAddressCount
; ///< IP addresses count
170 LIST_ENTRY GatewayAddress
; ///< Gateway address
171 UINT32 GatewayAddressCount
; ///< Gateway address count
172 LIST_ENTRY DnsAddress
; ///< DNS server address
173 UINT32 DnsAddressCount
; ///< DNS server address count
176 typedef struct _IP6_FORM_CALLBACK_INFO
{
178 EFI_HANDLE ChildHandle
;
179 EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccess
;
180 EFI_DEVICE_PATH_PROTOCOL
*HiiVendorDevicePath
;
181 EFI_HII_HANDLE RegisteredHandle
;
182 } IP6_FORM_CALLBACK_INFO
;
184 struct _IP6_CONFIG_INSTANCE
{
190 EFI_IP6_CONFIG_INTERFACE_INFO InterfaceInfo
;
191 EFI_IP6_CONFIG_INTERFACE_ID AltIfId
;
192 EFI_IP6_CONFIG_POLICY Policy
;
193 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits
;
195 IP6_CONFIG_DATA_ITEM DataItem
[Ip6ConfigDataTypeMaximum
];
196 NET_MAP DadFailedMap
;
197 NET_MAP DadPassedMap
;
199 EFI_IP6_CONFIG_PROTOCOL Ip6Config
;
201 EFI_EVENT Dhcp6SbNotifyEvent
;
203 EFI_HANDLE Dhcp6Handle
;
204 EFI_DHCP6_PROTOCOL
*Dhcp6
;
205 BOOLEAN OtherInfoOnly
;
207 EFI_EVENT Dhcp6Event
;
208 UINT32 FailedIaAddressCount
;
209 EFI_IPv6_ADDRESS
*DeclineAddress
;
210 UINT32 DeclineAddressCount
;
212 IP6_FORM_CALLBACK_INFO CallbackInfo
;
213 IP6_CONFIG_NVDATA Ip6NvData
;
217 Read the configuration data from variable storage according to the VarName and
218 gEfiIp6ConfigProtocolGuid. It checks the integrity of variable data. If the
219 data is corrupted, it clears the variable data to ZERO. Othewise, it outputs the
220 configuration data to IP6_CONFIG_INSTANCE.
222 @param[in] VarName The pointer to the variable name
223 @param[in, out] Instance The pointer to the IP6 config instance data.
225 @retval EFI_NOT_FOUND The variable can not be found or already corrupted.
226 @retval EFI_OUT_OF_RESOURCES Fail to allocate resource to complete the operation.
227 @retval EFI_SUCCESS The configuration data was retrieved successfully.
231 Ip6ConfigReadConfigData (
233 IN OUT IP6_CONFIG_INSTANCE
*Instance
237 The event process routine when the DHCPv6 server is answered with a reply packet
238 for an information request.
240 @param[in] This Points to the EFI_DHCP6_PROTOCOL.
241 @param[in] Context The pointer to the IP6 configuration instance data.
242 @param[in] Packet The DHCPv6 reply packet.
244 @retval EFI_SUCCESS The DNS server address was retrieved from the reply packet.
245 @retval EFI_NOT_READY The reply packet does not contain the DNS server option, or
246 the DNS server address is not valid.
251 Ip6ConfigOnDhcp6Reply (
252 IN EFI_DHCP6_PROTOCOL
*This
,
254 IN EFI_DHCP6_PACKET
*Packet
258 The work function to trigger the DHCPv6 process to perform a stateful autoconfiguration.
260 @param[in] Instance Pointer to the IP6 config instance data.
261 @param[in] OtherInfoOnly If FALSE, get stateful address and other information
262 via DHCPv6. Otherwise, only get the other information.
264 @retval EFI_SUCCESS The operation finished successfully.
265 @retval EFI_UNSUPPORTED The DHCP6 driver is not available.
269 Ip6ConfigStartStatefulAutoConfig (
270 IN IP6_CONFIG_INSTANCE
*Instance
,
271 IN BOOLEAN OtherInfoOnly
275 Initialize an IP6_CONFIG_INSTANCE.
277 @param[out] Instance The buffer of IP6_CONFIG_INSTANCE to be initialized.
279 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation.
280 @retval EFI_SUCCESS The IP6_CONFIG_INSTANCE initialized successfully.
284 Ip6ConfigInitInstance (
285 OUT IP6_CONFIG_INSTANCE
*Instance
289 Release an IP6_CONFIG_INSTANCE.
291 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed.
295 Ip6ConfigCleanInstance (
296 IN OUT IP6_CONFIG_INSTANCE
*Instance
300 Destroy the Dhcp6 child in IP6_CONFIG_INSTANCE and release the resources.
302 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed.
304 @retval EFI_SUCCESS The child was successfully destroyed.
305 @retval Others Failed to destroy the child.
309 Ip6ConfigDestroyDhcp6 (
310 IN OUT IP6_CONFIG_INSTANCE
*Instance