]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Replace the internal function with exposed one
authorJiaxin Wu <jiaxin.wu@intel.com>
Thu, 21 Jan 2016 17:40:56 +0000 (01:40 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Thu, 18 Feb 2016 05:07:59 +0000 (13:07 +0800)
This patch is used to replace the internal function with
the exposed one defined in NetLib.h.

Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
NetworkPkg/DnsDxe/DnsImpl.c
NetworkPkg/DnsDxe/DnsImpl.h
NetworkPkg/DnsDxe/DnsProtocol.c

index 617e623286d86f448b77e224735c62cae6afc4d9..19184415e5c5d0e0e8d79dfe8f75338239ccd12b 100644 (file)
@@ -1037,61 +1037,6 @@ AddDns6ServerIp (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**\r
-  Fill QName for IP querying. QName is a domain name represented as \r
-  a sequence of labels, where each label consists of a length octet \r
-  followed by that number of octets. The domain name terminates with \r
-  the zero length octet for the null label of the root. Caller should \r
-  take responsibility to the buffer in QName.\r
-\r
-  @param  HostName          Queried HostName    \r
-\r
-  @retval NULL      Failed to fill QName.\r
-  @return           QName filled successfully.\r
-  \r
-**/ \r
-CHAR8 *\r
-EFIAPI\r
-DnsFillinQNameForQueryIp (\r
-  IN  CHAR16              *HostName\r
-  )\r
-{\r
-  CHAR8                 *QueryName;\r
-  CHAR8                 *Header;\r
-  CHAR8                 *Tail;\r
-  UINTN                 Len;\r
-  UINTN                 Index;\r
-\r
-  QueryName  = NULL;\r
-  Header     = NULL;\r
-  Tail       = NULL;\r
-\r
-  QueryName = AllocateZeroPool (DNS_DEFAULT_BLKSIZE);\r
-  if (QueryName == NULL) {\r
-    return NULL;\r
-  }\r
-  \r
-  Header = QueryName;\r
-  Tail = Header + 1;\r
-  Len = 0;\r
-  for (Index = 0; HostName[Index] != 0; Index++) {\r
-    *Tail = (CHAR8) HostName[Index];\r
-    if (*Tail == '.') {\r
-      *Header = (CHAR8) Len;\r
-      Header = Tail;\r
-      Tail ++;\r
-      Len = 0;\r
-    } else {\r
-      Tail++;\r
-      Len++;\r
-    }\r
-  }\r
-  *Header = (CHAR8) Len;\r
-  *Tail = 0;\r
-\r
-  return QueryName;\r
-}\r
-\r
 /**\r
   Find out whether the response is valid or invalid.\r
 \r
@@ -1806,8 +1751,12 @@ ConstructDNSQuery (
   NET_FRAGMENT        Frag;\r
   DNS_HEADER          *DnsHeader;\r
   DNS_QUERY_SECTION   *DnsQuery;\r
-  \r
-  Frag.Bulk = AllocatePool (DNS_DEFAULT_BLKSIZE * sizeof (UINT8));\r
+\r
+  //\r
+  // Messages carried by UDP are restricted to 512 bytes (not counting the IP\r
+  // or UDP headers).\r
+  //\r
+  Frag.Bulk = AllocatePool (DNS_MAX_MESSAGE_SIZE * sizeof (UINT8));\r
   if (Frag.Bulk == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
index 8cd73e73a6897e13f548cf1c30db40017d1b63d3..0ef8255e05bb717546262b0a66d491698c968f60 100644 (file)
@@ -87,7 +87,6 @@ extern EFI_DNS6_PROTOCOL             mDns6Protocol;
 \r
 #define DNS_DEFAULT_TIMEOUT      2\r
 #define DNS_DEFAULT_RETRY        3\r
-#define DNS_DEFAULT_BLKSIZE      512\r
 \r
 #define DNS_TIME_TO_GETMAP       5\r
 \r
@@ -556,24 +555,6 @@ AddDns6ServerIp (
   IN EFI_IPv6_ADDRESS           ServerIp\r
   );\r
 \r
-/**\r
-  Fill QName for IP querying. QName is a domain name represented as \r
-  a sequence of labels, where each label consists of a length octet \r
-  followed by that number of octets. The domain name terminates with \r
-  the zero length octet for the null label of the root.\r
-\r
-  @param  HostName          Queried HostName    \r
-\r
-  @retval NULL      Failed to fill QName.\r
-  @return           QName filled successfully.\r
-  \r
-**/ \r
-CHAR8 *\r
-EFIAPI\r
-DnsFillinQNameForQueryIp (\r
-  IN  CHAR16              *HostName\r
-  );\r
-\r
 /**\r
   Find out whether the response is valid or invalid.\r
 \r
index f572b8b722ac0da5d46a7fef2a4481f6894ec569..11009fdc0dd9ff7f459ee620ed5f737519518686 100644 (file)
@@ -454,7 +454,7 @@ Dns4HostNameToIp (
   //\r
   // Construct QName.\r
   //\r
-  QueryName = DnsFillinQNameForQueryIp (TokenEntry->QueryHostName);\r
+  QueryName = NetLibCreateDnsQName (TokenEntry->QueryHostName);\r
   if (QueryName == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto ON_EXIT;\r
@@ -1264,7 +1264,7 @@ Dns6HostNameToIp (
   //\r
   // Construct QName.\r
   //\r
-  QueryName = DnsFillinQNameForQueryIp (TokenEntry->QueryHostName);\r
+  QueryName = NetLibCreateDnsQName (TokenEntry->QueryHostName);\r
   if (QueryName == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto ON_EXIT;\r