]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/SocketDxe/ComponentName.c
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / StdLib / SocketDxe / ComponentName.c
CommitLineData
d7ce7006 1/** @file\r
2 UEFI Component Name(2) protocol implementation.\r
3\r
4 Copyright (c) 2011, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "Socket.h"\r
16\r
17/**\r
18 EFI Component Name Protocol declaration\r
19**/\r
a88c3163 20GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL mComponentName = {\r
d7ce7006 21 GetDriverName,\r
22 GetControllerName,\r
23 "eng"\r
24};\r
25\r
26/**\r
27 EFI Component Name 2 Protocol declaration\r
28**/\r
a88c3163 29GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {\r
d7ce7006 30 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) GetDriverName,\r
31 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) GetControllerName,\r
32 "en"\r
33};\r
34\r
35\r
36/**\r
37 Driver name table declaration\r
38**/\r
39GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE\r
40mDriverNameTable[] = {\r
41 {"eng;en", L"Socket Layer Driver"},\r
42 {NULL, NULL}\r
43};\r
44\r
45/**\r
46 Retrieves a Unicode string that is the user readable name of the driver.\r
47\r
48 This function retrieves the user readable name of a driver in the form of a\r
49 Unicode string. If the driver specified by This has a user readable name in\r
50 the language specified by Language, then a pointer to the driver name is\r
51 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
52 by This does not support the language specified by Language,\r
53 then EFI_UNSUPPORTED is returned.\r
54\r
55 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
56 EFI_COMPONENT_NAME_PROTOCOL instance.\r
57 @param [in] pLanguage A pointer to a Null-terminated ASCII string\r
58 array indicating the language. This is the\r
59 language of the driver name that the caller is\r
60 requesting, and it must match one of the\r
61 languages specified in SupportedLanguages. The\r
62 number of languages supported by a driver is up\r
63 to the driver writer. Language is specified\r
64 in RFC 3066 or ISO 639-2 language code format.\r
65 @param [out] ppDriverName A pointer to the Unicode string to return.\r
66 This Unicode string is the name of the\r
67 driver specified by This in the language\r
68 specified by Language.\r
69\r
70 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
71 This and the language specified by Language was\r
72 returned in DriverName.\r
73 @retval EFI_INVALID_PARAMETER Language is NULL.\r
74 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
75 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
76 the language specified by Language.\r
77\r
78**/\r
79EFI_STATUS\r
80EFIAPI\r
81GetDriverName (\r
82 IN EFI_COMPONENT_NAME_PROTOCOL * pThis,\r
83 IN CHAR8 * pLanguage,\r
84 OUT CHAR16 ** ppDriverName\r
85 )\r
86{\r
87 EFI_STATUS Status;\r
88\r
89 Status = LookupUnicodeString2 (\r
90 pLanguage,\r
91 pThis->SupportedLanguages,\r
92 mDriverNameTable,\r
93 ppDriverName,\r
a88c3163 94 (BOOLEAN)(pThis == &mComponentName)\r
d7ce7006 95 );\r
96 return Status;\r
97}\r
98\r
99/**\r
100 Retrieves a Unicode string that is the user readable name of the controller\r
101 that is being managed by a driver.\r
102\r
103 This function retrieves the user readable name of the controller specified by\r
104 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
105 driver specified by This has a user readable name in the language specified by\r
106 Language, then a pointer to the controller name is returned in ControllerName,\r
107 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
108 managing the controller specified by ControllerHandle and ChildHandle,\r
109 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
110 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
111\r
112 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
113 EFI_COMPONENT_NAME_PROTOCOL instance.\r
114 @param [in] ControllerHandle The handle of a controller that the driver\r
115 specified by This is managing. This handle\r
116 specifies the controller whose name is to be\r
117 returned.\r
118 @param [in] ChildHandle The handle of the child controller to retrieve\r
119 the name of. This is an optional parameter that\r
120 may be NULL. It will be NULL for device\r
121 drivers. It will also be NULL for a bus drivers\r
122 that wish to retrieve the name of the bus\r
123 controller. It will not be NULL for a bus\r
124 driver that wishes to retrieve the name of a\r
125 child controller.\r
126 @param [in] pLanguage A pointer to a Null-terminated ASCII string\r
127 array indicating the language. This is the\r
128 language of the driver name that the caller is\r
129 requesting, and it must match one of the\r
130 languages specified in SupportedLanguages. The\r
131 number of languages supported by a driver is up\r
132 to the driver writer. Language is specified in\r
133 RFC 3066 or ISO 639-2 language code format.\r
134 @param [out] ppControllerName A pointer to the Unicode string to return.\r
135 This Unicode string is the name of the\r
136 controller specified by ControllerHandle and\r
137 ChildHandle in the language specified by\r
138 Language from the point of view of the driver\r
139 specified by This.\r
140\r
141 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
142 the language specified by Language for the\r
143 driver specified by This was returned in\r
144 DriverName.\r
145 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
146 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
147 EFI_HANDLE.\r
148 @retval EFI_INVALID_PARAMETER Language is NULL.\r
149 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
150 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
151 managing the controller specified by\r
152 ControllerHandle and ChildHandle.\r
153 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
154 the language specified by Language.\r
155\r
156**/\r
157EFI_STATUS\r
158EFIAPI\r
159GetControllerName (\r
160 IN EFI_COMPONENT_NAME_PROTOCOL * pThis,\r
161 IN EFI_HANDLE ControllerHandle,\r
162 IN OPTIONAL EFI_HANDLE ChildHandle,\r
163 IN CHAR8 * pLanguage,\r
164 OUT CHAR16 ** ppControllerName\r
165 )\r
166{\r
167 EFI_STATUS Status;\r
168\r
169 DBG_ENTER ( );\r
170\r
171 //\r
172 // Set the controller name\r
173 //\r
174 *ppControllerName = L"Socket Layer";\r
175 Status = EFI_SUCCESS;\r
176\r
177 //\r
178 // Return the operation status\r
179 //\r
180 DBG_EXIT_HEX ( Status );\r
181 return Status;\r
182}\r