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