]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/TcpDxe/ComponentName.c
Adopt new IPv4/IPv6 device path for network modules.
[mirror_edk2.git] / NetworkPkg / TcpDxe / ComponentName.c
CommitLineData
a3bcde70
HT
1/** @file\r
2 Implementation of protocols EFI_COMPONENT_NAME_PROTOCOL and\r
3 EFI_COMPONENT_NAME2_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 "TcpMain.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 or 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
62TcpComponentNameGetDriverName (\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 or ControllerName is NULL.\r
125\r
126 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
127 managing the controller specified by\r
128 ControllerHandle and ChildHandle.\r
129\r
130 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
131 the language specified by Language.\r
132\r
133**/\r
134EFI_STATUS\r
135EFIAPI\r
136TcpComponentNameGetControllerName (\r
137 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
138 IN EFI_HANDLE ControllerHandle,\r
139 IN EFI_HANDLE ChildHandle OPTIONAL,\r
140 IN CHAR8 *Language,\r
141 OUT CHAR16 **ControllerName\r
142 );\r
143\r
144///\r
145/// EFI Component Name Protocol\r
146///\r
147GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gTcpComponentName = {\r
148 TcpComponentNameGetDriverName,\r
149 TcpComponentNameGetControllerName,\r
150 "eng"\r
151};\r
152\r
153///\r
154/// EFI Component Name 2 Protocol\r
155///\r
156GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gTcpComponentName2 = {\r
157 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) TcpComponentNameGetDriverName,\r
158 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) TcpComponentNameGetControllerName,\r
159 "en"\r
160};\r
161\r
162GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mTcpDriverNameTable[] = {\r
163 {\r
164 "eng;en",\r
165 L"TCP Network Service Driver"\r
166 },\r
167 {\r
168 NULL,\r
169 NULL\r
170 }\r
171};\r
172\r
173/**\r
174 Retrieves a Unicode string that is the user-readable name of the driver.\r
175\r
176 This function retrieves the user-readable name of a driver in the form of a\r
177 Unicode string. If the driver specified by This has a user-readable name in\r
178 the language specified by Language, then a pointer to the driver name is\r
179 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
180 by This does not support the language specified by Language,\r
181 then EFI_UNSUPPORTED is returned.\r
182\r
183 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
184 EFI_COMPONENT_NAME_PROTOCOL instance.\r
185\r
186 @param[in] Language A pointer to a Null-terminated ASCII string\r
187 array indicating the language. This is the\r
188 language of the driver name that the caller is\r
189 requesting, and it must match one of the\r
190 languages specified in SupportedLanguages. The\r
191 number of languages supported by a driver is up\r
192 to the driver writer. Language is specified\r
193 in RFC 4646 or ISO 639-2 language code format.\r
194\r
195 @param[out] DriverName A pointer to the Unicode string to return.\r
196 This Unicode string is the name of the\r
197 driver specified by This in the language\r
198 specified by Language.\r
199\r
200 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
201 This, and the language specified by Language was\r
202 returned in DriverName.\r
203\r
204 @retval EFI_INVALID_PARAMETER Language or DriverName is NULL.\r
205\r
206 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
207 the language specified by Language.\r
208\r
209**/\r
210EFI_STATUS\r
211EFIAPI\r
212TcpComponentNameGetDriverName (\r
213 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
214 IN CHAR8 *Language,\r
215 OUT CHAR16 **DriverName\r
216 )\r
217{\r
218 return LookupUnicodeString2 (\r
219 Language,\r
220 This->SupportedLanguages,\r
221 mTcpDriverNameTable,\r
222 DriverName,\r
223 (BOOLEAN) (This == &gTcpComponentName)\r
224 );\r
225}\r
226\r
227/**\r
228 Retrieves a Unicode string that is the user-readable name of the controller\r
229 that is being managed by a driver.\r
230\r
231 This function retrieves the user-readable name of the controller specified by\r
232 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
233 driver specified by This has a user-readable name in the language specified by\r
234 Language, then a pointer to the controller name is returned in ControllerName,\r
235 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
236 managing the controller specified by ControllerHandle and ChildHandle,\r
237 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
238 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
239\r
240 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
241 EFI_COMPONENT_NAME_PROTOCOL instance.\r
242\r
243 @param[in] ControllerHandle The handle of a controller that the driver\r
244 specified by This is managing. This handle\r
245 specifies the controller whose name is to be\r
246 returned.\r
247\r
248 @param[in] ChildHandle The handle of the child controller to retrieve\r
249 the name of. This is an optional parameter that\r
250 may be NULL. It will be NULL for device\r
251 drivers. It will also be NULL for a bus drivers\r
252 that wish to retrieve the name of the bus\r
253 controller. It will not be NULL for a bus\r
254 driver that wishes to retrieve the name of a\r
255 child controller.\r
256\r
257 @param[in] Language A pointer to a Null-terminated ASCII string\r
258 array indicating the language. This is the\r
259 language of the driver name that the caller is\r
260 requesting, and it must match one of the\r
261 languages specified in SupportedLanguages. The\r
262 number of languages supported by a driver is up\r
263 to the driver writer. Language is specified in\r
264 RFC 4646 or ISO 639-2 language code format.\r
265\r
266 @param[out] ControllerName A pointer to the Unicode string to return.\r
267 This Unicode string is the name of the\r
268 controller specified by ControllerHandle and\r
269 ChildHandle in the language specified by\r
270 Language, from the point of view of the driver\r
271 specified by This.\r
272\r
273 @retval EFI_SUCCESS The Unicode string for the user-readable name in\r
274 the language specified by Language for the\r
275 driver specified by This was returned in\r
276 DriverName.\r
277\r
15ee13fc 278 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
a3bcde70
HT
279\r
280 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it is not a valid\r
281 EFI_HANDLE.\r
282\r
283 @retval EFI_INVALID_PARAMETER Language or ControllerName is NULL.\r
284\r
285 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
286 managing the controller specified by\r
287 ControllerHandle and ChildHandle.\r
288\r
289 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
290 the language specified by Language.\r
291\r
292**/\r
293EFI_STATUS\r
294EFIAPI\r
295TcpComponentNameGetControllerName (\r
296 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
297 IN EFI_HANDLE ControllerHandle,\r
298 IN EFI_HANDLE ChildHandle OPTIONAL,\r
299 IN CHAR8 *Language,\r
300 OUT CHAR16 **ControllerName\r
301 )\r
302{\r
303 return EFI_UNSUPPORTED;\r
304}\r