]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
MdeModulePkg: Update PXE driver to follow edk2 coding standards.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcSupport.c
index 327e4a26d81cad633d30d7aa502d4a4e4ea6ea52..a20fdb7a84aac3f877f15691260a0fa727611a4c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support routines for PxeBc.\r
 \r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -42,6 +42,8 @@ PxeBcCommonNotify (
   @param  SubnetMask Pointer to the subnetmask of the station ip address.\r
   @param  Gateway    Pointer to the gateway ip address.\r
   @param  SrcPort    Pointer to the srouce port of the station.\r
+  @param  Ttl        The time to live field of the IP header. \r
+  @param  ToS        The type of service field of the IP header.\r
 \r
   @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.\r
   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
@@ -65,7 +67,9 @@ PxeBcConfigureUdpWriteInstance (
   IN EFI_IPv4_ADDRESS   *StationIp,\r
   IN EFI_IPv4_ADDRESS   *SubnetMask,\r
   IN EFI_IPv4_ADDRESS   *Gateway,\r
-  IN OUT UINT16         *SrcPort\r
+  IN OUT UINT16         *SrcPort,\r
+  IN     UINT8          Ttl,\r
+  IN     UINT8          ToS\r
   )\r
 {\r
   EFI_UDP4_CONFIG_DATA  Udp4CfgData;\r
@@ -74,8 +78,8 @@ PxeBcConfigureUdpWriteInstance (
   ZeroMem (&Udp4CfgData, sizeof (Udp4CfgData));\r
 \r
   Udp4CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;\r
-  Udp4CfgData.TypeOfService  = DEFAULT_ToS;\r
-  Udp4CfgData.TimeToLive     = DEFAULT_TTL;\r
+  Udp4CfgData.TypeOfService  = ToS;\r
+  Udp4CfgData.TimeToLive     = TTL;\r
   Udp4CfgData.AllowDuplicatePort = TRUE;\r
 \r
   CopyMem (&Udp4CfgData.StationAddress, StationIp, sizeof (*StationIp));\r
@@ -140,16 +144,18 @@ CvtNum (
 /**\r
   Convert unsigned int number to decimal number.\r
 \r
-  @param  Number   The unsigned int number will be converted.\r
-  @param  Buffer   Pointer to the buffer to store the decimal number after transform.\r
-\r
+  @param      Number         The unsigned int number will be converted.\r
+  @param      Buffer         Pointer to the buffer to store the decimal number after transform.\r
+  @param[in]  BufferSize     The maxsize of the buffer.\r
+  \r
   @return the length of the number after transform.\r
 \r
 **/\r
 UINTN\r
 UtoA10 (\r
   IN UINTN Number,\r
-  IN CHAR8 *Buffer\r
+  IN CHAR8 *Buffer,\r
+  IN UINTN BufferSize\r
   )\r
 {\r
   UINTN Index;\r
@@ -164,7 +170,7 @@ UtoA10 (
     Number          = Number / 10;\r
   } while (Number != 0);\r
 \r
-  AsciiStrCpy (Buffer, &TempStr[Index]);\r
+  AsciiStrCpyS (Buffer, BufferSize, &TempStr[Index]);\r
 \r
   return AsciiStrLen (Buffer);\r
 }\r