/** @file\r
DevicePathFromText protocol as defined in the UEFI 2.0 specification.\r
\r
-Copyright (c) 2006 - 2009, Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2010, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
return (EFI_DEVICE_PATH_PROTOCOL *) MACDevPath;\r
}\r
\r
+\r
+/**\r
+ Converts a text format to the network protocol ID.\r
+\r
+ @param Text String of protocol field.\r
+\r
+ @return Network protocol ID .\r
+\r
+**/\r
+UINTN\r
+NetworkProtocolFromText (\r
+ IN CHAR16 *Text\r
+ )\r
+{\r
+ if (StrCmp (Text, L"UDP") == 0) {\r
+ return RFC_1700_UDP_PROTOCOL;\r
+ }\r
+\r
+ if (StrCmp (Text, L"TCP") == 0) {\r
+ return RFC_1700_TCP_PROTOCOL;\r
+ }\r
+\r
+ return Strtoi (Text);\r
+}\r
+\r
+\r
/**\r
Converts a text device path node to IPV4 device path structure.\r
\r
);\r
\r
StrToIPv4Addr (&RemoteIPStr, &IPv4->RemoteIpAddress);\r
- IPv4->Protocol = (UINT16) ((StrCmp (ProtocolStr, L"UDP") == 0) ? 0 : 1);\r
+ IPv4->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr);\r
if (StrCmp (TypeStr, L"Static") == 0) {\r
IPv4->StaticIpAddress = TRUE;\r
} else {\r
);\r
\r
StrToIPv6Addr (&RemoteIPStr, &IPv6->RemoteIpAddress);\r
- IPv6->Protocol = (UINT16) ((StrCmp (ProtocolStr, L"UDP") == 0) ? 0 : 1);\r
+ IPv6->Protocol = (UINT16) NetworkProtocolFromText (ProtocolStr);\r
if (StrCmp (TypeStr, L"Static") == 0) {\r
IPv6->StaticIpAddress = TRUE;\r
} else {\r