]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Mtftp6Dxe/Mtftp6Option.c
NetworkPkg/Mtftp6Dxe: Support windowsize in read request operation.
[mirror_edk2.git] / NetworkPkg / Mtftp6Dxe / Mtftp6Option.c
index 0dcf546fa82bef35188c4963aee4be2d94a00585..94790e3ad6e1e4a6700dd748b3380c9b9d51c56f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Mtftp6 option parse functions implementation.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -17,6 +17,7 @@
 \r
 CHAR8 *mMtftp6SupportedOptions[MTFTP6_SUPPORTED_OPTIONS_NUM] = {\r
   "blksize",\r
+  "windowsize",\r
   "timeout",\r
   "tsize",\r
   "multicast"\r
@@ -146,6 +147,7 @@ Mtftp6ParseMcastOption (
   @param[in]  Count         The num of the extension options.\r
   @param[in]  IsRequest     If FALSE, the extension options is included\r
                             by a request packet.\r
+  @param[in]  Operation     The current performed operation.\r
   @param[in]  ExtInfo       The pointer to the option information to be filled.\r
 \r
   @retval EFI_SUCCESS            Parse the multicast option successfully.\r
@@ -158,6 +160,7 @@ Mtftp6ParseExtensionOption (
   IN EFI_MTFTP6_OPTION        *Options,\r
   IN UINT32                   Count,\r
   IN BOOLEAN                  IsRequest,\r
+  IN UINT16                   Operation,\r
   IN MTFTP6_EXT_OPTION_INFO   *ExtInfo\r
   )\r
 {\r
@@ -228,6 +231,23 @@ Mtftp6ParseExtensionOption (
 \r
       ExtInfo->BitMap |= MTFTP6_OPT_MCAST_BIT;\r
 \r
+    } else if (AsciiStriCmp ((CHAR8 *) Opt->OptionStr, "windowsize") == 0) {\r
+      if (Operation == EFI_MTFTP6_OPCODE_WRQ) {\r
+        //\r
+        // Currently, windowsize is not supported in the write operation.\r
+        //\r
+        return EFI_UNSUPPORTED;\r
+      }\r
+\r
+      Value = (UINT32) AsciiStrDecimalToUintn ((CHAR8 *) Opt->ValueStr);\r
+\r
+      if ((Value < 1)) {\r
+        return EFI_INVALID_PARAMETER;\r
+      }\r
+\r
+      ExtInfo->WindowSize = (UINT16) Value;\r
+      ExtInfo->BitMap |= MTFTP6_OPT_WINDOWSIZE_BIT;\r
+\r
     } else if (IsRequest) {\r
       //\r
       // If it's a request, unsupported; else if it's a reply, ignore.\r