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