NetworkPkg/Mtftp6Dxe: Support windowsize in read request operation.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886 This patch is to support the TFTP windowsize option described in RFC 7440. The feature allows the client and server to negotiate a window size of consecutive blocks to send as an alternative for replacing the single-block lockstep schema. Currently, the windowsize for write request operation is not supported since there is no real use cases. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Shao Ming <ming.shao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Mtftp6 option parse functions implementation.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
CHAR8 *mMtftp6SupportedOptions[MTFTP6_SUPPORTED_OPTIONS_NUM] = {
|
||||
"blksize",
|
||||
"windowsize",
|
||||
"timeout",
|
||||
"tsize",
|
||||
"multicast"
|
||||
@@ -146,6 +147,7 @@ Mtftp6ParseMcastOption (
|
||||
@param[in] Count The num of the extension options.
|
||||
@param[in] IsRequest If FALSE, the extension options is included
|
||||
by a request packet.
|
||||
@param[in] Operation The current performed operation.
|
||||
@param[in] ExtInfo The pointer to the option information to be filled.
|
||||
|
||||
@retval EFI_SUCCESS Parse the multicast option successfully.
|
||||
@@ -158,6 +160,7 @@ Mtftp6ParseExtensionOption (
|
||||
IN EFI_MTFTP6_OPTION *Options,
|
||||
IN UINT32 Count,
|
||||
IN BOOLEAN IsRequest,
|
||||
IN UINT16 Operation,
|
||||
IN MTFTP6_EXT_OPTION_INFO *ExtInfo
|
||||
)
|
||||
{
|
||||
@@ -228,6 +231,23 @@ Mtftp6ParseExtensionOption (
|
||||
|
||||
ExtInfo->BitMap |= MTFTP6_OPT_MCAST_BIT;
|
||||
|
||||
} else if (AsciiStriCmp ((CHAR8 *) Opt->OptionStr, "windowsize") == 0) {
|
||||
if (Operation == EFI_MTFTP6_OPCODE_WRQ) {
|
||||
//
|
||||
// Currently, windowsize is not supported in the write operation.
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Value = (UINT32) AsciiStrDecimalToUintn ((CHAR8 *) Opt->ValueStr);
|
||||
|
||||
if ((Value < 1)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ExtInfo->WindowSize = (UINT16) Value;
|
||||
ExtInfo->BitMap |= MTFTP6_OPT_WINDOWSIZE_BIT;
|
||||
|
||||
} else if (IsRequest) {
|
||||
//
|
||||
// If it's a request, unsupported; else if it's a reply, ignore.
|
||||
|
Reference in New Issue
Block a user