]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Mtftp4Dxe / Mtftp4Option.c
index e40561a96b26b82f52e6ae13453906647f0c3ecd..d97f157f174472811bfc6cedf3c1727628e7801c 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   Routines to process MTFTP4 options.\r
 \r
-Copyright (c) 2006 - 2010, 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
-http://opensource.org/licenses/bsd-license.php<BR>\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -16,6 +10,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 CHAR8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS] = {\r
   "blksize",\r
+  "windowsize",\r
   "timeout",\r
   "tsize",\r
   "multicast"\r
@@ -400,6 +395,7 @@ Mtftp4ExtractMcast (
   @param  Count                  The number of options in the Options\r
   @param  Request                Whether this is a request or OACK. The format of\r
                                  multicast is different according to this setting.\r
+  @param  Operation              The current performed operation.\r
   @param  MtftpOption            The MTFTP4_OPTION for easy access.\r
 \r
   @retval EFI_INVALID_PARAMETER  The option is mal-formated\r
@@ -412,6 +408,7 @@ Mtftp4ParseOption (
   IN     EFI_MTFTP4_OPTION     *Options,\r
   IN     UINT32                Count,\r
   IN     BOOLEAN               Request,\r
+  IN     UINT16                Operation,\r
      OUT MTFTP4_OPTION         *MtftpOption\r
   )\r
 {\r
@@ -481,6 +478,22 @@ Mtftp4ParseOption (
 \r
       MtftpOption->Exist |= MTFTP4_MCAST_EXIST;\r
 \r
+    } else if (NetStringEqualNoCase (This->OptionStr, (UINT8 *) "windowsize")) {\r
+      if (Operation == EFI_MTFTP4_OPCODE_WRQ) {\r
+        //\r
+        // Currently, windowsize is not supported in the write operation.\r
+        //\r
+        return EFI_UNSUPPORTED;\r
+      }\r
+\r
+      Value = NetStringToU32 (This->ValueStr);\r
+\r
+      if (Value < 1) {\r
+        return EFI_INVALID_PARAMETER;\r
+      }\r
+\r
+      MtftpOption->WindowSize = (UINT16) Value;\r
+      MtftpOption->Exist |= MTFTP4_WINDOWSIZE_EXIST;\r
     } else if (Request) {\r
       //\r
       // Ignore the unsupported option if it is a reply, and return\r
@@ -500,6 +513,7 @@ Mtftp4ParseOption (
 \r
   @param  Packet                 The OACK packet to parse\r
   @param  PacketLen              The length of the packet\r
+  @param  Operation              The current performed operation.\r
   @param  MtftpOption            The MTFTP_OPTION for easy access.\r
 \r
   @retval EFI_INVALID_PARAMETER  The packet option is mal-formated\r
@@ -511,6 +525,7 @@ EFI_STATUS
 Mtftp4ParseOptionOack (\r
   IN     EFI_MTFTP4_PACKET     *Packet,\r
   IN     UINT32                PacketLen,\r
+  IN     UINT16                Operation,\r
      OUT MTFTP4_OPTION         *MtftpOption\r
   )\r
 {\r
@@ -527,7 +542,7 @@ Mtftp4ParseOptionOack (
   }\r
   ASSERT (OptionList != NULL);\r
 \r
-  Status = Mtftp4ParseOption (OptionList, Count, FALSE, MtftpOption);\r
+  Status = Mtftp4ParseOption (OptionList, Count, FALSE, Operation, MtftpOption);\r
 \r
   FreePool (OptionList);\r
   return Status;\r