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