]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
Replace references to RFC 3066 with RFC 4646.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4ConfigDxe / Ip4Config.h
CommitLineData
83cbd279 1/** @file\r
402fa70f 2 Header file for IP4Config driver.\r
83cbd279 3\r
402fa70f 4Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
83cbd279 5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
402fa70f 7which accompanies this distribution. The full text of the license may be found at<BR>\r
83cbd279 8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
83cbd279 13**/\r
14\r
402fa70f 15#ifndef _EFI_IP4CONFIG_H_\r
16#define _EFI_IP4CONFIG_H_\r
83cbd279 17\r
c8d8f1e3 18#include <Uefi.h>\r
b2570da8 19\r
20#include <Protocol/Dhcp4.h>\r
24e58768 21#include <Protocol/Ip4Config.h>\r
b2570da8 22#include <Protocol/ManagedNetwork.h>\r
23\r
24#include <Library/DebugLib.h>\r
25#include <Library/UefiRuntimeServicesTableLib.h>\r
26#include <Library/UefiDriverEntryPoint.h>\r
27#include <Library/UefiBootServicesTableLib.h>\r
28#include <Library/UefiLib.h>\r
29#include <Library/NetLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
83cbd279 31#include <Library/MemoryAllocationLib.h>\r
32\r
33#include "NicIp4Variable.h"\r
34\r
35typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;\r
36\r
c8d8f1e3 37//\r
38// Global variables \r
39//\r
40extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;\r
41extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;\r
42extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;\r
43\r
44extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];\r
45extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;\r
46extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;\r
47\r
48#define IP4_PROTO_ICMP 0x01\r
49#define IP4_CONFIG_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')\r
50\r
7bce0c5a 51typedef enum {\r
83cbd279 52 IP4_CONFIG_STATE_IDLE = 0,\r
53 IP4_CONFIG_STATE_STARTED,\r
7bce0c5a 54 IP4_CONFIG_STATE_CONFIGURED\r
55} IP4_CONFIG_STATE;\r
83cbd279 56\r
7bce0c5a 57typedef enum {\r
83cbd279 58 DHCP_TAG_PARA_LIST = 55,\r
59 DHCP_TAG_NETMASK = 1,\r
60 DHCP_TAG_ROUTER = 3\r
7bce0c5a 61} DHCP_TAGS;\r
83cbd279 62\r
63//\r
64// Configure the DHCP to request the routers and netmask\r
65// from server. The DHCP_TAG_NETMASK is included in Head.\r
66//\r
67#pragma pack(1)\r
68typedef struct {\r
69 EFI_DHCP4_PACKET_OPTION Head;\r
70 UINT8 Route;\r
71} IP4_CONFIG_DHCP4_OPTION;\r
72#pragma pack()\r
73\r
74struct _IP4_CONFIG_INSTANCE {\r
75 UINT32 Signature;\r
76 EFI_HANDLE Controller;\r
77 EFI_HANDLE Image;\r
78\r
79 EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;\r
80 EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;\r
81\r
82 //\r
83 // NicConfig's state, such as IP4_CONFIG_STATE_IDLE\r
84 //\r
85 INTN State;\r
86\r
87 //\r
88 // Mnp child to keep the connection with MNP.\r
89 //\r
90 EFI_MANAGED_NETWORK_PROTOCOL *Mnp;\r
91 EFI_HANDLE MnpHandle;\r
92\r
93 //\r
94 // User's requests data\r
95 //\r
96 EFI_EVENT DoneEvent;\r
97 EFI_EVENT ReconfigEvent;\r
98 EFI_STATUS Result;\r
99\r
100 //\r
101 // Identity of this interface and some configuration info.\r
102 //\r
103 NIC_ADDR NicAddr;\r
104 UINT16 NicName[IP4_NIC_NAME_LENGTH];\r
105 UINT32 NicIndex;\r
106 NIC_IP4_CONFIG_INFO *NicConfig;\r
107\r
108 //\r
109 // DHCP handles to access DHCP\r
110 //\r
111 EFI_DHCP4_PROTOCOL *Dhcp4;\r
112 EFI_HANDLE Dhcp4Handle;\r
113 EFI_EVENT Dhcp4Event;\r
114};\r
115\r
116#define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \\r
117 CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)\r
118\r
119#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \\r
120 CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)\r
121\r
7bce0c5a 122/**\r
123 Release all the DHCP related resources.\r
124\r
125 @param This The IP4 configure instance\r
126\r
127 @return None\r
128\r
129**/\r
83cbd279 130VOID\r
131Ip4ConfigCleanDhcp4 (\r
c8d8f1e3 132 IN IP4_CONFIG_INSTANCE *This\r
83cbd279 133 );\r
134\r
7bce0c5a 135/**\r
136 Clean up all the configuration parameters.\r
137\r
138 @param Instance The IP4 configure instance\r
139\r
140 @return None\r
141\r
142**/\r
83cbd279 143VOID\r
144Ip4ConfigCleanConfig (\r
145 IN IP4_CONFIG_INSTANCE *Instance\r
146 );\r
c8d8f1e3 147 \r
148//\r
149// EFI Component Name Functions\r
150//\r
151\r
152/**\r
153 Retrieves a Unicode string that is the user readable name of the driver.\r
154\r
155 This function retrieves the user readable name of a driver in the form of a\r
156 Unicode string. If the driver specified by This has a user readable name in\r
157 the language specified by Language, then a pointer to the driver name is\r
158 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
159 by This does not support the language specified by Language,\r
160 then EFI_UNSUPPORTED is returned.\r
161\r
162 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
163 EFI_COMPONENT_NAME_PROTOCOL instance.\r
164 @param Language[in] A pointer to a Null-terminated ASCII string\r
165 array indicating the language. This is the\r
166 language of the driver name that the caller is\r
167 requesting, and it must match one of the\r
168 languages specified in SupportedLanguages. The\r
169 number of languages supported by a driver is up\r
170 to the driver writer. Language is specified\r
0254efc0 171 in RFC 4646 or ISO 639-2 language code format. \r
c8d8f1e3 172 @param DriverName[out] A pointer to the Unicode string to return.\r
173 This Unicode string is the name of the\r
174 driver specified by This in the language\r
175 specified by Language.\r
176\r
177 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
178 This and the language specified by Language was\r
179 returned in DriverName.\r
180 @retval EFI_INVALID_PARAMETER Language is NULL.\r
181 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
182 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
183 the language specified by Language.\r
184\r
185**/\r
186EFI_STATUS\r
187EFIAPI\r
188Ip4ConfigComponentNameGetDriverName (\r
189 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
190 IN CHAR8 *Language,\r
191 OUT CHAR16 **DriverName\r
192 );\r
193\r
194/**\r
195 Retrieves a Unicode string that is the user readable name of the controller\r
196 that is being managed by a driver.\r
197\r
198 This function retrieves the user readable name of the controller specified by\r
199 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
200 driver specified by This has a user readable name in the language specified by\r
201 Language, then a pointer to the controller name is returned in ControllerName,\r
202 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
203 managing the controller specified by ControllerHandle and ChildHandle,\r
204 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
205 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
206\r
207 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
208 EFI_COMPONENT_NAME_PROTOCOL instance.\r
209 @param ControllerHandle[in] The handle of a controller that the driver\r
210 specified by This is managing. This handle\r
211 specifies the controller whose name is to be\r
212 returned.\r
213 @param ChildHandle[in] The handle of the child controller to retrieve\r
214 the name of. This is an optional parameter that\r
215 may be NULL. It will be NULL for device\r
216 drivers. It will also be NULL for a bus drivers\r
217 that wish to retrieve the name of the bus\r
218 controller. It will not be NULL for a bus\r
219 driver that wishes to retrieve the name of a\r
220 child controller.\r
221 @param Language[in] A pointer to a Null-terminated ASCII string\r
222 array indicating the language. This is the\r
223 language of the driver name that the caller is\r
224 requesting, and it must match one of the\r
225 languages specified in SupportedLanguages. The\r
226 number of languages supported by a driver is up\r
227 to the driver writer. Language is specified in\r
0254efc0 228 RFC 4646 or ISO 639-2 language code format.\r
c8d8f1e3 229 @param ControllerName[out] A pointer to the Unicode string to return.\r
230 This Unicode string is the name of the\r
231 controller specified by ControllerHandle and\r
232 ChildHandle in the language specified by\r
233 Language from the point of view of the driver\r
234 specified by This.\r
235 \r
236 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
237 the language specified by Language for the\r
238 driver specified by This was returned in\r
239 DriverName.\r
240 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
241 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
242 EFI_HANDLE.\r
243 @retval EFI_INVALID_PARAMETER Language is NULL.\r
244 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
245 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
246 managing the controller specified by\r
247 ControllerHandle and ChildHandle.\r
248 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
249 the language specified by Language.\r
250\r
251**/\r
252EFI_STATUS\r
253EFIAPI\r
254Ip4ConfigComponentNameGetControllerName (\r
255 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
256 IN EFI_HANDLE ControllerHandle,\r
257 IN EFI_HANDLE ChildHandle OPTIONAL,\r
258 IN CHAR8 *Language,\r
259 OUT CHAR16 **ControllerName\r
260 );\r
261 \r
262/**\r
263 Test to see if this driver supports ControllerHandle.\r
264\r
265 @param This Protocol instance pointer.\r
266 @param ControllerHandle Handle of device to test\r
267 @param RemainingDevicePath Optional parameter use to pick a specific child\r
268 device to start.\r
269\r
270 @retval EFI_SUCCES This driver supports this device\r
271 @retval EFI_ALREADY_STARTED This driver is already running on this device\r
272 @retval other This driver does not support this device\r
273\r
274**/\r
275EFI_STATUS\r
276EFIAPI\r
277Ip4ConfigDriverBindingSupported (\r
278 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
279 IN EFI_HANDLE ControllerHandle,\r
280 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
281 );\r
282 \r
283/**\r
284 Start this driver on ControllerHandle.\r
285\r
286 @param This Protocol instance pointer.\r
287 @param ControllerHandle Handle of device to bind driver to\r
288 @param RemainingDevicePath Optional parameter use to pick a specific child\r
289 device to start.\r
290\r
291 @retval EFI_SUCCES This driver is added to ControllerHandle\r
292 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
293 @retval other This driver does not support this device\r
294\r
295**/\r
296EFI_STATUS\r
297EFIAPI\r
298Ip4ConfigDriverBindingStart (\r
299 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
300 IN EFI_HANDLE ControllerHandle,\r
301 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
302 );\r
303 \r
304/**\r
305 Stop this driver on ControllerHandle.\r
306\r
307 @param This Protocol instance pointer.\r
308 @param ControllerHandle Handle of device to stop driver on\r
309 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
310 children is zero stop the entire bus driver.\r
311 @param ChildHandleBuffer List of Child Handles to Stop.\r
312\r
313 @retval EFI_SUCCES This driver is removed ControllerHandle\r
314 @retval other This driver was not removed from this device\r
315\r
316**/\r
317EFI_STATUS\r
318EFIAPI\r
319Ip4ConfigDriverBindingStop (\r
320 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
321 IN EFI_HANDLE ControllerHandle,\r
322 IN UINTN NumberOfChildren,\r
323 IN EFI_HANDLE *ChildHandleBuffer\r
324 );\r
325 \r
83cbd279 326#endif\r