]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/Ip6Dxe/ComponentName.c
1. Fix bugs for PXE-IPv6 to accommodate the situation:
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / ComponentName.c
CommitLineData
a3bcde70
HT
1/** @file\r
2 Implementation of EFI_COMPONENT_NAME_PROTOCOL and\r
3 EFI_COMPONENT_NAME2_PROTOCOL protocol.\r
4\r
15ee13fc 5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
a3bcde70
HT
6\r
7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions of the BSD License\r
9 which accompanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php.\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#include "Ip6Impl.h"\r
18\r
19//\r
20// EFI Component Name Functions\r
21//\r
22\r
23/**\r
24 Retrieves a Unicode string that is the user-readable name of the driver.\r
25\r
26 This function retrieves the user-readable name of a driver in the form of a\r
27 Unicode string. If the driver specified by This has a user-readable name in\r
28 the language specified by Language, then a pointer to the driver name is\r
29 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
30 by This does not support the language specified by Language,\r
31 then EFI_UNSUPPORTED is returned.\r
32\r
33 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
34 EFI_COMPONENT_NAME_PROTOCOL instance.\r
35\r
36 @param[in] Language A pointer to a Null-terminated ASCII string\r
37 array indicating the language. This is the\r
38 language of the driver name that the caller is\r
39 requesting, and it must match one of the\r
40 languages specified in SupportedLanguages. The\r
41 number of languages supported by a driver is up\r
42 to the driver writer. Language is specified\r
43 in RFC 4646 or ISO 639-2 language code format.\r
44\r
45 @param[out] DriverName A pointer to the Unicode string to return.\r
46 This Unicode string is the name of the\r
47 driver specified by This in the language\r
48 specified by Language.\r
49\r
50 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
51 This and the language specified by Language was\r
52 returned in DriverName.\r
53\r
54 @retval EFI_INVALID_PARAMETER Language is NULL.\r
55\r
56 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
57\r
58 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
59 the language specified by Language.\r
60\r
61**/\r
62EFI_STATUS\r
63EFIAPI\r
64Ip6ComponentNameGetDriverName (\r
65 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
66 IN CHAR8 *Language,\r
67 OUT CHAR16 **DriverName\r
68 );\r
69\r
70/**\r
71 Retrieves a Unicode string that is the user-readable name of the controller\r
72 that is managed by a driver.\r
73\r
74 This function retrieves the user-readable name of the controller specified by\r
75 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
76 driver specified by This has a user-readable name in the language specified by\r
77 Language, then a pointer to the controller name is returned in ControllerName,\r
78 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
79 managing the controller specified by ControllerHandle and ChildHandle,\r
80 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
81 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
82\r
83 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
84 EFI_COMPONENT_NAME_PROTOCOL instance.\r
85\r
86 @param[in] ControllerHandle The handle of a controller that the driver\r
87 specified by This is managing. This handle\r
88 specifies the controller whose name is to be\r
89 returned.\r
90\r
91 @param[in] ChildHandle The handle of the child controller to retrieve\r
92 the name of. This is an optional parameter that\r
93 may be NULL. It will be NULL for device\r
94 drivers. It will also be NULL for a bus drivers\r
95 that wish to retrieve the name of the bus\r
96 controller. It will not be NULL for a bus\r
97 driver that wishes to retrieve the name of a\r
98 child controller.\r
99\r
100 @param[in] Language A pointer to a Null-terminated ASCII string\r
101 array indicating the language. This is the\r
102 language of the driver name that the caller is\r
103 requesting, and it must match one of the\r
104 languages specified in SupportedLanguages. The\r
105 number of languages supported by a driver is up\r
106 to the driver writer. Language is specified in\r
107 RFC 4646 or ISO 639-2 language code format.\r
108\r
109 @param[out] ControllerName A pointer to the Unicode string to return.\r
110 This Unicode string is the name of the\r
111 controller specified by ControllerHandle and\r
112 ChildHandle in the language specified by\r
113 Language from the point of view of the driver\r
114 specified by This.\r
115\r
116 @retval EFI_SUCCESS The Unicode string for the user-readable name in\r
117 the language specified by Language for the\r
118 driver specified by This was returned in\r
119 DriverName.\r
120\r
15ee13fc 121 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
a3bcde70
HT
122\r
123 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it is not a valid\r
124 EFI_HANDLE.\r
125\r
126 @retval EFI_INVALID_PARAMETER Language is NULL.\r
127\r
128 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
129\r
130 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
131 managing the controller specified by\r
132 ControllerHandle and ChildHandle.\r
133\r
134 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
135 the language specified by Language.\r
136\r
137**/\r
138EFI_STATUS\r
139EFIAPI\r
140Ip6ComponentNameGetControllerName (\r
141 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
142 IN EFI_HANDLE ControllerHandle,\r
143 IN EFI_HANDLE ChildHandle OPTIONAL,\r
144 IN CHAR8 *Language,\r
145 OUT CHAR16 **ControllerName\r
146 );\r
147\r
148//\r
149// EFI Component Name Protocol.\r
150//\r
151GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIp6ComponentName = {\r
152 Ip6ComponentNameGetDriverName,\r
153 Ip6ComponentNameGetControllerName,\r
154 "eng"\r
155};\r
156\r
157//\r
158// EFI Component Name 2 Protocol.\r
159//\r
160GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIp6ComponentName2 = {\r
161 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ip6ComponentNameGetDriverName,\r
162 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ip6ComponentNameGetControllerName,\r
163 "en"\r
164};\r
165\r
166GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIp6DriverNameTable[] = {\r
167 {\r
168 "eng;en",\r
169 L"IP6 Network Service Driver"\r
170 },\r
171 {\r
172 NULL,\r
173 NULL\r
174 }\r
175};\r
176\r
177/**\r
178 Retrieves a Unicode string that is the user-readable name of the driver.\r
179\r
180 This function retrieves the user-readable name of a driver in the form of a\r
181 Unicode string. If the driver specified by This has a user-readable name in\r
182 the language specified by Language, then a pointer to the driver name is\r
183 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
184 by This does not support the language specified by Language,\r
185 then EFI_UNSUPPORTED is returned.\r
186\r
187 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
188 EFI_COMPONENT_NAME_PROTOCOL instance.\r
189\r
190 @param[in] Language A pointer to a Null-terminated ASCII string\r
191 array indicating the language. This is the\r
192 language of the driver name that the caller is\r
193 requesting, and it must match one of the\r
194 languages specified in SupportedLanguages. The\r
195 number of languages supported by a driver is up\r
196 to the driver writer. Language is specified\r
197 in RFC 4646 or ISO 639-2 language code format.\r
198\r
199 @param[out] DriverName A pointer to the Unicode string to return.\r
200 This Unicode string is the name of the\r
201 driver specified by This in the language\r
202 specified by Language.\r
203\r
204 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
205 This and the language specified by Language was\r
206 returned in DriverName.\r
207\r
208 @retval EFI_INVALID_PARAMETER Language is NULL.\r
209\r
210 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
211\r
212 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
213 the language specified by Language.\r
214\r
215**/\r
216EFI_STATUS\r
217EFIAPI\r
218Ip6ComponentNameGetDriverName (\r
219 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
220 IN CHAR8 *Language,\r
221 OUT CHAR16 **DriverName\r
222 )\r
223{\r
224 return LookupUnicodeString2 (\r
225 Language,\r
226 This->SupportedLanguages,\r
227 mIp6DriverNameTable,\r
228 DriverName,\r
229 (BOOLEAN) (This == &gIp6ComponentName)\r
230 );\r
231\r
232}\r
233\r
234/**\r
235 Retrieves a Unicode string that is the user-readable name of the controller\r
236 that is being managed by a driver.\r
237\r
238 This function retrieves the user-readable name of the controller specified by\r
239 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
240 driver specified by This has a user-readable name in the language specified by\r
241 Language, then a pointer to the controller name is returned in ControllerName,\r
242 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
243 managing the controller specified by ControllerHandle and ChildHandle,\r
244 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
245 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
246\r
247 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
248 EFI_COMPONENT_NAME_PROTOCOL instance.\r
249\r
250 @param[in] ControllerHandle The handle of a controller that the driver\r
251 specified by This is managing. This handle\r
252 specifies the controller whose name is to be\r
253 returned.\r
254\r
255 @param[in] ChildHandle The handle of the child controller to retrieve\r
256 the name of. This is an optional parameter that\r
257 may be NULL. It will be NULL for device\r
258 drivers. It will also be NULL for a bus drivers\r
259 that wish to retrieve the name of the bus\r
260 controller. It will not be NULL for a bus\r
261 driver that wishes to retrieve the name of a\r
262 child controller.\r
263\r
264 @param[in] Language A pointer to a Null-terminated ASCII string\r
265 array indicating the language. This is the\r
266 language of the driver name that the caller is\r
267 requesting, and it must match one of the\r
268 languages specified in SupportedLanguages. The\r
269 number of languages supported by a driver is up\r
270 to the driver writer. Language is specified in\r
271 RFC 4646 or ISO 639-2 language code format.\r
272\r
273 @param[out] ControllerName A pointer to the Unicode string to return.\r
274 This Unicode string is the name of the\r
275 controller specified by ControllerHandle and\r
276 ChildHandle in the language specified by\r
277 Language from the point of view of the driver\r
278 specified by This.\r
279\r
280 @retval EFI_SUCCESS The Unicode string for the user-readable name in\r
281 the language specified by Language for the\r
282 driver specified by This was returned in\r
283 DriverName.\r
284\r
15ee13fc 285 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
a3bcde70
HT
286\r
287 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it is not a valid\r
288 EFI_HANDLE.\r
289\r
290 @retval EFI_INVALID_PARAMETER Language is NULL.\r
291\r
292 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
293\r
294 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
295 managing the controller specified by\r
296 ControllerHandle and ChildHandle.\r
297\r
298 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
299 the language specified by Language.\r
300\r
301**/\r
302EFI_STATUS\r
303EFIAPI\r
304Ip6ComponentNameGetControllerName (\r
305 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
306 IN EFI_HANDLE ControllerHandle,\r
307 IN EFI_HANDLE ChildHandle OPTIONAL,\r
308 IN CHAR8 *Language,\r
309 OUT CHAR16 **ControllerName\r
310 )\r
311{\r
312 return EFI_UNSUPPORTED;\r
313}\r