X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FMtftp4Dxe%2FMtftp4Impl.h;h=33393d42472ccca9b9f994626d1bd646d4655a5f;hp=a1abf6fd6504c739519afec8b460b236264bf9b3;hb=c0fd7f734e2d33e22215899b40a47b843129541d;hpb=f6b7393ceb34c9b3a27434268bf2ce517047641f diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h index a1abf6fd65..33393d4247 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.h @@ -1,22 +1,17 @@ /** @file - + Mtftp4 Implementation. - + Mtftp4 Implementation, it supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2090 - TFTP Multicast Option RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options - -Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php
+ RFC7440 - TFTP Windowsize Option -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -34,6 +29,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include extern EFI_MTFTP4_PROTOCOL gMtftp4ProtocolTemplate; @@ -55,11 +51,12 @@ typedef struct _MTFTP4_PROTOCOL MTFTP4_PROTOCOL; #define MTFTP4_DEFAULT_TIMEOUT 3 #define MTFTP4_DEFAULT_RETRY 5 #define MTFTP4_DEFAULT_BLKSIZE 512 +#define MTFTP4_DEFAULT_WINDOWSIZE 1 #define MTFTP4_TIME_TO_GETMAP 5 #define MTFTP4_STATE_UNCONFIGED 0 #define MTFTP4_STATE_CONFIGED 1 -#define MTFTP4_STATE_DESTORY 2 +#define MTFTP4_STATE_DESTROY 2 /// /// Mtftp service block @@ -68,12 +65,11 @@ struct _MTFTP4_SERVICE { UINT32 Signature; EFI_SERVICE_BINDING_PROTOCOL ServiceBinding; - BOOLEAN InDestory; - UINT16 ChildrenNum; LIST_ENTRY Children; - EFI_EVENT Timer; ///< Ticking timer for all the MTFTP clients + EFI_EVENT Timer; ///< Ticking timer for all the MTFTP clients to handle the packet timeout case. + EFI_EVENT TimerNotifyLevel; ///< Ticking timer for all the MTFTP clients to calculate the packet live time. EFI_EVENT TimerToGetMap; EFI_HANDLE Controller; @@ -99,7 +95,7 @@ struct _MTFTP4_PROTOCOL { EFI_MTFTP4_PROTOCOL Mtftp4; INTN State; - BOOLEAN InDestory; + BOOLEAN InDestroy; MTFTP4_SERVICE *Service; EFI_HANDLE Handle; @@ -121,6 +117,18 @@ struct _MTFTP4_PROTOCOL { UINT16 LastBlock; LIST_ENTRY Blocks; + UINT16 WindowSize; + + // + // Record the total received and saved block number. + // + UINT64 TotalBlock; + + // + // Record the acked block number. + // + UINT64 AckedBlock; + // // The server's communication end point: IP and two ports. one for // initial request, one for its selected port. @@ -136,6 +144,7 @@ struct _MTFTP4_PROTOCOL { // NET_BUF *LastPacket; UINT32 PacketToLive; + BOOLEAN HasTimeout; UINT32 CurRetry; UINT32 MaxRetry; UINT32 Timeout; @@ -149,6 +158,12 @@ struct _MTFTP4_PROTOCOL { UDP_IO *McastUdpPort; }; +typedef struct { + EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; + UINTN NumberOfChildren; + EFI_HANDLE *ChildHandleBuffer; +} MTFTP4_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT; + /** Clean up the MTFTP session to get ready for new operation. @@ -164,8 +179,8 @@ Mtftp4CleanOperation ( /** Start the MTFTP session for upload. - - It will first init some states, then send the WRQ request packet, + + It will first init some states, then send the WRQ request packet, and start receiving the packet. @param Instance The MTFTP session @@ -183,9 +198,9 @@ Mtftp4WrqStart ( ); /** - Start the MTFTP session to download. - - It will first initialize some of the internal states then build and send a RRQ + Start the MTFTP session to download. + + It will first initialize some of the internal states then build and send a RRQ reqeuest packet, at last, it will start receive for the downloading. @param Instance The Mtftp session