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