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