return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp;\r
}\r
\r
+/**\r
+ Converts a text device path node to Bluetooth LE device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created Bluetooth LE device path structure.\r
+\r
+**/\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+DevPathFromTextBluetoothLE (\r
+ IN CHAR16 *TextDeviceNode\r
+ )\r
+{\r
+ CHAR16 *BluetoothLeAddrStr;\r
+ CHAR16 *BluetoothLeAddrTypeStr;\r
+ BLUETOOTH_LE_DEVICE_PATH *BluetoothLeDp;\r
+\r
+ BluetoothLeAddrStr = GetNextParamStr (&TextDeviceNode);\r
+ BluetoothLeAddrTypeStr = GetNextParamStr (&TextDeviceNode);\r
+ BluetoothLeDp = (BLUETOOTH_LE_DEVICE_PATH *) CreateDeviceNode (\r
+ MESSAGING_DEVICE_PATH,\r
+ MSG_BLUETOOTH_LE_DP,\r
+ (UINT16) sizeof (BLUETOOTH_LE_DEVICE_PATH)\r
+ );\r
+\r
+ BluetoothLeDp->Address.Type = (UINT8) Strtoi (BluetoothLeAddrTypeStr);\r
+ StrHexToBytes (\r
+ BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2,\r
+ BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address)\r
+ );\r
+ return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp;\r
+}\r
+\r
+/**\r
+ Converts a text device path node to DNS device path structure.\r
+\r
+ @param TextDeviceNode The input Text device path node.\r
+\r
+ @return A pointer to the newly-created DNS device path structure.\r
+\r
+**/\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+DevPathFromTextDns (\r
+ IN CHAR16 *TextDeviceNode\r
+ )\r
+{\r
+ CHAR16 *DeviceNodeStr;\r
+ CHAR16 *DeviceNodeStrPtr;\r
+ UINT32 DnsServerIpCount;\r
+ UINT16 DnsDeviceNodeLength;\r
+ DNS_DEVICE_PATH *DnsDeviceNode;\r
+ UINT32 DnsServerIpIndex;\r
+ CHAR16 *DnsServerIp;\r
+\r
+\r
+ //\r
+ // Count the DNS server address number.\r
+ //\r
+ DeviceNodeStr = UefiDevicePathLibStrDuplicate (TextDeviceNode);\r
+ if (DeviceNodeStr == NULL) {\r
+ return NULL;\r
+ }\r
+\r
+ DeviceNodeStrPtr = DeviceNodeStr;\r
+\r
+ DnsServerIpCount = 0;\r
+ while (DeviceNodeStrPtr != NULL && *DeviceNodeStrPtr != L'\0') {\r
+ GetNextParamStr (&DeviceNodeStrPtr);\r
+ DnsServerIpCount ++;\r
+ }\r
+\r
+ free (DeviceNodeStr);\r
+ DeviceNodeStr = NULL;\r
+\r
+ //\r
+ // One or more instances of the DNS server address in EFI_IP_ADDRESS,\r
+ // otherwise, NULL will be returned.\r
+ //\r
+ if (DnsServerIpCount == 0) {\r
+ return NULL;\r
+ }\r
+\r
+ //\r
+ // Create the DNS DeviceNode.\r
+ //\r
+ DnsDeviceNodeLength = (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + sizeof (UINT8) + DnsServerIpCount * sizeof (EFI_IP_ADDRESS));\r
+ DnsDeviceNode = (DNS_DEVICE_PATH *) CreateDeviceNode (\r
+ MESSAGING_DEVICE_PATH,\r
+ MSG_DNS_DP,\r
+ DnsDeviceNodeLength\r
+ );\r
+ if (DnsDeviceNode == NULL) {\r
+ return NULL;\r
+ }\r
+\r
+ //\r
+ // Confirm the DNS server address is IPv4 or IPv6 type.\r
+ //\r
+ DeviceNodeStrPtr = TextDeviceNode;\r
+ while (!IS_NULL (*DeviceNodeStrPtr)) {\r
+ if (*DeviceNodeStrPtr == L'.') {\r
+ DnsDeviceNode->IsIPv6 = 0x00;\r
+ break;\r
+ }\r
+\r
+ if (*DeviceNodeStrPtr == L':') {\r
+ DnsDeviceNode->IsIPv6 = 0x01;\r
+ break;\r
+ }\r
+\r
+ DeviceNodeStrPtr++;\r
+ }\r
+\r
+ for (DnsServerIpIndex = 0; DnsServerIpIndex < DnsServerIpCount; DnsServerIpIndex++) {\r
+ DnsServerIp = GetNextParamStr (&TextDeviceNode);\r
+ if (DnsDeviceNode->IsIPv6 == 0x00) {\r
+ StrToIpv4Address (DnsServerIp, NULL, &(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v4), NULL);\r
+ } else {\r
+ StrToIpv6Address (DnsServerIp, NULL, &(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v6), NULL);\r
+ }\r
+ }\r
+\r
+ return (EFI_DEVICE_PATH_PROTOCOL *) DnsDeviceNode;\r
+}\r
+\r
/**\r
Converts a text device path node to URI device path structure.\r
\r
{L"Unit", DevPathFromTextUnit },\r
{L"iSCSI", DevPathFromTextiSCSI },\r
{L"Vlan", DevPathFromTextVlan },\r
+ {L"Dns", DevPathFromTextDns },\r
{L"Uri", DevPathFromTextUri },\r
{L"Bluetooth", DevPathFromTextBluetooth },\r
{L"Wi-Fi", DevPathFromTextWiFi },\r
+ {L"BluetoothLE", DevPathFromTextBluetoothLE },\r
{L"MediaPath", DevPathFromTextMediaPath },\r
{L"HD", DevPathFromTextHD },\r
{L"CDROM", DevPathFromTextCDROM },\r