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))
30 #define REMOVE_DATA_ATTRIB(Attrib, Bits) ((Attrib) &= (~Bits))
32 typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE
;
34 #define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \
36 IP4_CONFIG2_INSTANCE, \
38 IP4_CONFIG2_INSTANCE_SIGNATURE \
41 #define IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE(Instance) \
45 IP4_SERVICE_SIGNATURE \
48 #define IP4_CONFIG2_INSTANCE_FROM_FORM_CALLBACK(Callback) \
50 IP4_CONFIG2_INSTANCE, \
52 IP4_CONFIG2_INSTANCE_SIGNATURE \
55 #define IP4_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(ConfigAccess) \
57 IP4_FORM_CALLBACK_INFO, \
58 HiiConfigAccessProtocol, \
59 IP4_FORM_CALLBACK_INFO_SIGNATURE \
63 The prototype of work function for EfiIp4Config2SetData().
65 @param[in] Instance The pointer to the IP4 config2 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 IPv4
72 network stack was set successfully.
77 (*IP4_CONFIG2_SET_DATA
) (
78 IN IP4_CONFIG2_INSTANCE
*Instance
,
84 The prototype of work function for EfiIp4Config2GetData().
86 @param[in] Instance The pointer to the IP4 config2 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 (*IP4_CONFIG2_GET_DATA
) (
102 IN IP4_CONFIG2_INSTANCE
*Instance
,
103 IN OUT UINTN
*DataSize
,
104 IN VOID
*Data OPTIONAL
109 EFI_IP4_CONFIG2_INTERFACE_INFO
*IfInfo
;
110 EFI_IP4_CONFIG2_POLICY
*Policy
;
111 EFI_IP4_CONFIG2_MANUAL_ADDRESS
*ManualAddress
;
112 EFI_IPv4_ADDRESS
*Gateway
;
113 EFI_IPv4_ADDRESS
*DnsServers
;
117 IP4_CONFIG2_SET_DATA SetData
;
118 IP4_CONFIG2_GET_DATA GetData
;
122 IP4_CONFIG2_DATA Data
;
124 } IP4_CONFIG2_DATA_ITEM
;
129 EFI_IP4_CONFIG2_DATA_TYPE DataType
;
130 } IP4_CONFIG2_DATA_RECORD
;
135 // heap data that contains the data for each data record.
137 // EFI_IP4_CONFIG2_POLICY Policy;
138 // UINT32 ManualaddressCount;
139 // UINT32 GatewayCount;
140 // UINT32 DnsServersCount;
141 // EFI_IP4_CONFIG2_MANUAL_ADDRESS ManualAddress[];
142 // EFI_IPv4_ADDRESS Gateway[];
143 // EFI_IPv4_ADDRESS DnsServers[];
147 UINT16 DataRecordCount
;
148 IP4_CONFIG2_DATA_RECORD DataRecord
[1];
149 } IP4_CONFIG2_VARIABLE
;
154 EFI_IP4_CONFIG2_POLICY Policy
; ///< manual or automatic
155 EFI_IP4_CONFIG2_MANUAL_ADDRESS
*ManualAddress
; ///< IP addresses
156 UINT32 ManualAddressCount
; ///< IP addresses count
157 EFI_IPv4_ADDRESS
*GatewayAddress
; ///< Gateway address
158 UINT32 GatewayAddressCount
; ///< Gateway address count
159 EFI_IPv4_ADDRESS
*DnsAddress
; ///< DNS server address
160 UINT32 DnsAddressCount
; ///< DNS server address count
161 } IP4_CONFIG2_NVDATA
;
163 typedef struct _IP4_FORM_CALLBACK_INFO
{
165 EFI_HANDLE ChildHandle
;
166 EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccessProtocol
;
167 EFI_DEVICE_PATH_PROTOCOL
*HiiVendorDevicePath
;
168 EFI_HII_HANDLE RegisteredHandle
;
169 } IP4_FORM_CALLBACK_INFO
;
171 struct _IP4_CONFIG2_INSTANCE
{
177 EFI_IP4_CONFIG2_PROTOCOL Ip4Config2
;
179 EFI_IP4_CONFIG2_INTERFACE_INFO InterfaceInfo
;
180 EFI_IP4_CONFIG2_POLICY Policy
;
181 IP4_CONFIG2_DATA_ITEM DataItem
[Ip4Config2DataTypeMaximum
];
183 EFI_EVENT Dhcp4SbNotifyEvent
;
185 EFI_HANDLE Dhcp4Handle
;
186 EFI_DHCP4_PROTOCOL
*Dhcp4
;
188 BOOLEAN OtherInfoOnly
;
189 EFI_EVENT Dhcp4Event
;
190 UINT32 FailedIaAddressCount
;
191 EFI_IPv4_ADDRESS
*DeclineAddress
;
192 UINT32 DeclineAddressCount
;
194 IP4_FORM_CALLBACK_INFO CallbackInfo
;
196 IP4_CONFIG2_NVDATA Ip4NvData
;
200 // Configure the DHCP to request the routers and netmask
201 // from server. The DHCP4_TAG_NETMASK is included in Head.
205 EFI_DHCP4_PACKET_OPTION Head
;
208 } IP4_CONFIG2_DHCP4_OPTION
;
212 Read the configuration data from variable storage according to the VarName and
213 gEfiIp4Config2ProtocolGuid. It checks the integrity of variable data. If the
214 data is corrupted, it clears the variable data to ZERO. Othewise, it outputs the
215 configuration data to IP4_CONFIG2_INSTANCE.
217 @param[in] VarName The pointer to the variable name
218 @param[in, out] Instance The pointer to the IP4 config2 instance data.
220 @retval EFI_NOT_FOUND The variable can not be found or already corrupted.
221 @retval EFI_OUT_OF_RESOURCES Fail to allocate resource to complete the operation.
222 @retval EFI_SUCCESS The configuration data was retrieved successfully.
226 Ip4Config2ReadConfigData (
228 IN OUT IP4_CONFIG2_INSTANCE
*Instance
232 Start the DHCP configuration for this IP service instance.
233 It will locates the EFI_IP4_CONFIG2_PROTOCOL, then start the
236 @param[in] Instance The IP4 config2 instance to configure.
238 @retval EFI_SUCCESS The auto configuration is successfully started.
239 @retval Others Failed to start auto configuration.
244 IN IP4_CONFIG2_INSTANCE
*Instance
248 Initialize an IP4_CONFIG2_INSTANCE.
250 @param[out] Instance The buffer of IP4_CONFIG2_INSTANCE to be initialized.
252 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation.
253 @retval EFI_SUCCESS The IP4_CONFIG2_INSTANCE initialized successfully.
257 Ip4Config2InitInstance (
258 OUT IP4_CONFIG2_INSTANCE
*Instance
262 Release an IP4_CONFIG2_INSTANCE.
264 @param[in, out] Instance The buffer of IP4_CONFIG2_INSTANCE to be freed.
268 Ip4Config2CleanInstance (
269 IN OUT IP4_CONFIG2_INSTANCE
*Instance
273 Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK.
275 @param Event The event that is signalled.
276 @param Context The IP4 service binding instance.
281 Ip4AutoReconfigCallBack (
287 Destroy the Dhcp4 child in IP4_CONFIG2_INSTANCE and release the resources.
289 @param[in, out] Instance The buffer of IP4 config2 instance to be freed.
291 @retval EFI_SUCCESS The child was successfully destroyed.
292 @retval Others Failed to destroy the child.
296 Ip4Config2DestroyDhcp4 (
297 IN OUT IP4_CONFIG2_INSTANCE
*Instance