2 Definitions for EFI IPv4 Configuration II Protocol implementation.
4 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef __IP4_CONFIG2_IMPL_H__
18 #define __IP4_CONFIG2_IMPL_H__
20 #define IP4_CONFIG2_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', 'C', '2')
21 #define IP4_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'F', 'C', 'I')
23 #define IP4_CONFIG2_VARIABLE_ATTRIBUTE (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)
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 _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE
;
33 #define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \
35 IP4_CONFIG2_INSTANCE, \
37 IP4_CONFIG2_INSTANCE_SIGNATURE \
40 #define IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE(Instance) \
44 IP4_SERVICE_SIGNATURE \
47 #define IP4_CONFIG2_INSTANCE_FROM_FORM_CALLBACK(Callback) \
49 IP4_CONFIG2_INSTANCE, \
51 IP4_CONFIG2_INSTANCE_SIGNATURE \
54 #define IP4_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(ConfigAccess) \
56 IP4_FORM_CALLBACK_INFO, \
57 HiiConfigAccessProtocol, \
58 IP4_FORM_CALLBACK_INFO_SIGNATURE \
62 The prototype of work function for EfiIp4Config2SetData().
64 @param[in] Instance The pointer to the IP4 config2 instance data.
65 @param[in] DataSize In bytes, the size of the buffer pointed to by Data.
66 @param[in] Data The data buffer to set.
68 @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type,
70 @retval EFI_SUCCESS The specified configuration data for the EFI IPv4
71 network stack was set successfully.
76 (*IP4_CONFIG2_SET_DATA
) (
77 IN IP4_CONFIG2_INSTANCE
*Instance
,
83 The prototype of work function for EfiIp4Config2GetData().
85 @param[in] Instance The pointer to the IP4 config2 instance data.
86 @param[in, out] DataSize On input, in bytes, the size of Data. On output, in
87 bytes, the size of buffer required to store the specified
89 @param[in] Data The data buffer in which the configuration data is returned.
90 Ignored if DataSize is ZERO.
92 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified
93 configuration data, and the required size is
95 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
100 (*IP4_CONFIG2_GET_DATA
) (
101 IN IP4_CONFIG2_INSTANCE
*Instance
,
102 IN OUT UINTN
*DataSize
,
103 IN VOID
*Data OPTIONAL
108 EFI_IP4_CONFIG2_INTERFACE_INFO
*IfInfo
;
109 EFI_IP4_CONFIG2_POLICY
*Policy
;
110 EFI_IP4_CONFIG2_MANUAL_ADDRESS
*ManualAddress
;
111 EFI_IPv4_ADDRESS
*Gateway
;
112 EFI_IPv4_ADDRESS
*DnsServers
;
116 IP4_CONFIG2_SET_DATA SetData
;
117 IP4_CONFIG2_GET_DATA GetData
;
121 IP4_CONFIG2_DATA Data
;
123 } IP4_CONFIG2_DATA_ITEM
;
128 EFI_IP4_CONFIG2_DATA_TYPE DataType
;
129 } IP4_CONFIG2_DATA_RECORD
;
134 // heap data that contains the data for each data record.
136 // EFI_IP4_CONFIG2_POLICY Policy;
137 // UINT32 ManualaddressCount;
138 // UINT32 GatewayCount;
139 // UINT32 DnsServersCount;
140 // EFI_IP4_CONFIG2_MANUAL_ADDRESS ManualAddress[];
141 // EFI_IPv4_ADDRESS Gateway[];
142 // EFI_IPv4_ADDRESS DnsServers[];
146 UINT16 DataRecordCount
;
147 IP4_CONFIG2_DATA_RECORD DataRecord
[1];
148 } IP4_CONFIG2_VARIABLE
;
153 EFI_IP4_CONFIG2_POLICY Policy
; ///< manual or automatic
154 EFI_IP4_CONFIG2_MANUAL_ADDRESS
*ManualAddress
; ///< IP addresses
155 UINT32 ManualAddressCount
; ///< IP addresses count
156 EFI_IPv4_ADDRESS
*GatewayAddress
; ///< Gateway address
157 UINT32 GatewayAddressCount
; ///< Gateway address count
158 EFI_IPv4_ADDRESS
*DnsAddress
; ///< DNS server address
159 UINT32 DnsAddressCount
; ///< DNS server address count
160 } IP4_CONFIG2_NVDATA
;
162 typedef struct _IP4_FORM_CALLBACK_INFO
{
164 EFI_HANDLE ChildHandle
;
165 EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccessProtocol
;
166 EFI_DEVICE_PATH_PROTOCOL
*HiiVendorDevicePath
;
167 EFI_HII_HANDLE RegisteredHandle
;
168 } IP4_FORM_CALLBACK_INFO
;
170 struct _IP4_CONFIG2_INSTANCE
{
176 EFI_IP4_CONFIG2_PROTOCOL Ip4Config2
;
178 EFI_IP4_CONFIG2_INTERFACE_INFO InterfaceInfo
;
179 EFI_IP4_CONFIG2_POLICY Policy
;
180 IP4_CONFIG2_DATA_ITEM DataItem
[Ip4Config2DataTypeMaximum
];
182 EFI_EVENT Dhcp4SbNotifyEvent
;
184 EFI_HANDLE Dhcp4Handle
;
185 EFI_DHCP4_PROTOCOL
*Dhcp4
;
187 BOOLEAN OtherInfoOnly
;
188 EFI_EVENT Dhcp4Event
;
189 UINT32 FailedIaAddressCount
;
190 EFI_IPv4_ADDRESS
*DeclineAddress
;
191 UINT32 DeclineAddressCount
;
193 IP4_FORM_CALLBACK_INFO CallbackInfo
;
195 IP4_CONFIG2_NVDATA Ip4NvData
;
199 // Configure the DHCP to request the routers and netmask
200 // from server. The DHCP4_TAG_NETMASK is included in Head.
204 EFI_DHCP4_PACKET_OPTION Head
;
207 } IP4_CONFIG2_DHCP4_OPTION
;
211 Read the configuration data from variable storage according to the VarName and
212 gEfiIp4Config2ProtocolGuid. 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 IP4_CONFIG2_INSTANCE.
216 @param[in] VarName The pointer to the variable name
217 @param[in, out] Instance The pointer to the IP4 config2 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 Ip4Config2ReadConfigData (
227 IN OUT IP4_CONFIG2_INSTANCE
*Instance
231 Start the DHCP configuration for this IP service instance.
232 It will locates the EFI_IP4_CONFIG2_PROTOCOL, then start the
235 @param[in] Instance The IP4 config2 instance to configure.
237 @retval EFI_SUCCESS The auto configuration is successfull started.
238 @retval Others Failed to start auto configuration.
243 IN IP4_CONFIG2_INSTANCE
*Instance
247 Initialize an IP4_CONFIG2_INSTANCE.
249 @param[out] Instance The buffer of IP4_CONFIG2_INSTANCE to be initialized.
251 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation.
252 @retval EFI_SUCCESS The IP4_CONFIG2_INSTANCE initialized successfully.
256 Ip4Config2InitInstance (
257 OUT IP4_CONFIG2_INSTANCE
*Instance
261 Release an IP4_CONFIG2_INSTANCE.
263 @param[in, out] Instance The buffer of IP4_CONFIG2_INSTANCE to be freed.
267 Ip4Config2CleanInstance (
268 IN OUT IP4_CONFIG2_INSTANCE
*Instance
272 Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK.
274 @param Event The event that is signalled.
275 @param Context The IP4 service binding instance.
280 Ip4AutoReconfigCallBack (
286 Destroy the Dhcp4 child in IP4_CONFIG2_INSTANCE and release the resources.
288 @param[in, out] Instance The buffer of IP4 config2 instance to be freed.
290 @retval EFI_SUCCESS The child was successfully destroyed.
291 @retval Others Failed to destroy the child.
295 Ip4Config2DestroyDhcp4 (
296 IN OUT IP4_CONFIG2_INSTANCE
*Instance