]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Ip4Config2.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / Ip4Config2.h
CommitLineData
cff298f4 1/** @file\r
2 This file provides a definition of the EFI IPv4 Configuration II\r
3 Protocol.\r
4\r
9095d37b 5Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
cff298f4 7\r
8@par Revision Reference:\r
9This Protocol is introduced in UEFI Specification 2.5\r
10\r
11**/\r
12#ifndef __EFI_IP4CONFIG2_PROTOCOL_H__\r
13#define __EFI_IP4CONFIG2_PROTOCOL_H__\r
14\r
15#include <Protocol/Ip4.h>\r
16\r
17#define EFI_IP4_CONFIG2_PROTOCOL_GUID \\r
18 { \\r
19 0x5b446ed1, 0xe30b, 0x4faa, {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \\r
20 }\r
21\r
22typedef struct _EFI_IP4_CONFIG2_PROTOCOL EFI_IP4_CONFIG2_PROTOCOL;\r
23\r
24\r
25///\r
26/// EFI_IP4_CONFIG2_DATA_TYPE\r
27///\r
28typedef enum {\r
29 ///\r
9095d37b
LG
30 /// The interface information of the communication device this EFI\r
31 /// IPv4 Configuration II Protocol instance manages. This type of\r
32 /// data is read only. The corresponding Data is of type\r
cff298f4 33 /// EFI_IP4_CONFIG2_INTERFACE_INFO.\r
34 ///\r
35 Ip4Config2DataTypeInterfaceInfo,\r
36 ///\r
9095d37b
LG
37 /// The general configuration policy for the EFI IPv4 network stack\r
38 /// running on the communication device this EFI IPv4\r
39 /// Configuration II Protocol instance manages. The policy will\r
40 /// affect other configuration settings. The corresponding Data is of\r
cff298f4 41 /// type EFI_IP4_CONFIG2_POLICY.\r
42 ///\r
43 Ip4Config2DataTypePolicy,\r
44 ///\r
9095d37b
LG
45 /// The station addresses set manually for the EFI IPv4 network\r
46 /// stack. It is only configurable when the policy is\r
47 /// Ip4Config2PolicyStatic. The corresponding Data is of\r
48 /// type EFI_IP4_CONFIG2_MANUAL_ADDRESS. When DataSize\r
49 /// is 0 and Data is NULL, the existing configuration is cleared\r
1499e1ae 50 /// from the EFI IPv4 Configuration II Protocol instance.\r
cff298f4 51 ///\r
52 Ip4Config2DataTypeManualAddress,\r
53 ///\r
9095d37b
LG
54 /// The gateway addresses set manually for the EFI IPv4 network\r
55 /// stack running on the communication device this EFI IPv4\r
56 /// Configuration II Protocol manages. It is not configurable when\r
57 /// the policy is Ip4Config2PolicyDhcp. The gateway\r
58 /// addresses must be unicast IPv4 addresses. The corresponding\r
cff298f4 59 /// Data is a pointer to an array of EFI_IPv4_ADDRESS instances.\r
9095d37b 60 /// When DataSize is 0 and Data is NULL, the existing configuration\r
1499e1ae 61 /// is cleared from the EFI IPv4 Configuration II Protocol instance.\r
cff298f4 62 ///\r
63 Ip4Config2DataTypeGateway,\r
64 ///\r
9095d37b
LG
65 /// The DNS server list for the EFI IPv4 network stack running on\r
66 /// the communication device this EFI IPv4 Configuration II\r
67 /// Protocol manages. It is not configurable when the policy is\r
68 /// Ip4Config2PolicyDhcp. The DNS server addresses must be\r
69 /// unicast IPv4 addresses. The corresponding Data is a pointer to\r
70 /// an array of EFI_IPv4_ADDRESS instances. When DataSize\r
71 /// is 0 and Data is NULL, the existing configuration is cleared\r
1499e1ae 72 /// from the EFI IPv4 Configuration II Protocol instance.\r
cff298f4 73 ///\r
74 Ip4Config2DataTypeDnsServer,\r
75 Ip4Config2DataTypeMaximum\r
76} EFI_IP4_CONFIG2_DATA_TYPE;\r
77\r
9132a8f8
JW
78///\r
79/// EFI_IP4_CONFIG2_INTERFACE_INFO related definitions\r
80///\r
81#define EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE 32\r
82\r
cff298f4 83///\r
84/// EFI_IP4_CONFIG2_INTERFACE_INFO\r
85///\r
86typedef struct {\r
87 ///\r
88 /// The name of the interface. It is a NULL-terminated Unicode string.\r
89 ///\r
9132a8f8 90 CHAR16 Name[EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE];\r
cff298f4 91 ///\r
9095d37b 92 /// The interface type of the network interface. See RFC 1700,\r
cff298f4 93 /// section "Number Hardware Type".\r
94 ///\r
95 UINT8 IfType;\r
96 ///\r
97 /// The size, in bytes, of the network interface's hardware address.\r
98 ///\r
99 UINT32 HwAddressSize;\r
100 ///\r
101 /// The hardware address for the network interface.\r
102 ///\r
103 EFI_MAC_ADDRESS HwAddress;\r
104 ///\r
105 /// The station IPv4 address of this EFI IPv4 network stack.\r
106 ///\r
107 EFI_IPv4_ADDRESS StationAddress;\r
108 ///\r
109 /// The subnet address mask that is associated with the station address.\r
110 ///\r
111 EFI_IPv4_ADDRESS SubnetMask;\r
112 ///\r
113 /// Size of the following RouteTable, in bytes. May be zero.\r
114 ///\r
115 UINT32 RouteTableSize;\r
116 ///\r
9095d37b
LG
117 /// The route table of the IPv4 network stack runs on this interface.\r
118 /// Set to NULL if RouteTableSize is zero. Type EFI_IP4_ROUTE_TABLE is defined in\r
cff298f4 119 /// EFI_IP4_PROTOCOL.GetModeData().\r
120 ///\r
121 EFI_IP4_ROUTE_TABLE *RouteTable OPTIONAL;\r
122} EFI_IP4_CONFIG2_INTERFACE_INFO;\r
123\r
124///\r
125/// EFI_IP4_CONFIG2_POLICY\r
126///\r
127typedef enum {\r
128 ///\r
9095d37b
LG
129 /// Under this policy, the Ip4Config2DataTypeManualAddress,\r
130 /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration\r
131 /// data are required to be set manually. The EFI IPv4 Protocol will get all\r
132 /// required configuration such as IPv4 address, subnet mask and\r
cff298f4 133 /// gateway settings from the EFI IPv4 Configuration II protocol.\r
134 ///\r
135 Ip4Config2PolicyStatic,\r
136 ///\r
9095d37b
LG
137 /// Under this policy, the Ip4Config2DataTypeManualAddress,\r
138 /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration data are\r
139 /// not allowed to set via SetData(). All of these configurations are retrieved from DHCP\r
cff298f4 140 /// server or other auto-configuration mechanism.\r
141 ///\r
142 Ip4Config2PolicyDhcp,\r
143 Ip4Config2PolicyMax\r
144} EFI_IP4_CONFIG2_POLICY;\r
145\r
146///\r
147/// EFI_IP4_CONFIG2_MANUAL_ADDRESS\r
148///\r
149typedef struct {\r
9095d37b 150 ///\r
cff298f4 151 /// The IPv4 unicast address.\r
152 ///\r
153 EFI_IPv4_ADDRESS Address;\r
154 ///\r
9095d37b 155 /// The subnet mask.\r
cff298f4 156 ///\r
157 EFI_IPv4_ADDRESS SubnetMask;\r
158} EFI_IP4_CONFIG2_MANUAL_ADDRESS;\r
159\r
160/**\r
9095d37b 161 Set the configuration for the EFI IPv4 network stack running on the communication device this EFI\r
cff298f4 162 IPv4 Configuration II Protocol instance manages.\r
163\r
9095d37b 164 This function is used to set the configuration data of type DataType for the EFI IPv4 network stack\r
cff298f4 165 running on the communication device this EFI IPv4 Configuration II Protocol instance manages.\r
166 The successfully configured data is valid after system reset or power-off.\r
9095d37b 167 The DataSize is used to calculate the count of structure instances in the Data for some\r
cff298f4 168 DataType that multiple structure instances are allowed.\r
9095d37b
LG
169 This function is always non-blocking. When setting some typeof configuration data, an\r
170 asynchronous process is invoked to check the correctness of the data, such as doing address conflict\r
171 detection on the manually set local IPv4 address. EFI_NOT_READY is returned immediately to\r
172 indicate that such an asynchronous process is invoked and the process is not finished yet. The caller\r
cff298f4 173 willing to get the result of the asynchronous process is required to call RegisterDataNotify()\r
9095d37b
LG
174 to register an event on the specified configuration data. Once the event is signaled, the caller can call\r
175 GetData()to get back the configuration data in order to know the result. For other types of\r
176 configuration data that do not require an asynchronous configuration process, the result of the\r
177 operation is immediately returned.\r
cff298f4 178\r
9095d37b 179 @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.\r
cff298f4 180 @param[in] DataType The type of data to set.\r
181 @param[in] DataSize Size of the buffer pointed to by Data in bytes.\r
9095d37b
LG
182 @param[in] Data The data buffer to set. The type ofthe data buffer is associated\r
183 with the DataType.\r
cff298f4 184\r
9095d37b 185 @retval EFI_SUCCESS The specified configuration data for the EFI IPv4 network stack is set\r
cff298f4 186 successfully.\r
187 @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
188 This is NULL.\r
9095d37b 189 One or more fields in Data and DataSize do not match the\r
1499e1ae 190 requirement of the data type indicated by DataType.\r
9095d37b 191 @retval EFI_WRITE_PROTECTED The specified configuration data is read-only or the specified configuration\r
cff298f4 192 data can not be set under the current policy.\r
193 @retval EFI_ACCESS_DENIED Another set operation on the specified configuration data is already in process.\r
9095d37b 194 @retval EFI_NOT_READY An asynchronous process is invoked to set the specified configuration data and\r
cff298f4 195 the process is not finished yet.\r
9095d37b 196 @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type indicated by DataType.\r
cff298f4 197 @retval EFI_UNSUPPORTED This DataType is not supported.\r
198 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
199 @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred.\r
200**/\r
9095d37b 201typedef\r
cff298f4 202EFI_STATUS\r
203(EFIAPI *EFI_IP4_CONFIG2_SET_DATA) (\r
204 IN EFI_IP4_CONFIG2_PROTOCOL *This,\r
205 IN EFI_IP4_CONFIG2_DATA_TYPE DataType,\r
206 IN UINTN DataSize,\r
207 IN VOID *Data\r
208 );\r
209\r
210/**\r
9095d37b 211 Get the configuration data for the EFI IPv4 network stack running on the communication device this\r
cff298f4 212 EFI IPv4 Configuration II Protocol instance manages.\r
213\r
9095d37b 214 This function returns the configuration data of type DataType for the EFI IPv4 network stack\r
cff298f4 215 running on the communication device this EFI IPv4 Configuration II Protocol instance manages.\r
9095d37b 216 The caller is responsible for allocating the buffer usedto return the specified configuration data and\r
cff298f4 217 the required size will be returned to the caller if the size of the buffer is too small.\r
9095d37b
LG
218 EFI_NOT_READY is returned if the specified configuration data is not ready due to an already in\r
219 progress asynchronous configuration process. The caller can call RegisterDataNotify() to\r
220 register an event on the specified configuration data. Once the asynchronous configuration process is\r
221 finished, the event will be signaled and a subsequent GetData() call will return the specified\r
cff298f4 222 configuration data.\r
223\r
9095d37b 224 @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.\r
cff298f4 225 @param[in] DataType The type of data to get.\r
9095d37b
LG
226 @param[out] DataSize On input, in bytes, the size of Data. On output, in bytes, the size\r
227 of buffer required to store the specified configuration data.\r
228 @param[in] Data The data buffer in which the configuration data is returned. The\r
229 type of the data buffer is associated with the DataType. Ignored\r
230 if DataSize is 0.\r
cff298f4 231\r
232 @retval EFI_SUCCESS The specified configuration data is got successfully.\r
233 @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE:\r
234 This is NULL.\r
235 DataSize is NULL.\r
236 Data is NULL if *DataSizeis not zero.\r
9095d37b 237 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified configuration data\r
cff298f4 238 and the required size is returned in DataSize.\r
9095d37b 239 @retval EFI_NOT_READY The specified configuration data is not ready due to an already in\r
cff298f4 240 progress asynchronous configuration process.\r
241 @retval EFI_NOT_FOUND The specified configuration data is not found.\r
242**/\r
243typedef\r
244EFI_STATUS\r
245(EFIAPI *EFI_IP4_CONFIG2_GET_DATA) (\r
246 IN EFI_IP4_CONFIG2_PROTOCOL *This,\r
247 IN EFI_IP4_CONFIG2_DATA_TYPE DataType,\r
248 IN OUT UINTN *DataSize,\r
249 IN VOID *Data OPTIONAL\r
250 );\r
251\r
252/**\r
9095d37b 253 Register an event that is to be signaled whenever a configuration process on the specified\r
cff298f4 254 configuration data is done.\r
255\r
9095d37b 256 This function registers an event that is to be signaled whenever a configuration process on the\r
cff298f4 257 specified configuration data is done. An event can be registered for different DataType\r
9095d37b 258 simultaneously and the caller is responsible for determining which type of configuration data causes\r
cff298f4 259 the signaling of the event in such case.\r
260\r
9095d37b 261 @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.\r
cff298f4 262 @param[in] DataType The type of data to unregister the event for.\r
263 @param[in] Event The event to register.\r
264\r
9095d37b 265 @retval EFI_SUCCESS The notification event for the specified configuration data is\r
cff298f4 266 registered.\r
267 @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.\r
268 @retval EFI_UNSUPPORTED The configuration data type specified by DataType is not supported.\r
269 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
270 @retval EFI_ACCESS_DENIED The Event is already registered for the DataType.\r
271**/\r
272typedef\r
273EFI_STATUS\r
274(EFIAPI *EFI_IP4_CONFIG2_REGISTER_NOTIFY) (\r
275 IN EFI_IP4_CONFIG2_PROTOCOL *This,\r
276 IN EFI_IP4_CONFIG2_DATA_TYPE DataType,\r
277 IN EFI_EVENT Event\r
278 );\r
279\r
280/**\r
281 Remove a previously registered event for the specified configuration data.\r
282\r
283 This function removes a previously registeredevent for the specified configuration data.\r
284\r
9095d37b 285 @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance.\r
cff298f4 286 @param[in] DataType The type of data to remove the previously registered event for.\r
287 @param[in] Event The event to unregister.\r
288\r
289 @retval EFI_SUCCESS The event registered for the specified configuration data is removed.\r
290 @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL.\r
291 @retval EFI_NOT_FOUND The Eventhas not been registered for the specified DataType.\r
292**/\r
293typedef\r
294EFI_STATUS\r
295(EFIAPI *EFI_IP4_CONFIG2_UNREGISTER_NOTIFY) (\r
296 IN EFI_IP4_CONFIG2_PROTOCOL *This,\r
297 IN EFI_IP4_CONFIG2_DATA_TYPE DataType,\r
298 IN EFI_EVENT Event\r
299 );\r
300\r
301///\r
9095d37b 302/// The EFI_IP4_CONFIG2_PROTOCOL is designed to be the central repository for the common\r
cff298f4 303/// configurations and the administrator configurable settings for the EFI IPv4 network stack.\r
9095d37b 304/// An EFI IPv4 Configuration II Protocol instance will be installed on each communication device that\r
cff298f4 305/// the EFI IPv4 network stack runs on.\r
306///\r
307struct _EFI_IP4_CONFIG2_PROTOCOL {\r
308 EFI_IP4_CONFIG2_SET_DATA SetData;\r
309 EFI_IP4_CONFIG2_GET_DATA GetData;\r
310 EFI_IP4_CONFIG2_REGISTER_NOTIFY RegisterDataNotify;\r
311 EFI_IP4_CONFIG2_UNREGISTER_NOTIFY UnregisterDataNotify;\r
312};\r
313\r
314extern EFI_GUID gEfiIp4Config2ProtocolGuid;\r
315\r
316#endif\r
317\r