2 Definitions for EFI IPv4 Configuration II Protocol implementation.
4 Copyright (c) 2015, 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 __IP4_CONFIG2_IMPL_H__
17 #define __IP4_CONFIG2_IMPL_H__
19 #define IP4_CONFIG2_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', 'C', '2')
20 #define IP4_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'F', 'C', 'I')
22 #define IP4_CONFIG2_VARIABLE_ATTRIBUTE (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)
24 #define DATA_ATTRIB_SIZE_FIXED 0x1
25 #define DATA_ATTRIB_VOLATILE 0x2
27 #define DHCP_TAG_PARA_LIST 55
28 #define DHCP_TAG_NETMASK 1
29 #define DHCP_TAG_ROUTER 3
32 #define DATA_ATTRIB_SET(Attrib, Bits) (BOOLEAN)((Attrib) & (Bits))
33 #define SET_DATA_ATTRIB(Attrib, Bits) ((Attrib) |= (Bits))
35 typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE
;
37 #define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \
39 IP4_CONFIG2_INSTANCE, \
41 IP4_CONFIG2_INSTANCE_SIGNATURE \
44 #define IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE(Instance) \
48 IP4_SERVICE_SIGNATURE \
51 #define IP4_CONFIG2_INSTANCE_FROM_FORM_CALLBACK(Callback) \
53 IP4_CONFIG2_INSTANCE, \
55 IP4_CONFIG2_INSTANCE_SIGNATURE \
58 #define IP4_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(ConfigAccess) \
60 IP4_FORM_CALLBACK_INFO, \
61 HiiConfigAccessProtocol, \
62 IP4_FORM_CALLBACK_INFO_SIGNATURE \
66 The prototype of work function for EfiIp4Config2SetData().
68 @param[in] Instance The pointer to the IP4 config2 instance data.
69 @param[in] DataSize In bytes, the size of the buffer pointed to by Data.
70 @param[in] Data The data buffer to set.
72 @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type,
74 @retval EFI_SUCCESS The specified configuration data for the EFI IPv4
75 network stack was set successfully.
80 (*IP4_CONFIG2_SET_DATA
) (
81 IN IP4_CONFIG2_INSTANCE
*Instance
,
87 The prototype of work function for EfiIp4Config2GetData().
89 @param[in] Instance The pointer to the IP4 config2 instance data.
90 @param[in, out] DataSize On input, in bytes, the size of Data. On output, in
91 bytes, the size of buffer required to store the specified
93 @param[in] Data The data buffer in which the configuration data is returned.
94 Ignored if DataSize is ZERO.
96 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified
97 configuration data, and the required size is
99 @retval EFI_SUCCESS The specified configuration data was obtained successfully.
104 (*IP4_CONFIG2_GET_DATA
) (
105 IN IP4_CONFIG2_INSTANCE
*Instance
,
106 IN OUT UINTN
*DataSize
,
107 IN VOID
*Data OPTIONAL
112 EFI_IP4_CONFIG2_INTERFACE_INFO
*IfInfo
;
113 EFI_IP4_CONFIG2_POLICY
*Policy
;
114 EFI_IP4_CONFIG2_MANUAL_ADDRESS
*ManualAddress
;
115 EFI_IPv4_ADDRESS
*Gateway
;
116 EFI_IPv4_ADDRESS
*DnsServers
;
120 IP4_CONFIG2_SET_DATA SetData
;
121 IP4_CONFIG2_GET_DATA GetData
;
125 IP4_CONFIG2_DATA Data
;
127 } IP4_CONFIG2_DATA_ITEM
;
132 EFI_IP4_CONFIG2_DATA_TYPE DataType
;
133 } IP4_CONFIG2_DATA_RECORD
;
138 // heap data that contains the data for each data record.
140 // EFI_IP4_CONFIG2_POLICY Policy;
141 // UINT32 ManualaddressCount;
142 // UINT32 GatewayCount;
143 // UINT32 DnsServersCount;
144 // EFI_IP4_CONFIG2_MANUAL_ADDRESS ManualAddress[];
145 // EFI_IPv4_ADDRESS Gateway[];
146 // EFI_IPv4_ADDRESS DnsServers[];
150 UINT16 DataRecordCount
;
151 IP4_CONFIG2_DATA_RECORD DataRecord
[1];
152 } IP4_CONFIG2_VARIABLE
;
157 EFI_IP4_CONFIG2_POLICY Policy
; ///< manual or automatic
158 EFI_IP4_CONFIG2_MANUAL_ADDRESS
*ManualAddress
; ///< IP addresses
159 UINT32 ManualAddressCount
; ///< IP addresses count
160 EFI_IPv4_ADDRESS
*GatewayAddress
; ///< Gateway address
161 UINT32 GatewayAddressCount
; ///< Gateway address count
162 EFI_IPv4_ADDRESS
*DnsAddress
; ///< DNS server address
163 UINT32 DnsAddressCount
; ///< DNS server address count
164 } IP4_CONFIG2_NVDATA
;
166 typedef struct _IP4_FORM_CALLBACK_INFO
{
168 EFI_HANDLE ChildHandle
;
169 EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccessProtocol
;
170 EFI_DEVICE_PATH_PROTOCOL
*HiiVendorDevicePath
;
171 EFI_HII_HANDLE RegisteredHandle
;
172 } IP4_FORM_CALLBACK_INFO
;
174 struct _IP4_CONFIG2_INSTANCE
{
180 EFI_IP4_CONFIG2_PROTOCOL Ip4Config2
;
182 EFI_IP4_CONFIG2_INTERFACE_INFO InterfaceInfo
;
183 EFI_IP4_CONFIG2_POLICY Policy
;
184 IP4_CONFIG2_DATA_ITEM DataItem
[Ip4Config2DataTypeMaximum
];
186 EFI_EVENT Dhcp4SbNotifyEvent
;
188 EFI_HANDLE Dhcp4Handle
;
189 EFI_DHCP4_PROTOCOL
*Dhcp4
;
191 BOOLEAN OtherInfoOnly
;
192 EFI_EVENT Dhcp4Event
;
193 UINT32 FailedIaAddressCount
;
194 EFI_IPv4_ADDRESS
*DeclineAddress
;
195 UINT32 DeclineAddressCount
;
197 IP4_FORM_CALLBACK_INFO CallbackInfo
;
199 IP4_CONFIG2_NVDATA Ip4NvData
;
203 // Configure the DHCP to request the routers and netmask
204 // from server. The DHCP_TAG_NETMASK is included in Head.
208 EFI_DHCP4_PACKET_OPTION Head
;
210 } IP4_CONFIG2_DHCP4_OPTION
;
214 Start the DHCP configuration for this IP service instance.
215 It will locates the EFI_IP4_CONFIG2_PROTOCOL, then start the
218 @param[in] Instance The IP4 config2 instance to configure.
220 @retval EFI_SUCCESS The auto configuration is successfull started.
221 @retval Others Failed to start auto configuration.
226 IN IP4_CONFIG2_INSTANCE
*Instance
230 Initialize an IP4_CONFIG2_INSTANCE.
232 @param[out] Instance The buffer of IP4_CONFIG2_INSTANCE to be initialized.
234 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation.
235 @retval EFI_SUCCESS The IP4_CONFIG2_INSTANCE initialized successfully.
239 Ip4Config2InitInstance (
240 OUT IP4_CONFIG2_INSTANCE
*Instance
244 Release an IP4_CONFIG2_INSTANCE.
246 @param[in, out] Instance The buffer of IP4_CONFIG2_INSTANCE to be freed.
250 Ip4Config2CleanInstance (
251 IN OUT IP4_CONFIG2_INSTANCE
*Instance
255 Destroy the Dhcp4 child in IP4_CONFIG2_INSTANCE and release the resources.
257 @param[in, out] Instance The buffer of IP4 config2 instance to be freed.
259 @retval EFI_SUCCESS The child was successfully destroyed.
260 @retval Others Failed to destroy the child.
264 Ip4Config2DestroyDhcp4 (
265 IN OUT IP4_CONFIG2_INSTANCE
*Instance