2 Definitions for EFI IPv6 Configuartion Protocol implementation.
4 Copyright (c) 2009 - 2013, 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
24 #define IP6_CONFIG_DHCP6_OPTION_ORO 6
25 #define IP6_CONFIG_DHCP6_OPTION_DNS_SERVERS 23
27 #define DATA_ATTRIB_SIZE_FIXED 0x1
28 #define DATA_ATTRIB_VOLATILE 0x2
30 #define DATA_ATTRIB_SET(Attrib, Bits) (BOOLEAN)((Attrib) & (Bits))
31 #define SET_DATA_ATTRIB(Attrib, Bits) ((Attrib) |= (Bits))
33 typedef struct _IP6_CONFIG_INSTANCE IP6_CONFIG_INSTANCE
;
35 #define IP6_CONFIG_INSTANCE_FROM_PROTOCOL(Proto) \
37 IP6_CONFIG_INSTANCE, \
39 IP6_CONFIG_INSTANCE_SIGNATURE \
43 #define IP6_CONFIG_INSTANCE_FROM_FORM_CALLBACK(Callback) \
45 IP6_CONFIG_INSTANCE, \
47 IP6_CONFIG_INSTANCE_SIGNATURE \
50 #define IP6_SERVICE_FROM_IP6_CONFIG_INSTANCE(Instance) \
54 IP6_SERVICE_SIGNATURE \
57 #define IP6_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(ConfigAccess) \
59 IP6_FORM_CALLBACK_INFO, \
61 IP6_FORM_CALLBACK_INFO_SIGNATURE \
65 The prototype of work function for EfiIp6ConfigSetData().
67 @param[in] Instance The pointer to the IP6 config instance data.
68 @param[in] DataSize In bytes, the size of the buffer pointed to by Data.
69 @param[in] Data The data buffer to set.
71 @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type,
73 @retval EFI_SUCCESS The specified configuration data for the EFI IPv6
74 network stack was set successfully.
79 (*IP6_CONFIG_SET_DATA
) (
80 IN IP6_CONFIG_INSTANCE
*Instance
,
86 The prototype of work function for EfiIp6ConfigGetData().
88 @param[in] Instance The pointer to the IP6 config instance data.
89 @param[in, out] DataSize On input, in bytes, the size of Data. On output, in
90 bytes, the size of buffer required to store the specified
92 @param[in] Data The data buffer in which the configuration data is returned.
93 Ignored if DataSize is ZERO.
95 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified
96 configuration data, and the required size is
98 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
103 (*IP6_CONFIG_GET_DATA
) (
104 IN IP6_CONFIG_INSTANCE
*Instance
,
105 IN OUT UINTN
*DataSize
,
106 IN VOID
*Data OPTIONAL
111 EFI_IP6_CONFIG_INTERFACE_INFO
*IfInfo
;
112 EFI_IP6_CONFIG_INTERFACE_ID
*AltIfId
;
113 EFI_IP6_CONFIG_POLICY
*Policy
;
114 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS
*DadXmits
;
115 EFI_IP6_CONFIG_MANUAL_ADDRESS
*ManualAddress
;
116 EFI_IPv6_ADDRESS
*Gateway
;
117 EFI_IPv6_ADDRESS
*DnsServers
;
121 IP6_CONFIG_SET_DATA SetData
;
122 IP6_CONFIG_GET_DATA GetData
;
126 IP6_CONFIG_DATA Data
;
128 } IP6_CONFIG_DATA_ITEM
;
133 EFI_IP6_CONFIG_DATA_TYPE DataType
;
134 } IP6_CONFIG_DATA_RECORD
;
139 // heap data that contains the data for each data record.
141 // BOOLEAN IsAltIfIdSet;
142 // EFI_IP6_CONFIG_POLICY Policy;
143 // EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits;
144 // UINT32 ManualaddressCount;
145 // UINT32 GatewayCount;
146 // UINT32 DnsServersCount;
147 // EFI_IP6_CONFIG_INTERFACE_ID AltIfId;
148 // EFI_IP6_CONFIG_MANUAL_ADDRESS ManualAddress[];
149 // EFI_IPv6_ADDRESS Gateway[];
150 // EFI_IPv6_ADDRESS DnsServers[];
155 UINT16 DataRecordCount
;
156 IP6_CONFIG_DATA_RECORD DataRecord
[1];
157 } IP6_CONFIG_VARIABLE
;
163 EFI_IP6_ADDRESS_INFO AddrInfo
;
164 } IP6_ADDRESS_INFO_ENTRY
;
167 EFI_IP6_CONFIG_POLICY Policy
; ///< manual or automatic
168 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadTransmitCount
; ///< dad transmits count
169 EFI_IP6_CONFIG_INTERFACE_ID InterfaceId
; ///< alternative interface id
170 LIST_ENTRY ManualAddress
; ///< IP addresses
171 UINT32 ManualAddressCount
; ///< IP addresses count
172 LIST_ENTRY GatewayAddress
; ///< Gateway address
173 UINT32 GatewayAddressCount
; ///< Gateway address count
174 LIST_ENTRY DnsAddress
; ///< DNS server address
175 UINT32 DnsAddressCount
; ///< DNS server address count
178 typedef struct _IP6_FORM_CALLBACK_INFO
{
180 EFI_HANDLE ChildHandle
;
181 EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccess
;
182 EFI_DEVICE_PATH_PROTOCOL
*HiiVendorDevicePath
;
183 EFI_HII_HANDLE RegisteredHandle
;
184 } IP6_FORM_CALLBACK_INFO
;
186 struct _IP6_CONFIG_INSTANCE
{
192 EFI_IP6_CONFIG_INTERFACE_INFO InterfaceInfo
;
193 EFI_IP6_CONFIG_INTERFACE_ID AltIfId
;
194 EFI_IP6_CONFIG_POLICY Policy
;
195 EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits
;
197 IP6_CONFIG_DATA_ITEM DataItem
[Ip6ConfigDataTypeMaximum
];
198 NET_MAP DadFailedMap
;
199 NET_MAP DadPassedMap
;
201 EFI_IP6_CONFIG_PROTOCOL Ip6Config
;
203 EFI_EVENT Dhcp6SbNotifyEvent
;
205 EFI_HANDLE Dhcp6Handle
;
206 EFI_DHCP6_PROTOCOL
*Dhcp6
;
207 BOOLEAN OtherInfoOnly
;
209 EFI_EVENT Dhcp6Event
;
210 UINT32 FailedIaAddressCount
;
211 EFI_IPv6_ADDRESS
*DeclineAddress
;
212 UINT32 DeclineAddressCount
;
214 IP6_FORM_CALLBACK_INFO CallbackInfo
;
215 IP6_CONFIG_NVDATA Ip6NvData
;
219 The event process routine when the DHCPv6 server is answered with a reply packet
220 for an information request.
222 @param[in] This Points to the EFI_DHCP6_PROTOCOL.
223 @param[in] Context The pointer to the IP6 configuration instance data.
224 @param[in] Packet The DHCPv6 reply packet.
226 @retval EFI_SUCCESS The DNS server address was retrieved from the reply packet.
227 @retval EFI_NOT_READY The reply packet does not contain the DNS server option, or
228 the DNS server address is not valid.
233 Ip6ConfigOnDhcp6Reply (
234 IN EFI_DHCP6_PROTOCOL
*This
,
236 IN EFI_DHCP6_PACKET
*Packet
240 The work function to trigger the DHCPv6 process to perform a stateful autoconfiguration.
242 @param[in] Instance Pointer to the IP6 config instance data.
243 @param[in] OtherInfoOnly If FALSE, get stateful address and other information
244 via DHCPv6. Otherwise, only get the other information.
246 @retval EFI_SUCCESS The operation finished successfully.
247 @retval EFI_UNSUPPORTED The DHCP6 driver is not available.
251 Ip6ConfigStartStatefulAutoConfig (
252 IN IP6_CONFIG_INSTANCE
*Instance
,
253 IN BOOLEAN OtherInfoOnly
257 Initialize an IP6_CONFIG_INSTANCE.
259 @param[out] Instance The buffer of IP6_CONFIG_INSTANCE to be initialized.
261 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation.
262 @retval EFI_SUCCESS The IP6_CONFIG_INSTANCE initialized successfully.
266 Ip6ConfigInitInstance (
267 OUT IP6_CONFIG_INSTANCE
*Instance
271 Release an IP6_CONFIG_INSTANCE.
273 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed.
277 Ip6ConfigCleanInstance (
278 IN OUT IP6_CONFIG_INSTANCE
*Instance
282 Destroy the Dhcp6 child in IP6_CONFIG_INSTANCE and release the resources.
284 @param[in, out] Instance The buffer of IP6_CONFIG_INSTANCE to be freed.
286 @retval EFI_SUCCESS The child was successfully destroyed.
287 @retval Others Failed to destroy the child.
291 Ip6ConfigDestroyDhcp6 (
292 IN OUT IP6_CONFIG_INSTANCE
*Instance