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 DHCP_TAG_PARA_LIST 55
29 #define DHCP_TAG_NETMASK 1
30 #define DHCP_TAG_ROUTER 3
31 #define DHCP_TAG_DNS_SERVER 6
33 #define DATA_ATTRIB_SET(Attrib, Bits) (BOOLEAN)((Attrib) & (Bits))
34 #define SET_DATA_ATTRIB(Attrib, Bits) ((Attrib) |= (Bits))
36 typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE
;
38 #define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \
40 IP4_CONFIG2_INSTANCE, \
42 IP4_CONFIG2_INSTANCE_SIGNATURE \
45 #define IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE(Instance) \
49 IP4_SERVICE_SIGNATURE \
52 #define IP4_CONFIG2_INSTANCE_FROM_FORM_CALLBACK(Callback) \
54 IP4_CONFIG2_INSTANCE, \
56 IP4_CONFIG2_INSTANCE_SIGNATURE \
59 #define IP4_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(ConfigAccess) \
61 IP4_FORM_CALLBACK_INFO, \
62 HiiConfigAccessProtocol, \
63 IP4_FORM_CALLBACK_INFO_SIGNATURE \
67 The prototype of work function for EfiIp4Config2SetData().
69 @param[in] Instance The pointer to the IP4 config2 instance data.
70 @param[in] DataSize In bytes, the size of the buffer pointed to by Data.
71 @param[in] Data The data buffer to set.
73 @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type,
75 @retval EFI_SUCCESS The specified configuration data for the EFI IPv4
76 network stack was set successfully.
81 (*IP4_CONFIG2_SET_DATA
) (
82 IN IP4_CONFIG2_INSTANCE
*Instance
,
88 The prototype of work function for EfiIp4Config2GetData().
90 @param[in] Instance The pointer to the IP4 config2 instance data.
91 @param[in, out] DataSize On input, in bytes, the size of Data. On output, in
92 bytes, the size of buffer required to store the specified
94 @param[in] Data The data buffer in which the configuration data is returned.
95 Ignored if DataSize is ZERO.
97 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified
98 configuration data, and the required size is
100 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
105 (*IP4_CONFIG2_GET_DATA
) (
106 IN IP4_CONFIG2_INSTANCE
*Instance
,
107 IN OUT UINTN
*DataSize
,
108 IN VOID
*Data OPTIONAL
113 EFI_IP4_CONFIG2_INTERFACE_INFO
*IfInfo
;
114 EFI_IP4_CONFIG2_POLICY
*Policy
;
115 EFI_IP4_CONFIG2_MANUAL_ADDRESS
*ManualAddress
;
116 EFI_IPv4_ADDRESS
*Gateway
;
117 EFI_IPv4_ADDRESS
*DnsServers
;
121 IP4_CONFIG2_SET_DATA SetData
;
122 IP4_CONFIG2_GET_DATA GetData
;
126 IP4_CONFIG2_DATA Data
;
128 } IP4_CONFIG2_DATA_ITEM
;
133 EFI_IP4_CONFIG2_DATA_TYPE DataType
;
134 } IP4_CONFIG2_DATA_RECORD
;
139 // heap data that contains the data for each data record.
141 // EFI_IP4_CONFIG2_POLICY Policy;
142 // UINT32 ManualaddressCount;
143 // UINT32 GatewayCount;
144 // UINT32 DnsServersCount;
145 // EFI_IP4_CONFIG2_MANUAL_ADDRESS ManualAddress[];
146 // EFI_IPv4_ADDRESS Gateway[];
147 // EFI_IPv4_ADDRESS DnsServers[];
151 UINT16 DataRecordCount
;
152 IP4_CONFIG2_DATA_RECORD DataRecord
[1];
153 } IP4_CONFIG2_VARIABLE
;
158 EFI_IP4_CONFIG2_POLICY Policy
; ///< manual or automatic
159 EFI_IP4_CONFIG2_MANUAL_ADDRESS
*ManualAddress
; ///< IP addresses
160 UINT32 ManualAddressCount
; ///< IP addresses count
161 EFI_IPv4_ADDRESS
*GatewayAddress
; ///< Gateway address
162 UINT32 GatewayAddressCount
; ///< Gateway address count
163 EFI_IPv4_ADDRESS
*DnsAddress
; ///< DNS server address
164 UINT32 DnsAddressCount
; ///< DNS server address count
165 } IP4_CONFIG2_NVDATA
;
167 typedef struct _IP4_FORM_CALLBACK_INFO
{
169 EFI_HANDLE ChildHandle
;
170 EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccessProtocol
;
171 EFI_DEVICE_PATH_PROTOCOL
*HiiVendorDevicePath
;
172 EFI_HII_HANDLE RegisteredHandle
;
173 } IP4_FORM_CALLBACK_INFO
;
175 struct _IP4_CONFIG2_INSTANCE
{
181 EFI_IP4_CONFIG2_PROTOCOL Ip4Config2
;
183 EFI_IP4_CONFIG2_INTERFACE_INFO InterfaceInfo
;
184 EFI_IP4_CONFIG2_POLICY Policy
;
185 IP4_CONFIG2_DATA_ITEM DataItem
[Ip4Config2DataTypeMaximum
];
187 EFI_EVENT Dhcp4SbNotifyEvent
;
189 EFI_HANDLE Dhcp4Handle
;
190 EFI_DHCP4_PROTOCOL
*Dhcp4
;
192 BOOLEAN OtherInfoOnly
;
193 EFI_EVENT Dhcp4Event
;
194 UINT32 FailedIaAddressCount
;
195 EFI_IPv4_ADDRESS
*DeclineAddress
;
196 UINT32 DeclineAddressCount
;
198 IP4_FORM_CALLBACK_INFO CallbackInfo
;
200 IP4_CONFIG2_NVDATA Ip4NvData
;
204 // Configure the DHCP to request the routers and netmask
205 // from server. The DHCP_TAG_NETMASK is included in Head.
209 EFI_DHCP4_PACKET_OPTION Head
;
212 } IP4_CONFIG2_DHCP4_OPTION
;
216 Read the configuration data from variable storage according to the VarName and
217 gEfiIp4Config2ProtocolGuid. It checks the integrity of variable data. If the
218 data is corrupted, it clears the variable data to ZERO. Othewise, it outputs the
219 configuration data to IP4_CONFIG2_INSTANCE.
221 @param[in] VarName The pointer to the variable name
222 @param[in, out] Instance The pointer to the IP4 config2 instance data.
224 @retval EFI_NOT_FOUND The variable can not be found or already corrupted.
225 @retval EFI_OUT_OF_RESOURCES Fail to allocate resource to complete the operation.
226 @retval EFI_SUCCESS The configuration data was retrieved successfully.
230 Ip4Config2ReadConfigData (
232 IN OUT IP4_CONFIG2_INSTANCE
*Instance
236 Start the DHCP configuration for this IP service instance.
237 It will locates the EFI_IP4_CONFIG2_PROTOCOL, then start the
240 @param[in] Instance The IP4 config2 instance to configure.
242 @retval EFI_SUCCESS The auto configuration is successfull started.
243 @retval Others Failed to start auto configuration.
248 IN IP4_CONFIG2_INSTANCE
*Instance
252 Initialize an IP4_CONFIG2_INSTANCE.
254 @param[out] Instance The buffer of IP4_CONFIG2_INSTANCE to be initialized.
256 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation.
257 @retval EFI_SUCCESS The IP4_CONFIG2_INSTANCE initialized successfully.
261 Ip4Config2InitInstance (
262 OUT IP4_CONFIG2_INSTANCE
*Instance
266 Release an IP4_CONFIG2_INSTANCE.
268 @param[in, out] Instance The buffer of IP4_CONFIG2_INSTANCE to be freed.
272 Ip4Config2CleanInstance (
273 IN OUT IP4_CONFIG2_INSTANCE
*Instance
277 Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK.
279 @param Event The event that is signalled.
280 @param Context The IP4 service binding instance.
285 Ip4AutoReconfigCallBack (
291 Destroy the Dhcp4 child in IP4_CONFIG2_INSTANCE and release the resources.
293 @param[in, out] Instance The buffer of IP4 config2 instance to be freed.
295 @retval EFI_SUCCESS The child was successfully destroyed.
296 @retval Others Failed to destroy the child.
300 Ip4Config2DestroyDhcp4 (
301 IN OUT IP4_CONFIG2_INSTANCE
*Instance