summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-25 03:40:18 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-25 03:40:18 +0000
commit052019e1fa1ca604778da724e139d1c17abada42 (patch)
tree9ce9548658b881689564d13759320aa5f7f53be3 /MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
parent9b6f044a327dabb0a8cd3a38e8c0249fefbcc8af (diff)
downloadedk2-052019e1fa1ca604778da724e139d1c17abada42.zip
edk2-052019e1fa1ca604778da724e139d1c17abada42.tar.gz
edk2-052019e1fa1ca604778da724e139d1c17abada42.tar.bz2
Fix the issue that the protocol field in IPv4 and IPv6 is does not reflect the RFC1700 real value: In RFC1700, UDP value is 17 while TCP value is 6.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9804 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c')
-rw-r--r--MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c54
1 files changed, 47 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
index 12caea1..82789c1 100644
--- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
+++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
@@ -1,7 +1,7 @@
/** @file
DevicePathToText protocol as defined in the UEFI 2.0 specification.
-Copyright (c) 2006 - 2009, Intel Corporation. <BR>
+Copyright (c) 2006 - 2010, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -997,6 +997,28 @@ DevPathToTextMacAddr (
}
/**
+ Converts network protocol string to its text representation.
+
+ @param Str The string representative of input device.
+ @param Protocol The network protocol ID.
+
+**/
+VOID
+CatNetworkProtocol (
+ IN OUT POOL_PRINT *Str,
+ IN UINT16 Protocol
+ )
+{
+ if (Protocol == RFC_1700_TCP_PROTOCOL) {
+ CatPrint (Str, L"TCP");
+ } else if (Protocol == RFC_1700_UDP_PROTOCOL) {
+ CatPrint (Str, L"UDP");
+ } else {
+ CatPrint (Str, L"0x%x", Protocol);
+ }
+}
+
+/**
Converts a IPv4 device path structure to its string representative.
@param Str The string representative of input device.
@@ -1034,12 +1056,21 @@ DevPathToTextIPv4 (
CatPrint (
Str,
- L"IPv4(%d.%d.%d.%d,%s,%s,%d.%d.%d.%d)",
+ L"IPv4(%d.%d.%d.%d,",
(UINTN) IPDevPath->RemoteIpAddress.Addr[0],
(UINTN) IPDevPath->RemoteIpAddress.Addr[1],
(UINTN) IPDevPath->RemoteIpAddress.Addr[2],
- (UINTN) IPDevPath->RemoteIpAddress.Addr[3],
- (IPDevPath->Protocol == 1) ? L"TCP" : L"UDP",
+ (UINTN) IPDevPath->RemoteIpAddress.Addr[3]
+ );
+
+ CatNetworkProtocol (
+ Str,
+ IPDevPath->Protocol
+ );
+
+ CatPrint (
+ Str,
+ L",%s,%d.%d.%d.%d)",
IPDevPath->StaticIpAddress ? L"Static" : L"DHCP",
(UINTN) IPDevPath->LocalIpAddress.Addr[0],
(UINTN) IPDevPath->LocalIpAddress.Addr[1],
@@ -1098,7 +1129,7 @@ DevPathToTextIPv6 (
CatPrint (
Str,
- L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,%s,%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
+ L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,",
(UINTN) IPDevPath->RemoteIpAddress.Addr[0],
(UINTN) IPDevPath->RemoteIpAddress.Addr[1],
(UINTN) IPDevPath->RemoteIpAddress.Addr[2],
@@ -1114,8 +1145,17 @@ DevPathToTextIPv6 (
(UINTN) IPDevPath->RemoteIpAddress.Addr[12],
(UINTN) IPDevPath->RemoteIpAddress.Addr[13],
(UINTN) IPDevPath->RemoteIpAddress.Addr[14],
- (UINTN) IPDevPath->RemoteIpAddress.Addr[15],
- (IPDevPath->Protocol == 1) ? L"TCP" : L"UDP",
+ (UINTN) IPDevPath->RemoteIpAddress.Addr[15]
+ );
+
+ CatNetworkProtocol (
+ Str,
+ IPDevPath->Protocol
+ );
+
+ CatPrint (
+ Str,
+ L"%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
IPDevPath->StaticIpAddress ? L"Static" : L"DHCP",
(UINTN) IPDevPath->LocalIpAddress.Addr[0],
(UINTN) IPDevPath->LocalIpAddress.Addr[1],